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