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