Make part of the Subscribers object modeled
[lispflowmapping.git] / mappingservice / lisp-proto / src / main / yang / odl-lisp-proto.yang
1 module odl-lisp-proto {
2
3     yang-version 1;
4     namespace "urn:opendaylight:lfm:lisp-proto";
5     prefix "lisp-proto";
6
7     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
8     import odl-inet-binary-types { prefix inet-bin; revision-date 2016-03-03; }
9     import odl-lisp-address-types { prefix odl-lisp-address; revision-date 2016-05-04; }
10
11     organization "LISP Flow Mapping";
12
13     contact
14         "David Goldberg <david.goldberg@contextream.com>
15         Vina Ermagan <vermagan@cisco.com>";
16
17     description
18         "YANG representation of LISP (RFC6830) protocol.";
19
20     revision "2015-11-05" {
21         description "Renamed the module to lisp-proto.";
22         reference "https://tools.ietf.org/html/rfc6830";
23     }
24
25     typedef xtr-id {
26         type binary {
27             length "16";
28         }
29         description
30             "128 bit xTR identifier.";
31     }
32
33     typedef site-id {
34         type binary {
35             length "8";
36         }
37         description
38             "64 bit site identifier.";
39     }
40
41     grouping transport-address {
42         container transport-address {
43             leaf ipAddress {
44                 type inet-bin:ip-address-binary;
45                 reference "http://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
46             }
47             leaf port {
48                 type inet:port-number;
49             }
50         }
51     }
52
53     grouping mapping-authkey-container {
54         container mapping-authkey {
55             leaf key-string {
56                 type string;
57             }
58             leaf key-type {
59                 type uint16;
60             }
61         }
62     }
63
64     grouping eid-container {
65         container eid {
66             uses odl-lisp-address:augmented-lisp-address;
67         }
68     }
69
70     grouping rloc-container {
71         container rloc {
72             uses odl-lisp-address:augmented-lisp-address;
73         }
74     }
75
76     grouping eid-list {
77         list eid-item {
78             key "eid-item-id";
79             leaf eid-item-id {
80                 type string;
81             }
82             uses eid-container;
83         }
84     }
85
86     grouping LocatorRecords {
87         list LocatorRecord {
88             key "locator-id";
89             leaf locator-id {
90                 type string;
91             }
92             leaf priority {
93                 type uint8;
94             }
95             leaf weight {
96                 type uint8;
97             }
98             leaf multicastPriority {
99                 type uint8;
100             }
101             leaf multicastWeight {
102                 type uint8;
103             }
104             leaf localLocator {
105                 type boolean;
106             }
107             leaf rlocProbed {
108                 type boolean;
109             }
110             leaf routed {
111                 type boolean;
112             }
113
114             //locator address
115             uses rloc-container;
116         }
117     }
118
119     grouping map-request-metadata {
120         leaf source-rloc {
121             type inet-bin:ip-address-binary;
122             description
123                 "The Source IP address used for sending the enclosing control
124                 packet in RLOC space.";
125         }
126         description
127             "This is a collection of fields which are not present in the actual
128             mapping record defined in RFC 6830, but are used internally in
129             OpenDaylight";
130     }
131
132     grouping mapping-record-metadata {
133         leaf xtr-id {
134             type xtr-id;
135             description
136                 "128 bit xTR identifier.";
137         }
138         leaf site-id {
139             type site-id;
140             description
141                 "64 bit site identifier.";
142         }
143         leaf source-rloc {
144             type inet-bin:ip-address-binary;
145             description
146                 "The Source IP address used for sending the enclosing control
147                  packet in RLOC space.";
148         }
149         leaf timestamp {
150             type int64;
151             description
152                 "Milliseconds since January 1, 1970, 00:00:00 GMT";
153         }
154         description
155             "This is a collection of fields which are not present in the actual
156             mapping record defined in RFC 6830, but are used internally in
157             OpenDaylight";
158     }
159
160     grouping mapping-record-container {
161         container mapping-record {
162             leaf recordTtl {
163                 type int32;
164                 description
165                     "A mapping record's time to live in Minute(s)";
166             }
167             leaf mapVersion {
168                 type int16;
169             }
170             leaf action {
171                 type enumeration {
172                     enum NoAction;
173                     enum NativelyForward;
174                     enum SendMapRequest;
175                     enum Drop;
176                 }
177             }
178             leaf authoritative {
179                 type boolean;
180             }
181             // EID prefix
182             uses eid-container;
183
184             // locator record list
185             uses LocatorRecords;
186
187             // metadata
188             uses mapping-record-metadata;
189         }
190     }
191
192     grouping mapping-record-list {
193         list mapping-record-item {
194             key "mapping-record-item-id";
195             leaf mapping-record-item-id {
196                 type string;
197             }
198             uses mapping-record-container;
199         }
200     }
201
202     grouping xtrSiteId {
203         leaf xtrId {
204             type xtr-id;
205         }
206         leaf siteId {
207             type site-id;
208         }
209     }
210
211     grouping MapRegister {
212         reference "http://tools.ietf.org/html/rfc6830#section-6.1.6 , http://tools.ietf.org/html/draft-ermagan-lisp-nat-traversal-05#section-4.3";
213         leaf proxyMapReply {
214             type boolean;
215         }
216         leaf xtrSiteIdPresent {
217             type boolean;
218         }
219         leaf wantMapNotify {
220             type boolean;
221         }
222         leaf nonce {
223             type int64;
224         }
225         leaf keyId {
226             type int16;
227         }
228         leaf authenticationData {
229             type binary;
230         }
231         leaf mergeEnabled {
232             type boolean;
233         }
234         uses mapping-record-list;
235         uses xtrSiteId;
236     }
237
238     grouping MapNotify {
239         reference "http://tools.ietf.org/html/rfc6830#section-6.1.7 , http://tools.ietf.org/html/draft-ermagan-lisp-nat-traversal-05#section-4.3";
240         leaf xtrSiteIdPresent {
241             type boolean;
242         }
243         leaf nonce {
244             type int64;
245         }
246         leaf keyId {
247             type int16;
248         }
249         leaf authenticationData {
250             type binary;
251         }
252         leaf mergeEnabled {
253             type boolean;
254         }
255         uses mapping-record-list;
256         uses xtrSiteId;
257     }
258
259     grouping MapRequest {
260         reference "http://tools.ietf.org/html/rfc6830#section-6.1.2";
261         leaf authoritative {
262             type boolean;
263         }
264         leaf mapDataPresent {
265             type boolean;
266         }
267         leaf probe {
268             type boolean;
269         }
270         leaf smr {
271             type boolean;
272         }
273         leaf pitr {
274             type boolean;
275         }
276         leaf smrInvoked {
277             type boolean;
278         }
279         leaf nonce {
280             type int64;
281         }
282         container SourceEid {
283             uses eid-container;
284         }
285         list itrRloc {
286             key "itr-rloc-id";
287             leaf itr-rloc-id {
288                 type string;
289             }
290             uses rloc-container;
291         }
292         uses eid-list;
293         container MapReply {
294             uses mapping-record-container;
295         }
296         uses map-request-metadata;
297     }
298
299     grouping MapReply {
300         reference "http://tools.ietf.org/html/rfc6830#section-6.1.4";
301         leaf probe {
302             type boolean;
303         }
304         leaf nonce {
305             type int64;
306         }
307         leaf echoNonceEnabled {
308             type boolean;
309         }
310         leaf securityEnabled {
311             type boolean;
312         }
313         uses mapping-record-list;
314     }
315
316     grouping map-register-cache-key-container {
317         container map-register-cache-key {
318             leaf eid-prefix {
319                 type binary;
320                 description
321                     "The EID prefix stored as binary data";
322             }
323             leaf xtr-id {
324                 type binary;
325                 description
326                     "128 bit xTR identifier.";
327             }
328             leaf site-id {
329                 type binary;
330                 description
331                     "64 bit site identifier.";
332             }
333             description
334                 "The lookup key in the Map-Register fast path.";
335         }
336     }
337
338     grouping map-register-cache-metadata-container {
339         container map-register-cache-metadata {
340             list eid-lisp-address {
341                 key "eid-lisp-address-id";
342                 leaf eid-lisp-address-id {
343                     type string;
344                 }
345                 uses eid-container;
346                 description "List of EID-Prefixes from Map-Register message.";
347             }
348             leaf xtr-id {
349                 type xtr-id;
350                 description
351                     "128 bit xTR identifier.";
352             }
353             leaf site-id {
354                 type site-id;
355                 description
356                     "64 bit site identifier.";
357             }
358             leaf timestamp {
359                 type int64;
360                 description
361                     "Milliseconds since January 1, 1970, 00:00:00 GMT";
362             }
363             leaf want-map-notify {
364                 type boolean;
365                 description
366                     "xTR askes for Map-Register acknowledgement in form of
367                     a Map-Notify control message.";
368             }
369             leaf merge-enabled {
370                 type boolean;
371                 description "Value of 22th bit in map register message.";
372             }
373             description
374                 "The Map-Register cache metadata is information for a mapping
375                 database about mapping update event, without the full Map-Register
376                 packet data. The metadata and the packet data together will form
377                 the Map-Register cache value.";
378         }
379     }
380
381     grouping map-register-cache-value-grouping {
382         container map-register-cache-value {
383             uses map-register-cache-metadata-container;
384             uses mapping-authkey-container;
385             leaf packet-data {
386                 type binary;
387                 description
388                     "Map-Register packet contents";
389             }
390         }
391     }
392
393     grouping subscriber-address-grouping {
394         container subscriber-address {
395             description
396                 "A network element which subscribed to notifications about mapping changes.";
397             uses rloc-container;
398             uses eid-container;
399         }
400     }
401
402     typedef message-type {
403         type enumeration {
404             enum reserved {
405                 value 0;
406                 description
407                     "Reserved";
408             }
409             enum map-request {
410                 value 1;
411                 description
412                     "Map-Request control packet";
413             }
414             enum map-reply {
415                 value 2;
416                 description
417                     "Map-Reply control packet";
418             }
419             enum map-register {
420                 value 3;
421                 description
422                     "Map-Register control packet";
423             }
424             enum map-notify {
425                 value 4;
426                 description
427                     "Map-Notify control packet";
428             }
429             enum map-referral {
430                 value 6;
431                 description
432                     "Map-Referral control packet";
433             }
434             enum info {
435                 value 7;
436                 description
437                     "Info control packet";
438             }
439             enum encapsulated-control-message {
440                 value 8;
441                 description
442                     "Encapsulated control packet";
443             }
444         }
445         description
446             "Defines the LISP control message types";
447         reference "https://tools.ietf.org/html/rfc6830#section-6.1.1";
448     }
449
450     grouping MapRegisterMessage {
451         container MapRegister {
452             uses MapRegister;
453         }
454         uses transport-address;
455     }
456
457     grouping MapRegisterNotification {
458         container MapRegister {
459             uses MapRegister;
460         }
461         uses transport-address;
462     }
463
464     grouping MapNotifyMessage {
465         container MapNotify {
466             uses MapNotify;
467         }
468         uses transport-address;
469     }
470
471     grouping MapNotifyNotification {
472         container MapNotify {
473             uses MapNotify;
474         }
475         uses transport-address;
476     }
477
478     grouping MapRequestMessage {
479         container MapRequest {
480             uses MapRequest;
481         }
482         uses transport-address;
483     }
484
485     grouping MapRequestNotification {
486         container MapRequest {
487             uses MapRequest;
488         }
489         uses transport-address;
490     }
491
492     grouping MapReplyMessage {
493         container MapReply {
494             uses MapReply;
495         }
496         uses transport-address;
497     }
498
499     grouping MapReplyNotification {
500         container MapReply {
501             uses MapReply;
502         }
503         uses transport-address;
504     }
505
506     notification addMapping {
507         uses MapRegisterNotification;
508     }
509
510     notification gotMapNotify {
511         uses MapNotifyNotification;
512     }
513
514     notification requestMapping {
515         uses MapRequestNotification;
516     }
517
518     notification gotMapReply {
519         uses MapReplyNotification;
520     }
521
522     notification xtrRequestMapping {
523         uses MapRequestNotification;
524     }
525
526     notification xtrReplyMapping {
527         uses MapReplyNotification;
528     }
529
530     notification mappingKeepAlive {
531         uses map-register-cache-metadata-container;
532     }
533 }