d7aad651c495ff0bff61d1f6b4112c38721d6836
[honeycomb.git] / lisp / api / src / main / yang / lisp.yang
1 //TODO mandatory statements
2 module lisp {
3   yang-version 1;
4   namespace "urn:opendaylight:params:xml:ns:yang:lisp";
5   prefix "lisp";
6   import ietf-interfaces {
7     prefix "if";
8   }
9   import ietf-inet-types {
10     prefix "inet";
11   }
12   import ietf-lisp-address-types {
13     prefix "lisp-types";
14   }
15   organization
16     "FD.io Overlay Forwarding Engine (ONE) project";
17   contact
18     "Florin Coras <fcoras@cisco.com>
19      Vina Ermagan <vermagan@cisco.com>
20      ONE list <one@lists.fd.io>";
21
22   description
23     "This YANG module defines the generic configuration and
24     operational data for LISP in VPP";
25   revision "2016-05-20" {
26     description
27       "Initial revision of LISP model";
28     reference
29       "https://tools.ietf.org/html/rfc6830";
30   }
31
32   typedef locator-set-ref {
33     type leafref {
34       path "/lisp/lisp-feature-data/locator-sets/locator-set/name";
35     }
36     description "Locator-set reference";
37   }
38
39   typedef mapping-id {
40     type string;
41     description "Mapping ID";
42   }
43
44   typedef map-reply-action {
45     type enumeration {
46       enum no-action {
47         value 0;
48         description
49           "Mapping is kept alive and no encapsulation occurs.";
50       }
51       enum natively-forward {
52         value 1;
53         description
54           "Matching packets are not encapsulated or dropped but
55            natively forwarded.";
56       }
57       enum send-map-request {
58         value 2;
59         description
60           "Matching packets invoke Map-Requests.";
61       }
62       enum drop {
63         value 3;
64         description
65           "Matching packets are dropped.";
66       }
67     }
68     description
69       "Defines the lisp map-cache ACT type";
70     reference
71       "https://tools.ietf.org/html/rfc6830#section-6.1.4";
72   }
73   grouping locator-properties-grouping {
74     description
75       "Properties of a RLOC";
76     leaf priority {
77       type uint8;
78       description
79         "Locator priority.";
80     }
81     leaf weight {
82       type uint8;
83       description
84         "Locator weight.";
85     }
86   }
87
88   grouping locator-sets-grouping {
89     // NOTE: to be used only for local locators
90     // lisp_add_del_locator_set locator-set <ls_name> [del]
91     // lisp_add_del_locator locator-set <ls_name> iface <iface_name>
92     //                                  p <val> w <val> [del]
93     container locator-sets {
94       list locator-set {
95         key "name";
96         leaf name {
97           type string;
98           description "Locator-set name";
99         }
100         list interface {
101           key "interface-ref";
102           leaf interface-ref {
103             type if:interface-ref;
104             description "Interface reference";
105           }
106           uses locator-properties-grouping;
107           description "List of interfaces part of the locator-set";
108         }
109         description "Locator-set";
110       }
111       description "Locator-sets";
112     }
113     description "Grouping for locator-sets";
114   }
115
116   grouping adjacencies-grouping {
117     container adjacencies {
118       list adjacency {
119         key "id";
120         leaf id {
121           type string;
122           description "Adjacency id";
123         }
124         container local-eid {
125           uses lisp-types:lisp-address;
126           description "Local EID that must have a local mapping";
127         }
128         container remote-eid {
129           uses lisp-types:lisp-address;
130           description "Remote EID that must have a remote mapping";
131         }
132         description "List of adjacencies";
133       }
134       description "Adjacencies programmed into the data plane";
135     }
136     description "Adjacencies grouping";
137   }
138
139   grouping dp-subtable-grouping {
140     // Once both vni and table-id are set:
141     // lisp_eid_table_add_del_map <vni> <dp_table>
142     container local-mappings {
143       list local-mapping {
144         key "id";
145         leaf id {
146           type mapping-id;
147           description "Id that uniquely identifies a mapping";
148         }
149         container eid {
150           uses lisp-types:lisp-address;
151           description "EID address";
152         }
153         leaf locator-set {
154           type locator-set-ref;
155           description "Locator-set";
156         }
157         description "Local mapping";
158       }
159       description "Local EID to locator-set mappings";
160     }
161     // lisp_add_del_local_eid eid <ip-address/mask> locator-set
162     //                            <ls-name> [del]
163     // lisp_add_del_remote_mapping vni <vni> eid <eid> seid
164     //                             <seid> [action <action>] rloc
165     //                             <ip-addr> [rloc <ip-addr> ..]
166     // NOTE: 1.lisp_add_del_remote_mapping seid is used to build
167     //         src/dst mappings. Rlocs have p/w in them
168     container remote-mappings {
169       list remote-mapping {
170         key "id";
171         leaf id {
172           type mapping-id;
173           description "Id that uniquely identifies a mapping";
174         }
175         container eid {
176             description "Remote EID address";
177             uses lisp-types:lisp-address;
178         }
179         leaf ttl {
180           type uint32;
181           description "Mapping validity period.";
182         }
183         leaf authoritative {
184           type bits {
185             bit A {
186               description "Authoritative bit.";
187             }
188           }
189           description
190             "Bit that indicates if mapping comes from an
191              authoritative source.";
192         }
193         choice locator-list {
194           description
195             "list of locators are either negative, or positive.";
196           case negative-mapping {
197             //NOTE - Wrapped in container to prevent leaf map-reply-action enforcing impresence of rlocs
198             container map-reply{
199                 leaf map-reply-action {
200                   type map-reply-action;
201                   description
202                     "Forwarding action for a negative mapping.";
203                 }
204             }
205           }
206           case positive-mapping {
207             // NOTE if container is not needed to encapsulate
208             // locator list, remove it
209             container rlocs {
210               list locator {
211                  key "address";
212                  leaf address {
213                    type inet:ip-address;
214                    description "Locator address";
215                  }
216                  uses locator-properties-grouping;
217                  description "Remote locator";
218               }
219               description
220                 "List of locators for a positive mapping.";
221             }
222           }
223         }
224         uses adjacencies-grouping;
225         description "List of remote mappings";
226       }
227       description "Map-cache/remote mappings cache";
228     }
229     description "Data path subtable (VRF/bridge domain) grouping";
230   }
231
232   grouping eid-table-grouping {
233     container eid-table {
234       list vni-table {
235         key "virtual-network-identifier";
236         leaf virtual-network-identifier {
237             type uint32;
238             description "vni";
239         }
240         container vrf-subtable {
241           leaf table-id {
242              type uint32;
243              description "table-id";
244           }
245
246           uses dp-subtable-grouping;
247           description "VRF subtable";
248         }
249         container bridge-domain-subtable {
250           leaf bridge-domain-ref {
251             type string;
252             description "Name reference to existing bridge domain";
253           }
254
255           uses dp-subtable-grouping;
256           description "Bridge domain subtable";
257         }
258         description "VNI tables";
259       }
260       description "EID table";
261     }
262     description "EID table grouping";
263   }
264   grouping map-resolvers-grouping {
265     container map-resolvers {
266       // lisp_add_del_map_resolver <ip>
267       list map-resolver {
268         key ip-address;
269         leaf ip-address {
270           type inet:ip-address;
271           description "Map-resolver IP address";
272         }
273         description "List of map-resolvers";
274       }
275       description "Map-resolvers configured";
276     }
277     description "Map-Resolver grouping";
278   }
279   grouping pitr-cfg-grouping {
280     // lisp_pitr_set_locator_set <ip>
281     container pitr-cfg {
282       leaf locator-set {
283         type locator-set-ref;
284         description "Locator-set reference";
285       }
286       description "Proxy-ITR configuration";
287     }
288     description "PITR configuration grouping";
289   }
290
291   grouping itr-remote-locator-sets-grouping{
292     container itr-remote-locator-set{
293     // lisp_add_del_map_request_itr_rlocs add/del <ls_name>
294     // lisp_get_map_request_itr_rlocs
295         leaf remote-locator-set-name{
296             type locator-set-ref;
297             description "Locators to be used in map-requests";
298         }
299     }
300   }
301
302   grouping lisp-feature-data-grouping{
303     //aggregation of all lisp data, restricted by Lisp beeing enabled
304
305     container lisp-feature-data{
306         when "../lisp:enable = 'true'";
307
308         uses locator-sets-grouping;
309         uses eid-table-grouping;
310         uses map-resolvers-grouping;
311         uses pitr-cfg-grouping;
312         uses itr-remote-locator-sets-grouping;
313     }
314   }
315
316   // ref https://wiki.fd.io/view/ONE/Command-line_Interface_CLI_Guide
317   container lisp {
318
319     // lisp_enable_disable / lisp_enable_disable_status_dump
320     leaf enable {
321       type boolean;
322       description "Enable/disable LISP feature";
323     }
324     uses lisp-feature-data-grouping;
325     description "LISP configuration";
326   }
327
328   container lisp-state {
329
330     // lisp_enable_disable / lisp_enable_disable_status_dump
331     leaf enable {
332       type boolean;
333       description "Enable/disable LISP feature";
334     }
335     uses lisp-feature-data-grouping;
336     description "LISP state";
337   }
338 }