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     container ethernet {
89       when "../if:type = 'ianaift:ethernetCsmacd'";
90       leaf mtu {
91         type uint16 {
92           range "64..9216";
93         }
94         units "octets";
95         default 9216;
96         description
97         "The size, in octets, of the largest packet that the
98          hardware interface will send and receive.";
99       }
100     }
101     container routing {
102       leaf vrf-id {
103         type uint32;
104         default 0;
105       }
106     }
107     container vxlan {
108       // FIXME: this should be in an vxlan-specific extension
109       when "../if:type = 'v3po:vxlan-tunnel'";
110
111       leaf src {
112         /* mandatory true; */
113         type inet:ipv4-address;
114       }
115       leaf dst {
116         /* mandatory true; */
117         type inet:ipv4-address;
118       }
119       leaf vni {
120         /* mandatory true; */
121         type vxlan-vni;
122       }
123       leaf encap-vrf-id {
124         type uint32;
125       }
126     }
127     container l2 {
128       description
129       "Parameters for configuring Layer2 features on interfaces.";
130       must "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " +
131       "not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))";
132
133       choice interconnection {
134         case xconnect-based {
135           leaf xconnect-outgoing-interface {
136             /* Don't allow selection of this interface */
137             must "../../if:name != current()";
138             type if:interface-ref;
139             description
140               "L2 xconnect mode";
141           }
142         }
143         case bridge-based {
144           leaf bridge-domain {
145             type bridge-domain-ref;
146             description
147               "Interfaces in a bridge-domain forward packets to other
148                interfaces in the same bridge-domain based on
149                destination mac address.";
150           }
151           leaf split-horizon-group {
152             when "../bridge-domain";
153             type uint8 {
154               range "0..255";
155             }
156             default 0;
157             description
158               "Interface's split-horizon group. Interfaces in the same
159                bridge-domain and split-horizon group can not forward
160                packets between each other. ";
161           }
162           leaf bridged-virtual-interface {
163             when "../bridge-domain";
164             type boolean;
165             default false;
166             description
167               "Interface forward packets in the bridge-domain
168                associated with the BVI.";
169           }
170         }
171       }
172     }
173   }
174
175   container vpp {
176     description
177     "VPP config data";
178
179     container bridge-domains {
180       list bridge-domain {
181         key "name";
182         // TODO: where does this come from?
183         max-elements 1024;
184
185         leaf name {
186           type string;
187         }
188
189         uses bridge-domain-attributes;
190
191         list l2-fib {
192           key "phys-address";
193
194           leaf phys-address {
195             type yang:phys-address;
196           }
197           leaf action {
198             type enumeration {
199               enum "forward";
200               enum "filter";
201             }
202             mandatory true;
203           }
204           leaf outgoing-interface {
205             type if:interface-ref;
206           }
207         }
208       }
209     }
210   }
211
212   augment /if:interfaces-state/if:interface {
213     ext:augment-identifier "vpp-interface-state-augmentation";
214
215     leaf description {
216       type string;
217     }
218     container ethernet {
219       when "../if:type = 'ianaift:ethernetCsmacd'";
220       leaf mtu {
221         type uint16;
222       }
223       leaf manufacturer-description {
224         type string;
225       }
226       leaf duplex {
227         type enumeration {
228           enum "half";
229           enum "full";
230         }
231       }
232     }
233     container vxlan {
234       when "../if:type = 'v3po:vxlan-tunnel'";
235
236       leaf src {
237         type inet:ipv4-address;
238       }
239       leaf dst {
240         type inet:ipv4-address;
241       }
242       leaf vni {
243         type uint32;
244       }
245       leaf encap-vrf-id {
246         type uint32;
247       }
248     }
249     container l2 {
250       choice interconnection {
251         case xconnect-based {
252           leaf xconnect-outgoing-interface {
253             type if:interface-ref;
254           }
255         }
256         case bridge-based {
257           leaf bridge-domain {
258             type bridge-domain-ref;
259           }
260           leaf split-horizon-group {
261             type uint8;
262           }
263           leaf bridged-virtual-interface {
264             type boolean;
265           }
266         }
267       }
268     }
269   }
270
271   augment /if:interfaces-state/if:interface/if:statistics {
272     ext:augment-identifier "vpp-interface-statistics-augmentation";
273     leaf in-errors-no-buf {
274       type yang:counter64;
275     }
276     leaf in-errors-miss {
277       type yang:counter64;
278     }
279     leaf out-discards-fifo-full {
280       type yang:counter64;
281     }
282   }
283
284   container vpp-state {
285     config false;
286
287     description
288       "VPP operational data";
289
290     container bridge-domains {
291       // FIXME: Should this live in bridge-domain.yang in a modular fashion ?
292       list bridge-domain {
293
294         key "name";
295         leaf name {
296           type string;
297         }
298
299         uses bridge-domain-attributes;
300
301         list interface {
302           key "name";
303
304           leaf name {
305             type if:interface-state-ref;
306           }
307
308           leaf split-horizon-group {
309             type uint8;
310           }
311
312           leaf bridged-virtual-interface {
313             type boolean;
314           }
315         }
316
317         list l2-fib {
318           key "phys-address";
319
320           leaf phys-address {
321             type yang:phys-address;
322           }
323           leaf static-config {
324             type boolean;
325           }
326           leaf outgoing-interface {
327             when "../v3po:action = 'forward'";
328             type if:interface-state-ref;
329           }
330           leaf action {
331             type enumeration {
332               enum "forward";
333               enum "filter";
334             }
335             mandatory true;
336           }
337           leaf bridged-virtual-interface {
338             when "../v3po:action = 'forward'";
339             type boolean;
340           }
341         }
342         description
343           "bridge-domain operational data";
344       }
345     }
346
347     container version {
348       leaf name {
349         type string;
350       }
351       leaf build-directory {
352         type string;
353       }
354       leaf build-date {
355         type string;
356       }
357       leaf branch {
358         type string;
359       }
360       description
361       "vlib version info";
362     }
363   }
364
365   rpc vpp-poll-oper-data {
366     output {
367       leaf status {
368         type uint32;
369       }
370     }
371   }
372 }