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