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