Allow multiple NTS Manager instances to run on the same machine.
[sim/o1-interface.git] / ntsimulator / yang / o-ran-interfaces.yang
1 module o-ran-interfaces {
2   yang-version 1.1;
3   namespace "urn:o-ran:interfaces:1.0";
4   prefix "o-ran-int";
5
6
7   import ietf-inet-types {
8     prefix "inet";
9   }
10
11   import iana-if-type {
12     prefix "ianaift";
13   }
14
15   import ietf-interfaces {
16     prefix "if";
17   }
18
19   import ietf-ip {
20     prefix "ip";
21   }
22
23   import ietf-hardware {
24     prefix "hw";
25   }
26
27   import ietf-yang-types {
28     prefix "yang";
29   }
30
31   import iana-hardware {
32     prefix "ianahw";
33   }
34
35   organization "O-RAN Alliance";
36
37   contact
38     "www.o-ran.org";
39
40   description
41     "This module defines the YANG definitions for managng the O-RAN
42      interfaces.
43
44     Copyright 2019 the O-RAN Alliance.
45
46     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
47     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49     ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
50     LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
51     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
55     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
56     POSSIBILITY OF SUCH DAMAGE.
57
58     Redistribution and use in source and binary forms, with or without
59     modification, are permitted provided that the following conditions are met:
60
61     * Redistributions of source code must retain the above copyright notice,
62     this list of conditions and the above disclaimer.
63     * Redistributions in binary form must reproduce the above copyright notice,
64     this list of conditions and the above disclaimer in the documentation
65     and/or other materials provided with the distribution.
66     * Neither the Members of the O-RAN Alliance nor the names of its
67     contributors may be used to endorse or promote products derived from
68     this software without specific prior written permission.";
69
70   revision "2019-03-28" {
71     description
72       "version 1.0.1
73
74       1) increasing max elements for user plane DSCP markings to 64
75       2) re-organizing layout to facilitate cross-WG adoption, whilst ensuring
76       nodes are syntactically and semantically equivalent";
77
78     reference "ORAN-WG4.M.0-v01.00";
79   }
80
81   revision "2019-02-04" {
82     description
83       "version 1.0.0
84
85       1) imported model from xRAN
86       2) changed namespace and reference from xran to o-ran";
87
88     reference "ORAN-WG4.M.0-v01.00";
89   }
90
91   feature UDPIP-BASED-CU-PLANE {
92     description
93       "This feature indicates that the RU supports the UDP/IP based transport
94       for the CU plane.";
95   }
96
97   feature ALIASMAC-BASED-CU-PLANE {
98     description
99       "This feature indicates that the RU supports the alias MAC address
100        based transport for the CU plane.";
101   }
102
103
104   typedef pcp {
105     type uint8 {
106       range "0..7";
107     }
108     description
109       "Priority Code Point. PCP is a 3-bit field that refers to the
110       class of service applied to a VLAN tagged frame.  The
111       field specifies a priority value between 0 and 7, these values
112       can be used by quality of service (QoS) to prioritize
113       different classes of traffic.";
114     reference
115      "IEEE 802.1Q-2014: Virtual Bridged Local Area Networks";
116   }
117
118   grouping cos-marking {
119     description
120       "Configuration data for CU Plane ethernet CoS marking";
121     container class-of-service {
122       description
123         "CoS Configuration";
124       leaf u-plane-marking {
125         type pcp;
126         default 7;
127         description
128           "Marking used for default u-plane flows.
129           7 represents highest priority for u-plane marking";
130       }
131       leaf c-plane-marking {
132         type pcp;
133         default 7;
134         description "7 represents highest priority for c-plane marking";
135       }
136       leaf m-plane-marking {
137         type pcp;
138         default 2;
139         description "2 represents highest excellent effort for m-plane marking";
140       }
141       leaf s-plane-marking {
142         type pcp;
143         default 7;
144         description "7 represents highest priority for s-plane marking";
145       }
146       leaf other-marking {
147         type pcp;
148         default 1;
149         description "1 represents best effort for other marking";
150       }
151       list enhanced-uplane-markings{
152         key "up-marking-name";
153         max-elements 4;
154         description
155           "list of mappings for enhanced (non-default) u-plane markings";
156         leaf up-marking-name {
157           type string;
158           description "The name of the marking";
159         }
160         leaf enhanced-marking {
161           type pcp;
162           description "the enhanced u-plane marking";
163         }
164       }
165     }
166   }
167
168   grouping dscp-marking {
169     description
170       "Configuration data for CU Plane DSCP marking";
171     container diffserv-markings {
172       description
173         "DSCP Configuration";
174       leaf u-plane-marking {
175         type inet:dscp;
176         default 46;
177         description
178           "Marking used for default u-plane flows.
179           46 represents expedited forwarding";
180       }
181       leaf c-plane-marking {
182         type inet:dscp;
183         default 46;
184         description "46 represents expedited forwarding";
185       }
186       leaf s-plane-marking {
187         type inet:dscp;
188         default 46;
189         description "46 represents expedited forwarding";
190       }
191       leaf other-marking {
192         type inet:dscp;
193         default 0;
194         description "0 represents best effort forwarding";
195       }
196       list enhanced-uplane-markings{
197         key up-marking-name;
198         max-elements 64;
199         description
200           "list of mappings for enhanced (non-default) u-plane markings";
201         leaf up-marking-name {
202           type string;
203           description "The name of the marking";
204         }
205         leaf enhanced-marking {
206           type inet:dscp;
207           description "the enhanced u-plane marking";
208         }
209       }
210     }
211   }
212
213 // Cross Working Group Augmentations Follow
214
215 // Cross Working Group augmentations for basic Ethernet leafs
216
217   augment "/if:interfaces/if:interface" {
218     when "if:type = 'ianaift:ethernetCsmacd'" {
219       description "Applies to Ethernet interfaces";
220     }
221     description
222       "Augment the interface model with parameters for
223       base Ethernet interface";
224
225     leaf l2-mtu {
226       type uint16 {
227         range "64 .. 65535";
228       }
229       units bytes;
230       default 1500;
231       description
232         "The maximum size of layer 2 frames that may be transmitted
233         or received on the interface (excluding any FCS overhead).
234         For Ethernet interfaces it also excludes the
235         4-8 byte overhead of any known (i.e. explicitly matched by
236         a child sub-interface) 801.1Q VLAN tags.";
237     }
238     leaf vlan-tagging {
239       type boolean;
240       default true;
241       description
242         "Indicates if VLAN tagging is used.
243         Default true is used to enable equipment to auonomously discover that it is
244         connected to a trunk port.";
245     }
246     uses cos-marking;
247   }
248
249 // Cross Working Group augmentation for l2vlan interfaces for VLAN definition
250
251   augment "/if:interfaces/if:interface" {
252     when "if:type = 'ianaift:l2vlan'";
253     description "augments for VLAN definition";
254     leaf base-interface {
255       type if:interface-ref;
256       must "/if:interfaces/if:interface[if:name = current()]"
257             + "/o-ran-int:vlan-tagging = 'true'" {
258         description
259           "The base interface must have VLAN tagging enabled.";
260       }
261       description
262         "The base interface for the VLAN sub-interafce.";
263     }
264     leaf vlan-id {
265       type uint16 {
266         range "1..4094";
267       }
268       description
269         "The VLAN-ID.";
270     }
271   }
272
273 // Cross Working Group augmention for both ethernetCsmacd and l2vlan interfaces
274
275   augment "/if:interfaces/if:interface" {
276     when "(if:type = 'ianaift:ethernetCsmacd') or
277           (if:type = 'ianaift:l2vlan')" {
278       description "Applies to ethernetCsmacd and l2vlan interfaces";
279     }
280     description
281       "Augment the interface model with parameters for all
282       both ethernetCsmacd and l2vlan interfaces.";
283     leaf last-cleared {
284       type yang:date-and-time;
285       config false;
286       description
287         "Timestamp of the last time the interface counters were
288         cleared.";
289     }
290   }
291
292 // Cross Working Group augmention to ietf-ip covering DSCP for M-Plane
293
294 augment "/if:interfaces/if:interface/ip:ipv4" {
295   description "augments for IPv4 based M-Plane transport";
296   leaf m-plane-marking {
297     type inet:dscp;
298     default 18;
299     description "18 represents AF21 or 'immediate traffic'";
300   }
301 }
302 augment "/if:interfaces/if:interface/ip:ipv6" {
303   description "augments for IPv6 based M-Plane transport";
304   leaf m-plane-marking {
305     type inet:dscp;
306     default 18;
307     description "18 represents AF21 or 'immediate traffic'";
308   }
309 }
310
311 // WG4 Specific Augmentations Follow
312
313 // WG4 Augmentation for basic Ethernet leafs
314
315   augment "/if:interfaces/if:interface" {
316     if-feature ALIASMAC-BASED-CU-PLANE;
317     when "if:type = 'ianaift:ethernetCsmacd'" {
318       description
319         "Applies to WG4 Ethernet interfaces for alias MAC based CU-Plane";
320     }
321     description
322       "Augment the interface model with parameters for
323       base Ethernet interface";
324
325     leaf-list alias-macs {
326       type yang:mac-address;
327       description
328         "Augments interfaces with range of alias MAC addresses.";
329     }
330   }
331
332 // WG4 Augmention for both ethernetCsmacd and l2vlan interfaces
333
334   augment "/if:interfaces/if:interface" {
335     when "(if:type = 'ianaift:ethernetCsmacd') or
336           (if:type = 'ianaift:l2vlan')" {
337       description "Applies to ethernetCsmacd and l2vlan interfaces";
338     }
339     description
340       "Augment the interface model with parameters for all
341       both ethernetCsmacd and l2vlan interfaces.";
342     leaf mac-address {
343       type yang:mac-address;
344       description
345         "The MAC address of the interface.";
346     }
347     container port-reference {
348       description
349         "a port reference used by other O-RAN modules";
350       leaf port-name {
351         type leafref {
352           path '/hw:hardware/hw:component/hw:name';
353         }
354         must "derived-from-or-self(deref(current())/../hw:class, 'ianahw:port')";
355 // TAKE NOTE - depending on version of pyang, this may generate various
356 // warnings, e.g., warning: XPath for "port-name" does not exist
357         description
358           "O-RAN interfaces use a reference to a physical port component.
359
360           In this case, the component name referenced must be of class type
361           port, i.e., when /hw:hardware/hw:component/hw:class is derived from
362           ianahw:port";
363       }
364       leaf port-number {
365         type uint8;
366         description
367           "A number allocated by the server which identifies a port.
368           Port number value is 0 to N-1 where N is number of ports
369           in the device.
370
371           This value is fixed for the lifetime of the equipment, i.e., cannot be
372           changed during equipment reboots.";
373       }
374     }
375   }
376
377 // WG4 specific augmention to ietf-ip covering DSCP for CUS Plane
378
379   augment "/if:interfaces/if:interface/ip:ipv4" {
380     if-feature UDPIP-BASED-CU-PLANE;
381     description "augments for IPv4 based CUS transport";
382     uses dscp-marking;
383   }
384   augment "/if:interfaces/if:interface/ip:ipv6" {
385     if-feature UDPIP-BASED-CU-PLANE;
386     description "augments for IPv6 based CUS transport";
387     uses dscp-marking;
388   }
389
390 // Other Working Group Specific Augmentations Follow Here
391
392
393   rpc reset-interface-counters {
394     description
395       "Management plane triggered restart of the interface counters.";
396   }
397 }