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