blob: 377a64047af9ecb89226bc4d87f2c5abe9848d32 [file] [log] [blame]
Thomas Vachuska6655bee2017-08-24 16:12:59 -07001module openconfig-platform {
2
3 yang-version "1";
4
5 // namespace
6 namespace "http://openconfig.net/yang/platform";
7
8 prefix "oc-platform";
9
10 import openconfig-platform-types { prefix oc-platform-types; }
11 import openconfig-interfaces { prefix oc-if; }
12 import openconfig-extensions { prefix oc-ext; }
13
14
15 // meta
16 organization "OpenConfig working group";
17
18 contact
19 "OpenConfig working group
20 www.openconfig.net";
21
22 description
23 "This module defines a data model for representing a system
24 component inventory, which can include hardware or software
25 elements arranged in an arbitrary structure. The primary
26 relationship supported by the model is containment, e.g.,
27 components containing subcomponents.
28
29 It is expected that this model reflects every field replacable
30 unit on the device at a minimum (i.e., additional information
31 may be supplied about non-replacable components).
32
33 Every element in the inventory is termed a 'component' with each
34 component expected to have a unique name and type, and optionally
35 a unique system-assigned identifier and FRU number. The
36 uniqueness is guaranteed by the system within the device.
37
38 Components may have properties defined by the system that are
39 modeled as a list of key-value pairs. These may or may not be
40 user-configurable. The model provides a flag for the system
41 to optionally indicate which properties are user configurable.
42
43 Each component also has a list of 'subcomponents' which are
44 references to other components. Appearance in a list of
45 subcomponents indicates a containment relationship as described
46 above. For example, a linecard component may have a list of
47 references to port components that reside on the linecard.
48
49 This schema is generic to allow devices to express their own
50 platform-specific structure. It may be augmented by additional
51 component type-specific schemas that provide a common structure
52 for well-known component types. In these cases, the system is
53 expected to populate the common component schema, and may
54 optionally also represent the component and its properties in the
55 generic structure.
56
57 The properties for each component may include dynamic values,
58 e.g., in the 'state' part of the schema. For example, a CPU
59 component may report its utilization, temperature, or other
60 physical properties. The intent is to capture all platform-
61 specific physical data in one location, including inventory
62 (presence or absence of a component) and state (physical
63 attributes or status).";
64
65 oc-ext:openconfig-version "0.5.0";
66
67 revision "2016-12-22" {
68 description
69 "Added temperature state variable to component";
70 reference "0.5.0";
71 }
72
73 // grouping statements
74
75
76 grouping platform-component-properties-config {
77 description
78 "System-defined configuration data for component properties";
79
80 leaf name {
81 type string;
82 description
83 "System-supplied name of the property -- this is typically
84 non-configurable";
85 }
86
87 leaf value {
88 type union {
89 type string;
90 type boolean;
91 type int64;
92 type uint64;
93 type decimal64 {
94 fraction-digits 2;
95 }
96 }
97 description
98 "Property values can take on a variety of types. Signed and
99 unsigned integer types may be provided in smaller sizes,
100 e.g., int8, uint16, etc.";
101 }
102 }
103
104 grouping platform-component-properties-state {
105 description
106 "Operational state data for component properties";
107
108 leaf configurable {
109 type boolean;
110 description
111 "Indication whether the property is user-configurable";
112 }
113 }
114
115 grouping platform-component-properties-top {
116 description
117 "Top-level grouping ";
118
119 container properties {
120 description
121 "Enclosing container ";
122
123 list property {
124 key "name";
125 description
126 "List of system properties for the component";
127
128 leaf name {
129 type leafref {
130 path "../config/name";
131 }
132 description
133 "Reference to the property name.";
134 }
135
136 container config {
137 description
138 "Configuration data for each property";
139
140 uses platform-component-properties-config;
141 }
142
143 container state {
144
145 config false;
146
147 description
148 "Operational state data for each property";
149
150 uses platform-component-properties-config;
151 uses platform-component-properties-state;
152 }
153 }
154 }
155 }
156
157 grouping platform-subcomponent-ref-config {
158 description
159 "Configuration data for subcomponent references";
160
161 leaf name {
162 type leafref {
163 path "../../../../../component/config/name";
164 }
165 description
166 "Reference to the name of the subcomponent";
167 }
168 }
169
170 grouping platform-subcomponent-ref-state {
171 description
172 "Operational state data for subcomponent references";
173
174 }
175
176 grouping platform-subcomponent-ref-top {
177 description
178 "Top-level grouping for list of subcomponent references";
179
180 container subcomponents {
181 description
182 "Enclosing container for subcomponent references";
183
184 list subcomponent {
185 key "name";
186 description
187 "List of subcomponent references";
188
189 leaf name {
190 type leafref {
191 path "../config/name";
192 }
193 description
194 "Reference to the name list key";
195 }
196
197 container config {
198 description
199 "Configuration data ";
200
201 uses platform-subcomponent-ref-config;
202 }
203
204 container state {
205
206 config false;
207
208 description
209 "Operational state data ";
210
211 uses platform-subcomponent-ref-config;
212 uses platform-subcomponent-ref-state;
213 }
214 }
215 }
216 }
217
218 grouping platform-component-config {
219 description
220 "Configuration data for components";
221
222 leaf name {
223 type string;
224 description
225 "Device name for the component -- this will not be a
226 configurable parameter on many implementations";
227 }
228 }
229
230 grouping platform-component-state {
231 description
232 "Operational state data for device components.";
233
234 leaf type {
235 type union {
236 type identityref {
237 base oc-platform-types:OPENCONFIG_HARDWARE_COMPONENT;
238 }
239 type identityref {
240 base oc-platform-types:OPENCONFIG_SOFTWARE_COMPONENT;
241 }
242 }
243 description
244 "Type of component as identified by the system";
245 }
246
247 leaf id {
248 type string;
249 description
250 "Unique identifier assigned by the system for the
251 component";
252 }
253
254 leaf description {
255 type string;
256 description
257 "System-supplied description of the component";
258 }
259
260 leaf mfg-name {
261 type string;
262 description
263 "System-supplied identifier for the manufacturer of the
264 component. This data is particularly useful when a
265 component manufacturer is different than the overall
266 device vendor.";
267 }
268
269 leaf version {
270 type string;
271 description
272 "System-defined version string for a hardware, firmware,
273 or software component.";
274 }
275
276 leaf serial-no {
277 type string;
278 description
279 "System-assigned serial number of the component.";
280 }
281
282 leaf part-no {
283 type string;
284 description
285 "System-assigned part number for the component. This should
286 be present in particular if the component is also an FRU
287 (field replacable unit)";
288 }
289 }
290
291 grouping platform-component-temp-state {
292 description
293 "Temperature state data for device components";
294
295 container temperature {
296 description
297 "Temperature in degrees Celsius of the component. Values include
298 the instantaneous, average, minimum, and maximum statistics. If
299 avg/min/max statistics are not supported, the target is expected
300 to just supply the instant value";
301
302 uses oc-platform-types:avg-min-max-instant-stats-precision1-celsius;
303 }
304 }
305
306 grouping platform-component-top {
307 description
308 "Top-level grouping for components in the device inventory";
309
310 container components {
311 description
312 "Enclosing container for the components in the system.";
313
314 list component {
315 key "name";
316 description
317 "List of components, keyed by component name.";
318
319 leaf name {
320 type leafref {
321 path "../config/name";
322 }
323 description
324 "References the component name";
325 }
326
327 container config {
328 description
329 "Configuration data for each component";
330
331 uses platform-component-config;
332 }
333
334 container state {
335
336 config false;
337
338 description
339 "Operational state data for each component";
340
341 uses platform-component-config;
342 uses platform-component-state;
343 uses platform-component-temp-state;
344 }
345
346 uses platform-component-properties-top;
347 uses platform-subcomponent-ref-top;
348 }
349 }
350 }
351
352 // data definition statements
353
354 uses platform-component-top;
355
356
357 // augments
358
359 augment "/oc-if:interfaces/oc-if:interface/oc-if:state" {
360 //TODO: add 'when' or other condition to make sure this
361 //leafref points to a component of type PORT.
362 description
363 "Adds a reference from the base interface to the corresponding
364 port component in the device inventory.";
365
366 leaf hardware-port {
367 type leafref {
368 path "/oc-platform:components/oc-platform:component/" +
369 "oc-platform:name";
370 }
371 description
372 "References the hardware port in the device inventory";
373 }
374 }
375
376}