Support of WG4 OpenFronthaul Management-Plane VES
[scp/oam/modeling.git] / data-model / yang / published / opnfv / yes-types.yang
1 module yes-types {
2   yang-version 1.1;
3   namespace "urn:opnfv:params:xml:ns:yang:yes-types";
4   prefix yt;
5
6   import ietf-yang-types {
7     prefix yang;
8     reference
9       "RFC 6991: Common YANG Data Types.";
10   }
11
12   organization
13     "Open Platform for NFV (OPNFV) - Virtual Event Streaming (VES) project";
14   contact
15     "wiki.opnfv.org/display/ves";
16   description
17     "This module contains common type definitions and groupings of the
18      yang-based-event-stream (YES). Such definitions could be used also outside of
19      YES if appropriate.
20
21      Copyright 2020 highstreet technologies GmbH and others.
22
23      Licensed under the Apache License, Version 2.0 (the 'License');
24      you may not use this file except in compliance with the License.
25      You may obtain a copy of the License at
26
27       http://www.apache.org/licenses/LICENSE-2.0
28
29      Unless required by applicable law or agreed to in writing, software
30      distributed under the License is distributed on an 'AS IS' BASIS,
31      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32      See the License for the specific language governing permissions and
33      limitations under the License.";
34
35   revision 2020-06-28 {
36     description
37       "Initial version";
38     reference
39       "ONAP SDN-R: wiki.onap.org/display/DW/SDN-R
40        VES: wiki.opnfv.org/display/ves/VES+Home
41             docs.onap.org/en/frankfurt/submodules/dcaegen2.git/docs/sections/services/ves-http
42        YES: wiki.opnfv.org/display/ves/VES+goes+YES";
43   }
44
45   /*
46    * Identities
47    */
48
49   identity domain-id {
50     description
51       "Base identity for the event domain.  A unique identification of the
52        event domain.
53
54        This identity is abstract and MUST NOT be used for domains.";
55   }
56
57   identity event-type-id {
58     description
59       "Base identity for the event type.  A unique identification of the
60        event type.
61
62        This identity is abstract and MUST NOT be used for event types.";
63   }
64
65   identity application {
66     base event-type-id;
67     description
68       "Indicates that the event is raised by a software application.";
69     reference
70       "https://en.wikipedia.org/wiki/Application_software";
71   }
72
73   identity micro-service {
74     base event-type-id;
75     description
76       "Indicates that the event is raised by a software micro-service.";
77     reference
78       "https://en.wikipedia.org/wiki/Microservices";
79   }
80
81   identity guest-operating-system {
82     base event-type-id;
83     description
84       "Indicates that the event is raised by the operating system of a
85        guest virtual network function.";
86   }
87
88   identity host-operating-system {
89     base event-type-id;
90     description
91       "Indicates that the event is raised by the operating system of a
92        host system running virtual network functions.";
93   }
94
95   identity platform {
96     base event-type-id;
97     description
98       "Indicates that the event is raised by the cloud and/or data center
99        itself.";
100   }
101
102   identity physical-network-function {
103     base event-type-id;
104     description
105       "Indicates that the event is raised by a physical network function.";
106   }
107
108   identity performance-measurement-type-id {
109     description
110       "Base identity for performance measurement types. A unique identification
111        of the performance measurement value, not including the resource.
112        Different resources can share performance measurement types. If the
113        resource reports the same performance measurement type, it is to be
114        considered to be the same performance measurement.
115
116        This identity is abstract and MUST NOT be used for performance
117        measurement.";
118   }
119
120   identity performance-measurement-unit-id {
121     description
122       "Base identity for performance measurement units.
123
124        This identity is abstract and MUST NOT be used for performance
125        measurement.";
126   }
127
128   identity celsius {
129     base performance-measurement-unit-id;
130     description
131       "°C: Grad Celsius";
132   }
133
134   identity dBm {
135     base performance-measurement-unit-id;
136     description
137       "dBm is unit of level used to indicate that a power ratio is expressed in
138        decibels (dB) with reference to one milliwatt (mW).";
139   }
140
141   identity dB {
142     base performance-measurement-unit-id;
143     description
144       "dB: decibels";
145   }
146
147   identity fahrenheit {
148     base performance-measurement-unit-id;
149     description
150       "°F: Grad Fahrenheit";
151   }
152
153   identity mW {
154     base performance-measurement-unit-id;
155     description
156       "mW: milliwatt";
157   }
158
159   identity kHz {
160     base performance-measurement-unit-id;
161     description
162       "kHz: kilohertz";
163   }
164
165   /*
166    * Type definitions
167    */
168
169   typedef domain-id {
170     type identityref {
171       base domain-id;
172     }
173     description
174       "Identifies an event domain. The description of the domain
175        identifier MUST indicate if the domain identifier is abstract or not.
176        An abstract domain identifier is used as a base for other domain ids
177        and will not be used as a value for a domain or be present in
178        the event.";
179   }
180
181   typedef event-type-id {
182     type identityref {
183       base event-type-id;
184     }
185     description
186       "Identifies an event type. The description of the event type
187        MUST indicate if the event type is abstract or not.
188        An abstract event type is used as a base for other event types
189        and will not be used as a value for an event.";
190   }
191
192   typedef pm-value-type {
193     type union {
194       type uint64;
195       type int64;
196       type decimal64 {
197         fraction-digits 2;
198       }
199       type decimal64 {
200         fraction-digits 17;
201       }
202     }
203     description
204       "Inspired and copied from OpenROADM. A generic type definition
205        for performance monitoring values.";
206   }
207
208   typedef performance-measurement-type-id {
209     type identityref {
210       base performance-measurement-type-id;
211     }
212     description
213       "Identifies an performance-measurement type. The description of the
214        performance measurement type id MUST indicate if the performance
215        measurement type is abstract or not. An abstract performance measurement
216        type is used as a base for other performance measurement type ids
217        and will not be used as a value for an performance measurement or be
218        present in the performance measurement inventory.";
219   }
220
221   typedef performance-measurement-unit-id {
222     type identityref {
223       base performance-measurement-unit-id;
224     }
225     description
226       "Identifies an performance-measurement unit. The description of the
227        performance measurement unit id MUST indicate if the performance
228        measurement unit is abstract or not. An abstract performance measurement
229        unit is used as a base for other performance measurement unit ids
230        and will not be used as a value for an performance measurement or be
231        present in the performance measurement inventory.";
232   }
233
234   typedef priority {
235     type enumeration {
236       enum high {
237         description
238           "Indicates the highest priority of an event. This value SHOULD
239            be used only in very rare cases, where it must be ensured,
240            that the event SHOULD be processed immediately by-passing any
241            queue. ";
242       }
243       enum medium {
244         description
245           "This value SHOULD be used to indicate that the event SHOULD
246            be processed faster than default. ";
247       }
248       enum normal {
249         description
250           "The default value of a event priority.";
251       }
252       enum low {
253         description
254           "Indicates that such event can be process, when the processing
255            system is idle.";
256       }
257     }
258     description
259       "A non-extensible enumeration defining the different priority levels.
260        In case of resource constrainer and overload scenarios an event with
261        a higher priority SHOULD be handled first.";
262   }
263
264   typedef resource {
265     type union {
266       type instance-identifier {
267         require-instance false;
268       }
269       type yang:object-identifier;
270       type string;
271       type yang:uuid;
272     }
273     description
274       "This is an identification of the event emitting resource, such as an
275        interface.  It should be as fine-grained as possible both to
276        guide the operator and to guarantee uniqueness of the event emitting
277        resource.
278
279        If the resource is modeled in YANG, this type will
280        be an instance-identifier.
281
282        If the resource is an SNMP object, the type will be an
283        object-identifier.
284
285        If the resource is anything else, for example a distinguished
286        name or a CIM path, this type will be a string.
287
288        If the alarming object is identified by a UUID use the uuid
289        type.  Be cautious when using this type, since a UUID is hard
290        to use for an operator.
291
292        If the server supports several models, the precedence should
293        be in the order as given in the union definition.";
294     reference
295       "RRC 8632: Type Definition 'resource'";
296   }
297
298   /*
299    * Groupings
300    */
301
302   grouping schema-grp {
303     leaf namespace {
304       type string {
305         length "1..255";
306       }
307       mandatory true;
308       description
309         "The (YANG-) schema namespace as as unique reference.";
310     }
311     leaf module {
312       type string {
313         length "1..255";
314       }
315       description
316         "The (YANG-) module name.";
317     }
318     leaf revision {
319       type yang:date-and-time;
320       description
321         "The revision date of the (YANG-) schema.";
322     }
323     description
324       "An object class to reference a (YANG-) schema.";
325   }
326 }