Merge "Bug 5270: Fix merging"
[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 2010-09-24; }
8     import ietf-lisp-address-types { prefix lisp-address; revision-date 2015-11-05; }
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-11-05" {
20         description "Renamed the module to lisp-proto.";
21         reference "https://tools.ietf.org/html/rfc6830";
22     }
23
24     typedef ipv4-address-binary {
25         type binary {
26             length "4";
27         }
28         description
29             "The ipv4-address-binary type represents an IPv4 address in binary
30              in network byte order.";
31     }
32
33     typedef ipv6-address-binary {
34         type binary {
35             length "16";
36         }
37         description
38             "The ipv6-address-binary type represents an IPv6 address in binary
39              in network byte order.";
40     }
41
42     typedef ip-address-binary {
43         type union {
44             type ipv4-address-binary;
45             type ipv6-address-binary;
46         }
47         description
48             "The ip-address-binary type represents an IP address in binary
49              in network byte order, and is IP version neutral.  The length of
50              the byte array implies the IP version.";
51     }
52
53     grouping transport-address {
54         container transport-address {
55             leaf ipAddress {
56                 type inet:ip-address;
57                 reference "http://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
58             }
59             leaf port {
60                 type inet:port-number;
61             }
62         }
63     }
64
65     grouping eid-container {
66         container eid {
67             uses lisp-address:lisp-address;
68         }
69     }
70
71     grouping rloc-container {
72         container rloc {
73             uses lisp-address:lisp-address;
74         }
75     }
76
77     grouping eid-list {
78         list eid-item {
79             key "eid-item-id";
80             leaf eid-item-id {
81                 type string;
82             }
83             uses eid-container;
84         }
85     }
86
87     grouping LocatorRecords {
88         list LocatorRecord {
89             key "locator-id";
90             leaf locator-id {
91                 type string;
92             }
93             leaf priority {
94                 type uint8;
95             }
96             leaf weight {
97                 type uint8;
98             }
99             leaf multicastPriority {
100                 type uint8;
101             }
102             leaf multicastWeight {
103                 type uint8;
104             }
105             leaf localLocator {
106                 type boolean;
107             }
108             leaf rlocProbed {
109                 type boolean;
110             }
111             leaf routed {
112                 type boolean;
113             }
114
115             //locator address
116             uses rloc-container;
117         }
118     }
119
120     grouping mapping-record-metadata {
121         leaf xtr-id {
122             type binary {
123                 length "16";
124             }
125             description
126                 "128 bit xTR identifier.";
127         }
128         leaf site-id {
129             type binary {
130                 length "8";
131             }
132             description
133                 "64 bit site identifier.";
134         }
135         leaf source-rloc {
136             type inet:ip-address;
137             description
138                 "The Source IP address used for sending the enclosing control
139                  packet in RLOC space.";
140         }
141         leaf timestamp {
142             type int64;
143             description
144                 "Milliseconds since January 1, 1970, 00:00:00 GMT";
145         }
146         description
147             "This is a collection of fields which are not present in the actual
148             mapping record defined in RFC 6830, but are used internally in
149             OpenDaylight";
150     }
151
152     grouping mapping-record-container {
153         container mapping-record {
154             leaf recordTtl {
155                 type int32;
156             }
157             leaf maskLength {
158                 type uint8;
159             }
160             leaf mapVersion {
161                 type int16;
162             }
163             leaf action {
164                 type enumeration {
165                     enum NoAction;
166                     enum NativelyForward;
167                     enum SendMapRequest;
168                     enum Drop;
169                 }
170             }
171             leaf authoritative {
172                 type boolean;
173             }
174             // EID prefix
175             uses eid-container;
176
177             // locator record list
178             uses LocatorRecords;
179
180             // metadata
181             uses mapping-record-metadata;
182         }
183     }
184
185     grouping mapping-record-list {
186         list mapping-record-item {
187             key "mapping-record-item-id";
188             leaf mapping-record-item-id {
189                 type string;
190             }
191             uses mapping-record-container;
192         }
193     }
194
195     grouping xtrSiteId {
196         leaf xtrId {
197             type binary {
198                 length "16";
199             }
200         }
201         leaf siteId {
202             type binary {
203                 length "8";
204             }
205         }
206     }
207
208     grouping MapRegister {
209         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";
210         leaf proxyMapReply {
211             type boolean;
212         }
213         leaf xtrSiteIdPresent {
214             type boolean;
215         }
216         leaf wantMapNotify {
217             type boolean;
218         }
219         leaf nonce {
220             type int64;
221         }
222         leaf keyId {
223             type int16;
224         }
225         leaf authenticationData {
226             type binary;
227         }
228         leaf mergeEnabled {
229             type boolean;
230         }
231         uses mapping-record-list;
232         uses xtrSiteId;
233     }
234
235     grouping MapNotify {
236         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";
237         leaf xtrSiteIdPresent {
238             type boolean;
239         }
240         leaf nonce {
241             type int64;
242         }
243         leaf keyId {
244             type int16;
245         }
246         leaf authenticationData {
247             type binary;
248         }
249         leaf mergeEnabled {
250             type boolean;
251         }
252         uses mapping-record-list;
253         uses xtrSiteId;
254     }
255
256     grouping MapRequest {
257         reference "http://tools.ietf.org/html/rfc6830#section-6.1.2";
258         leaf authoritative {
259             type boolean;
260         }
261         leaf mapDataPresent {
262             type boolean;
263         }
264         leaf probe {
265             type boolean;
266         }
267         leaf smr {
268             type boolean;
269         }
270         leaf pitr {
271             type boolean;
272         }
273         leaf smrInvoked {
274             type boolean;
275         }
276         leaf nonce {
277             type int64;
278         }
279         container SourceEid {
280             uses eid-container;
281         }
282         list itrRloc {
283             key "itr-rloc-id";
284             leaf itr-rloc-id {
285                 type string;
286             }
287             uses rloc-container;
288         }
289         uses eid-list;
290         container MapReply {
291             uses mapping-record-container;
292         }
293     }
294
295     grouping MapReply {
296         reference "http://tools.ietf.org/html/rfc6830#section-6.1.4";
297         leaf probe {
298             type boolean;
299         }
300         leaf nonce {
301             type int64;
302         }
303         leaf echoNonceEnabled {
304             type boolean;
305         }
306         leaf securityEnabled {
307             type boolean;
308         }
309         uses mapping-record-list;
310     }
311
312     typedef message-type {
313         type enumeration {
314             enum reserved {
315                 value 0;
316                 description
317                     "Reserved";
318             }
319             enum map-request {
320                 value 1;
321                 description
322                     "Map-Request control packet";
323             }
324             enum map-reply {
325                 value 2;
326                 description
327                     "Map-Reply control packet";
328             }
329             enum map-register {
330                 value 3;
331                 description
332                     "Map-Register control packet";
333             }
334             enum map-notify {
335                 value 4;
336                 description
337                     "Map-Notify control packet";
338             }
339             enum map-referral {
340                 value 6;
341                 description
342                     "Map-Referral control packet";
343             }
344             enum info {
345                 value 7;
346                 description
347                     "Info control packet";
348             }
349             enum encapsulated-control-message {
350                 value 8;
351                 description
352                     "Encapsulated control packet";
353             }
354         }
355         description
356             "Defines the LISP control message types";
357         reference "https://tools.ietf.org/html/rfc6830#section-6.1.1";
358     }
359
360     grouping MapRegisterMessage {
361         container MapRegister {
362             uses MapRegister;
363         }
364         uses transport-address;
365     }
366
367     grouping MapRegisterNotification {
368         container MapRegister {
369             uses MapRegister;
370         }
371         uses transport-address;
372     }
373
374     grouping MapNotifyMessage {
375         container MapNotify {
376             uses MapNotify;
377         }
378         uses transport-address;
379     }
380
381     grouping MapNotifyNotification {
382         container MapNotify {
383             uses MapNotify;
384         }
385         uses transport-address;
386     }
387
388     grouping MapRequestMessage {
389         container MapRequest {
390             uses MapRequest;
391         }
392         uses transport-address;
393     }
394
395     grouping MapRequestNotification {
396         container MapRequest {
397             uses MapRequest;
398         }
399         uses transport-address;
400     }
401
402     grouping MapReplyMessage {
403         container MapReply {
404             uses MapReply;
405         }
406         uses transport-address;
407     }
408
409     grouping MapReplyNotification {
410         container MapReply {
411             uses MapReply;
412         }
413         uses transport-address;
414     }
415
416     notification addMapping {
417         uses MapRegisterNotification;
418     }
419
420     notification gotMapNotify {
421         uses MapNotifyNotification;
422     }
423
424     notification requestMapping {
425         uses MapRequestNotification;
426     }
427
428     notification gotMapReply {
429         uses MapReplyNotification;
430     }
431
432     notification xtrRequestMapping {
433         uses MapRequestNotification;
434     }
435
436     notification xtrReplyMapping {
437         uses MapReplyNotification;
438     }
439 }