Add newline at the end of the document, for triggering a new release.
[sim/o1-interface.git] / ntsimulator / yang / o-ran-hardware.yang
1 module o-ran-hardware {
2   yang-version 1.1;
3   namespace "urn:o-ran:hardware:1.0";
4   prefix "o-ran-hw";
5
6   import ietf-hardware {
7     prefix hw;
8   }
9   import iana-hardware {
10     prefix ianahw;
11   }
12
13   organization "O-RAN Alliance";
14
15   contact
16     "www.o-ran.org";
17
18   description
19     "This module defines the YANG definitions for managng the O-RAN hardware.
20
21      Copyright 2019 the O-RAN Alliance.
22
23      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
24      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33      POSSIBILITY OF SUCH DAMAGE.
34
35      Redistribution and use in source and binary forms, with or without
36      modification, are permitted provided that the following conditions are met:
37
38      * Redistributions of source code must retain the above copyright notice,
39      this list of conditions and the above disclaimer.
40      * Redistributions in binary form must reproduce the above copyright notice,
41      this list of conditions and the above disclaimer in the documentation
42      and/or other materials provided with the distribution.
43      * Neither the Members of the O-RAN Alliance nor the names of its
44      contributors may be used to endorse or promote products derived from
45      this software without specific prior written permission.";
46
47    revision "2019-03-28" {
48     description
49       "version 1.0.1
50
51       1) added new identities to accommodate cross working group use of
52       o-ran-hardware and assoicated set of augmentations that are backwards
53       compatible to version 1.0.0";
54
55     reference "ORAN-WG4.M.0-v01.00";
56    }
57
58   revision "2019-02-04" {
59    description
60      "version 1.0.0
61
62      1) imported model from xRAN
63      2) changed namespace and reference from xran to o-ran";
64
65    reference "ORAN-WG4.M.0-v01.00";
66   }
67
68   feature ENERGYSAVING {
69     description
70       "Indicates that the Radio Unit supports energy saving state.";
71   }
72
73   // identity statements
74   identity O-RAN-RADIO {
75     base ianahw:module;
76     description
77       "Module used as it represents a self-contained sub-system
78       used in /hw:/hardware/hw:component/hw:class to represent
79       an O-RAN RU";
80   }
81
82   identity O-RAN-HW-COMPONENT {
83     base ianahw:module;
84     description
85       "Module used as it represents a self-contained sub-system
86       used in /hw:/hardware/hw:component/hw:class to represent
87       any O-RAN hardware component";
88   }
89
90   identity O-DU-COMPONENT {
91     base O-RAN-HW-COMPONENT;
92     description
93       "Used in /hw:/hardware/hw:component/hw:class to represent
94       any O-RAN defined O-DU hardware component";
95   }
96
97   identity O-RU-COMPONENT {
98     base O-RAN-HW-COMPONENT;
99     description
100       "Used in /hw:/hardware/hw:component/hw:class to represent
101       any O-RAN defined O-RU hardware component, including a stand-alone
102       O-RU or an O-RU component integrated into a multi-module system.";
103   }
104
105   // typedef statements
106   typedef energysaving-state {
107     type enumeration {
108       enum UNKNOWN {
109         description "The Radio Unit is unable to report energy saving state.";
110       }
111       enum SLEEPING {
112         description
113           "The Radio Unit is in a sleep state. The NETCONF management plane
114            connection is functioning. Other functions and hardware which are
115            not needed for management plane may be in energy saving mode.";
116       }
117       enum AWAKE {
118         description
119           "The Radio Unit is not in an energy saving state.";
120       }
121     }
122     description
123       "new typedef since ietf-hardware only covers pwer-state
124       for redundancy purposes and not power saving operations.";
125   }
126
127   typedef availability-type {
128     type enumeration {
129       enum UNKNOWN {
130         description "The Radio Unit is unable to report its availability state.";
131       }
132       enum NORMAL {
133         description
134           "The equipment is functioning correctly.";
135       }
136       enum DEGRADED {
137         description
138           "The equipment may be reporting a major alarm or may be reporting a critical
139            alarm that is only impacting one or more subcomponent, but where the
140            equipment's implementation permit it to continue operation (server traffic)
141            in a degraded state.
142
143            Used for example, when the equipment has M identical sub-components and
144            when a critical alarm is imapcting only N subcomponents, where N<M.";
145       }
146       enum FAULTY {
147         description
148           "The (sub-)components impacted by the critical alarm(s) impact the
149           ability of the equipment to continue operation (serve traffic).";
150       }
151     }
152     description
153       "Equipment's availability-state is derived by matching active faults
154        and their impact to module's operation and enables an equipment to indicate
155        that even though it may have one or more critical alarms, it can continue
156        to serve traffic.";
157   }
158
159   // common WG4 and croos-WG augmentations using O-RAN-RADIO identity
160
161   augment "/hw:hardware/hw:component" {
162     when "(derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-RADIO')) or
163     (derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-HW-COMPONENT'))";
164     description "New O-RAN parameters for o-ran hardware";
165
166     container label-content {
167       config false;
168       description
169         "Which set of attributes are printed on the Radio Unit's label";
170       leaf model-name {
171         type boolean;
172         description
173           "indicates whether model-name is included on the equipment's label";
174       }
175       leaf serial-number {
176         type boolean;
177         description
178           "indicates whether serial number is included on the equipment's label";
179       }
180     }
181     leaf product-code {
182       type string;
183       config false;
184       mandatory true;
185       description
186         "O-RAN term that is distinct from model-name in ietf-hardware.";
187     }
188     leaf energy-saving-enabled {
189       if-feature "ENERGYSAVING";
190       type boolean;
191       config true;
192       default false;
193       description
194         "This parameter can enable O-RAN unit to be switched to energy
195          saving mode.
196          TRUE indicates to switch the energy saving mode.
197          FALSE indicates to cancel the energy saving mode.
198          At the energy saving mode, all power of whole O-RAN unit becomes
199          lowest level whereas M-plane is still available";
200     }
201   }
202
203   augment "/hw:hardware/hw:component" {
204     when "(derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-RADIO')) or
205     (derived-from-or-self(hw:class, 'ianahw:port')) or
206     (derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-HW-COMPONENT'))";
207     description "New O-RAN parameters for o-ran naming";
208     leaf o-ran-name {
209       type leafref {
210         path "/hw:hardware/hw:component/hw:name";
211       }
212       must "re-match(current(),'[a-zA-Z0-9][a-zA-Z0-9\\.\\-_]{0,253}[a-zA-Z0-9]')" {
213         error-message "Name must match pattern and length.";
214       }
215       mandatory true;
216       description
217         "O-RAN name needed to bind and match with the name of hw element,
218         to be compliant with O-RAN naming convention.";
219     }
220   }
221
222   augment "/hw:hardware/hw:component/hw:state"  {
223     when "(derived-from-or-self(../hw:class, 'o-ran-hw:O-RAN-RADIO')) or
224     (derived-from-or-self(../hw:class, 'o-ran-hw:O-RAN-HW-COMPONENT'))";
225     description
226       "new O-RAN defined state";
227     leaf power-state {
228       if-feature "ENERGYSAVING";
229       type energysaving-state;
230       config false;
231       description
232         "The current power saving state for this component.
233         Note - hw:/hardware/compnent/state/standby-state defined in RFC 4268 is
234         used for redundancy purposes and not power saving operations.";
235     }
236     leaf availability-state {
237       type availability-type;
238       config false;
239       description
240         "Equipment's availability-state is derived by matching active faults
241          and their impact to module's operation and enables an equipment to indicate
242          that even though it may have one or more critical alarms, it can continue
243          to serve traffic.";
244     }
245   }
246
247
248 // augmentations to Notifications
249
250   augment "/hw:hardware-state-oper-enabled"  {
251     description "new availability state";
252     leaf availability-state {
253       type leafref {
254         path "/hw:hardware/hw:component/hw:state/o-ran-hw:availability-state";
255       }
256       description
257         "The availability-state of the O-RU.";
258     }
259   }
260
261   augment "/hw:hardware-state-oper-disabled"  {
262     description "new availability state";
263     leaf availability-state {
264       type leafref {
265         path "/hw:hardware/hw:component/hw:state/o-ran-hw:availability-state";
266       }
267       description
268         "The availability-state of the O-RU.";
269     }
270   }
271 }