Add ietf-lisp-address-types model
[lispflowmapping.git] / mappingservice / lisp-proto / src / main / yang / ietf-lisp-address-types.yang
1 module ietf-lisp-address-types {
2   namespace "urn:ietf:params:xml:ns:yang:ietf-lisp-address-types";
3   prefix laddr;
4   import ietf-inet-types {
5     prefix inet;
6     revision-date 2013-07-15;
7   }
8   import ietf-yang-types {
9     prefix yang;
10     revision-date 2013-07-15;
11   }
12   organization
13     "IETF LISP (Locator/ID Separation Protocol) Working Group";
14   contact
15     "lisp@ietf.org";
16   description
17     "This YANG module defines the LISP Canonical Address Formats
18      (LCAF) for LISP. The module can be extended by vendors to
19      define vendor-specific parameters.
20
21      Copyright (c) 2014 IETF Trust and the persons identified as
22      authors of the code.  All rights reserved.
23
24      Redistribution and use in source and binary forms, with or
25      without modification, is permitted pursuant to, and subject
26      to the license terms contained in, the Simplified BSD License
27      set forth in Section 4.c of the IETF Trust's Legal Provisions
28      Relating to IETF Documents
29      (http://trustee.ietf.org/license-info).
30
31      This version of this YANG module is part of RFC 6338; see
32      the RFC itself for full legal notices.
33
34     ";
35   revision 2015-11-05 {
36     description
37       "Initial revision.";
38     reference
39       "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10";
40   }
41   identity lisp-address-family {
42     description
43       "Base identity from which identities describing LISP address
44        families are derived.";
45   }
46   identity no-address-afi {
47     base lisp-address-family;
48     description
49       "IANA Reserved.";
50     }
51   identity ipv4-afi {
52     base lisp-address-family;
53     description
54       "IANA IPv4 address family.";
55   }
56   identity ipv4-prefix-afi {
57     base lisp-address-family;
58     description
59       "IANA IPv4 address family prefix.";
60   }
61   identity ipv6-afi {
62     base lisp-address-family;
63     description
64       "IANA IPv6 address family.";
65   }
66   identity ipv6-prefix-afi {
67     base lisp-address-family;
68     description
69       "IANA IPv6 address family prefix.";
70   }
71   identity mac-afi {
72     base lisp-address-family;
73     description
74       "IANA MAC address family.";
75   }
76   identity distinguished-name-afi {
77     base lisp-address-family;
78     description
79       "IANA Distinguished Name address family.";
80   }
81   identity as-number-afi {
82       base lisp-address-family;
83       description
84         "IANA AS Number address family.";
85   }
86   identity lcaf {
87     base lisp-address-family;
88     description
89       "IANA LISP Canonical Address Format address family.";
90   }
91   identity null-address-lcaf {
92     base lcaf;
93     description
94       "Null body LCAF type.";
95   }
96   identity afi-list-lcaf {
97     base lcaf;
98     description
99       "AFI-List LCAF type.";
100   }
101   identity instance-id-lcaf {
102     base lcaf;
103     description
104       "Instance-ID LCAF type.";
105   }
106   identity as-number-lcaf {
107     base lcaf;
108     description
109       "AS Number LCAF type.";
110   }
111   identity application-data-lcaf {
112     base lcaf;
113     description
114       "Application Data LCAF type.";
115   }
116   identity geo-coordinates-lcaf {
117     base lcaf;
118     description
119       "Geo-coordinates LCAF type.";
120   }
121   identity opaque-key-lcaf {
122     base lcaf;
123     description
124       "Opaque Key LCAF type.";
125   }
126   identity nat-traversal-lcaf {
127     base lcaf;
128     description
129       "NAT-Traversal LCAF type.";
130   }
131   identity nonce-locator-lcaf {
132     base lcaf;
133     description
134       "Nonce-Locator LCAF type.";
135   }
136   identity multicast-info-lcaf {
137     base lcaf;
138     description
139       "Multicast Info LCAF type.";
140   }
141   identity explicit-locator-path-lcaf {
142     base lcaf;
143     description
144       "Explicit Locator Path LCAF type.";
145   }
146   identity security-key-lcaf {
147     base lcaf;
148     description
149       "Security Key LCAF type.";
150   }
151   identity source-dest-key-lcaf {
152     base lcaf;
153     description
154       "Source/Dest LCAF type.";
155   }
156   identity replication-list-lcaf {
157     base lcaf;
158     description
159       "Replication-List LCAF type.";
160   }
161   identity json-data-model-lcaf {
162     base lcaf;
163     description
164       "JSON Data Model LCAF type.";
165   }
166   identity key-value-address-lcaf {
167     base lcaf;
168     description
169       "Key/Value Address LCAF type.";
170   }
171   identity encapsulation-format-lcaf {
172     base lcaf;
173     description
174       "Encapsulation Format LCAF type.";
175   }
176   identity service-path-lcaf {
177     base lcaf;
178     description
179       "Service Path LCAF type.";
180   }
181   typedef instance-id-type {
182     type uint32 {
183       range "0..16777215";
184     }
185     description
186       "Defines the range of values for an Instance ID.";
187   }
188   typedef service-path-id-type {
189     type uint32 {
190       range "0..16777215";
191     }
192     description
193       "Defines the range of values for a Service Path ID.";
194   }
195    typedef distinguished-name-type {
196     type string;
197     description
198       "Distinguished Name address.";
199     reference
200       "http://www.iana.org/assignments/address-family-numbers/
201        address-family-numbers.xhtml";
202   }
203   typedef simple-address {
204     type union {
205       type inet:ip-address;
206       type inet:ip-prefix;
207       type yang:mac-address;
208       type distinguished-name-type;
209       type inet:as-number;
210     }
211     description
212       "Union of address types that can be part of LCAFs.";
213   }
214
215   typedef lisp-address-family-ref {
216     type identityref {
217       base lisp-address-family;
218     }
219     description
220       "LISP address family reference.";
221   }
222   typedef lcaf-ref {
223     type identityref {
224       base lcaf;
225     }
226     description
227       "LCAF types reference.";
228   }
229
230   grouping lisp-address {
231     description
232       "Generic LISP address.";
233     leaf address-type {
234       type lisp-address-family-ref;
235       mandatory true;
236       description
237         "Type of the LISP address.";
238     }
239     leaf virtual-network-id {
240       type instance-id-type;
241       description
242         "Virtual Network Identifier (instance-id) of the address.";
243     }
244     choice address {
245       description
246         "Various LISP address types, including IP, MAC, and LCAF.";
247
248       leaf no-address {
249         when "../address-type = 'laddr:no-addr-afi'" {
250           description
251             "When AFI is 0.";
252         }
253         type empty;
254         description
255           "No address.";
256       }
257       leaf ipv4 {
258         when "../address-type = 'laddr:ipv4-afi'" {
259           description
260             "When AFI is IPv4.";
261         }
262         type inet:ipv4-address;
263         description
264           "IPv4 address.";
265       }
266       leaf ipv4-prefix {
267         when "../address-type = 'laddr:ipv4-prefix-afi'" {
268           description
269             "When AFI is IPv4.";
270         }
271         type inet:ipv4-prefix;
272         description
273           "IPv4 prefix.";
274       }
275       leaf ipv6 {
276         when "../address-type = 'laddr:ipv6-afi'" {
277           description
278             "When AFI is IPv6.";
279         }
280         type inet:ipv6-address;
281         description
282           "IPv6 address.";
283       }
284       leaf ipv6-prefix {
285         when "../address-type = 'laddr:ipv6-prefix-afi'" {
286           description
287             "When AFI is IPv6.";
288         }
289         type inet:ipv6-prefix;
290         description
291           "IPv6 address.";
292       }
293       leaf mac {
294         when "../address-type = 'laddr:mac-afi'" {
295           description
296             "When AFI is MAC.";
297         }
298         type yang:mac-address;
299         description
300           "MAC address.";
301       }
302       leaf distinguished-name {
303         when "../address-type = 'laddr:distinguished-name-afi'" {
304           description
305             "When AFI is distinguished-name.";
306         }
307         type distinguished-name-type;
308         description
309           "Distinguished Name address.";
310       }
311       leaf as-number {
312         when "../address-type = 'laddr:as-number-afi'" {
313           description
314             "When AFI is as-number.";
315         }
316         type inet:as-number;
317         description
318           "AS Number.";
319       }
320       container null-address {
321         when "../address-type = 'laddr:null-address-lcaf'" {
322           description
323             "When LCAF type is null.";
324         }
325         description
326           "Null body LCAF type";
327         leaf address {
328           type empty;
329           description
330             "AFI address.";
331         }
332       }
333       container afi-list {
334         when "../address-type = 'laddr:afi-list-lcaf'" {
335           description
336             "When LCAF type is AFI-List.";
337         }
338         description
339           "AFI-List LCAF type.";
340         reference
341           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
342            #section-4.16.1";
343         leaf-list address-list {
344           type simple-address;
345           description
346             "List of AFI addresses.";
347         }
348       }
349       container instance-id {
350         when "../address-type = 'laddr:instance-id-lcaf'" {
351           description
352             "When LCAF type is Instance-ID";
353         }
354         description
355           "Instance ID LCAF type.";
356         reference
357           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
358            #section-4.2";
359         leaf iid {
360           type instance-id-type;
361           description
362             "Instance ID value.";
363         }
364         leaf mask-length {
365             type uint8;
366             description
367               "Mask length.";
368         }
369         leaf address {
370           type simple-address;
371           description
372             "AFI address.";
373         }
374       }
375       container as-number-lcaf {
376         when "../address-type = 'laddr:as-number-lcaf'" {
377           description
378             "When LCAF type is AS-Number.";
379         }
380         description
381           "AS Number LCAF type.";
382         reference
383           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
384            #section-4.3";
385         leaf as {
386           type inet:as-number;
387           description
388             "AS number.";
389         }
390         leaf address {
391           type simple-address;
392           description
393             "AFI address.";
394         }
395       }
396       container application-data {
397         when "../address-type = 'laddr:application-data-lcaf'" {
398           description
399             "When LCAF type is Application Data.";
400         }
401         description
402           "Application Data LCAF type.";
403         reference
404           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
405            #section-4.4";
406         leaf address {
407             type simple-address;
408             description
409               "AFI address.";
410         }
411         leaf protocol {
412             type uint8;
413             description
414               "Protocol number.";
415         }
416         leaf ip-tos {
417             type int32;
418             description
419               "Type of service field.";
420         }
421         leaf local-port-low {
422             type inet:port-number;
423             description
424               "Low end of local port range.";
425         }
426         leaf local-port-high {
427             type inet:port-number;
428             description
429               "High end of local port range.";
430         }
431         leaf remote-port-low {
432             type inet:port-number;
433             description
434               "Low end of remote port range.";
435         }
436         leaf remote-port-high {
437             type inet:port-number;
438             description
439               "High end of remote port range.";
440         }
441       }
442       container geo-coordinates {
443         when "../address-type = 'laddr:geo-coordinates-lcaf'" {
444           description
445             "When LCAF type is Geo-coordinates.";
446         }
447         description
448           "Geo-coordinates LCAF type.";
449         reference
450           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
451            #section-4.5";
452         leaf latitude {
453           type bits {
454             bit N {
455               description
456                 "Latitude bit.";
457             }
458           }
459           description
460             "Bit that selects between North and South latitude.";
461         }
462         leaf latitude-degrees {
463           type uint8 {
464             range "0 .. 90";
465           }
466           description
467             "Degrees of latitude.";
468         }
469         leaf latitude-minutes {
470           type uint8 {
471             range "0..59";
472           }
473           description
474             "Minutes of latitude.";
475         }
476         leaf latitude-seconds {
477           type uint8 {
478             range "0..59";
479           }
480           description
481             "Seconds of latitude.";
482         }
483         leaf longitude {
484           type bits {
485             bit E {
486               description
487                 "Longitude bit.";
488             }
489           }
490           description
491             "Bit that selects between East and West longitude.";
492         }
493         leaf longitude-degrees {
494           type uint16 {
495             range "0 .. 180";
496           }
497           description
498             "Degrees of longitude.";
499         }
500         leaf longitude-minutes {
501           type uint8 {
502             range "0..59";
503           }
504           description
505             "Minutes of longitude.";
506         }
507         leaf longitude-seconds {
508           type uint8 {
509             range "0..59";
510           }
511           description
512             "Seconds of longitude.";
513         }
514         leaf altitude {
515           type int32;
516           description
517             "Height relative to sea level in meters.";
518         }
519         leaf address {
520           type simple-address;
521           description
522             "AFI address.";
523         }
524       }
525       container nat-traversal {
526         when "../address-type = 'laddr:nat-traversal-lcaf'" {
527           description
528             "When LCAF type is NAT-Traversal.";
529         }
530         description
531           "NAT-Traversal LCAF type.";
532         reference
533           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
534            #section-4.6";
535         leaf ms-udp-port {
536           type uint16;
537           description
538             "Map-Server UDP port (set to 4342).";
539         }
540         leaf etr-udp-port {
541           type uint16;
542           description
543             "ETR UDP port.";
544         }
545         leaf global-etr-rloc {
546           type simple-address;
547           description
548             "Global ETR RLOC address.";
549         }
550         leaf ms-rloc {
551           type simple-address;
552           description
553             "Map-Server RLOC address.";
554         }
555         leaf private-etr-rloc {
556           type simple-address;
557           description
558             "Private ETR RLOC address.";
559         }
560         leaf-list rtr-rlocs {
561           type simple-address;
562           description
563             "List of RTR RLOC addresses.";
564         }
565       }
566       container explicit-locator-path {
567         when "../address-type = 'laddr:explicit-locator-path-lcaf'" {
568           description
569             "When LCAF type type is Explicit Locator Path.";
570         }
571         description
572           "Explicit Locator Path LCAF type.";
573         reference
574           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
575            #section-4.9";
576         list hop {
577           key "hop-id";
578           ordered-by user;
579           description
580             "List of locator hops forming the explicit path.";
581           leaf hop-id {
582             type string;
583             description
584               "Unique identifier for the hop.";
585           }
586           leaf address {
587             type simple-address;
588             description
589               "AFI address.";
590           }
591           leaf lrs-bits {
592             type bits{
593               bit lookup {
594                 description
595                   "Lookup bit.";
596               }
597               bit rloc-probe {
598                 description
599                   "RLOC-probe bit.";
600               }
601               bit strict {
602                 description
603                   "Strict bit.";
604               }
605             }
606             description
607               "Flag bits per hop.";
608           }
609         }
610       }
611       container source-dest-key {
612         when "../address-type = 'laddr:source-dest-key-lcaf'" {
613           description
614             "When LCAF type type is Source/Dest.";
615         }
616         description
617           "Source/Dest LCAF type.";
618         reference
619             "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
620             #section-4.11";
621         leaf source {
622           type simple-address;
623           description
624             "Source address.";
625         }
626         leaf dest {
627           type simple-address;
628           description
629             "Destination address.";
630         }
631       }
632       container key-value-address {
633         when "../address-type = 'laddr:key-value-address-lcaf'" {
634           description
635             "When LCAF type type is Key/Value Address.";
636         }
637         description
638           "Key/Value Address LCAF type.";
639         reference
640           "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
641            #section-4.11";
642         leaf key {
643           type simple-address;
644           description
645             "Address as Key.";
646         }
647         leaf value {
648           type simple-address;
649           description
650             "Address as Value.";
651         }
652       }
653       container service-path {
654         when "../address-type = 'laddr:service-path-lcaf'" {
655         description
656           "When LCAF type service path identifier.";
657             }
658         description
659           "Service Path LCAF type.";
660         reference
661           "http://tools.ietf.org/html/draft-ermagan-lisp-nsh-00";
662         leaf service-path-id {
663           type service-path-id-type;
664           description
665             "Service path identifier for the path for NSH header";
666         }
667         leaf service-index {
668           type uint8;
669           description
670             "Service path index for NSH header";
671         }
672       }
673     }
674   }
675 }