Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 1 | module yang { |
| 2 | namespace "urn:ietf:params:xml:ns:yang:1"; |
| 3 | prefix yang; |
| 4 | |
| 5 | import ietf-yang-metadata { |
| 6 | prefix md; |
| 7 | revision-date 2016-08-05; |
| 8 | } |
| 9 | |
| 10 | organization |
| 11 | "libyang"; |
| 12 | |
| 13 | contact |
| 14 | "Web: <https://github.com/CESNET/libyang/> |
Michal Vasko | 79a7a87 | 2022-06-17 09:00:48 +0200 | [diff] [blame^] | 15 | Author: Radek Krejci <rkrejci@cesnet.cz> |
| 16 | Author: Michal Vasko <mvasko@cesnet.cz>"; |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 17 | |
| 18 | description |
Michal Vasko | 79a7a87 | 2022-06-17 09:00:48 +0200 | [diff] [blame^] | 19 | "This is a dummy module with no data formally supplying the definitions |
| 20 | of various metadata defined in RFC 6020 and RFC 7950. There are |
| 21 | additional metadata used in libyang diff data format."; |
| 22 | |
| 23 | revision 2022-06-16 { |
| 24 | description |
| 25 | "Added typedef for key metadata type."; |
| 26 | } |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 27 | |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 28 | revision 2021-04-07 { |
| 29 | description |
| 30 | "Added metadata for key-less list and state leaf-list diff."; |
| 31 | } |
| 32 | |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 33 | revision 2020-06-17 { |
| 34 | description |
| 35 | "Added metadata for diff."; |
| 36 | } |
| 37 | |
| 38 | revision 2017-02-20 { |
| 39 | description |
| 40 | "Added metadata for NETCONF's edit-config manipulation with ordered |
| 41 | lists and leaf-lists."; |
| 42 | reference |
| 43 | "RFC 7950: The YANG 1.1 Data Modeling Language"; |
| 44 | } |
| 45 | |
| 46 | revision 2016-02-11 { |
| 47 | description |
| 48 | "Initial revision"; |
| 49 | reference |
| 50 | "RFC 6020: YANG - A Data Modeling Language for |
| 51 | the Network Configuration Protocol (NETCONF)"; |
| 52 | } |
| 53 | |
Michal Vasko | 79a7a87 | 2022-06-17 09:00:48 +0200 | [diff] [blame^] | 54 | typedef instance-identifier-keys { |
| 55 | type string; |
| 56 | reference "RFC7950 section 7.8.6."; |
| 57 | description |
| 58 | "The key predicates of the full instance-identifier built-in type."; |
| 59 | } |
| 60 | |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 61 | md:annotation insert { |
| 62 | type enumeration { |
| 63 | enum first; |
| 64 | enum last; |
| 65 | enum before; |
| 66 | enum after; |
| 67 | } |
| 68 | reference "RFC7950 section 7.8.6. and section 7.7.9."; |
| 69 | description |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 70 | "In user ordered leaf-list, this attribute can be used to control |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 71 | where in the leaf-list the entry is inserted. It can be used during |
| 72 | the NETCONF <edit-config> \"create\" operations to insert a new list or |
| 73 | leaf-list entry, or during \"merge\" or \"replace\" operations to insert |
| 74 | a new list or leaf-list entry or move an existing one. |
| 75 | |
| 76 | If the value is \"before\" or \"after\", the \"value\"/\"key\" attribute |
| 77 | MUST also be used to specify an existing entry in the list or leaf-list. |
| 78 | |
| 79 | If no \"insert\" attribute is present in the \"create\" operation, it |
| 80 | defaults to \"last\"."; |
| 81 | } |
| 82 | |
| 83 | md:annotation value { |
| 84 | type string; |
| 85 | reference "RFC7950 section 7.7.9."; |
| 86 | description |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 87 | "In user ordered leaf-list, this attribute must be used if the attribute |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 88 | insert is used and specifies before/after which existing instance the |
| 89 | new instance should be inserted."; |
| 90 | } |
| 91 | |
| 92 | md:annotation key { |
Michal Vasko | 79a7a87 | 2022-06-17 09:00:48 +0200 | [diff] [blame^] | 93 | type union { |
| 94 | type empty; |
| 95 | type instance-identifier-keys; |
| 96 | } |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 97 | reference "RFC7950 section 7.8.6."; |
| 98 | description |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 99 | "In user ordered list, this attribute must be used if the attribute |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 100 | insert is used and specifies before/after which existing instance the |
| 101 | new instance should be inserted."; |
| 102 | } |
| 103 | |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 104 | md:annotation position { |
| 105 | type union { |
| 106 | type empty; |
| 107 | type uint32 { |
| 108 | range 1..max; |
| 109 | } |
| 110 | } |
| 111 | description |
| 112 | "In key-less list or state leaf-list, this attribute must be used if |
| 113 | the attribute insert is used and specifies the instance position |
| 114 | before/after which the new instance should be inserted."; |
| 115 | } |
| 116 | |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 117 | md:annotation operation { |
| 118 | type enumeration { |
| 119 | enum none { |
| 120 | description |
| 121 | "The node existed in both data trees but there is a nested node |
| 122 | with another operation. In case of a leaf, only its default |
| 123 | flag changed."; |
| 124 | } |
| 125 | enum create { |
| 126 | description |
| 127 | "The node did not exist in the first tree and was created in the |
| 128 | second tree."; |
| 129 | } |
| 130 | enum delete { |
| 131 | description |
| 132 | "The node existed in the first tree and was deleted in the second |
| 133 | tree."; |
| 134 | } |
| 135 | enum replace { |
| 136 | description |
| 137 | "The node value was changed or the node was moved for |
| 138 | leaves/anyxml/anydata and user-ordered lists/leaf-lists, |
| 139 | respectively."; |
| 140 | } |
| 141 | } |
| 142 | reference "RFC6241 section 7.2."; |
| 143 | description |
| 144 | "Operation of a node in a diff. If a node has no operation, |
| 145 | it is inherited from its nearest parent with an operation. |
| 146 | Top-level nodes must always have an operation. |
| 147 | |
| 148 | User-ordered lists/leaf-lists with operation 'create' and |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 149 | 'replace' MUST also have the 'key', 'value', or 'position' |
| 150 | metadata defined. It specifies the preceding instance. |
| 151 | In case the value of this metadata is empty, the node was |
| 152 | created/moved on the first position. |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 153 | |
| 154 | All the operations keep the meaning of edit-config operations |
| 155 | with similar names but some are further restricted, meaning |
| 156 | they are used for only a subset of use-cases."; |
| 157 | } |
| 158 | |
| 159 | md:annotation orig-default { |
| 160 | type boolean; |
| 161 | description |
| 162 | "Information about the previous default state of the node."; |
| 163 | } |
| 164 | |
| 165 | md:annotation orig-value { |
| 166 | type string; |
| 167 | description |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 168 | "Previous value of a changed leaf. Alternatively, its meaning |
| 169 | is the same as the \"value\" attribute but identifies the original |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 170 | leaf-list instance rather than the new one."; |
| 171 | } |
| 172 | |
| 173 | md:annotation orig-key { |
Michal Vasko | 79a7a87 | 2022-06-17 09:00:48 +0200 | [diff] [blame^] | 174 | type union { |
| 175 | type empty; |
| 176 | type instance-identifier-keys; |
| 177 | } |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 178 | description |
Michal Vasko | e78faec | 2021-04-08 17:24:43 +0200 | [diff] [blame] | 179 | "Its meaning is the same as the \"key\" attribute but identifies |
| 180 | the original list instance rather than the new one."; |
| 181 | } |
| 182 | |
| 183 | md:annotation orig-position { |
| 184 | type union { |
| 185 | type empty; |
| 186 | type uint32 { |
| 187 | range 1..max; |
| 188 | } |
| 189 | } |
| 190 | description |
| 191 | "Its meaning is the same as the \"position\" attribute but identifies |
Michal Vasko | e893ddd | 2020-06-23 13:35:20 +0200 | [diff] [blame] | 192 | the original list instance rather than the new one."; |
| 193 | } |
| 194 | } |