Add INFO.yaml for GBP
[groupbasedpolicy.git] / groupbasedpolicy / src / main / yang / model / endpoint.yang
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 module endpoint {
10     yang-version 1;
11
12     namespace "urn:opendaylight:groupbasedpolicy:endpoint";
13     prefix "gbp-endpoint";
14
15     import gbp-common {prefix gbp-common;}
16     import ietf-inet-types {
17         prefix inet;
18         revision-date 2013-07-15;
19     }
20     import ietf-yang-types {
21         prefix yang;
22         revision-date 2013-07-15;
23     }
24
25     revision "2014-04-21" {
26         description
27             "Initial revision.";
28     }
29
30     grouping l2-key {
31         description
32             "The fields that identify an endpoint by a layer 2 address";
33         leaf l2-context {
34             type gbp-common:l2-bridge-domain-id;
35             description
36                 "The bridge domain for the layer 2 address for this endpoint";
37         }
38         leaf mac-address {
39             type yang:mac-address;
40             description
41                 "The MAC address for the endpoint";
42         }
43     }
44
45     grouping l3-key {
46         description
47             "The fields that identify an endpoint by a layer 3 address";
48         leaf l3-context {
49             type gbp-common:l3-context-id;
50             mandatory true;
51             description
52                 "The context for this layer 3 address";
53         }
54         leaf ip-address {
55             type inet:ip-address;
56             mandatory true;
57             description
58                 "The actual IP address for the endpoint";
59         }
60     }
61
62     grouping l3-prefix-key {
63         description
64             "The fields that identify an endpoint by a layer 3 prefix";
65         leaf l3-context {
66             type gbp-common:l3-context-id;
67             mandatory true;
68             description
69                 "The context for this layer 3 prefix";
70         }
71         leaf ip-prefix {
72             type inet:ip-prefix;
73             mandatory true;
74             description
75                 "The IP prefix for the endpoint";
76         }
77     }
78
79     // A base type for an end point
80     grouping endpoint-fields {
81         description "An endpoint and its associated metadata";
82         leaf tenant {
83             type gbp-common:tenant-id;
84             mandatory true;
85             description
86                 "The tenant with which this endpoint is associated";
87         }
88
89         uses l2-key;
90
91         leaf network-containment {
92             description
93                 "The network domain associated with this endpoint's fowarding
94                 context.";
95             type gbp-common:network-domain-id;
96         }
97         list l3-address {
98             description
99                 "All the layer 3 addresses associated with this endpoint";
100             key "l3-context ip-address";
101             uses l3-key;
102         }
103         leaf endpoint-group {
104             type gbp-common:endpoint-group-id;
105             description
106                 "The group associated with this endpoint";
107         }
108         leaf-list endpoint-groups {
109             type gbp-common:endpoint-group-id;
110             description
111                 "The groups associated with this endpoint";
112             ordered-by user;
113         }
114         leaf-list condition {
115             type gbp-common:condition-name;
116             description
117                 "The conditions associated with this endpoint";
118         }
119         leaf timestamp {
120             type int64;
121             description
122                 "The last timestamp associated with this endpoint record.
123                  This will be used for aging data in the registry.";
124         }
125     }
126
127     //  L3 Prefix EndPointFields
128     grouping endpoint-l3-prefix-fields {
129         description "An l3 prefix endpoint and its associated metadata";
130         uses l3-prefix-key;
131         leaf tenant {
132             type gbp-common:tenant-id;
133             mandatory true;
134             description
135                 "The tenant with which this endpoint is associated";
136         }
137         leaf endpoint-group {
138             type gbp-common:endpoint-group-id;
139             description
140                 "The group associated with this endpoint";
141         }
142         leaf-list endpoint-groups {
143             type gbp-common:endpoint-group-id;
144             description
145                 "The groups associated with this endpoint";
146             ordered-by user;
147         }
148         leaf-list condition {
149             type gbp-common:condition-name;
150             description
151                 "The conditions associated with this endpoint";
152         }
153         list endpoint-l2-gateways {
154             key "l2-context mac-address";
155             uses l2-key;
156         }
157         list endpoint-l3-gateways {
158             key "l3-context ip-address";
159             uses l3-key;
160         }
161         leaf timestamp {
162             type int64;
163             description
164                 "The last timestamp associated with this endpoint record.
165                  This will be used for aging data in the registry.";
166         }
167     }
168
169     grouping has-endpoint-group-conditions {
170         description
171             "Base type for object with endpoint group to condition
172              mappings.";
173
174         leaf endpoint-group {
175             description "The endpoint group conditions to assign";
176             type gbp-common:endpoint-group-id;
177         }
178         list endpoint-group-condition {
179             description
180                 "The conditions associated with this endpoint
181                  group";
182             key "condition";
183             leaf condition {
184                 description "A condition name to associate.";
185                 type gbp-common:condition-name;
186             }
187         }
188     }
189
190     container endpoints {
191
192         // use base-endpoint.yang instead
193         status deprecated;
194
195         description
196             "Repository for operational state data about endpoints needed for
197              policy resolution.";
198         config false;
199
200         list endpoint {
201             description
202                 "Endpoints indexed by layer 2 addreses.  When modifying
203                  data here, you must also modify data in the
204                  endpoints-l3 list as well.";
205             key "l2-context mac-address";
206             uses endpoint-fields;
207         }
208
209         list endpoint-l3 {
210             description
211                 "Endpoints indexed by layer 3 addreses.  When modifying
212                  data here, you must also modify data in the endpoints
213                  list as well.";
214             key "l3-context ip-address";
215             uses l3-key;
216             uses endpoint-fields;
217         }
218
219         list endpoint-l3-prefix {
220             key "l3-context ip-prefix";
221             uses endpoint-l3-prefix-fields;
222         }
223
224         list condition-mapping {
225             description
226                 "A list mapping conditions to entire endpoint groups.
227                  This offers a quickly way to set a condition on many
228                  endpoints at once.";
229
230             key "endpoint-group";
231             uses has-endpoint-group-conditions;
232         }
233     }
234
235     rpc register-endpoint {
236
237         // use base-endpoint.yang instead
238         status deprecated;
239
240         description
241             "Register a new endpoint into the registry.  If there
242              is already an existing endpoint with the same keys, they
243              will be overwritten with the new information.";
244
245         input {
246             uses endpoint-fields;
247         }
248     }
249
250     rpc register-l3-prefix-endpoint {
251
252         // use base-endpoint.yang instead
253         status deprecated;
254
255         description
256             "Register an L3 Prefix Endpoint to the endpoint registery. If there
257             is already an existing endpoint with the same keys, they
258             will be overwritten with the new information.";
259
260         input {
261             uses endpoint-l3-prefix-fields;
262         }
263     }
264
265     rpc unregister-endpoint {
266
267         // use base-endpoint.yang instead
268         status deprecated;
269
270         description "Unregister an endpoint or endpoints from the registry.";
271
272         input {
273             list l2 {
274                 key "l2-context mac-address";
275                 uses l2-key;
276             }
277             list l3 {
278                 key "l3-context ip-address";
279                 uses l3-key;
280             }
281             list l3-prefix {
282                 key "l3-context ip-prefix";
283                 uses l3-prefix-key;
284             }
285         }
286     }
287
288     rpc set-endpoint-group-conditions {
289
290         status deprecated;
291
292         description
293             "Set a list of conditions for a particular endpoint group.
294              These conditions will apply to all endpoints in the
295              endpoint group.  These conditions will be added to the
296              existing list of conditions.";
297
298         input {
299             uses has-endpoint-group-conditions;
300         }
301     }
302
303     rpc unset-endpoint-group-conditions {
304
305         status deprecated;
306
307         description
308             "Remove a list of conditions from an endpoint group.";
309
310         input {
311             uses has-endpoint-group-conditions;
312         }
313     }
314 }