port/interface-external-ids refactoring
[ovsdb.git] / southbound / southbound-api / src / main / yang / ovsdb.yang
1 module ovsdb {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:ovsdb";
4     prefix "southbound";
5
6     import network-topology {prefix "topo"; revision-date "2013-10-21"; }
7     import yang-ext { prefix "ext"; }
8     import ietf-inet-types { prefix inet; }
9     import overlay { prefix overlay; }
10     import ietf-yang-types { prefix yang; revision-date "2013-07-15";}
11     import opendaylight-l2-types { prefix ethertype; revision-date "2013-08-27";}
12
13     revision "2015-01-05" {
14         description "Initial revision of southbound model";
15     }
16
17     typedef ovsdb-termination-point-ref {
18         description "A reference to an ovsdb termination point";
19         type instance-identifier;
20     }
21
22     typedef ovsdb-bridge-ref {
23         description "A reference to an ovsdb bridge";
24         type instance-identifier;
25     }
26
27     typedef ovsdb-node-ref {
28         description "A reference to an ovsdb node";
29         type instance-identifier;
30     }
31
32     typedef flow-node-ref {
33         description "A reference to a flow node";
34         type instance-identifier;
35     }
36
37     typedef ovsdb-bridge-name {
38         type string;
39     }
40
41     typedef datapath-id {
42         type string {
43           pattern
44             '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){7}';
45         }
46         description
47           "The datapath-d type represents OpenFlow datapath-id .
48         The canonical representation uses lowercase characters.
49
50         In the value set and its semantics, this type is similar
51         to the MacAddress textual convention of the SMIv2, but with
52         16 extra bits";
53         reference
54           "Openflow 1.3.0 Spec
55            IEEE 802: IEEE Standard for Local and Metropolitan Area
56                 Networks: Overview and Architecture
57            RFC 2579: Textual Conventions for SMIv2";
58     }
59
60     identity datapath-type-base {
61         description "Base identity for all OVSDB datapath types";
62     }
63
64     identity datapath-type-system {
65         description "Datapath type for the kernel datapath";
66         base datapath-type-base;
67     }
68
69     identity datapath-type-netdev {
70         description "Datapath type for the userspace datapath";
71         base datapath-type-base;
72     }
73
74     identity ovsdb-bridge-protocol-base {
75         description "Base identity for all ovsdb-bridge-protocols";
76     }
77
78     identity ovsdb-bridge-protocol-openflow-10 {
79         description "Ovsdb bridge protocol OpenFlow 1.0";
80         base ovsdb-bridge-protocol-base;
81     }
82
83     identity ovsdb-bridge-protocol-openflow-11 {
84         description "Ovsdb bridge protocol OpenFlow 1.1";
85         base ovsdb-bridge-protocol-base;
86     }
87
88     identity ovsdb-bridge-protocol-openflow-12 {
89         description "Ovsdb bridge protocol OpenFlow 1.2";
90         base ovsdb-bridge-protocol-base;
91     }
92
93     identity ovsdb-bridge-protocol-openflow-13 {
94         description "Ovsdb bridge protocol OpenFlow 1.3";
95         base ovsdb-bridge-protocol-base;
96     }
97
98     identity ovsdb-bridge-protocol-openflow-14 {
99         description "Ovsdb bridge protocol OpenFlow 1.4";
100         base ovsdb-bridge-protocol-base;
101     }
102
103     identity ovsdb-bridge-protocol-openflow-15 {
104         description "Ovsdb bridge protocol OpenFlow 1.5";
105         base ovsdb-bridge-protocol-base;
106     }
107
108     identity ovsdb-fail-mode-base {
109         description "Base identity for ovsdb-failmode";
110     }
111
112     identity ovsdb-fail-mode-standalone {
113         description "Identity for ovsdb-failmode standalone";
114         base ovsdb-fail-mode-base;
115     }
116
117     identity ovsdb-fail-mode-secure {
118         description "Identity for ovsdb-failmode standalone";
119         base ovsdb-fail-mode-base;
120     }
121
122     grouping ovsdb-bridge-attributes {
123         leaf bridge-uuid {
124             description "The unique identifier of the bridge";
125             type yang:uuid;
126         }
127
128         leaf bridge-name {
129             description "The name of the bridge";
130             type ovsdb-bridge-name;
131         }
132         list protocol-entry {
133             key "protocol";
134             leaf protocol {
135                 description "Protocol bridge should seek to speak to its controller";
136                 type identityref {
137                     base ovsdb-bridge-protocol-base;
138                 }
139             }
140         }
141
142         list controller-entry {
143             description "Bridge controller info";
144             key "target";
145             leaf target {
146                 description "Uri telling bridge how to connect to controller";
147                 type inet:uri;
148             }
149         }
150
151         leaf datapath-id {
152             description "Datapath-id of the bridge";
153             type datapath-id;
154         }
155
156         leaf datapath-type {
157             description "The datapath type of the bridge";
158             type identityref {
159                 base datapath-type-base;
160             }
161         }
162
163         leaf fail-mode {
164             description "Failmode of the bridge";
165             type identityref {
166                 base ovsdb-fail-mode-base;
167             }
168         }
169
170         leaf flow-node {
171             description "Flow node corresponding to this bridge";
172             type flow-node-ref;
173         }
174
175         leaf managed-by {
176             description "The OVSDB which this bridge belongs to";
177             type ovsdb-node-ref;
178         }
179     }
180
181     grouping ovsdb-node-attributes {
182         uses overlay:ip-port-locator;
183
184         leaf ovs-version {
185             type string;
186         }
187
188         list managed-node-entry {
189             key "bridge-ref";
190             leaf bridge-ref {
191                 type ovsdb-bridge-ref;
192             }
193         }
194
195         list datapath-type-entry {
196             key "datapath-type";
197             leaf datapath-type {
198                 description "Datapath types supported by OVSDB node";
199                 type identityref {
200                     base datapath-type-base;
201                 }
202             }
203         }
204
205         list interface-type-entry {
206             key "interface-type";
207             leaf interface-type {
208                 description "Interface types supported by OVSDB node";
209                 type identityref {
210                     base interface-type-base;
211                 }
212             }
213         }
214
215      }
216
217     identity interface-type-base {
218         description "Base identity for all OVSDB interface types";
219     }
220
221     identity interface-type-system {
222         description "Interface type for system interfaces";
223         base interface-type-base;
224     }
225
226     identity interface-type-internal {
227         description "Interface type for internal interfaces";
228         base interface-type-base;
229     }
230
231     identity interface-type-vxlan {
232         description "Interface type for vxlan interfaces";
233         base interface-type-base;
234     }
235
236     identity interface-type-patch {
237         description "Interface type for patch interfaces";
238         base interface-type-base;
239     }
240
241     identity interface-type-tap {
242         description "Interface type for tun/tap interfaces";
243         base interface-type-base;
244     }
245
246     identity interface-type-geneve {
247         description "Interface type for geneve interfaces";
248         base interface-type-base;
249     }
250
251     identity interface-type-gre {
252         description "Interface type for gre interfaces";
253         base interface-type-base;
254     }
255
256     identity interface-type-ipsec-gre {
257         description "Interface type for ipsec-gre interfaces";
258         base interface-type-base;
259     }
260
261     identity interface-type-gre64 {
262         description "Interface type for gre64 interfaces";
263         base interface-type-base;
264     }
265
266     identity interface-type-ipsec-gre64 {
267         description "Interface type for ipsec-gre64 interfaces";
268         base interface-type-base;
269     }
270
271     identity interface-type-lisp {
272         description "Interface type for lisp interfaces";
273         base interface-type-base;
274     }
275
276     identity interface-type-dpdk {
277         description "Interface type for dpdk interfaces";
278         base interface-type-base;
279     }
280
281     identity interface-type-dpdkr {
282         description "Interface type for dpdk ring interfaces";
283         base interface-type-base;
284     }
285
286     identity interface-type-dpdkvhost {
287         description "Interface type for dpdkvhost interfaces";
288         base interface-type-base;
289     }
290
291     identity interface-type-dpdkvhostuser {
292         description "Interface type for dpdkvhostuser interfaces";
293         base interface-type-base;
294     }
295
296     grouping ovsdb-port-interface-attributes {
297         leaf port-uuid {
298             description "The unique identifier of the OVSDB port";
299             type yang:uuid;
300         }
301
302         leaf interface-uuid {
303             description "The unique identifier of the OVSDB interface";
304             type yang:uuid;
305         }
306
307         leaf name {
308             description "The name of the OVSDB port/interface";
309             type string;
310         }
311
312         leaf interface-type {
313             description "The type of the OVSDB interface";
314             type identityref {
315                 base interface-type-base;
316             }
317         }
318
319         list options {
320             description "Port/Interface related optional input values";
321             key "option";
322             leaf option {
323                 description "Option name";
324                 type string;
325             }
326             leaf value {
327                 description "Option value";
328                 type string;
329             }
330         }
331
332         leaf ofport {
333             description "Port/Interface related optional ofport";
334             type uint32;
335         }
336
337         leaf ofport_request {
338             description "Port/Interface related optional ofport_request, in range 1 to 65279";
339             type uint16 {
340                 range "1..65279";
341             }
342         }
343
344         leaf vlan-tag {
345             description "The VLAN tag of the termination point.";
346             type ethertype:vlan-id;
347         }
348
349         list trunks {
350             description "Represents the trunks of a termination point.";
351             leaf trunk {
352                 type ethertype:vlan-id;
353             }
354         }
355
356         leaf vlan-mode {
357             description "The VLAN mode of the termination point.";
358             type enumeration {
359                 enum "access" {
360                     value 1;
361                     description
362                         "The VLAN mode access.";
363                 }
364                 enum "native-tagged" {
365                     value 2;
366                     description
367                         "The VLAN mode native-tagged.";
368                 }
369                 enum "native-untagged" {
370                     value 3;
371                     description
372                         "The VLAN mode native-untagged.";
373                 }
374                 enum "trunk" {
375                     value 4;
376                     description
377                         "The VLAN mode trunk.";
378                 }
379             }
380         }
381
382         list port-external-ids {
383             description "Port external ids";
384             key "external-id-key";
385             leaf external-id-key {
386                 description "external-id name/key";
387                 type string;
388                 mandatory true;
389             }
390             leaf external-id-value {
391                 description "external-id value";
392                 type string;
393                 mandatory true;
394             }
395         }
396
397         list interface-external-ids {
398             description "Interface external ids";
399             key "external-id-key";
400             leaf external-id-key {
401                 description "external-id name/key";
402                 type string;
403                 mandatory true;
404             }
405             leaf external-id-value {
406                 description "external-id value";
407                 type string;
408                 mandatory true;
409             }
410         }
411     }
412
413     grouping ovsdb-other-config-attributes {
414         list other-configs {
415             description "Other config attributes for OVSDB tables";
416             key "other-config-key";
417             leaf other-config-key {
418                 description "other-config name/key";
419                 type string;
420             }
421             leaf other-config-value {
422                 description "other-config value";
423                 type string;
424             }
425          }
426     }
427
428     augment "/topo:network-topology/topo:topology/topo:node" {
429         description "Augmentation for bridge nodes managed by ovsdb";
430         ext:augment-identifier "ovsdb-bridge-augmentation";
431         uses ovsdb-bridge-attributes;
432     }
433
434     augment "/topo:network-topology/topo:topology/topo:node" {
435         description "Augment topology node for an ovsdb node";
436         ext:augment-identifier "ovsdb-node-augmentation";
437         uses ovsdb-node-attributes;
438         uses ovsdb-other-config-attributes;
439     }
440
441     augment "/topo:network-topology/topo:topology/topo:node/topo:termination-point" {
442         description "Augment topology node termination-point for an ovsdb port/interface";
443         ext:augment-identifier "ovsdb-termination-point-augmentation";
444         uses ovsdb-port-interface-attributes;
445     }
446 }