41ad7fb8398bd24c61b9b69fed6227eb33adc5cc
[lispflowmapping.git] / mappingservice / api / src / main / yang / mappingservice.yang
1 module mappingservice {
2
3     yang-version 1;
4     namespace "urn:opendaylight:lfm:mappingservice";
5     prefix "mappingservice";
6
7     import config { prefix config; revision-date 2013-04-05; }
8     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
9     import yang-ext { prefix ext; revision-date 2013-07-09; }
10     import lisp-proto { prefix lisp-proto; revision-date 2015-08-20; }
11
12     contact "Lorand Jakab <lojakab@cisco.com";
13
14     description
15         "An MD-SAL based implementation of a LISP Map-Server database";
16
17     revision "2015-09-06" {
18         description "Renamed and moved module to mappingservice.api.";
19     }
20
21     identity mappingservice {
22         base config:service-type;
23         config:java-class "org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService";
24     }
25
26     identity mappingservice-shell {
27         base config:service-type;
28         config:java-class "org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell";
29     }
30
31     identity lisp-mappingservice {
32         base config:service-type;
33         config:java-class "org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping";
34     }
35
36     typedef mapping-origin {
37         description "The originating entity of an EID-to-RLOC mapping";
38         type enumeration {
39             enum northbound;
40             enum southbound;
41         }
42     }
43
44     typedef site-id {
45         description "64 bit site identifier";
46         type binary {
47             length "8";
48         }
49     }
50
51     typedef iid-uri {
52         description "IID as a string lookup key in a URI";
53         type inet:uri;
54     }
55
56     typedef eid-uri {
57         description "EID as a string lookup key in a URI";
58         type inet:uri;
59     }
60
61     typedef mapping-change {
62         description "Type of mapping update";
63         type enumeration {
64             enum updated;
65             enum removed;
66         }
67     }
68
69     identity instance-id-context {
70         description "A classifier for instance-id elements which allows direct access to a particular element in the data tree.";
71     }
72
73     identity eid-context {
74         description "A classifier for endpoint-id elements which allows direct access to a particular element in the data tree.";
75     }
76
77     grouping mapping-authkey-container {
78         container mapping-authkey {
79             leaf key-string {
80                 type string;
81             }
82             leaf key-type {
83                 type uint16;
84             }
85         }
86     }
87
88     grouping db-instance {
89         description "Describes the mappings belonging to the same Instance ID";
90         leaf iid-uri {
91             description "The 24-bit Instance ID";
92             type iid-uri;
93         }
94         list mapping {
95             description "A list of EID-to-RLOC mappings within the same Instance ID";
96             key "eid-uri origin";
97             ext:context-instance "eid-context";
98             leaf eid-uri {
99                 type eid-uri;
100             }
101             leaf origin {
102                 description "Mapping origin";
103                 type mapping-origin;
104             }
105             leaf-list site-id {
106                 description "Site ID";
107                 type site-id;
108             }
109             uses lisp-proto:mapping-record-container;
110         }
111         list authentication-key {
112             description "A list of authentication keys for EID prefixes within the same Instance ID";
113             key "eid-uri";
114             ext:context-instance "eid-context";
115             leaf eid-uri {
116                 type eid-uri;
117             }
118             uses lisp-proto:eid-container;
119             uses mapping-authkey-container;
120         }
121     }
122
123     container mapping-database {
124         description "The LISP EID-to-RLOC mapping database";
125         list instance-id {
126             description "A list of LISP Instance IDs";
127             key "iid-uri";
128             ext:context-instance "instance-id-context";
129             uses db-instance;
130         }
131     }
132
133     rpc add-key {
134         input {
135             uses lisp-proto:eid-container;
136             uses mapping-authkey-container;
137         }
138     }
139
140     rpc get-key {
141         input {
142             uses lisp-proto:eid-container;
143         }
144         output {
145             uses mapping-authkey-container;
146         }
147     }
148
149     rpc update-key {
150         input {
151             uses lisp-proto:eid-container;
152             uses mapping-authkey-container;
153         }
154     }
155
156     rpc remove-key {
157         input {
158             uses lisp-proto:eid-container;
159         }
160     }
161
162     rpc add-mapping {
163         input {
164             uses lisp-proto:mapping-record-container;
165         }
166     }
167
168     rpc get-mapping {
169         input {
170             uses lisp-proto:eid-container;
171         }
172         output {
173             uses lisp-proto:mapping-record-container;
174         }
175     }
176
177     rpc update-mapping {
178         input {
179             uses lisp-proto:mapping-record-container;
180         }
181     }
182
183     rpc remove-mapping {
184         input {
185             uses lisp-proto:eid-container;
186         }
187     }
188
189     notification mapping-changed {
190         description "Notification sent when a mapping is changed";
191         leaf change-type {
192             description "The type of change";
193             type mapping-change;
194         }
195         uses lisp-proto:mapping-record-container;
196     }
197 }