Update Robert's coordinates
[honeycomb.git] / v3po / api / src / main / yang / v3po.yang
1 module v3po {
2   yang-version 1;
3   namespace "urn:opendaylight:params:xml:ns:yang:v3po";
4   prefix "v3po";
5
6   revision "2015-01-05" {
7     description "Initial revision of v3po model";
8   }
9
10   import iana-if-type {
11     prefix "ianaift";
12   }
13   import ietf-interfaces {
14     prefix "if";
15   }
16   import ietf-yang-types {
17     prefix "yang";
18   }
19   import ietf-inet-types {
20     prefix "inet";
21   }
22   import ietf-ip {
23     prefix "ip";
24   }
25   import yang-ext {
26     prefix "ext";
27   }
28
29   typedef bridge-domain-ref {
30     type leafref {
31       path "/vpp/bridge-domains/bridge-domain/name";
32     }
33     description
34       "This type is used by to reference a bridge domain table";
35   }
36
37   typedef bridged-virtual-interface-ref {
38     type leafref {
39       path "/if:interfaces/if:interface/l2/bridged-virtual-interface";
40     }
41     description
42       "This type is used by to reference a bridged virtual interface";
43   }
44
45   identity vxlan-tunnel {
46     base if:interface-type;
47   }
48
49   typedef vxlan-vni {
50     // FIXME: should be in a vxlan-specific model
51     description "VNI used in a VXLAN tunnel";
52     type uint32 {
53       range "0..16777215";
54     }
55   }
56
57   grouping bridge-domain-attributes {
58     leaf flood {
59       type boolean;
60       default true;
61       description
62       "Enable/disable L2 flooding.";
63     }
64     leaf forward {
65       type boolean;
66       default true;
67       description
68       "Enable/disable L2 forwarding.";
69     }
70     leaf learn {
71       type boolean;
72       default true;
73       description
74       "Enable/disable L2 learning.";
75     }
76     leaf unknown-unicast-flood {
77       type boolean;
78       default true;
79     }
80     leaf arp-termination {
81       type boolean;
82       default false;
83     }
84   }
85
86   augment /if:interfaces/if:interface {
87     ext:augment-identifier "vpp-interface-augmentation";
88
89     // FIXME using ietf-interfaces model for vpp interfaces makes it hard to implement because:
90     // 1. The link between interface type and this augmentation is unclear
91     // 2. Only this augmentation with combination of ifc type is trigger to do something for vpp, what if user only configures base interface stuff ? + We need to get leaves defined by ietf-interfaces when we are processing this augment
92
93     container ethernet {
94       when "../if:type = 'ianaift:ethernetCsmacd'";
95       leaf mtu {
96         type uint16 {
97           range "64..9216";
98         }
99         units "octets";
100         default 9216;
101         description
102         "The size, in octets, of the largest packet that the
103          hardware interface will send and receive.";
104       }
105     }
106     container routing {
107       leaf vrf-id {
108         type uint32;
109         default 0;
110       }
111     }
112     container vxlan {
113       // FIXME: this should be in an vxlan-specific extension
114       when "../if:type = 'v3po:vxlan-tunnel'";
115
116       leaf src {
117         /* mandatory true; */
118         type inet:ipv4-address;
119       }
120       leaf dst {
121         /* mandatory true; */
122         type inet:ipv4-address;
123       }
124       leaf vni {
125         /* mandatory true; */
126         type vxlan-vni;
127       }
128       leaf encap-vrf-id {
129         type uint32;
130       }
131     }
132     container l2 {
133       description
134       "Parameters for configuring Layer2 features on interfaces.";
135       must "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " +
136       "not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))";
137
138       choice interconnection {
139         case xconnect-based {
140           leaf xconnect-outgoing-interface {
141             /* Don't allow selection of this interface */
142             must "../../if:name != current()";
143             type if:interface-ref;
144             description
145               "L2 xconnect mode";
146           }
147         }
148         case bridge-based {
149           leaf bridge-domain {
150             type bridge-domain-ref;
151             description
152               "Interfaces in a bridge-domain forward packets to other
153                interfaces in the same bridge-domain based on
154                destination mac address.";
155           }
156           leaf split-horizon-group {
157             when "../bridge-domain";
158             type uint8 {
159               range "0..255";
160             }
161             default 0;
162             description
163               "Interface's split-horizon group. Interfaces in the same
164                bridge-domain and split-horizon group can not forward
165                packets between each other. ";
166           }
167           leaf bridged-virtual-interface {
168             when "../bridge-domain";
169             type boolean;
170             default false;
171             description
172               "Interface forward packets in the bridge-domain
173                associated with the BVI.";
174           }
175         }
176       }
177     }
178   }
179
180   container vpp {
181     description
182     "VPP config data";
183
184     container bridge-domains {
185       list bridge-domain {
186         key "name";
187         // TODO: where does this come from?
188         max-elements 1024;
189
190         leaf name {
191           type string;
192         }
193
194         uses bridge-domain-attributes;
195
196         list l2-fib {
197           key "phys-address";
198
199           leaf phys-address {
200             type yang:phys-address;
201           }
202           leaf action {
203             type enumeration {
204               enum "forward";
205               enum "filter";
206             }
207             mandatory true;
208           }
209           leaf outgoing-interface {
210             type if:interface-ref;
211           }
212         }
213       }
214     }
215   }
216
217   augment /if:interfaces-state/if:interface {
218     ext:augment-identifier "vpp-interface-state-augmentation";
219
220     leaf description {
221       type string;
222     }
223     container ethernet {
224       when "../if:type = 'ianaift:ethernetCsmacd'";
225       leaf mtu {
226         type uint16;
227       }
228       leaf manufacturer-description {
229         type string;
230       }
231       leaf duplex {
232         type enumeration {
233           enum "half";
234           enum "full";
235         }
236       }
237     }
238     container vxlan {
239       when "../if:type = 'v3po:vxlan-tunnel'";
240
241       leaf src {
242         type inet:ipv4-address;
243       }
244       leaf dst {
245         type inet:ipv4-address;
246       }
247       leaf vni {
248         type uint32;
249       }
250       leaf encap-vrf-id {
251         type uint32;
252       }
253     }
254     container l2 {
255       choice interconnection {
256         case xconnect-based {
257           leaf xconnect-outgoing-interface {
258             type if:interface-ref;
259           }
260         }
261         case bridge-based {
262           leaf bridge-domain {
263             type bridge-domain-ref;
264           }
265           leaf split-horizon-group {
266             type uint8;
267           }
268           leaf bridged-virtual-interface {
269             type boolean;
270           }
271         }
272       }
273     }
274   }
275
276   augment /if:interfaces-state/if:interface/if:statistics {
277     ext:augment-identifier "vpp-interface-statistics-augmentation";
278     leaf in-errors-no-buf {
279       type yang:counter64;
280     }
281     leaf in-errors-miss {
282       type yang:counter64;
283     }
284     leaf out-discards-fifo-full {
285       type yang:counter64;
286     }
287   }
288
289   container vpp-state {
290     config false;
291
292     description
293       "VPP operational data";
294
295     container bridge-domains {
296       // FIXME: Should this live in bridge-domain.yang in a modular fashion ?
297       list bridge-domain {
298
299         key "name";
300         leaf name {
301           type string;
302         }
303
304         uses bridge-domain-attributes;
305
306         list interface {
307           key "name";
308
309           leaf name {
310             type if:interface-state-ref;
311           }
312
313           leaf split-horizon-group {
314             type uint8;
315           }
316
317           leaf bridged-virtual-interface {
318             type boolean;
319           }
320         }
321
322         list l2-fib {
323           key "phys-address";
324
325           leaf phys-address {
326             type yang:phys-address;
327           }
328           leaf static-config {
329             type boolean;
330           }
331           leaf outgoing-interface {
332             when "../v3po:action = 'forward'";
333             type if:interface-state-ref;
334           }
335           leaf action {
336             type enumeration {
337               enum "forward";
338               enum "filter";
339             }
340             mandatory true;
341           }
342           leaf bridged-virtual-interface {
343             when "../v3po:action = 'forward'";
344             type boolean;
345           }
346         }
347         description
348           "bridge-domain operational data";
349       }
350     }
351
352     container version {
353       leaf name {
354         type string;
355       }
356       leaf build-directory {
357         type string;
358       }
359       leaf build-date {
360         type string;
361       }
362       leaf branch {
363         type string;
364       }
365       description
366       "vlib version info";
367     }
368   }
369 }