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