Added interests to renderer.yang
[groupbasedpolicy.git] / groupbasedpolicy / src / main / yang / model / renderer.yang
1 /*
2  * Copyright (c) 2015 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 renderer {
10     yang-version 1;
11
12     namespace "urn:opendaylight:groupbasedpolicy:renderer";
13     prefix "gbp-renderer";
14
15     import gbp-common {
16         prefix gbp-common;
17         revision-date 2014-04-21;
18     }
19     import policy {
20         prefix policy;
21         revision-date 2014-04-21;
22     }
23     import ietf-inet-types {
24         prefix inet;
25         revision-date 2010-09-24;
26     }
27
28     description
29         "This module defines renderer capabilities.";
30
31     revision "2015-11-03" {
32         description
33             "Initial revision.";
34     }
35
36     typedef renderer-name {
37         type gbp-common:name;
38         description "A name for a renderer";
39     }
40
41     grouping supported-string-value-fields {
42         list supported-string-value {
43             description "String value has to be identical.";
44             key value;
45             leaf value {
46                 type string;
47             }
48         }
49     }
50
51     grouping supported-int-value-fields {
52         list supported-int-value {
53             description "Int value has to be identical.";
54             key value;
55             leaf value {
56                 type int64;
57             }
58         }
59         list supported-int-value-in-range {
60             description "Int value has to be inside the range include boundaries.";
61             key "min max";
62             leaf min {
63                 type int64;
64             }
65             leaf max {
66                 type int64;
67             }
68         }
69     }
70
71     grouping supported-range-value-fields {
72         list supported-range-value {
73             description "Min and max values have to be inside the range include boundaries.";
74             key "min max";
75             leaf min {
76                 type int64;
77             }
78             leaf max {
79                 type int64;
80             }
81         }
82     }
83
84     grouping has-parameters-type {
85         choice parameter-type {
86             case string {
87                 uses supported-string-value-fields;
88             }
89             case int {
90                 uses supported-int-value-fields;
91             }
92             case range {
93                 uses supported-range-value-fields;
94             }
95         }
96     }
97
98     container renderers {
99         description
100             "Leaf containing all renderers' description.";
101
102         config false;
103
104         list renderer {
105             description
106                 "A renderer provides a list of capabilities.";
107
108             key name;
109
110             leaf name {
111                 description
112                     "A user-visible name for the renderer.";
113                 type renderer-name;
114             }
115
116             container interests {
117                 description "Represents interests of the renderer.";
118
119                 container followed-tenants {
120                     description "Interesting tenants for the renderer.";
121
122                     list followed-tenant {
123                         description "Tenant which is followed by the renderer.";
124
125                         key id;
126
127                         leaf id {
128                             type gbp-common:tenant-id;
129                         }
130
131                         list followed-endpoint-group {
132                             description "Endpoint-group which is followed by the renderer.";
133
134                             key id;
135
136                             leaf id {
137                                 type gbp-common:endpoint-group-id;
138                             }
139                         }
140                     }
141                 }
142             }
143
144
145             container capabilities {
146                 description "Capabilities this renderer provides.";
147
148                 list supported-classifier-definition {
149                     description
150                         "Classifier definitions this renderer can use.";
151
152                     key classifier-definition-id;
153
154                     leaf classifier-definition-id {
155                         description "Reference to a classifier definition in config datastore.";
156                         type leafref {
157                             path "/policy:subject-feature-definitions/policy:classifier-definition/policy:id";
158                         }
159                     }
160
161                     leaf parent-classifier-definition-id {
162                         description
163                             "Optional reference to a parent classifier definition,
164                             to provide a hierarchical structure.";
165                         type leafref {
166                             path "/policy:subject-feature-definitions/policy:classifier-definition/policy:id";
167                         }
168                     }
169
170                     list supported-parameter-values {
171                         description "Represents supported paramters and its values by renderer.
172                             If it contains only parameter-name without paramater-type, it means that any value is supported.";
173                         key parameter-name;
174
175                         leaf parameter-name {
176                             description "TODO";
177                             type leafref {
178                                 path "/policy:subject-feature-definitions/policy:classifier-definition/policy:parameter/policy:name";
179                             }
180                         }
181
182                         uses has-parameters-type;
183                     }
184                 }
185
186                 list supported-action-definition {
187                     description
188                         "Action definitions this renderer can use.";
189
190                     key action-definition-id;
191
192                     leaf action-definition-id {
193                         description "Reference to an action definition in config datastore.";
194                         type leafref {
195                             path "/policy:subject-feature-definitions/policy:action-definition/policy:id";
196                         }
197                     }
198
199                     leaf parent-action-definition-id {
200                         description
201                             "Optional reference to a parent action definition,
202                             to provide a hierarchical structure.";
203                         type leafref {
204                             path "/policy:subject-feature-definitions/policy:action-definition/policy:id";
205                         }
206                     }
207
208                     list supported-parameter-values {
209                         description "Represents supported paramters and its values by renderer.
210                             If it contains only parameter-name without paramater-type, it means that any value is supported.";
211                         key parameter-name;
212
213                         leaf parameter-name {
214                             description "TODO";
215                             type leafref {
216                                 path "/policy:subject-feature-definitions/policy:action-definition/policy:parameter/policy:name";
217                             }
218                         }
219
220                         uses has-parameters-type;
221                     }
222                 }
223             }
224         }
225     }
226 }