Feature 5649: allow alternative images for specific VIMs in VNFD
[osm/IM.git] / models / yang / ietf-l2-topology.yang
1
2 /*
3  * NO RW COPYRIGHT
4  *
5  */
6
7 module ietf-l2-topology {
8     yang-version 1;
9     namespace "urn:ietf:params:xml:ns:yang:ietf-l2-topology";
10     prefix "l2t";
11
12     import ietf-network {
13       prefix "nw";
14     }
15
16     import ietf-network-topology {
17       prefix "nt";
18     }
19
20     import ietf-inet-types {
21       prefix "inet";
22     }
23
24     import ietf-yang-types {
25       prefix "yang";
26     }
27
28     organization "TBD";
29     contact "I-D Editor: jie.dong@huawei.com";
30
31     description
32       "This module defines a basic model for
33        the layer-2 topology of a network";
34
35     revision "2015-06-23" {
36       description "Initial revision";
37       reference "draft-ietf-i2rs-l2-network-topology-01";
38     }
39
40    /*
41     * Typedefs
42     */
43
44     typedef vlan {
45       type uint16 {
46         range "0..4095";
47       }
48       description "VLAN ID";
49     }
50
51     typedef trill-nickname {
52       type uint16;
53       description "TRILL Nickname";
54     }
55
56     typedef flag-type {
57       type identityref {
58         base "flag-identity";
59       }
60       description "Base type for flags";
61     }
62
63     typedef l2-network-event-type {
64       type enumeration {
65         enum "add" {
66           value 0;
67           description "An L2 node or link or termination-point
68           has been added";
69         }
70         enum "remove" {
71           value 1;
72           description "An L2 node or link or termination-point
73           has been removed";
74         }
75         enum "update" {
76           value 2;
77           description "An L2 node or link or termination-point
78           has been updated";
79         }
80       }
81       description "l2 network event type for notifications";
82     } // l2-topology-event-type
83
84
85     /*
86     * Features
87     */
88
89     feature VLAN {
90       description
91         "Indicates that the system supports the
92          vlan functions";
93     }
94
95     feature QinQ {
96       description
97         "Indicates that the system supports the
98          qinq functions";
99     }
100
101     feature PBB {
102       description
103        "Indicates that the device supports the
104         provider-backbone-bridging functions";
105     }
106
107     feature VPLS {
108       description
109         "Indicates that the device supports the
110          VPLS functions";
111       reference "RFC 4761, RFC 4762";
112     }
113
114     feature TRILL {
115       description
116         "Indicates that the device supports the
117          TRILL functions";
118       reference "RFC 6325";
119     }
120
121     feature VXLAN {
122       description
123         "Indicates that the device supports the
124          VXLAN functions";
125       reference "RFC 7348";
126     }
127
128    /*
129     * Identities
130     */
131     identity flag-identity {
132       description "Base type for flags";
133     }
134
135     identity encapsulation-type {
136       description
137         "Base identity from which specific encapsulation
138          types are derived.";
139     }
140
141     identity eth-encapsulation-type {
142       base encapsulation-type;
143       description
144         "Base identity from which specific ethernet
145          encapsulation types are derived.";
146
147     }
148
149     identity ethernet {
150       base eth-encapsulation-type;
151       description
152         "native ethernet encapsulation";
153     }
154
155     identity vlan {
156       base eth-encapsulation-type;
157       description
158         "vlan encapsulation";
159     }
160
161     identity qinq {
162       base eth-encapsulation-type;
163       description
164         "qinq encapsulation";
165     }
166
167     identity pbb {
168       base eth-encapsulation-type;
169       description
170         "pbb encapsulation";
171     }
172
173     identity trill {
174       base eth-encapsulation-type;
175       description
176         "trill encapsulation";
177     }
178
179     identity vpls {
180       base eth-encapsulation-type;
181       description
182         "vpls encapsulation";
183     }
184
185     identity vxlan {
186       base eth-encapsulation-type;
187       description
188         "vxlan encapsulation";
189     }
190
191     identity frame-relay {
192       base encapsulation-type;
193       description
194         "Frame Relay encapsulation";
195     }
196
197     identity ppp {
198       base encapsulation-type;
199       description
200         "PPP encapsulation";
201     }
202
203     identity hdlc {
204       base encapsulation-type;
205       description
206         "HDLC encapsulation";
207     }
208
209     identity atm {
210       base encapsulation-type;
211       description
212         "Base identity from which specific ATM
213          encapsulation types are derived.";
214
215     }
216
217     identity pwe3 {
218       base encapsulation-type;
219       description
220         "Base identity from which specific pw
221          encapsulation types are derived.";
222     }
223
224
225    /*
226     * Groupings
227     */
228
229
230     grouping l2-network-type {
231       description "Identify the topology type to be L2.";
232       container l2-network {
233         presence "indicates L2 Network";
234         description
235         "The presence of the container node indicates
236          L2 Topology";
237       }
238     }
239
240     grouping l2-network-attributes {
241       description "L2 Topology scope attributes";
242       container l2-network-attributes {
243         description "Containing L2 network attributes";
244         leaf name {
245           type string;
246           description "Name of the L2 network";
247         }
248
249         leaf-list flag {
250           type flag-type;
251           description "L2 network flags";
252         }
253       }
254     }
255
256     grouping l2-node-attributes {
257       description "L2 node attributes";
258       container l2-node-attributes {
259         description "Containing L2 node attributes";
260         leaf name {
261           type string;
262           description "Node name";
263         }
264         leaf description {
265           type string;
266           description "Node description";
267         }
268         leaf-list management-address {
269           type inet:ip-address;
270           description "System management address";
271         }
272         leaf management-vid {
273           if-feature VLAN;
274           type vlan;
275           description "System management VID";
276         }
277         leaf-list nick-name {
278           if-feature TRILL;
279           type trill-nickname;
280           description "Nickname of the RBridge";
281         }
282         leaf-list flag {
283           type flag-type;
284           description "Node operational flags";
285         }
286       }
287     }  // grouping l2-node-attributes
288
289
290     grouping l2-link-attributes {
291       description "L2 link attributes";
292       container l2-link-attributes {
293         description "Containing L2 link attributes";
294         leaf name {
295           type string;
296           description "Link name";
297         }
298         leaf-list flag {
299           type flag-type;
300           description "Link flags";
301         }
302         leaf rate {
303           type decimal64 {
304             fraction-digits 2;
305           }
306           description "Link rate";
307
308         }
309         leaf delay {
310           type uint32;
311           description "Link delay in microseconds";
312         }
313         leaf-list srlg {
314           type uint32;
315           description
316             "List of Shared Risk Link Groups
317              this link belongs to.";
318         }
319       }
320     } // grouping l2-link-attributes
321
322     grouping l2-termination-point-attributes {
323       description "L2 termination point attributes";
324       container l2-termination-point-attributes {
325         description "Containing L2 TP attributes";
326         leaf description {
327           type string;
328           description "Port description";
329         }
330
331         leaf maximum-frame-size {
332           type uint32;
333           description "Maximum frame size";
334         }
335
336         choice l2-termination-point-type {
337           description
338             "Indicates termination-point type
339              specific attributes";
340           case ethernet {
341             leaf mac-address {
342               type yang:mac-address;
343               description "Interface MAC address";
344             }
345
346             leaf eth-encapsulation {
347               type identityref {
348                 base eth-encapsulation-type;
349               }
350               description
351                 "Encapsulation type of this
352                  ternimation point.";
353             }
354
355             leaf port-vlan-id {
356               if-feature VLAN;
357               type vlan;
358               description "Port VLAN ID";
359             }
360
361             list vlan-id-name {
362               if-feature VLAN;
363               key "vlan-id";
364               description "Interface configured VLANs";
365               leaf vlan-id {
366                 type vlan;
367                 description "VLAN ID";
368               }
369               leaf vlan-name {
370                 type string;
371                 description "VLAN Name";
372               }
373             }
374           } //case ethernet
375
376           case legacy {
377             leaf encapsulation {
378               type identityref {
379                 base encapsulation-type;
380               }
381               description
382                 "Encapsulation type of this termination point.";
383             }
384           } //case legacy
385
386         } //choice termination-point-type
387
388         leaf tp-state {
389           type enumeration {
390             enum in-use {
391               value 0;
392               description
393                 "the termination point is in forwarding state";
394             }
395             enum blocking {
396               value 1;
397               description
398                 "the termination point is in blocking state";
399             }
400             enum down {
401               value 2;
402               description
403                 "the termination point is in down state";
404             }
405             enum others {
406               value 3;
407               description
408                 "the termination point is in other state";
409             }
410           }
411           config false;
412           description "State of the termination point";
413         }
414       }
415     } // grouping l2-termination-point-attributes
416
417 /*** grouping of network/node/link/tp leaf-refs ***/
418
419   grouping network-ref {
420     description
421       "Grouping for an absolute reference to a network topology
422       instance.";
423     leaf network-ref {
424       type leafref {
425         path "/nw:network/nw:network-id";
426       }
427       description
428         "An absolute reference to a network topology instance.";
429     }
430   }
431
432   grouping link-ref {
433     description
434       "Grouping for an absolute reference to a link instance.";
435       uses network-ref;
436       leaf link-ref {
437         type leafref {
438           path "/nw:network"
439             +"[nw:network-id = current()/../network-ref]"
440             +"/nt:link/nt:link-id";
441         }
442       description
443         "An absolute reference to a link instance.";
444     }
445   }
446
447   grouping node-ref {
448     description
449       "Grouping for an absolute reference to a node instance.";
450     uses network-ref;
451     leaf node-ref {
452       type leafref {
453         path "/nw:network"
454           +"[nw:network-id = current()/../network-ref]"
455           +"/nw:node/nw:node-id";
456       }
457       description
458         "An absolute reference to a node instance.";
459     }
460   }
461
462   grouping tp-ref {
463     description
464       "Grouping for an absolute reference to a termination point.";
465     uses node-ref;
466     leaf tp-ref {
467       type leafref {
468         path "/nw:network"
469           +"[nw:network-id = current()/../network-ref]"
470           +"/nw:node[nw:node-id = current()/../node-ref]"
471           +"/nt:termination-point/nt:tp-id";
472       }
473       description
474         "Grouping for an absolute reference to a TP.";
475     }
476   }
477
478
479    /*
480     * Data nodes
481     */
482     augment "/nw:network/nw:network-types" {
483       description
484         "Introduce new network type for L2 topology";
485       uses l2-network-type;
486     }
487
488     augment "/nw:network" {
489       /* RIFT-Change: when not to be used yet
490       when "nw:network-types/l2-network" {
491         description
492           "Augmentation parameters apply only for networks
493            with L2 topology";
494       }
495       */
496       description
497         "Configuration parameters for the L2 network
498          as a whole";
499       uses l2-network-attributes;
500     }
501
502     augment "/nw:network/nw:node" {
503       /* RIFT-Change: when not to be used yet
504       when "../nw:network-types/l2-network" {
505         description
506           "Augmentation parameters apply only for networks
507            with L2 topology";
508       }
509       */
510       description
511         "Configuration parameters for L2 at the node
512          level";
513       uses l2-node-attributes;
514     }
515
516     augment "/nw:network/nt:link" {
517       /* RIFT-Change: when not to be used yet
518       when "/nw:network/nw:network-types/l2-network" {
519         description
520           "Augmentation parameters apply only for networks
521            with L2 topology";
522       }
523       */
524       description "Augment L2 topology link information";
525       uses l2-link-attributes;
526     }
527
528     augment "/nw:network/nw:node/nt:termination-point" {
529       /* RIFT-Change: when not to be used yet
530       when "/nw:network/nw:network-types/l2-network" {
531         description
532           "Augmentation parameters apply only for networks
533            with L2 topology";
534       }
535       */
536       description
537         "Augment L2 topology termination point configuration";
538       uses l2-termination-point-attributes;
539     }
540
541    /*
542     * Notifications
543     */
544
545     notification l2-node-event {
546       description "Notification event for L2 node";
547       leaf event-type {
548         type l2-network-event-type;
549         description "Event type";
550       }
551       uses node-ref;
552       uses l2-network-type;
553       uses l2-node-attributes;
554     }
555
556     notification l2-link-event {
557       description "Notification event for L2 link";
558       leaf event-type {
559         type l2-network-event-type;
560         description "Event type";
561       }
562       uses link-ref;
563       uses l2-network-type;
564       uses l2-link-attributes;
565     }
566
567     notification l2-termination-point-event {
568       description "Notification event for L2 termination point";
569       leaf event-type {
570         type l2-network-event-type;
571         description "Event type";
572       }
573       uses tp-ref;
574       uses l2-network-type;
575       uses l2-termination-point-attributes;
576     }
577
578 }  // module l2-topology