Update docs conf.yaml version to Sulfur
[transportpce.git] / ordmodels / device / src / main / yang / org-openroadm-ip@2020-05-29.yang
1 module org-openroadm-ip {
2   namespace "http://org/openroadm/ip";
3   prefix org-openroadm-ip;
4
5   import org-openroadm-device {
6     prefix org-openroadm-device;
7     revision-date 2020-05-29;
8   }
9   import org-openroadm-interfaces {
10     prefix openROADM-if;
11     revision-date 2019-11-29;
12   }
13   import ietf-inet-types {
14     prefix inet;
15     revision-date 2013-07-15;
16   }
17   import ietf-yang-types {
18     prefix yang;
19     revision-date 2013-07-15;
20   }
21
22   organization
23     "Open ROADM MSA";
24   contact
25     "OpenROADM.org";
26   description
27     "This model defines Yang model for IP (IPv4 and IPv6) interfaces.
28
29      This model reuses data items defined in the IETF YANG model for
30      interfaces described by RFC 7277.
31
32      Some attributes which are not required in Open ROADM MSA are removed.
33      Yang file included are changed to fit into Open ROADM MSA yang structure.
34
35      IETF code is subject to the following copyright and license:
36      Copyright (c) IETF Trust and the persons identified as authors of
37      the code.
38      All rights reserved.
39
40      Redistribution and use in source and binary forms, with or without
41      modification, is permitted pursuant to, and subject to the license
42      terms contained in, the Simplified BSD License set forth in
43      Section 4.c of the IETF Trust's Legal Provisions Relating
44      to IETF Documents (http://trustee.ietf.org/license-info).";
45
46   revision 2020-05-29 {
47     description
48       "Version 7.1.0";
49   }
50   revision 2020-03-27 {
51     description
52       "Version 7.0.0";
53   }
54   revision 2019-11-29 {
55     description
56       "Version 6.1.0";
57   }
58   revision 2019-09-27 {
59     description
60       "Version 6.0.0";
61   }
62   revision 2019-05-31 {
63     description
64       "Version 5.1.0";
65   }
66   revision 2019-03-29 {
67     description
68       "Version 5.0.0";
69   }
70   revision 2014-06-16 {
71     description
72       "Initial revision.";
73     reference
74       "RFC 7277: A YANG Data Model for IP Management";
75   }
76
77   feature ipv4-non-contiguous-netmasks {
78     description
79       "Indicates support for configuring non-contiguous
80        subnet masks.";
81   }
82
83   feature ipv6-privacy-autoconf {
84     description
85       "Indicates support for Privacy Extensions for Stateless Address
86        Autoconfiguration in IPv6.";
87     reference
88       "RFC 4941: Privacy Extensions for Stateless Address
89                  Autoconfiguration in IPv6";
90   }
91
92   typedef ip-address-origin {
93     type enumeration {
94       enum other {
95         description
96           "None of the following.";
97       }
98       enum static {
99         description
100           "Indicates that the address has been statically
101            configured - for example, using NETCONF or a Command Line
102            Interface.";
103       }
104       enum dhcp {
105         description
106           "Indicates an address that has been assigned to this
107            system by a DHCP server.";
108       }
109       enum link-layer {
110         description
111           "Indicates an address created by IPv6 stateless
112            autoconfiguration that embeds a link-layer address in its
113            interface identifier.";
114       }
115       enum random {
116         description
117           "Indicates an address chosen by the system at
118
119            random, e.g., an IPv4 address within 169.254/16, an
120            RFC 4941 temporary address, or an RFC 7217 semantically
121            opaque address.";
122         reference
123           "RFC 4941: Privacy Extensions for Stateless Address
124                      Autoconfiguration in IPv6
125            RFC 7217: A Method for Generating Semantically Opaque
126                      Interface Identifiers with IPv6 Stateless
127                      Address Autoconfiguration (SLAAC)";
128       }
129     }
130     description
131       "The origin of an address.";
132   }
133
134   typedef neighbor-origin {
135     type enumeration {
136       enum other {
137         description
138           "None of the following.";
139       }
140       enum static {
141         description
142           "Indicates that the mapping has been statically
143            configured - for example, using NETCONF or a Command Line
144            Interface.";
145       }
146       enum dynamic {
147         description
148           "Indicates that the mapping has been dynamically resolved
149            using, e.g., IPv4 ARP or the IPv6 Neighbor Discovery
150            protocol.";
151       }
152     }
153     description
154       "The origin of a neighbor entry.";
155   }
156
157   grouping ip-grp {
158     container ipv4 {
159       presence "Enables IPv4 unless the 'enabled' leaf
160                 (which defaults to 'true') is set to 'false'";
161       description
162         "Parameters for the IPv4 address family.";
163       leaf enabled {
164         type boolean;
165         default "false";
166         description
167           "Controls whether IPv4 is enabled or disabled on this
168            interface.  When IPv4 is enabled, this interface is
169            connected to an IPv4 stack, and the interface can send
170            and receive IPv4 packets.";
171       }
172       leaf forwarding {
173         type boolean;
174         default "false";
175         description
176           "Controls IPv4 packet forwarding of datagrams received by,
177            but not addressed to, this interface.  IPv4 routers
178            forward datagrams.  IPv4 hosts do not (except those
179            source-routed via the host).";
180       }
181       leaf mtu {
182         type uint16 {
183           range "68..max";
184         }
185         units "octets";
186         default "1500";
187         description
188           "The size, in octets, of the largest IPv4 packet that the
189            interface will send and receive.
190
191            The server may restrict the allowed values for this leaf,
192            depending on the interface's type.
193
194            If this leaf is not configured, the operationally used MTU
195            depends on the interface's type.
196
197            The max value supported must be at least 9000.";
198         reference
199           "RFC 791: Internet Protocol";
200       }
201       leaf address-src {
202         when "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface[org-openroadm-device:name='UNNUMBERED']";
203         type enumeration {
204           enum NEM {
205             value 1;
206           }
207         }
208         description
209           "The source of the shared IP address for unnumbered IP interface.";
210       }
211       leaf address-force {
212         when "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface[org-openroadm-device:name='UNNUMBERED']";
213         type leafref {
214           path "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface/org-openroadm-ip:ipv4/org-openroadm-ip:address/org-openroadm-ip:ip";
215         }
216         must "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface[org-openroadm-device:name='NEM']/org-openroadm-ip:ipv4/org-openroadm-ip:address[org-openroadm-ip:ip=current()]/org-openroadm-ip:ip = current()" {
217           error-message "IP address shall be sourced from the NEM interface only";
218         }
219         must 'not (../address-src)' {
220           error-message "Both address-src & address-force cannot be configured at the same time";
221         }
222         description
223           "The IP address to use for the unnumbered interface";
224       }
225       list address {
226         key "ip";
227         description
228           "The list of configured IPv4 addresses on the interface.";
229         leaf ip {
230           type inet:ipv4-address-no-zone;
231           description
232             "The IPv4 address on the interface.";
233         }
234         leaf preferred {
235           when "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface[org-openroadm-device:name='NEM']";
236           type enumeration {
237             enum true {
238               value 1;
239             }
240             enum false {
241               value 0;
242             }
243           }
244           default "false";
245           description
246             "Mark address availability for unnumbered interface use.";
247         }
248         choice subnet {
249           mandatory true;
250           description
251             "The subnet can be specified as a prefix-length, or,
252              if the server supports non-contiguous netmasks, as
253              a netmask.";
254           leaf prefix-length {
255             type uint8 {
256               range "0..32";
257             }
258             description
259               "The length of the subnet prefix.";
260           }
261           leaf netmask {
262             if-feature "ipv4-non-contiguous-netmasks";
263             type yang:dotted-quad;
264             description
265               "The subnet specified as a netmask.";
266           }
267         }
268       }
269     }
270     container ipv6 {
271       presence "Enables IPv6 unless the 'enabled' leaf
272                 (which defaults to 'true') is set to 'false'";
273       description
274         "Parameters for the IPv6 address family.";
275       leaf enabled {
276         type boolean;
277         default "false";
278         description
279           "Controls whether IPv6 is enabled or disabled on this
280            interface.  When IPv6 is enabled, this interface is
281            connected to an IPv6 stack, and the interface can send
282            and receive IPv6 packets.";
283       }
284       leaf forwarding {
285         type boolean;
286         default "false";
287         description
288           "Controls IPv6 packet forwarding of datagrams received by,
289            but not addressed to, this interface.  IPv6 routers
290            forward datagrams.  IPv6 hosts do not (except those
291            source-routed via the host).";
292         reference
293           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
294                      Section 6.2.1, IsRouter";
295       }
296       leaf mtu {
297         type uint32 {
298           range "1280..1500";
299         }
300         units "octets";
301         default "1500";
302         description
303           "The size, in octets, of the largest IPv6 packet that the
304            interface will send and receive.
305
306            The server may restrict the allowed values for this leaf,
307            depending on the interface's type.
308
309            If this leaf is not configured, the operationally used MTU
310            depends on the interface's type.";
311         reference
312           "RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
313                      Section 5";
314       }
315       list address {
316         key "ip";
317         description
318           "The list of configured IPv6 addresses on the interface.";
319         leaf ip {
320           type inet:ipv6-address-no-zone;
321           description
322             "The IPv6 address on the interface.";
323         }
324         leaf prefix-length {
325           type uint8 {
326             range "0..128";
327           }
328           mandatory true;
329           description
330             "The length of the subnet prefix.";
331         }
332       }
333     }
334     description
335      "Grouping for ip";
336   }
337
338   augment "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface" {
339     when "org-openroadm-device:type = 'openROADM-if:ip'";
340     description
341       "Parameters for configuring IP on interfaces.
342
343        If an interface is not capable of running IP, the server
344        must not allow the client to configure these parameters.";
345     uses ip-grp;
346     }
347 }