Prepare the YANG models for RESTCONF
[lispflowmapping.git] / mappingservice / yangmodel / src / main / yang / lfm-control-plane.yang
1 module lfm-control-plane {
2
3     yang-version 1;
4     namespace "urn:opendaylight:lfm-control-plane";
5     prefix "lfm-control-plane";
6
7     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
8     import ietf-yang-types { prefix yang; revision-date 2010-09-24; }
9     import yang-ext { prefix ext; revision-date "2013-07-09"; }
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 version of the mapping service.";
19
20     revision "2015-03-14" {
21         description "Updated for ODL Lithium";
22     }
23
24     typedef mapping-origin {
25         description "The originating entity of an EID-to-RLOC mapping";
26         type enumeration {
27             enum northbound;
28             enum southbound;
29         }
30     }
31
32     typedef iid-uri {
33         description "IID as a string lookup key in a URI";
34         type inet:uri;
35     }
36
37     typedef eid-uri {
38         description "EID as a string lookup key in a URI";
39         type inet:uri;
40     }
41
42     identity instance-id-context {
43         description "A classifier for instance-id elements which allows direct access to a particular element in the data tree.";
44     }
45
46     identity eid-context {
47         description "A classifier for endpoint-id elements which allows direct access to a particular element in the data tree.";
48     }
49
50     grouping TransportAddress {
51         container TransportAddress {
52             leaf ipAddress {
53                 type inet:ip-address;
54                 reference "http://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
55             }
56             leaf port {
57                 type inet:port-number;
58             }
59         }
60     }
61
62     grouping LispAFIAddress {
63         leaf afi {
64             type int16;
65             reference "http://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
66         }
67     }
68
69     grouping LispNoAddress {
70         uses LispAFIAddress {
71             refine afi {
72                 default 0;
73             }
74         }
75     }
76
77     grouping LispIpv4Address {
78         uses LispAFIAddress {
79             refine afi {
80                 default 1;
81             }
82         }
83         leaf Ipv4Address {
84             type inet:ipv4-address;
85             reference "https://tools.ietf.org/html/rfc3209#section-4.6.2.1";
86         }
87     }
88
89     grouping LispIpv6Address {
90         uses LispAFIAddress {
91             refine afi {
92                 default 2;
93             }
94         }
95         leaf Ipv6Address {
96             type inet:ipv6-address;
97         }
98     }
99
100     grouping LispMacAddress {
101         uses LispAFIAddress {
102             refine afi {
103                 default 16389;
104             }
105         }
106         leaf MacAddress {
107             type yang:mac-address;
108         }
109     }
110
111     grouping LispDistinguishedNameAddress {
112         uses LispAFIAddress {
113             refine afi {
114                 default 17;
115             }
116         }
117         leaf distinguishedName {
118             type string;
119         }
120     }
121
122     grouping LispASAddress {
123         uses LispAFIAddress {
124             refine afi {
125                 default 18;
126             }
127         }
128         leaf AS {
129             type int32;
130         }
131     }
132
133     grouping LispSimpleAddress {
134         choice primitiveAddress {
135             case No {
136                 container NoAddress {
137                     uses LispNoAddress;
138                 }
139             }
140             case Ipv4 {
141                 container Ipv4Address {
142                     uses LispIpv4Address;
143                 }
144             }
145             case Ipv6 {
146                 container Ipv6Address {
147                     uses LispIpv6Address;
148                 }
149             }
150             case Mac {
151                 container MacAddress {
152                     uses LispMacAddress;
153                 }
154             }
155             case DistinguishedName {
156                 container DistinguishedNameAddress {
157                     uses LispDistinguishedNameAddress;
158                 }
159             }
160             case AS {
161                 container ASAddress {
162                     uses LispASAddress;
163                 }
164             }
165         }
166     }
167
168     grouping ReencapHop {
169         container hop {
170             uses LispSimpleAddress;
171         }
172         leaf lookup {
173             type boolean;
174         }
175         leaf RLOCProbe {
176             type boolean;
177         }
178         leaf strict {
179             type boolean;
180         }
181     }
182
183     grouping LispLcafAddress {
184         uses LispAFIAddress {
185             refine afi {
186                     default 16387;
187             }
188         }
189         leaf lcafType {
190             type uint8;
191             reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03";
192         }
193     }
194
195     grouping LcafSegmentAddress {
196         reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.1";
197         uses LispLcafAddress {
198             refine lcafType {
199                 default 2;
200             }
201         }
202         leaf instanceId {
203             type uint32 {
204                 range "0 .. 16777215";
205             }
206         }
207         leaf iidMaskLength {
208             type uint8;
209         }
210         container Address {
211             uses LispSimpleAddress;
212         }
213     }
214
215     grouping LcafTrafficEngineeringAddress {
216         reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.1";
217         uses LispLcafAddress {
218             refine lcafType {
219                 default 10;
220             }
221         }
222         list Hops {
223             key "name";
224             leaf name {
225                 type string;
226             }
227             uses ReencapHop;
228         }
229     }
230
231     grouping LcafListAddress {
232         reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.1";
233         uses LispLcafAddress {
234             refine lcafType {
235                 default 1;
236             }
237         }
238         list Addresses {
239             key "name";
240             leaf name {
241                 type string;
242             }
243             uses LispSimpleAddress;
244         }
245     }
246
247     grouping LcafSourceDestAddress {
248         reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.11";
249         uses LispLcafAddress {
250             refine lcafType {
251                 default 12;
252             }
253         }
254         container srcAddress {
255             uses LispSimpleAddress;
256         }
257         container dstAddress {
258             uses LispSimpleAddress;
259         }
260         leaf srcMaskLength {
261             type uint8;
262         }
263         leaf dstMaskLength {
264             type uint8;
265         }
266     }
267
268     grouping LcafKeyValueAddress {
269         reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-04#section-4.14";
270         uses LispLcafAddress {
271             refine lcafType {
272                 default 15;
273             }
274         }
275         container key {
276             uses LispSimpleAddress;
277         }
278         container value {
279             uses LispSimpleAddress;
280         }
281     }
282
283     grouping LcafApplicationDataAddress {
284         reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.11";
285         uses LispLcafAddress {
286             refine lcafType {
287                 default 4;
288             }
289         }
290         container Address {
291             uses LispSimpleAddress;
292         }
293         leaf protocol {
294             type uint8;
295         }
296         leaf ipTos {
297             type int32;
298         }
299         leaf localPort {
300             type inet:port-number;
301         }
302         leaf remotePort {
303             type inet:port-number;
304         }
305     }
306
307
308     grouping LispAddress {
309         container LispAddressContainer {
310             choice Address {
311                 case No {
312                     container NoAddress {
313                         uses LispNoAddress;
314                     }
315                 }
316                 case Ipv4 {
317                     container Ipv4Address {
318                         uses LispIpv4Address;
319                     }
320                 }
321                 case Ipv6 {
322                     container Ipv6Address {
323                         uses LispIpv6Address;
324                     }
325                 }
326                 case Mac {
327                     container MacAddress {
328                         uses LispMacAddress;
329                     }
330                 }
331                 case DistinguishedName {
332                     container distinguishedName {
333                         uses LispDistinguishedNameAddress;
334                     }
335                 }
336                 case AS {
337                     container AS {
338                         uses LispASAddress;
339                     }
340                 }
341                 case LcafSegment {
342                     container LcafSegmentAddr {
343                         uses LcafSegmentAddress;
344                     }
345                 }
346                 case LcafSourceDest {
347                     container LcafSourceDestAddr {
348                         uses LcafSourceDestAddress;
349                     }
350                 }
351                 case LcafKeyValue {
352                     container LcafKeyValueAddressAddr {
353                         uses LcafKeyValueAddress;
354                     }
355                 }
356                 case LcafList {
357                     container LcafListAddr {
358                         uses LcafListAddress;
359                     }
360                 }
361                 case LcafApplicationData {
362                     container LcafApplicationDataAddr {
363                         uses LcafApplicationDataAddress;
364                     }
365                 }
366                 case LcafTrafficEngineering {
367                     container LcafTrafficEngineeringAddr {
368                         uses LcafTrafficEngineeringAddress;
369                     }
370                 }
371             }
372         }
373     }
374
375     grouping EidRecords {
376         list EidRecord {
377             uses LispAddress;
378             leaf mask {
379                 type uint8;
380             }
381         }
382     }
383
384     grouping LocatorRecords {
385         list LocatorRecord {
386             key "name";
387             leaf name {
388                 type string;
389             }
390             leaf priority {
391                 type uint8;
392             }
393             leaf weight {
394                 type uint8;
395             }
396             leaf multicastPriority {
397                 type uint8;
398             }
399             leaf multicastWeight {
400                 type uint8;
401             }
402             leaf localLocator {
403                 type boolean;
404             }
405             leaf rlocProbed {
406                 type boolean;
407             }
408             leaf routed {
409                 type boolean;
410             }
411
412             //locator address
413             uses LispAddress;
414         }
415     }
416
417     grouping EidToLocatorRecord {
418         leaf recordTtl {
419             type int32;
420         }
421         leaf maskLength {
422             type uint8;
423         }
424         leaf mapVersion {
425             type int16;
426         }
427         leaf action {
428             type enumeration {
429                 enum NoAction;
430                 enum NativelyForward;
431                 enum SendMapRequest;
432                 enum Drop;
433             }
434         }
435         leaf authoritative {
436             type boolean;
437         }
438         // EID prefix
439         uses LispAddress;
440
441         // locator record list
442         uses LocatorRecords;
443     }
444
445     grouping EidToLocatorRecords {
446         list eidToLocatorRecord {
447             uses EidToLocatorRecord;
448         }
449     }
450
451     grouping xtrSiteId {
452         leaf xtrId {
453             type binary;
454         }
455         leaf siteId {
456             type binary;
457         }
458     }
459
460     grouping MapRegister {
461         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";
462         leaf proxyMapReply {
463             type boolean;
464         }
465         leaf xtrSiteIdPresent {
466             type boolean;
467         }
468         leaf wantMapNotify {
469             type boolean;
470         }
471         leaf nonce {
472             type int64;
473         }
474         leaf keyId {
475             type int16;
476         }
477         leaf authenticationData {
478             type binary;
479         }
480         uses EidToLocatorRecords;
481         uses xtrSiteId;
482     }
483
484     grouping MapNotify {
485         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";
486         leaf xtrSiteIdPresent {
487             type boolean;
488         }
489         leaf nonce {
490             type int64;
491         }
492         leaf keyId {
493             type int16;
494         }
495         leaf authenticationData {
496             type binary;
497         }
498         uses EidToLocatorRecords;
499         uses xtrSiteId;
500     }
501
502     grouping MapRequest {
503         reference "http://tools.ietf.org/html/rfc6830#section-6.1.2";
504         leaf authoritative {
505             type boolean;
506         }
507         leaf mapDataPresent {
508             type boolean;
509         }
510         leaf probe {
511             type boolean;
512         }
513         leaf smr {
514             type boolean;
515         }
516         leaf pitr {
517             type boolean;
518         }
519         leaf smrInvoked {
520             type boolean;
521         }
522         leaf nonce {
523             type int64;
524         }
525         container SourceEid {
526             uses LispAddress;
527         }
528         list itrRloc {
529             uses LispAddress;
530         }
531         uses EidRecords;
532         container MapReply{
533             uses EidToLocatorRecord;
534         }
535     }
536
537     grouping MapReply {
538         reference "http://tools.ietf.org/html/rfc6830#section-6.1.4";
539         leaf probe {
540             type boolean;
541         }
542         leaf nonce {
543             type int64;
544         }
545         leaf echoNonceEnabled {
546             type boolean;
547         }
548         leaf securityEnabled {
549             type boolean;
550         }
551         uses EidToLocatorRecords;
552     }
553
554     grouping MapRegisterNotification {
555         container MapRegister {
556             uses MapRegister;
557         }
558         uses TransportAddress;
559     }
560
561     grouping MapNotifyMessage {
562         container MapNotify {
563             uses MapNotify;
564         }
565         uses TransportAddress;
566     }
567
568     grouping MapRequestMessage {
569         container MapRequest {
570             uses MapRequest;
571         }
572         uses TransportAddress;
573     }
574
575     grouping MapRequestNotification {
576         container MapRequest {
577             uses MapRequest;
578         }
579         uses TransportAddress;
580     }
581
582     grouping MapReplyMessage {
583         container MapReply {
584             uses MapReply;
585         }
586         uses TransportAddress;
587     }
588
589     grouping MapReplyNotification {
590         container MapReply {
591             uses MapReply;
592         }
593     }
594
595     rpc sendMapNotify {
596         input {
597             uses MapNotifyMessage;
598         }
599     }
600
601     rpc sendMapRequest {
602         input {
603             uses MapRequestMessage;
604         }
605     }
606
607     rpc sendMapReply {
608         input {
609             uses MapReplyMessage;
610         }
611     }
612
613     notification addMapping {
614         uses MapRegisterNotification;
615     }
616
617     notification requestMapping {
618         uses MapRequestNotification;
619     }
620
621     notification xtrRequestMapping {
622         uses MapRequestNotification;
623     }
624
625     notification xtrReplyMapping {
626         uses MapReplyNotification;
627     }
628
629     grouping db-instance {
630         description "Describes the mappings belonging to the same Instance ID";
631         leaf iid {
632             description "The 24-bit Instance ID";
633             type iid-uri;
634         }
635         list eid {
636             description "A list of EID-to-RLOC mappings within the same Instance ID";
637             key "eid origin";
638             ext:context-instance "eid-context";
639             leaf eid {
640                 type eid-uri;
641             }
642             leaf origin {
643                 type mapping-origin;
644             }
645             uses EidToLocatorRecord;
646         }
647     }
648
649     container mapping-database {
650         description "The LISP EID-to-RLOC mapping database";
651         list instance-id {
652             description "A list of LISP Instance IDs";
653             key "iid";
654             ext:context-instance instance-id-context";
655             uses db-instance;
656         }
657     }
658 }