fix ServiceHandler SpotBugs false positives
[transportpce.git] / tests / honeynode / 2.2.1 / honeynode-plugin-api / src / main / yang / openconfig / openconfig-platform-transceiver@2018-01-22.yang
1 module openconfig-platform-transceiver {
2
3   yang-version "1";
4
5   // namespace
6   namespace "http://openconfig.net/yang/platform/transceiver";
7
8   prefix "oc-transceiver";
9
10   // import some basic types
11   import openconfig-platform { prefix oc-platform; }
12   import openconfig-platform-port { prefix oc-port; }
13   import openconfig-interfaces { prefix oc-if; }
14   import openconfig-transport-types { prefix oc-opt-types; }
15   import openconfig-types { prefix oc-types; }
16   import openconfig-extensions { prefix oc-ext; }
17   import openconfig-yang-types { prefix oc-yang; }
18
19
20   // meta
21   organization "OpenConfig working group";
22
23   contact
24     "OpenConfig working group
25     www.openconfig.net";
26
27   description
28     "This module defines configuration and operational state data
29     for transceivers (i.e., pluggable optics).  The module should be
30     used in conjunction with the platform model where other
31     physical entity data are represented.
32
33     In the platform model, a component of type=TRANSCEIVER is
34     expected to be a subcomponent of a PORT component.  This
35     module defines a concrete schema for the associated data for
36     components with type=TRANSCEIVER.";
37
38   oc-ext:openconfig-version "0.4.1";
39
40   revision "2018-01-22" {
41     description
42       "Fixed physical-channel path reference";
43     reference "0.4.1";
44   }
45
46   revision "2017-09-18" {
47     description
48       "Use openconfig-yang-types module";
49     reference "0.4.0";
50   }
51
52   revision "2017-07-08" {
53     description
54       "Adds clarification on aggregate power measurement data";
55     reference "0.3.0";
56   }
57
58   revision "2016-12-22" {
59     description
60       "Adds preconfiguration data and clarified units";
61     reference "0.2.0";
62   }
63
64   // identity statements
65
66   // typedef statements
67
68   // grouping statements
69
70   grouping optical-power-state {
71     description
72       "Reusable leaves related to optical power state -- these
73       are read-only state values. If avg/min/max statistics are
74       not supported, the target is expected to just supply the
75       instant value";
76
77     container output-power {
78       description
79         "The output optical power of a physical channel in units
80         of 0.01dBm, which may be associated with individual
81         physical channels, or an aggregate of multiple physical
82         channels (i.e., for the overall transceiver). For an
83         aggregate, this may be a measurement from a photodetector
84         or a a calculation performed on the device by summing up
85         all of the related individual physical channels.
86         Values include the instantaneous, average, minimum, and
87         maximum statistics. If avg/min/max statistics are not
88         supported, the target is expected to just supply the
89         instant value";
90
91       uses oc-types:avg-min-max-instant-stats-precision2-dBm;
92     }
93
94     container input-power {
95       description
96         "The input optical power of a physical channel in units
97         of 0.01dBm, which may be associated with individual
98         physical channels, or an aggregate of multiple physical
99         channels (i.e., for the overall transceiver). For an
100         aggregate, this may be a measurement from a photodetector
101         or a a calculation performed on the device by summing up
102         all of the related individual physical channels.
103         Values include the instantaneous, average, minimum, and
104         maximum statistics. If avg/min/max statistics are not
105         supported, the target is expected to just supply the
106         instant value";
107
108       uses oc-types:avg-min-max-instant-stats-precision2-dBm;
109     }
110
111     container laser-bias-current {
112       description
113         "The current applied by the system to the transmit laser to
114         achieve the output power. The current is expressed in mA
115         with up to two decimal precision. Values include the
116         instantaneous, average, minimum, and maximum statistics.
117         If avg/min/max statistics are not supported, the target is
118         expected to just supply the instant value";
119
120       uses oc-types:avg-min-max-instant-stats-precision2-mA;
121     }
122   }
123
124   grouping output-optical-frequency {
125     description
126       "Reusable leaves related to optical output power -- this is
127       typically configurable on line side and read-only on the
128       client-side";
129
130     leaf output-frequency {
131       type oc-opt-types:frequency-type;
132       description
133         "The frequency in MHz of the individual physical channel
134         (e.g. ITU C50 - 195.0THz and would be reported as
135         195,000,000 MHz in this model). This attribute is not
136         configurable on most client ports.";
137     }
138   }
139
140
141   grouping physical-channel-config {
142     description
143       "Configuration data for physical client channels";
144
145     leaf index {
146       type uint16 {
147         range 0..max;
148       }
149       description
150         "Index of the physical channnel or lane within a physical
151         client port";
152     }
153
154     leaf description {
155       type string;
156       description
157         "Text description for the client physical channel";
158     }
159
160     leaf tx-laser {
161       type boolean;
162       description
163         "Enable (true) or disable (false) the transmit label for the
164         channel";
165     }
166
167     leaf target-output-power {
168       type decimal64 {
169         fraction-digits 2;
170       }
171       units dBm;
172       description
173         "Target output optical power level of the optical channel,
174         expressed in increments of 0.01 dBm (decibel-milliwats)";
175     }
176   }
177
178   grouping physical-channel-state {
179     description
180       "Operational state data for client channels.";
181
182     uses output-optical-frequency;
183     uses optical-power-state;
184   }
185
186   grouping physical-channel-top {
187     description
188       "Top-level grouping for physical client channels";
189
190     container physical-channels {
191       description
192         "Enclosing container for client channels";
193
194       list channel {
195         key "index";
196         description
197           "List of client channels, keyed by index within a physical
198           client port.  A physical port with a single channel would
199           have a single zero-indexed element";
200
201         leaf index {
202           type leafref {
203             path "../config/index";
204           }
205           description
206             "Reference to the index number of the channel";
207         }
208
209         container config {
210           description
211             "Configuration data for physical channels";
212
213           uses physical-channel-config;
214         }
215
216         container state {
217
218           config false;
219
220           description
221             "Operational state data for channels";
222
223           uses physical-channel-config;
224           uses physical-channel-state;
225         }
226       }
227     }
228   }
229
230
231   grouping port-transceiver-config {
232     description
233       "Configuration data for client port transceivers";
234
235     leaf enabled {
236       type boolean;
237       description
238         "Turns power on / off to the transceiver -- provides a means
239         to power on/off the transceiver (in the case of SFP, SFP+,
240         QSFP,...) or enable high-power mode (in the case of CFP,
241         CFP2, CFP4) and is optionally supported (device can choose to
242         always enable).  True = power on / high power, False =
243         powered off";
244     }
245
246     leaf form-factor-preconf {
247       type identityref {
248         base oc-opt-types:TRANSCEIVER_FORM_FACTOR_TYPE;
249       }
250       description
251         "Indicates the type of optical transceiver used on this
252         port.  If the client port is built into the device and not
253         pluggable, then non-pluggable is the corresponding state. If
254         a device port supports multiple form factors (e.g. QSFP28
255         and QSFP+, then the value of the transceiver installed shall
256         be reported. If no transceiver is present, then the value of
257         the highest rate form factor shall be reported
258         (QSFP28, for example).
259
260         The form factor is included in configuration data to allow
261         pre-configuring a device with the expected type of
262         transceiver ahead of deployment.  The corresponding state
263         leaf should reflect the actual transceiver type plugged into
264         the system.";
265     }
266
267     leaf ethernet-pmd-preconf {
268       type identityref {
269         base oc-opt-types:ETHERNET_PMD_TYPE;
270       }
271       description
272         "The Ethernet PMD is a property of the optical transceiver
273         used on the port, indicating the type of physical connection.
274         It is included in configuration data to allow pre-configuring
275         a port/transceiver with the expected PMD.  The actual PMD is
276         indicated by the ethernet-pmd state leaf.";
277     }
278   }
279
280   grouping port-transceiver-state {
281     description
282       "Operational state data for client port transceivers";
283
284     leaf present {
285       type enumeration {
286         enum PRESENT {
287           description
288             "Transceiver is present on the port";
289         }
290         enum NOT_PRESENT {
291           description
292             "Transceiver is not present on the port";
293         }
294       }
295       description
296         "Indicates whether a transceiver is present in
297         the specified client port.";
298     }
299
300     leaf form-factor {
301       type identityref {
302         base oc-opt-types:TRANSCEIVER_FORM_FACTOR_TYPE;
303       }
304       description
305         "Indicates the type of optical transceiver used on this
306         port.  If the client port is built into the device and not
307         pluggable, then non-pluggable is the corresponding state. If
308         a device port supports multiple form factors (e.g. QSFP28
309         and QSFP+, then the value of the transceiver installed shall
310         be reported. If no transceiver is present, then the value of
311         the highest rate form factor shall be reported
312         (QSFP28, for example).";
313     }
314
315     leaf connector-type {
316       type identityref {
317         base oc-opt-types:FIBER_CONNECTOR_TYPE;
318       }
319       description
320         "Connector type used on this port";
321     }
322
323     leaf internal-temp {
324     // TODO: this should probably be removed if we add temperature
325     // as a top-level component property, i.e., transceiver temp
326     // should be reported there.
327       type int16 {
328         range -40..125;
329       }
330       description
331         "Internally measured temperature in degrees Celsius. MSA
332         valid range is between -40 and +125C. Accuracy shall be
333         better than +/- 3 degC over the whole temperature range.";
334     }
335
336     leaf vendor {
337       type string {
338         length 1..16;
339       }
340       description
341         "Full name of transceiver vendor. 16-octet field that
342         contains ASCII characters, left-aligned and padded on the
343         right with ASCII spaces (20h)";
344     }
345
346     leaf vendor-part {
347       type string {
348         length 1..16;
349       }
350       description
351         "Transceiver vendor's part number. 16-octet field that
352         contains ASCII characters, left-aligned and padded on the
353         right with ASCII spaces (20h). If part number is undefined,
354         all 16 octets = 0h";
355     }
356
357     leaf vendor-rev {
358       type string {
359         length 1..2;
360       }
361       description
362         "Transceiver vendor's revision number. 2-octet field that
363         contains ASCII characters, left-aligned and padded on the
364         right with ASCII spaces (20h)";
365     }
366
367     //TODO: these compliance code leaves should be active based on
368     //the type of port
369     leaf ethernet-pmd {
370       type identityref {
371         base oc-opt-types:ETHERNET_PMD_TYPE;
372       }
373       description
374         "Ethernet PMD (physical medium dependent sublayer) that the
375         transceiver supports. The SFF/QSFP MSAs have registers for
376         this and CFP MSA has similar.";
377     }
378
379     leaf sonet-sdh-compliance-code {
380       type identityref {
381         base oc-opt-types:SONET_APPLICATION_CODE;
382       }
383       description
384         "SONET/SDH application code supported by the port";
385     }
386
387     leaf otn-compliance-code {
388       type identityref {
389         base oc-opt-types:OTN_APPLICATION_CODE;
390       }
391       description
392         "OTN application code supported by the port";
393     }
394
395     leaf serial-no {
396       type string {
397         length 1..16;
398       }
399       description
400         "Transceiver serial number. 16-octet field that contains
401         ASCII characters, left-aligned and padded on the right with
402         ASCII spaces (20h). If part serial number is undefined, all
403         16 octets = 0h";
404     }
405
406     leaf date-code {
407       type oc-yang:date-and-time;
408       description
409         "Representation of the transceiver date code, typically
410         stored as YYMMDD.  The time portion of the value is
411         undefined and not intended to be read.";
412     }
413
414     leaf fault-condition {
415       type boolean;
416       description
417         "Indicates if a fault condition exists in the transceiver";
418     }
419
420     uses optical-power-state;
421
422   }
423
424   grouping port-transceiver-top {
425     description
426       "Top-level grouping for client port transceiver data";
427
428     container transceiver {
429       description
430         "Top-level container for client port transceiver data";
431
432       container config {
433         description
434           "Configuration data for client port transceivers";
435
436         uses port-transceiver-config;
437       }
438
439       container state {
440
441         config false;
442
443         description
444           "Operational state data for client port transceivers";
445
446         uses port-transceiver-config;
447         uses port-transceiver-state;
448       }
449       // physical channels are associated with a transceiver
450       // component
451       uses physical-channel-top;
452     }
453   }
454
455   // data definition statements
456
457   // augment statements
458
459   augment "/oc-platform:components/oc-platform:component" {
460     description
461       "Adding transceiver data to physical inventory";
462
463     uses port-transceiver-top {
464       when "current()/oc-platform:state/" +
465         "oc-platform:type = 'TRANSCEIVER'" {
466         description
467           "Augment is active when component is of type TRANSCEIVER";
468       }
469     }
470   }
471
472   augment "/oc-if:interfaces/oc-if:interface/oc-if:state" {
473     //TODO: add 'when' or other condition to make sure this
474     //leafref points to a component of type TRANSCEIVER.
475     description
476       "Adds a reference from the base interface to its corresponding
477       physical channels.";
478
479     leaf-list physical-channel {
480       type leafref {
481         path "/oc-platform:components/" +
482           "oc-platform:component[oc-platform:name=current()/../oc-port:hardware-port]/" +
483           "oc-transceiver:transceiver/" +
484           "oc-transceiver:physical-channels/oc-transceiver:channel/" +
485           "oc-transceiver:index";
486       }
487       description
488         "For a channelized interface, list of references to the
489         physical channels (lanes) corresponding to the interface.";
490     }
491   }
492
493   // rpc statements
494
495   // notification statements
496
497 }