474ee33013e615b904049a3e6f16d98749bbed5a
[groupbasedpolicy.git] / groupbasedpolicy / src / main / yang / model / common.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 gbp-common {
10     yang-version 1;
11
12     namespace "urn:opendaylight:groupbasedpolicy:common";
13     prefix "gbp-common";
14
15     description 
16         "Common types and definitions for group-based policy models";
17
18     revision "2014-04-21" {
19         description "Initial revision";
20     }
21
22     // **********
23     // Base types
24     // **********
25
26     typedef description {
27         description "A human-readable description for a object.";
28         type string {
29             length "1..4096";
30         }
31     }
32
33     typedef name {
34         description 
35             "A generic string name type. 
36              Must start with a letter";
37         type string {
38             pattern '[a-zA-Z]([a-zA-Z0-9\-_.])*';
39             length "1..256";
40         }
41     }
42
43     // UUID type from ietf-yang-types@2013-07-15
44     typedef uuid {
45         type string {
46             pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
47                 + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
48         }
49         description
50             "A Universally Unique IDentifier in the string representation 
51              defined in RFC 4122.  The canonical representation uses
52              lowercase characters.
53
54              The following is an example of a UUID in string
55              representation: f81d4fae-7dec-11d0-a765-00a0c91e6bf6";
56         reference
57             "RFC 4122: A Universally Unique IDentifier (UUID) URN
58              Namespace";
59     }
60
61     typedef unique-id {
62         type uuid;
63         description "A globally unique identifier";
64     }
65
66     // *************
67     // Relator names
68     // *************
69
70     typedef relator-name {
71         type name;
72         description "A name for a relator.";
73     }
74
75     typedef target-name {
76         type relator-name;
77         description "A name for a target.";
78     }
79
80     typedef selector-name {
81         type relator-name;
82         description "A name for a selector.";
83     }
84
85     // *****************
86     // Unique object IDs
87     // *****************
88
89     typedef network-domain-id {
90         type unique-id;
91         description "A unique ID for a network domain";
92     }
93     
94     typedef subnet-id {
95         type network-domain-id;
96         description "A unique ID for a subnet";
97     }
98
99     typedef context-id {
100         type network-domain-id;
101         description "A unique ID for a forwarding context";
102     }
103
104     typedef l2-context-id {
105         type context-id;
106         description "A unique ID for a layer 2 context";
107     }
108
109     typedef l2-bridge-domain-id {
110         type l2-context-id;
111         description "A unique ID for a bridge domain";
112     }
113
114     typedef l2-flood-domain-id {
115         type l2-context-id;
116         description "A unique ID for a flood domain";
117     }
118
119     typedef l3-context-id {
120         type context-id;
121         description "A unique ID for a layer 3 context";
122     }
123
124     typedef tenant-id {
125         type unique-id;
126         description "A unique ID for a tenant";
127     }
128
129     typedef endpoint-group-id {
130         type unique-id;
131         description "A unique ID for an endpoint group";
132     }
133
134     typedef contract-id {
135         type unique-id;
136         description "A unique ID for a contract";
137     }
138
139     // *************
140     // Matcher names
141     // *************
142
143     typedef matcher-name {
144         type name;
145         description "A name for a matcher";
146     }
147
148     typedef quality-matcher-name {
149         type matcher-name;
150         description "A name for a quality matcher";
151     }
152
153     typedef requirement-matcher-name {
154         type matcher-name;
155         description "A name for a requirement matcher";
156     }
157
158     typedef condition-matcher-name {
159         type matcher-name;
160         description "A name for a condition matcher";
161     }
162
163     typedef capability-matcher-name {
164         type matcher-name;
165         description "A name for a capability matcher";
166     }
167
168     // *************
169     // Label names
170     // *************
171
172     typedef label-name {
173         type name;
174         description "A name for a label";
175     }
176
177     typedef capability-name {
178         type label-name;
179         description "A name for a capability";
180     }
181
182     typedef requirement-name {
183         type label-name;
184         description "A name for a requirement";
185     }
186
187     typedef quality-name {
188         type label-name;
189         description "A name for a quality.";
190     }
191
192     typedef condition-name {
193         type label-name;
194         description "A name for a condition.";
195     }
196
197     // ****************************
198     // Subject/clause-related names
199     // ****************************
200
201     typedef clause-name {
202         type name;
203         description "A name for a clause.";
204     }
205
206     typedef subject-name {
207         type name;
208         description "A name for a subject.";
209     }
210
211     typedef rule-name {
212         type name;
213         description "A name for a rule.";
214     }
215
216     // ****************
217     // Subject features
218     // ****************
219
220     typedef subject-feature-id {
221         type unique-id;
222         description "A unique ID for a parameterized object";
223     }
224
225     typedef classifier-definition-id {
226         type subject-feature-id;
227         description "A unique ID for a classifier.";
228     }
229
230     typedef action-definition-id {
231         type subject-feature-id;
232         description "A unique ID for an action.";
233     }
234
235     typedef subject-feature-name {
236         type name;
237         description "A name for a parameterized object";
238     }
239
240     typedef classifier-name {
241         type subject-feature-name;
242         description "A name for a classifier.";
243     }
244
245     typedef action-name {
246         type subject-feature-name;
247         description "A name for an action.";
248     }
249
250     typedef parameter-name {
251         type name;
252         description "A name for a parameter.";
253     }
254 }