d72502416259b3d383020a0e67a709f35e38158a
[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 capabilities {
117                 description "Capabilities this renderer provides.";
118
119                 list supported-classifier-definition {
120                     description
121                         "Classifier definitions this renderer can use.";
122
123                     key classifier-definition-id;
124
125                     leaf classifier-definition-id {
126                         description "Reference to a classifier definition in config datastore.";
127                         type leafref {
128                             path "/policy:subject-feature-definitions/policy:classifier-definition/policy:id";
129                         }
130                     }
131
132                     leaf parent-classifier-definition-id {
133                         description
134                             "Optional reference to a parent classifier definition,
135                             to provide a hierarchical structure.";
136                         type leafref {
137                             path "/policy:subject-feature-definitions/policy:classifier-definition/policy:id";
138                         }
139                     }
140
141                     list supported-parameter-values {
142                         description "Represents supported paramters and its values by renderer.
143                             If it contains only parameter-name without paramater-type, it means that any value is supported.";
144                         key parameter-name;
145
146                         leaf parameter-name {
147                             description "TODO";
148                             type leafref {
149                                 path "/policy:subject-feature-definitions/policy:classifier-definition/policy:parameter/policy:name";
150                             }
151                         }
152
153                         uses has-parameters-type;
154                     }
155                 }
156
157                 list supported-action-definition {
158                     description
159                         "Action definitions this renderer can use.";
160
161                     key action-definition-id;
162
163                     leaf action-definition-id {
164                         description "Reference to an action definition in config datastore.";
165                         type leafref {
166                             path "/policy:subject-feature-definitions/policy:action-definition/policy:id";
167                         }
168                     }
169
170                     leaf parent-action-definition-id {
171                         description
172                             "Optional reference to a parent action definition,
173                             to provide a hierarchical structure.";
174                         type leafref {
175                             path "/policy:subject-feature-definitions/policy:action-definition/policy:id";
176                         }
177                     }
178
179                     list supported-parameter-values {
180                         description "Represents supported paramters and its values by renderer.
181                             If it contains only parameter-name without paramater-type, it means that any value is supported.";
182                         key parameter-name;
183
184                         leaf parameter-name {
185                             description "TODO";
186                             type leafref {
187                                 path "/policy:subject-feature-definitions/policy:action-definition/policy:parameter/policy:name";
188                             }
189                         }
190
191                         uses has-parameters-type;
192                     }
193                 }
194             }
195         }
196     }
197 }