Import OPNVF Yang based Event Stream
[scp/oam/modeling.git] / data-model / yang / published / opnfv / yes-fault.yang
1 module yes-fault {
2     yang-version 1.1;
3     namespace "urn:opnfv:params:xml:ns:yang:yes-fault";
4     prefix yf;
5
6     import yang-based-event-stream {
7         prefix yes;
8         reference
9           "wiki.opnfv.org/display/ves/VES+goes+YES";
10     }
11     import yes-types {
12         prefix yt;
13         reference
14           "wiki.opnfv.org/display/ves/VES+goes+YES";
15     }
16     import ietf-alarms {
17         prefix al;
18         reference
19           "RFC 8632: A YANG Data Model for Alarm Management";
20     }
21
22     organization
23       "Open Platform for NFV (OPNFV) - Virtual Event Streaming (VES) project";
24     contact
25       "wiki.opnfv.org/display/ves";
26     description
27       "This module is inspired by VES 7.1.1 but uses YANG concepts and types to
28        describe the exchanged data format.
29
30        Copyright 2020 highstreet technologies GmbH and others.
31
32        Licensed under the Apache License, Version 2.0 (the 'License');
33        you may not use this file except in compliance with the License.
34        You may obtain a copy of the License at
35
36         http://www.apache.org/licenses/LICENSE-2.0
37
38        Unless required by applicable law or agreed to in writing, software
39        distributed under the License is distributed on an 'AS IS' BASIS,
40        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41        See the License for the specific language governing permissions and
42        limitations under the License.";
43
44     revision 2020-06-28 {
45         description
46           "Initial version";
47         reference
48           "ONAP SDN-R: wiki.onap.org/display/DW/SDN-R
49            VES: wiki.opnfv.org/display/ves/VES+Home
50                 docs.onap.org/en/frankfurt/submodules/dcaegen2.git/docs/sections/services/ves-http
51            YES: wiki.opnfv.org/display/ves/VES+goes+YES";
52     }
53
54     /*
55      * Identities
56      */
57     identity fault {
58         base yt:domain-id;
59         description
60           "Indicates, that the event body contains fault(s) related asynchronous
61            message context.";
62     }
63
64     identity category-id {
65         description
66           "Base identity for the alarm category.  A unique identification of the
67            alarm category.
68
69            This identity is abstract and MUST NOT be used for alarm categories.";
70     }
71
72     identity license {
73         base category-id;
74         description
75           "The alarm is related to a license.";
76     }
77
78     identity hardware {
79         base category-id;
80         description
81           "The alarm is related to hardware.";
82     }
83
84     identity link {
85         base category-id;
86         description
87           "The alarm is related to telecommunication and/or infrastructure
88            link.";
89     }
90
91     identity routing {
92         base category-id;
93         description
94           "The alarm is related to packet routing.";
95     }
96
97     identity security {
98         base category-id;
99         description
100           "The alarm is related to security.";
101     }
102     identity signaling {
103         base category-id;
104         description
105           "The alarm is related to network signaling.";
106     }
107
108     /*
109      * Type definitions
110      */
111     typedef category-id {
112         type identityref {
113             base category-id;
114         }
115         description
116           "Identifies an alarm category. The description of the alarm category
117            identifier MUST indicate if the alarm category identifier is abstract
118            or not.
119            An abstract alarm category identifier is used as a base for other
120            alarm category ids and will not be used as a value for a category or
121            be present in the fault event.";
122     }
123
124     /*
125      * Groupings
126      */
127     grouping fault-grp {
128         leaf condition {
129             type string {
130                 length "255";
131             }
132             mandatory true;
133             description
134               "The alarm condition reported by the network function.";
135         }
136         leaf interface {
137             type al:resource;
138             description
139               "The card, port, channel or interface name of the network function
140                generating the alarm:
141
142                TODO: Shouldn't this leaf be mandatory for alarm correlation?";
143         }
144         leaf category {
145             type category-id;
146             description
147               "Event category, for example: license, link, routing, security,
148                signaling.";
149         }
150         leaf severity {
151             type al:severity-with-clear;
152             mandatory true;
153             description
154               "The event severity.";
155         }
156         leaf source-type {
157             type string {
158                 length "255";
159             }
160             mandatory true;
161             description
162               "Type of event source; examples: card, host, other, port,
163                portThreshold, router, slotThreshold, switch, virtualMachine,
164                virtualNetworkFunction.
165
166                TODO: Is this needed? or What is the difference to category?";
167         }
168         leaf specific-problem {
169             type string {
170                 length "255";
171             }
172             description
173               "A short description of the alarm or problem.";
174         }
175         leaf network-function-status {
176             type enumeration {
177                 enum enabled {
178                     description
179                       "The network function is operational.";
180                 }
181                 enum disabled {
182                     description
183                       "The network function is not operational.";
184                 }
185             }
186             description
187               "The operational status of the network function.";
188         }
189         description
190           "An object class containing all fault specific parameters.";
191     }
192
193     /*
194      * Augmentation of YES
195      */
196     augment "/yes:event-history/yes:event" {
197         when "derived-from-or-self(/yes:event-history/yes:event/yes:header/yes:domain, 'yf:fault')" {
198             description
199               "The event header must indicate 'fault'.";
200         }
201         if-feature yes:event-history;
202         list fault {
203             uses fault-grp;
204             description
205               "A list for fault objects.";
206         }
207         description
208           "Adds to YES the specifics of fault notifications.";
209     }
210
211     augment "/yes:yang-based-event-stream/yes:event" {
212         when "derived-from-or-self(/yes:yang-based-event-stream/yes:event/yes:header/yes:domain, 'yf:fault')" {
213             description
214               "The event header must indicate 'fault'.";
215         }
216         list fault {
217             uses fault-grp;
218             description
219               "A list for fault objects.";
220         }
221         description
222           "Adds to YES the specifics of fault notifications.";
223     }
224 }