Merge "Model update to add external-id to port/interface."
[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 bridge-name {
313             description "Create termination point on this bridge";
314             type string;
315         }
316
317         leaf interface-type {
318             description "The type of the OVSDB interface";
319             type identityref {
320                 base interface-type-base;
321             }
322         }
323
324         list options {
325             description "Port/Interface related optional input values";
326             key "option";
327             leaf option {
328                 description "Option name";
329                 type string;
330             }
331             leaf value {
332                 description "Option value";
333                 type string;
334             }
335         }
336
337         leaf ofport {
338             description "Port/Interface related optional ofport";
339             type uint16;
340         }
341
342         leaf ofport_request {
343             description "Port/Interface related optional ofport_request, in range 1 to 65279";
344             type uint16 {
345                 range "1..65279";
346             }
347         }
348
349         leaf attached-to {
350             description "Reference to the bridge where terminiation point is attached.";
351             type ovsdb-bridge-ref;
352         }
353
354         leaf vlan-tag {
355             description "The VLAN tag of the termination point.";
356             type ethertype:vlan-id;
357         }
358
359         list trunks {
360             description "Represents the trunks of a termination point.";
361             leaf trunk {
362                 type ethertype:vlan-id;
363             }
364         }
365     }
366
367     grouping ovsdb-external-ids-attributes {
368         list external-ids {
369             description "Port/Interface external id";
370             key "external-id-key";
371             leaf external-id-key {
372                 description "external-id name/key";
373                 type string;
374             }
375             leaf external-id-value {
376                 description "external-id value";
377                 type string;
378             }
379          }
380     }
381
382     augment "/topo:network-topology/topo:topology/topo:node" {
383         description "Augmentation for bridge nodes managed by ovsdb";
384         ext:augment-identifier "ovsdb-bridge-augmentation";
385         uses ovsdb-bridge-attributes;
386     }
387
388     augment "/topo:network-topology/topo:topology/topo:node" {
389         description "Augment topology node for an ovsdb node";
390         ext:augment-identifier "ovsdb-node-augmentation";
391         uses ovsdb-node-attributes;
392     }
393
394     augment "/topo:network-topology/topo:topology/topo:node/topo:termination-point" {
395         description "Augment topology node termination-point for an ovsdb port/interface";
396         ext:augment-identifier "ovsdb-termination-point-augmentation";
397         uses ovsdb-port-interface-attributes;
398         uses ovsdb-external-ids-attributes;
399     }
400 }