Merge "Change hwvtep.yang and fix related code"
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-api / src / main / yang / hwvtep.yang
1 module hwvtep {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:ovsdb:hwvtep";
4     prefix "hwvtepsb";
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 ietf-yang-types { prefix yang; revision-date "2013-07-15";}
10     import opendaylight-l2-types { prefix ethertype; revision-date "2013-08-27";}
11
12     revision "2015-09-01" {
13         description "1st revision of southbound model for hwvtep";
14     }
15
16     typedef hwvtep-physical-switch-ref {
17         description "A reference to a hwvtep based physical switch";
18         type instance-identifier;
19     }
20
21     typedef hwvtep-logical-switch-ref {
22         description "A reference to a logical switch in hwvtep based switches";
23         type instance-identifier;
24     }
25
26     typedef hwvtep-physical-locator-ref {
27         description "A reference to an endpoint to which logical switch traffic may be encapsulated and forwarded";
28         type instance-identifier;
29     }
30
31     typedef hwvtep-physical-locator-set-ref {
32         description "A reference to a set of endpoints to which logical switch traffic may be encapsulated and forwarded via replication";
33         type instance-identifier;
34     }
35
36     typedef hwvtep-global-ref {
37         description "A reference to an hwvtep global node";
38         type instance-identifier;
39     }
40
41     typedef hwvtep-node-name {
42         type string;
43     }
44
45     grouping hwvtep-node-identification {
46         leaf hwvtep-node-name {
47             description "The name of the node";
48             type hwvtep-node-name;
49         }
50         leaf hwvtep-node-description {
51             description "The description of the node";
52             type string;
53         }
54     }
55
56     grouping hwvtep-mac-table-generic-attributes {
57         leaf mac-entry-key {
58             description "MAC address entry";
59             type string;
60         }
61         leaf logical-switch-ref {
62             description "The logical switch to which this mapping applies";
63             type hwvtep-logical-switch-ref;
64         }
65     }
66
67     grouping hwvtep-ucast-mac-table-attributes {
68         description "Unicast mac table attributes";
69         leaf ipaddr {
70             description "Optional IP address associated with the mac";
71             type inet:ip-address;
72         }
73         leaf locator-ref {
74             description "Reference to the physical locator to reach this entry";
75             type hwvtep-physical-locator-ref;
76         }
77     }
78
79     grouping hwvtep-mcast-mac-table-attributes {
80         leaf locator-set-ref {
81             description "Reference to a set of physical locators used for replication";
82             type hwvtep-physical-locator-set-ref;
83         }
84     }
85
86     grouping hwvtep-tunnel-attributes {
87         leaf local-locator-ref {
88             description "Reference to the physical locator to reach this entry";
89             type hwvtep-physical-locator-ref;
90         }
91         leaf remote-locator-ref {
92             description "Reference to the physical locator to reach this entry";
93             type hwvtep-physical-locator-ref;
94         }
95         leaf bfd-config-local {
96             type string;
97         }
98         leaf bfd-config-remote {
99             type string;
100         }
101         leaf bfd-params {
102             type string;
103         }
104     }
105
106     grouping hwvtep-physical-switch-attributes {
107         uses hwvtep-node-identification;
108         list management-ips {
109             key "management-ips-key";
110             leaf management-ips-key {
111                description "Management IP address of the switch";
112                type inet:ip-address;
113             }
114         }
115         leaf managed-by {
116             description "The hwvtep global node to which this physical switch belongs to";
117             type hwvtep-global-ref;
118         }
119         list tunnel-ips {
120             key "tunnel-ips-key";
121             leaf tunnel-ips-key {
122                description "Management IP address of the switch";
123                type inet:ip-address;
124             }
125         }
126         list tunnels {
127             uses hwvtep-tunnel-attributes ;
128         }
129         list ucast-macs-local {
130             key "mac-entry-key";
131             uses hwvtep-mac-table-generic-attributes;
132             uses hwvtep-ucast-mac-table-attributes;
133         }
134         list ucast-macs-remote {
135             key "mac-entry-key";
136             uses hwvtep-mac-table-generic-attributes;
137             uses hwvtep-ucast-mac-table-attributes;
138         }
139         list mcast-macs-local {
140             key "mac-entry-key";
141             uses hwvtep-mac-table-generic-attributes;
142             uses hwvtep-mcast-mac-table-attributes;
143         }
144         list mcast-macs-remote {
145             key "mac-entry-key";
146             uses hwvtep-mac-table-generic-attributes;
147             uses hwvtep-mcast-mac-table-attributes;
148         }
149     }
150
151     grouping hwvtep-connection-info-attributes {
152         leaf remote-ip {
153             type inet:ip-address;
154             description "Hwvtep Connection Remote IP";
155         }
156         leaf remote-port {
157             type inet:port-number;
158             description "Hwvtep Connection Remote Port Number";
159         }
160         leaf local-ip {
161             type inet:ip-address;
162             description "Hwvtep Connection Local IP";
163         }
164         leaf local-port {
165             type inet:port-number;
166             description "Hwvtep Connection Local Port Number IP";
167         }
168     }
169
170     grouping hwvtep-global-attributes {
171         description "global node for the hwvtep";
172         container connection-info {
173             uses hwvtep-connection-info-attributes;
174         }
175         list managers {
176             description "";
177             key "target";
178             leaf target {
179                 description "Uri indicating connection method to the Manager";
180                 type inet:uri;
181             }
182             leaf manager-uuid {
183                 description "The unique identifier of the manager";
184                 type yang:uuid;
185             }
186             leaf is-connected {
187                 type boolean;
188             }
189             list manager-other-configs {
190                 description "Key-value pairs for configuring rarely used features.
191                     other_config : dscp : optional string
192                     contains an integer, in the range 0 - 63. DSCP value to be used when establishing a connection to the switch. Default value of 48 if none specified.";
193                 key "other-config-key";
194                 leaf other-config-key {
195                     description "other-config name/key";
196                     type string;
197                 }
198                 leaf other-config-value {
199                     description "other-config value";
200                     type string;
201                 }
202             }
203         }
204         list switches {
205             description "List of physical switches managed by this node";
206             key "switch-ref";
207             leaf switch-ref {
208                 type hwvtep-physical-switch-ref;
209             }
210         }
211         list logical-switches {
212             key "hwvtep-node-name";
213             uses hwvtep-logical-switch-attributes;
214         }
215     }
216
217     identity encapsulation-type-base {
218         description "Base Encapsulation type";
219     }
220
221     identity encapsulation-type-vxlan-over-ipv4 {
222         base encapsulation-type-base;
223         description "Encapsulation type vxlan-over-ipv4";
224     }
225
226     typedef encapsulation-type {
227         type identityref {
228             base encapsulation-type-base;
229         }
230         description "This type is used to refer to an Encapsulation Type.";
231     }
232
233     grouping hwvtep-physical-locator-attributes {
234         leaf encapsulation-type {
235             type encapsulation-type;
236             description "Encapsulation type used by this locator";
237         }
238         leaf dst-ip {
239             type inet:ip-address;
240             description "IP address of the locator";
241         }
242     }
243
244     grouping hwvtep-physical-locator-set-attributes {
245         list locator-set {
246             leaf locator-ref {
247                 type hwvtep-physical-locator-ref;
248             }
249         }
250     }
251
252     grouping hwvtep-logical-switch-attributes {
253         uses hwvtep-node-identification;
254         leaf hwvtep-logical-switch-external-id {
255             description "A unique identifier of the logical switch";
256             type yang:uuid;
257         }
258         leaf tunnel-key {
259             description "Per Logical Switch tunnel key";
260             type string;
261         }
262         uses hwvtep-physical-locator-set-attributes;
263     }
264
265     grouping hwvtep-physical-port-attributes {
266         uses hwvtep-node-identification;
267         list vlan-bindings {
268             description "A map of vlan ID to logical switch pairs";
269             key "vlan-id-key";
270             leaf vlan-id-key {
271                 description "vlan ids in the range 0 - 4095";
272                 type ethertype:vlan-id;
273             }
274             leaf logical-switch-ref {
275                 description "Reference to logical switch for the vlan";
276                 type hwvtep-logical-switch-ref;
277             }
278         }
279     }
280
281     augment "/topo:network-topology/topo:topology/topo:node" {
282         description "Augmentation for physical switch nodes managed by hwvtep";
283         ext:augment-identifier "physical-switch-augmentation";
284         uses hwvtep-physical-switch-attributes;
285     }
286
287     augment "/topo:network-topology/topo:topology/topo:node" {
288         description "Augment topology node for a hwvtep node";
289         ext:augment-identifier "hwvtep-global-augmentation";
290         uses hwvtep-global-attributes;
291     }
292
293     augment "/topo:network-topology/topo:topology/topo:node/topo:termination-point" {
294         description "Augment topology node termination-point for a hwvtep physical-locator";
295         ext:augment-identifier "hwvtep-physical-locator-augmentation";
296         uses hwvtep-physical-locator-attributes;
297     }
298
299     augment "/topo:network-topology/topo:topology/topo:node/topo:termination-point" {
300         description "Augment topology node termination-point for a hwvtep physical-port";
301         ext:augment-identifier "hwvtep-physical-port-augmentation";
302         uses hwvtep-physical-port-attributes;
303     }
304 }