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