interface/port-other-config support
[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; revision-date 2010-09-24; }
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             leaf controller-uuid {
150                 description "The unique identifier of the controller";
151                 type yang:uuid;
152             }
153
154         }
155
156         leaf datapath-id {
157             description "Datapath-id of the bridge";
158             type datapath-id;
159         }
160
161         leaf datapath-type {
162             description "The datapath type of the bridge";
163             type identityref {
164                 base datapath-type-base;
165             }
166         }
167
168         leaf fail-mode {
169             description "Failmode of the bridge";
170             type identityref {
171                 base ovsdb-fail-mode-base;
172             }
173         }
174
175         leaf flow-node {
176             description "Flow node corresponding to this bridge";
177             type flow-node-ref;
178         }
179
180         leaf managed-by {
181             description "The OVSDB which this bridge belongs to";
182             type ovsdb-node-ref;
183         }
184
185         list bridge-external-ids {
186             description "Bridge external id";
187             key "bridge-external-id-key";
188             leaf bridge-external-id-key {
189                 description "external-id name/key";
190                 type string;
191                 mandatory true;
192             }
193             leaf bridge-external-id-value {
194                 description "bridge-external-id value";
195                 type string;
196                 mandatory true;
197             }
198         }
199
200         list bridge-other-configs {
201             description "Other config attributes for Bridges";
202             key "bridge-other-config-key";
203             leaf bridge-other-config-key {
204                 description "bridge-other-config name/key";
205                 type string;
206             }
207             leaf bridge-other-config-value {
208                 description "bridge-other-config value";
209                 type string;
210             }
211         }
212
213     }
214
215     grouping ovsdb-node-attributes {
216         uses overlay:ip-port-locator;
217
218         leaf ovs-version {
219             type string;
220         }
221
222         list managed-node-entry {
223             key "bridge-ref";
224             leaf bridge-ref {
225                 type ovsdb-bridge-ref;
226             }
227         }
228
229         list datapath-type-entry {
230             key "datapath-type";
231             leaf datapath-type {
232                 description "Datapath types supported by OVSDB node";
233                 type identityref {
234                     base datapath-type-base;
235                 }
236             }
237         }
238
239         list interface-type-entry {
240             key "interface-type";
241             leaf interface-type {
242                 description "Interface types supported by OVSDB node";
243                 type identityref {
244                     base interface-type-base;
245                 }
246             }
247         }
248
249         list openvswitch-external-ids {
250             description "Open_vSwitch table external ids";
251             key "external-id-key";
252             leaf external-id-key {
253                 description "external-id name/key";
254                 type string;
255                 mandatory true;
256             }
257             leaf external-id-value {
258                 description "external-id value";
259                 type string;
260                 mandatory true;
261             }
262         }
263
264         list openvswitch-other-configs {
265             description "Open_vSwitch table other configs";
266             key "other-config-key";
267             leaf other-config-key {
268                 description "other-config name/key";
269                 type string;
270             }
271             leaf other-config-value {
272                 description "other-config value";
273                 type string;
274             }
275          }
276
277      }
278
279     identity interface-type-base {
280         description "Base identity for all OVSDB interface types";
281     }
282
283     identity interface-type-system {
284         description "Interface type for system interfaces";
285         base interface-type-base;
286     }
287
288     identity interface-type-internal {
289         description "Interface type for internal interfaces";
290         base interface-type-base;
291     }
292
293     identity interface-type-vxlan {
294         description "Interface type for vxlan interfaces";
295         base interface-type-base;
296     }
297
298     identity interface-type-patch {
299         description "Interface type for patch interfaces";
300         base interface-type-base;
301     }
302
303     identity interface-type-tap {
304         description "Interface type for tun/tap interfaces";
305         base interface-type-base;
306     }
307
308     identity interface-type-geneve {
309         description "Interface type for geneve interfaces";
310         base interface-type-base;
311     }
312
313     identity interface-type-gre {
314         description "Interface type for gre interfaces";
315         base interface-type-base;
316     }
317
318     identity interface-type-ipsec-gre {
319         description "Interface type for ipsec-gre interfaces";
320         base interface-type-base;
321     }
322
323     identity interface-type-gre64 {
324         description "Interface type for gre64 interfaces";
325         base interface-type-base;
326     }
327
328     identity interface-type-ipsec-gre64 {
329         description "Interface type for ipsec-gre64 interfaces";
330         base interface-type-base;
331     }
332
333     identity interface-type-lisp {
334         description "Interface type for lisp interfaces";
335         base interface-type-base;
336     }
337
338     identity interface-type-dpdk {
339         description "Interface type for dpdk interfaces";
340         base interface-type-base;
341     }
342
343     identity interface-type-dpdkr {
344         description "Interface type for dpdk ring interfaces";
345         base interface-type-base;
346     }
347
348     identity interface-type-dpdkvhost {
349         description "Interface type for dpdkvhost interfaces";
350         base interface-type-base;
351     }
352
353     identity interface-type-dpdkvhostuser {
354         description "Interface type for dpdkvhostuser interfaces";
355         base interface-type-base;
356     }
357
358     grouping ovsdb-port-interface-attributes {
359         leaf port-uuid {
360             description "The unique identifier of the OVSDB port";
361             type yang:uuid;
362         }
363
364         leaf interface-uuid {
365             description "The unique identifier of the OVSDB interface";
366             type yang:uuid;
367         }
368
369         leaf name {
370             description "The name of the OVSDB port/interface";
371             type string;
372         }
373
374         leaf interface-type {
375             description "The type of the OVSDB interface";
376             type identityref {
377                 base interface-type-base;
378             }
379         }
380
381         list options {
382             description "Port/Interface related optional input values";
383             key "option";
384             leaf option {
385                 description "Option name";
386                 type string;
387             }
388             leaf value {
389                 description "Option value";
390                 type string;
391             }
392         }
393
394         leaf ofport {
395             description "Port/Interface related optional ofport";
396             type uint32;
397         }
398
399         leaf ofport_request {
400             description "Port/Interface related optional ofport_request, in range 1 to 65279";
401             type uint16 {
402                 range "1..65279";
403             }
404         }
405
406         leaf vlan-tag {
407             description "The VLAN tag of the termination point.";
408             type ethertype:vlan-id;
409         }
410
411         list trunks {
412             description "Represents the trunks of a termination point.";
413             leaf trunk {
414                 type ethertype:vlan-id;
415             }
416         }
417
418         leaf vlan-mode {
419             description "The VLAN mode of the termination point.";
420             type enumeration {
421                 enum "access" {
422                     value 1;
423                     description
424                         "The VLAN mode access.";
425                 }
426                 enum "native-tagged" {
427                     value 2;
428                     description
429                         "The VLAN mode native-tagged.";
430                 }
431                 enum "native-untagged" {
432                     value 3;
433                     description
434                         "The VLAN mode native-untagged.";
435                 }
436                 enum "trunk" {
437                     value 4;
438                     description
439                         "The VLAN mode trunk.";
440                 }
441             }
442         }
443
444         list port-other-configs {
445             description "Other config attributes for Ports";
446             key "other-config-key";
447             leaf other-config-key {
448                 description "port-other-config name/key";
449                 type string;
450             }
451             leaf other-config-value {
452                 description "port-other-config value";
453                 type string;
454             }
455         }
456
457         list interface-other-configs {
458             description "Other config attributes for Interfaces";
459             key "other-config-key";
460             leaf other-config-key {
461                 description "interface-other-config name/key";
462                 type string;
463             }
464             leaf other-config-value {
465                 description "interface-other-config value";
466                 type string;
467             }
468         }
469
470         list port-external-ids {
471             description "Port external ids";
472             key "external-id-key";
473             leaf external-id-key {
474                 description "external-id name/key";
475                 type string;
476                 mandatory true;
477             }
478             leaf external-id-value {
479                 description "external-id value";
480                 type string;
481                 mandatory true;
482             }
483         }
484
485         list interface-external-ids {
486             description "Interface external ids";
487             key "external-id-key";
488             leaf external-id-key {
489                 description "external-id name/key";
490                 type string;
491                 mandatory true;
492             }
493             leaf external-id-value {
494                 description "external-id value";
495                 type string;
496                 mandatory true;
497             }
498         }
499     }
500
501     augment "/topo:network-topology/topo:topology/topo:node" {
502         description "Augmentation for bridge nodes managed by ovsdb";
503         ext:augment-identifier "ovsdb-bridge-augmentation";
504         uses ovsdb-bridge-attributes;
505     }
506
507     augment "/topo:network-topology/topo:topology/topo:node" {
508         description "Augment topology node for an ovsdb node";
509         ext:augment-identifier "ovsdb-node-augmentation";
510         uses ovsdb-node-attributes;
511     }
512
513     augment "/topo:network-topology/topo:topology/topo:node/topo:termination-point" {
514         description "Augment topology node termination-point for an ovsdb port/interface";
515         ext:augment-identifier "ovsdb-termination-point-augmentation";
516         uses ovsdb-port-interface-attributes;
517     }
518 }