Bulk merge of l2gw changes
[netvirt.git] / elanmanager / api / src / main / yang / elan.yang
1 module elan {
2
3     namespace "urn:opendaylight:netvirt:elan";
4     prefix elan;
5
6     import network-topology {prefix "topo"; revision-date "2013-10-21"; }
7     import hwvtep {prefix "hwvtep"; revision-date "2015-09-01"; }
8     import yang-ext {prefix ext; revision-date "2013-07-09";}
9
10     import ietf-interfaces {
11         prefix if;
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     }
20
21
22     revision "2015-06-02" {
23         description "elan module";
24     }
25
26     /*
27     * elan instance view.
28     */
29     container elan-instances {
30         description
31            "elan instances configuration parameters. Elan instances support both the VLAN and VNI based elans.";
32
33         list elan-instance {
34             max-elements "unbounded";
35             min-elements "0";
36             key "elan-instance-name";
37             description
38                 "Specifies the name of the elan instance. It is a string of 1 to 31
39                  case-sensitive characters.";
40             leaf elan-instance-name {
41                 type string;
42                 description "The name of the elan-instance.";
43             }
44             leaf elan-tag {
45                 type    uint32;
46                 description "ELAN unique identifier which is unique across all the tenants.
47                              This will be created internally and if provided, the value will be discarded.";
48             }
49             leaf segment-type {
50                 description "Optional. Network segment type. It's mandatory when there are external
51                                 devices participating in the ELAN";
52                 type identityref {
53                     base segment-type-base;
54                 }
55             }
56             leaf segmentation-id {
57                 type uint32;
58                 description "Optional. Isolated segment on the physical network. For example,
59                                 if segment-type is vlan, this ID is a vlan identifier. If segment-type
60                                 is vxlan, this ID is a vni";
61             }
62             leaf physical-network-name {
63                 type string;
64                 description "Optional. The name of the physical network attached to the ELAN.";
65             }
66             leaf external {
67                 description "indicates whether this is an external network";
68                 type boolean;
69                 default false;
70             }
71             leaf mac-timeout {
72                 type uint32 {
73                     range "0..65535";
74                 }
75                 description "MAC Table entry ageing time in seconds.
76                              A value of 0 will indicate that the MAC will never expire.";
77             }
78             leaf description {
79                 description
80                     "A textual description of elan instance, the elan instance description
81                     helps users memorize the elan instance.";
82
83                 type string {
84                     length "1..254";
85                 }
86             }
87             list elan-segments {
88                 description "List of provider network(s) associated with this ELAN.";
89                 key segmentation-index;
90                 leaf segmentation-index {
91                     description "A hidden counter to act as a key, because segmentation id
92                     is not required.";
93                     type uint32;
94                 }
95                 leaf physical-network-name {
96                     description "Optional. The name of the physical network attached to the ELAN.";
97                     type string;
98                 }
99                 leaf segment-type {
100                     description "Optional. Network segment type. It's mandatory when there are external
101                                 devices participating in the ELAN";
102                     type identityref {
103                         base segment-type-base;
104                     }
105                 }
106                 leaf segmentation-id {
107                     description "Optional. Isolated segment on the physical network. For example,
108                                 if segment-type is vlan, this ID is a vlan identifier. If segment-type
109                                 is vxlan, this ID is a vni";
110                     type uint32;
111                 }
112             }
113             list external-teps {
114                 description "Optional. The external tep ips of the nodes where this elan is present";
115                 key tep-ip;
116                 leaf tep-ip {
117                     type inet:ip-address;
118                 }
119                 leaf nodeid {
120                     type string;
121                 }
122             }
123         }
124     }
125
126   /*
127    * Binding Interfaces to a elan Instance.
128    */
129   container elan-interfaces {
130     description
131         "elan is enabled on interfaces.";
132
133     list elan-interface  {
134         key "name";
135         max-elements "unbounded";
136         min-elements "0";
137         leaf name {
138             type leafref {
139                 path "/if:interfaces/if:interface/if:name";
140             }
141         }
142         leaf elan-instance-name {
143             mandatory true;
144             type string;
145         }
146
147         list static-mac-entries {
148             key "mac-address";
149             leaf mac-address {
150                 type yang:phys-address;
151             }
152             leaf ip-prefix {
153                 type inet:ip-address;
154             }
155         }
156
157         leaf description {
158             description
159                 "A textual description of elan port, the elan port description
160                 helps users memorize the elan port.";
161
162             type string {
163                  length "1..254";
164             }
165         }
166     }
167   }
168
169     /* operational data stores */
170   container elan-state {
171     config false;
172     description
173       "operational state of elans.";
174
175     list elan {
176         key "name";
177         description "The list of interfaces on the device.";
178         max-elements "unbounded";
179         min-elements "0";
180         leaf name {
181             type string;
182             description
183               "The name of the elan-instance.";
184         }
185         leaf-list elan-interfaces{
186             type leafref {
187                 path "/if:interfaces/if:interface/if:name";
188             }
189             description "Interfaces connected to this elan instance.";
190         }
191     }
192   }
193
194   grouping forwarding-entries {
195     description "Details of the MAC entries";
196
197     list mac-entry {
198       key "mac-address";
199       description "Details of a MAC address";
200       max-elements "unbounded";
201       min-elements "0";
202
203       leaf mac-address {
204           type yang:phys-address;
205       }
206
207       leaf interface {
208          type leafref {
209              path "/if:interfaces/if:interface/if:name";
210          }
211       }
212
213       leaf controllerLearnedForwardingEntryTimestamp {
214         type uint64;
215       }
216
217       leaf isStaticAddress {
218         type boolean;
219       }
220
221       leaf ip-prefix {
222         type inet:ip-address;
223       }
224
225       leaf src-tor-nodeid {
226           type string;
227           description
228             "The src tor node id";
229       }
230     }
231   }
232
233   augment "/topo:network-topology/topo:topology/topo:node/hwvtep:local-ucast-macs" {
234       description "Augmentation for physical switch nodes managed by hwvtep";
235       ext:augment-identifier "srcnode-augmentation";
236       leaf src-tor-nodeid {
237         type string;
238         description
239           "The src tor node id";
240       }
241   }
242
243   container elan-forwarding-tables {
244     config false;
245     description
246       "MAC tables for each elan instance";
247
248     list mac-table {
249         max-elements "unbounded";
250         min-elements "0";
251         key "elan-instance-name";
252         description
253             "Specifies the name of the elan instance. It is a string of 1 to 31
254              case-sensitive characters.";
255
256         leaf elan-instance-name {
257             type string;
258             description
259               "The name of the elan-instance.";
260         }
261
262         uses forwarding-entries;
263     }
264   }
265
266     container elan-interface-forwarding-entries {
267         config false;
268
269         list elan-interface-mac {
270             key "elan-interface";
271             description "All the MAC addresses learned on a particular elan interface";
272             max-elements "unbounded";
273             min-elements "0";
274             leaf elan-interface {
275                 type leafref {
276                     path "/if:interfaces/if:interface/if:name";
277                 }
278             }
279
280             uses forwarding-entries;
281         }
282     }
283
284     container elan-dpn-interfaces {
285         config false;
286
287         list elan-dpn-interfaces-list {
288             key "elan-instance-name";
289             description "All the dpns of this elan and all the ports of the corresponding dpns";
290             max-elements "unbounded";
291             min-elements "0";
292
293             leaf elan-instance-name {
294                 type string;
295                 description "The name of the elan-instance.";
296             }
297
298             list dpn-interfaces {
299                 key "dp-id";
300                 description "A DPN in which the elan spans across";
301                 max-elements "unbounded";
302                 min-elements "0";
303
304                 leaf dp-id {
305                     type uint64;
306                 }
307
308                 leaf-list interfaces {
309                     type leafref {
310                         path "/if:interfaces/if:interface/if:name";
311                     }
312                 }
313             }
314         }
315     }
316
317     container elan-tag-name-map {
318         config false;
319
320         list elan-tag-name {
321             key elan-tag;
322             leaf elan-tag {
323                 type uint32;
324             }
325
326             leaf name {
327                 type string;
328                 description
329                 "The name of the elan-instance.";
330             }
331         }
332     }
333
334     augment "/elan:elan-instances/elan:elan-instance" {
335         ext:augment-identifier "evpn-augmentation";
336         leaf evpn-name {
337             type string;
338         }
339
340         leaf l3vpn-name {
341             type string;
342         }
343     }
344
345     identity segment-type-base {
346         description "Base entity for all network segment types";
347     }
348
349     identity segment-type-flat {
350         description "Flat network segment type";
351         base segment-type-base;
352     }
353
354     identity segment-type-vlan {
355         description "VLAN network segment type";
356         base segment-type-base;
357     }
358
359     identity segment-type-vxlan {
360         description "VxLAN network segment type";
361         base segment-type-base;
362     }
363
364     identity segment-type-gre {
365         description "GRE network segment type";
366         base segment-type-base;
367     }
368
369 }