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