diff --git a/confdgnmi/Makefile b/confdgnmi/Makefile index bf5b6c5..8eba6f9 100644 --- a/confdgnmi/Makefile +++ b/confdgnmi/Makefile @@ -35,9 +35,11 @@ SRC_DIR=src TEST_DIR=tests PCG_DIR=$(SRC_DIR) +OC_YANG = $(shell grep -L ^submodule oc/*.yang) +OC_FXS = $(OC_YANG:oc/%.yang=%.fxs) all: gnmi_proto \ - iana-if-type.fxs ietf-interfaces.fxs route-status.fxs \ + iana-if-type.fxs ietf-interfaces.fxs route-status.fxs $(OC_FXS) \ $(CDB_DIR) ssh-keydir init_interfaces.xml @echo "Build complete" @@ -47,6 +49,10 @@ all: gnmi_proto \ init_interfaces.xml: ./datagen.py 10 + +$(OC_FXS) : %.fxs : oc/%.yang + confdc -c -o $@ --yangpath oc/ $^ + gnmi_proto: python -m grpc_tools.protoc -I$(PCG_DIR)/proto --python_out=$(PCG_DIR) --grpc_python_out=$(PCG_DIR) $(PCG_DIR)/proto/gnmi.proto $(PCG_DIR)/proto/gnmi_ext.proto @@ -69,6 +75,7 @@ start: stop $(CONFD) -c confd.conf $(CONFD_FLAGS) confd_load -m -l ./init_interfaces.xml confd_load -m -O -l ./init_interfaces_state.xml + confd_load -mol ./oc-interfaces.xml ./oc-components.xml ###################################################################### stop: diff --git a/confdgnmi/README.md b/confdgnmi/README.md index 7f5579b..d941c60 100644 --- a/confdgnmi/README.md +++ b/confdgnmi/README.md @@ -1,5 +1,5 @@ # ConfD gNMI Adapter Demo - + This project represents ConfD gNMI Adapter demo. -See `docs/ConfD_gNMI_adapter.adoc` for the User and Developer documentation. \ No newline at end of file +See [docs/ConfD_gNMI_adapter.adoc](docs/ConfD_gNMI_adapter.adoc) for the User and Developer documentation. diff --git a/confdgnmi/datagen.py b/confdgnmi/datagen.py index b5cc250..82e8c1d 100755 --- a/confdgnmi/datagen.py +++ b/confdgnmi/datagen.py @@ -4,8 +4,7 @@ def gen_intf(name): - interface = """ + interface = """ {} gigabitEthernet diff --git a/confdgnmi/oc-components.xml b/confdgnmi/oc-components.xml new file mode 100644 index 0000000..c5ed527 --- /dev/null +++ b/confdgnmi/oc-components.xml @@ -0,0 +1,98 @@ + + + + box0 + + box0 + + + box0 + + + + confd + + confd + + + confd + + + + cpu0 + + cpu0 + + + cpu0 + + + + confd + + confd + + + confd + + + + fan0 + + fan0 + + + fan0 + + + + + + fan0 + + fan0 + + + fan0 + + + + fan1 + + fan1 + + + fan1 + + + + lc0 + + lc0 + + + lc0 + + + + cpu0 + + cpu0 + + + cpu0 + + + + fan1 + + fan1 + + + fan1 + + + + + + diff --git a/confdgnmi/oc-interfaces.xml b/confdgnmi/oc-interfaces.xml new file mode 100644 index 0000000..fd58346 --- /dev/null +++ b/confdgnmi/oc-interfaces.xml @@ -0,0 +1,80 @@ + + + + GigabitEthernet1/1/1 + + GigabitEthernet1/1/1 + ianaift:ethernetCsmacd + true + + + GigabitEthernet1/1/1 + + + + 12 + + 12 + + + 12 + + + + + + Port-channel1 + + Port-channel1 + ianaift:propVirtual + true + + + Port-channel1 + + + + 1 + + 1 + + + 1 + + + + + + gig0 + + gig0 + ianaift:ethernetCsmacd + + + gig0 + + + + 00:11:22:33:44:55 + false + SPEED_10GB + + + + TRUNK + + + + + + gig2 + + gig2 + ianaift:gigabitEthernet + + + gig2 + + + + diff --git a/confdgnmi/oc/openconfig-alarm-types.yang b/confdgnmi/oc/openconfig-alarm-types.yang new file mode 100644 index 0000000..c4617b5 --- /dev/null +++ b/confdgnmi/oc/openconfig-alarm-types.yang @@ -0,0 +1,150 @@ +module openconfig-alarm-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/alarms/types"; + + prefix "oc-alarm-types"; + + // import some basic types + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines operational state data related to alarms + that the device is reporting. + + This model reuses some data items defined in the draft IETF + YANG Alarm Module: + https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02 + + Portions of this code were derived from the draft IETF YANG Alarm + Module. Please reproduce this note if possible. + + IETF code is subject to the following copyright and license: + Copyright (c) IETF Trust and the persons identified as authors of + the code. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in + Section 4.c of the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info)."; + + oc-ext:openconfig-version "0.2.1"; + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.2.1"; + } + + revision "2018-01-16" { + description + "Moved alarm identities into separate types module"; + reference "0.2.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // identity statements + identity OPENCONFIG_ALARM_TYPE_ID { + description + "Base identity for alarm type ID profiles"; + } + + identity AIS { + base OPENCONFIG_ALARM_TYPE_ID; + description + "Defines an alarm indication signal type of alarm"; + } + + identity EQPT { + base OPENCONFIG_ALARM_TYPE_ID; + description + "Defines an equipment related type of alarm that is specific + to the physical hardware"; + } + + identity LOS { + base OPENCONFIG_ALARM_TYPE_ID; + description + "Defines a loss of signal type of alarm"; + } + + identity OTS { + base OPENCONFIG_ALARM_TYPE_ID; + description + "Defines a optical transport signal type of alarm"; + } + + identity OPENCONFIG_ALARM_SEVERITY { + description + "Base identity for alarm severity profiles. Derived + identities are based on contents of the draft + IETF YANG Alarm Module"; + reference + "IETF YANG Alarm Module: Draft - typedef severity + https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02"; + + } + + identity UNKNOWN { + base OPENCONFIG_ALARM_SEVERITY; + description + "Indicates that the severity level could not be determined. + This level SHOULD be avoided."; + } + + identity MINOR { + base OPENCONFIG_ALARM_SEVERITY; + description + "Indicates the existence of a non-service affecting fault + condition and that corrective action should be taken in + order to prevent a more serious (for example, service + affecting) fault. Such a severity can be reported, for + example, when the detected alarm condition is not currently + degrading the capacity of the resource"; + } + + identity WARNING { + base OPENCONFIG_ALARM_SEVERITY; + description + "Indicates the detection of a potential or impending service + affecting fault, before any significant effects have been felt. + Action should be taken to further diagnose (if necessary) and + correct the problem in order to prevent it from becoming a more + serious service affecting fault."; + } + + identity MAJOR { + base OPENCONFIG_ALARM_SEVERITY; + description + "Indicates that a service affecting condition has developed + and an urgent corrective action is required. Such a severity + can be reported, for example, when there is a severe + degradation in the capability of the resource and its full + capability must be restored."; + } + + identity CRITICAL { + base OPENCONFIG_ALARM_SEVERITY; + description + "Indicates that a service affecting condition has occurred + and an immediate corrective action is required. Such a + severity can be reported, for example, when a resource becomes + totally out of service and its capability must be restored."; + } + +} \ No newline at end of file diff --git a/confdgnmi/oc/openconfig-alarms.yang b/confdgnmi/oc/openconfig-alarms.yang new file mode 100644 index 0000000..c7d71f1 --- /dev/null +++ b/confdgnmi/oc/openconfig-alarms.yang @@ -0,0 +1,237 @@ +module openconfig-alarms { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/alarms"; + + prefix "oc-alarms"; + + // import some basic types + import openconfig-alarm-types { prefix oc-alarm-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-types { prefix oc-types; } + import openconfig-platform { prefix oc-platform; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines operational state data related to alarms + that the device is reporting. + + This model reuses some data items defined in the draft IETF + YANG Alarm Module: + https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02 + + Portions of this code were derived from the draft IETF YANG Alarm + Module. Please reproduce this note if possible. + + IETF code is subject to the following copyright and license: + Copyright (c) IETF Trust and the persons identified as authors of + the code. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in + Section 4.c of the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info)."; + + oc-ext:openconfig-version "0.3.2"; + + revision "2019-07-09" { + description + "Clarify relative base for leaves using timeticks64."; + reference "0.3.2"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.3.1"; + } + + revision "2018-01-16" { + description + "Moved alarm identities into separate types module"; + reference "0.3.0"; + } + + revision "2018-01-10" { + description + "Make alarms list read only"; + reference "0.2.0"; + } + + revision "2017-08-24" { + description + "Initial public release"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // grouping statements + + grouping alarm-state { + description + "Operational state data for device alarms"; + + leaf id { + type string; + description + "Unique ID for the alarm -- this will not be a + configurable parameter on many implementations"; + } + + leaf resource { + type string; + description + "The item that is under alarm within the device. The + resource may be a reference to an item which is + defined elsewhere in the model. For example, it + may be a platform/component, interfaces/interface, + terminal-device/logical-channels/channel, etc. In this + case the system should match the name of the referenced + item exactly. The referenced item could alternatively be + the path of the item within the model."; + reference + "IETF YANG Alarm Module: Draft - typedef resource + https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02"; + } + + leaf text { + type string; + description + "The string used to inform operators about the alarm. This + MUST contain enough information for an operator to be able + to understand the problem. If this string contains structure, + this format should be clearly documented for programs to be + able to parse that information"; + reference + "IETF YANG Alarm Module: Draft - typedef alarm-text + https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02"; + } + + leaf time-created { + type oc-types:timeticks64; + description + "The time at which the alarm was raised by the system. + This value is expressed relative to the Unix Epoch."; + } + + leaf severity { + type identityref { + base oc-alarm-types:OPENCONFIG_ALARM_SEVERITY; + } + description + "The severity level indicating the criticality and impact + of the alarm"; + reference + "IETF YANG Alarm Module: Draft - typedef severity + https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02"; + } + + leaf type-id { + type union { + type string; + type identityref { + base oc-alarm-types:OPENCONFIG_ALARM_TYPE_ID; + } + } + description + "The abbreviated name of the alarm, for example LOS, + EQPT, or OTS. Also referred to in different systems as + condition type, alarm identifier, or alarm mnemonic. It + is recommended to use the OPENCONFIG_ALARM_TYPE_ID + identities where possible and only use the string type + when the desired identityref is not yet defined"; + reference + "IETF YANG Alarm Module: Draft - typedef alarm-type-id + https://tools.ietf.org/html/draft-vallin-netmod-alarm-module-02"; + } + } + + grouping alarm-config { + description + "Configuration data for device alarms"; + } + + grouping alarms-top { + description + "Top-level grouping for device alarms"; + + container alarms { + description + "Top-level container for device alarms"; + + config false; + + list alarm { + key "id"; + description + "List of alarms, keyed by a unique id"; + + leaf id { + type leafref { + path "../state/id"; + } + + description + "References the unique alarm id"; + } + + container config { + description + "Configuration data for each alarm"; + + uses alarm-config; + } + + container state { + config false; + + description + "Operational state data for a device alarm"; + + uses alarm-config; + uses alarm-state; + } + } + } + } + + + // augments + + augment "/oc-platform:components/oc-platform:component/oc-platform:state" { + description + "Adds specific alarms related to a component."; + + leaf equipment-failure { + type boolean; + default "false"; + description + "If true, the hardware indicates that the component's physical equipment + has failed"; + } + + leaf equipment-mismatch { + type boolean; + default "false"; + description + "If true, the hardware indicates that the component inserted into the + affected component's physical location is of a different type than what + is configured"; + } + } + +} diff --git a/confdgnmi/oc/openconfig-extensions.yang b/confdgnmi/oc/openconfig-extensions.yang new file mode 100644 index 0000000..2e0fd9f --- /dev/null +++ b/confdgnmi/oc/openconfig-extensions.yang @@ -0,0 +1,206 @@ +module openconfig-extensions { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/openconfig-ext"; + + prefix "oc-ext"; + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module provides extensions to the YANG language to allow + OpenConfig specific functionality and meta-data to be defined."; + + oc-ext:openconfig-version "0.5.1"; + + revision "2022-10-05" { + description + "Add missing version statement."; + reference "0.5.1"; + } + + revision "2020-06-16" { + description + "Add extension for POSIX pattern statements."; + reference "0.5.0"; + } + + revision "2018-10-17" { + description + "Add extension for regular expression type."; + reference "0.4.0"; + } + + revision "2017-04-11" { + description + "rename password type to 'hashed' and clarify description"; + reference "0.3.0"; + } + + revision "2017-01-29" { + description + "Added extension for annotating encrypted values."; + reference "0.2.0"; + } + + revision "2015-10-09" { + description + "Initial OpenConfig public release"; + reference "0.1.0"; + } + + + // extension statements + extension openconfig-version { + argument "semver" { + yin-element false; + } + description + "The OpenConfig version number for the module. This is + expressed as a semantic version number of the form: + x.y.z + where: + * x corresponds to the major version, + * y corresponds to a minor version, + * z corresponds to a patch version. + This version corresponds to the model file within which it is + defined, and does not cover the whole set of OpenConfig models. + + Individual YANG modules are versioned independently -- the + semantic version is generally incremented only when there is a + change in the corresponding file. Submodules should always + have the same semantic version as their parent modules. + + A major version number of 0 indicates that this model is still + in development (whether within OpenConfig or with industry + partners), and is potentially subject to change. + + Following a release of major version 1, all modules will + increment major revision number where backwards incompatible + changes to the model are made. + + The minor version is changed when features are added to the + model that do not impact current clients use of the model. + + The patch-level version is incremented when non-feature changes + (such as bugfixes or clarifications to human-readable + descriptions that do not impact model functionality) are made + that maintain backwards compatibility. + + The version number is stored in the module meta-data."; + } + + extension openconfig-hashed-value { + description + "This extension provides an annotation on schema nodes to + indicate that the corresponding value should be stored and + reported in hashed form. + + Hash algorithms are by definition not reversible. Clients + reading the configuration or applied configuration for the node + should expect to receive only the hashed value. Values written + in cleartext will be hashed. This annotation may be used on + nodes such as secure passwords in which the device never reports + a cleartext value, even if the input is provided as cleartext."; + } + + extension regexp-posix { + description + "This extension indicates that the regular expressions included + within the YANG module specified are conformant with the POSIX + regular expression format rather than the W3C standard that is + specified by RFC6020 and RFC7950."; + } + + extension posix-pattern { + argument "pattern" { + yin-element false; + } + description + "Provides a POSIX ERE regular expression pattern statement as an + alternative to YANG regular expresssions based on XML Schema Datatypes. + It is used the same way as the standard YANG pattern statement defined in + RFC6020 and RFC7950, but takes an argument that is a POSIX ERE regular + expression string."; + reference + "POSIX Extended Regular Expressions (ERE) Specification: + https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04"; + } + + extension telemetry-on-change { + description + "The telemetry-on-change annotation is specified in the context + of a particular subtree (container, or list) or leaf within the + YANG schema. Where specified, it indicates that the value stored + by the nodes within the context change their value only in response + to an event occurring. The event may be local to the target, for + example - a configuration change, or external - such as the failure + of a link. + + When a telemetry subscription allows the target to determine whether + to export the value of a leaf in a periodic or event-based fashion + (e.g., TARGET_DEFINED mode in gNMI), leaves marked as + telemetry-on-change should only be exported when they change, + i.e., event-based."; + } + + extension telemetry-atomic { + description + "The telemetry-atomic annotation is specified in the context of + a subtree (containre, or list), and indicates that all nodes + within the subtree are always updated together within the data + model. For example, all elements under the subtree may be updated + as a result of a new alarm being raised, or the arrival of a new + protocol message. + + Transport protocols may use the atomic specification to determine + optimisations for sending or storing the corresponding data."; + } + + extension operational { + description + "The operational annotation is specified in the context of a + grouping, leaf, or leaf-list within a YANG module. It indicates + that the nodes within the context are derived state on the device. + + OpenConfig data models divide nodes into the following three categories: + + - intended configuration - these are leaves within a container named + 'config', and are the writable configuration of a target. + - applied configuration - these are leaves within a container named + 'state' and are the currently running value of the intended configuration. + - derived state - these are the values within the 'state' container which + are not part of the applied configuration of the device. Typically, they + represent state values reflecting underlying operational counters, or + protocol statuses."; + } + + extension catalog-organization { + argument "org" { + yin-element false; + } + description + "This extension specifies the organization name that should be used within + the module catalogue on the device for the specified YANG module. It stores + a pithy string where the YANG organization statement may contain more + details."; + } + + extension origin { + argument "origin" { + yin-element false; + } + description + "This extension specifies the name of the origin that the YANG module + falls within. This allows multiple overlapping schema trees to be used + on a single network element without requiring module based prefixing + of paths."; + } +} diff --git a/confdgnmi/oc/openconfig-if-aggregate.yang b/confdgnmi/oc/openconfig-if-aggregate.yang new file mode 100644 index 0000000..f6a577b --- /dev/null +++ b/confdgnmi/oc/openconfig-if-aggregate.yang @@ -0,0 +1,249 @@ +module openconfig-if-aggregate { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/interfaces/aggregate"; + + prefix "oc-lag"; + + // import some basic types + import openconfig-interfaces { prefix oc-if; } + import openconfig-if-ethernet { prefix oc-eth; } + import iana-if-type { prefix ianaift; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Model for managing aggregated (aka bundle, LAG) interfaces."; + + oc-ext:openconfig-version "2.4.4"; + + revision "2022-06-28" { + description + "Remove reference to invalid oc-ift type check"; + reference "2.4.4"; + } + + revision "2020-05-01" { + description + "Update when statements to reference config nodes + from config true elements."; + reference "2.4.3"; + } + + revision "2019-04-16" { + description + "Update import prefix for iana-if-type module"; + reference "2.4.2"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "2.3.2"; + } + + revision "2018-03-23" { + description + "Fix/cleanup when statements in aggregates model."; + reference "2.3.1"; + } + + revision "2018-01-05" { + description + "Add logical loopback to interface."; + reference "2.3.0"; + } + + revision "2017-12-22" { + description + "Add IPv4 proxy ARP configuration."; + reference "2.2.0"; + } + + revision "2017-12-21" { + description + "Added IPv6 router advertisement configuration."; + reference "2.1.0"; + } + + revision "2017-07-14" { + description + "Added Ethernet/IP state data; Add dhcp-client; + migrate to OpenConfig types modules; Removed or + renamed opstate values"; + reference "2.0.0"; + } + + revision "2016-12-22" { + description + "Fixes to Ethernet interfaces model"; + reference "1.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + typedef aggregation-type { + type enumeration { + enum LACP { + description "LAG managed by LACP"; + } + enum STATIC { + description "Statically configured bundle / LAG"; + } + } + description + "Type to define the lag-type, i.e., how the LAG is + defined and managed"; + } + + // grouping statements + + + grouping aggregation-logical-config { + description + "Configuration data for aggregate interfaces"; + + + leaf lag-type { + type aggregation-type; + description + "Sets the type of LAG, i.e., how it is + configured / maintained"; + } + + leaf min-links { + type uint16; + description + "Specifies the mininum number of member + interfaces that must be active for the aggregate interface + to be available"; + } + } + + grouping aggregation-logical-state { + description + "Operational state data for aggregate interfaces"; + + leaf lag-speed { + type uint32; + units Mbps; + description + "Reports effective speed of the aggregate interface, + based on speed of active member interfaces"; + } + + leaf-list member { + when "../../config/lag-type = 'STATIC'" { + description + "The simple list of member interfaces is active + when the aggregate is statically configured"; + } + type oc-if:base-interface-ref; + description + "List of current member interfaces for the aggregate, + expressed as references to existing interfaces"; + } + } + + grouping aggregation-logical-top { + description "Top-level data definitions for LAGs"; + + container aggregation { + + description + "Options for logical interfaces representing + aggregates"; + + container config { + description + "Configuration variables for logical aggregate / + LAG interfaces"; + + uses aggregation-logical-config; + } + + container state { + + config false; + description + "Operational state variables for logical + aggregate / LAG interfaces"; + + uses aggregation-logical-config; + uses aggregation-logical-state; + + } + } + } + + grouping ethernet-if-aggregation-config { + description + "Adds configuration items for Ethernet interfaces + belonging to a logical aggregate / LAG"; + + leaf aggregate-id { + type leafref { + path "/oc-if:interfaces/oc-if:interface/oc-if:name"; + } + description + "Specify the logical aggregate interface to which + this interface belongs"; + } + } + + // data definition statements + + // augment statements + + augment "/oc-if:interfaces/oc-if:interface" { + + description "Adds LAG configuration to the interface module"; + + uses aggregation-logical-top { + when "oc-if:config/oc-if:type = 'ianaift:ieee8023adLag'" { + description + "active when the interface is set to type LAG"; + } + } + } + + augment "/oc-if:interfaces/oc-if:interface/oc-eth:ethernet/" + + "oc-eth:config" { + description + "Adds LAG settings to individual Ethernet interfaces"; + + uses ethernet-if-aggregation-config; + } + + augment "/oc-if:interfaces/oc-if:interface/oc-eth:ethernet/" + + "oc-eth:state" { + description + "Adds LAG settings to individual Ethernet interfaces"; + + uses ethernet-if-aggregation-config; + } + + // rpc statements + + // notification statements + +} diff --git a/confdgnmi/oc/openconfig-if-ethernet.yang b/confdgnmi/oc/openconfig-if-ethernet.yang new file mode 100644 index 0000000..803e7f9 --- /dev/null +++ b/confdgnmi/oc/openconfig-if-ethernet.yang @@ -0,0 +1,683 @@ +module openconfig-if-ethernet { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/interfaces/ethernet"; + + prefix "oc-eth"; + + // import some basic types + import openconfig-interfaces { prefix oc-if; } + import iana-if-type { prefix ianaift; } + import openconfig-yang-types { prefix oc-yang; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Model for managing Ethernet interfaces -- augments the OpenConfig + model for interface configuration and state."; + + oc-ext:openconfig-version "2.12.2"; + + revision "2022-04-20" { + description + "Remove unused import"; + reference "2.12.2"; + } + + revision "2021-07-20" { + description + "Fix typo in hardware MAC address description."; + reference "2.12.1"; + } + + revision "2021-07-07" { + description + "Add support for configuring fec-mode per interface."; + reference "2.12.0"; + } + + revision "2021-06-16" { + description + "Remove trailing whitespace."; + reference "2.11.1"; + } + + revision "2021-06-09" { + description + "Add support for standalone link training."; + reference "2.11.0"; + } + + revision "2021-05-17" { + description + "Add ethernet counters: in-carrier-errors, + in-interrupted-tx, in-late-collision, in-mac-errors-rx, + in-single-collision, in-symbol-error and out-mac-errors-tx"; + reference "2.10.0"; + } + + revision "2021-03-30" { + description + "Add counter for drops due to oversized frames."; + reference "2.9.0"; + } + + revision "2020-05-06" { + description + "Minor formatting fix."; + reference "2.8.1"; + } + + revision "2020-05-06" { + description + "Add 200G, 400G, 600G and 800G Ethernet speeds."; + reference "2.8.0"; + } + + revision "2020-05-05" { + description + "Fix when statement checks to use rw paths when + from a rw context."; + reference "2.7.3"; + } + + revision "2019-04-16" { + description + "Update import prefix for iana-if-type module"; + reference "2.7.2"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "2.6.2"; + } + + revision "2018-09-04" { + description + "Remove in-crc-align-errors as it is a duplicate of + in-crc-errors"; + reference "2.6.1"; + } + + revision "2018-08-28" { + description + "Add Ethernet counter in-block-errors"; + reference "2.6.0"; + } + + revision "2018-07-02" { + description + "Add new ethernet counters of in-undersize-frames, + in-crc-align-errors and the distribution container"; + reference "2.5.0"; + } + + revision "2018-04-10" { + description + "Add identities for 2.5 and 5 Gbps."; + reference "2.4.0"; + } + + revision "2018-01-05" { + description + "Add logical loopback to interface."; + reference "2.3.0"; + } + + revision "2017-12-21" { + description + "Added IPv6 router advertisement configuration."; + reference "2.1.0"; + } + + revision "2017-07-14" { + description + "Added Ethernet/IP state data; Add dhcp-client; + migrate to OpenConfig types modules; Removed or + renamed opstate values"; + reference "2.0.0"; + } + + revision "2016-12-22" { + description + "Fixes to Ethernet interfaces model"; + reference "1.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // identity statements + identity INTERFACE_FEC { + description + "Base type to specify FEC modes that can be configured on the interface. + These are FEC modes defined for applying to logical interfaces and their + underlying electrical channels."; + } + + identity FEC_FC { + base INTERFACE_FEC; + description + "Firecode is used for channels with NRZ modulation and speeds less than 100G. + This FEC is designed to comply with the IEEE 802.3, Clause 74."; + } + + identity FEC_RS528 { + base INTERFACE_FEC; + description + "RS528 is used for channels with NRZ modulation. This FEC is designed to + comply with IEEE 802.3, Clause 91."; + } + + identity FEC_RS544 { + base INTERFACE_FEC; + description + "RS544 is used for channels with PAM4 modulation."; + } + + identity FEC_RS544_2X_INTERLEAVE { + base INTERFACE_FEC; + description + "RS544-2x-interleave is used for channels with PAM4 modulation."; + } + + identity FEC_DISABLED { + base INTERFACE_FEC; + description + "FEC is administratively disabled."; + } + + identity ETHERNET_SPEED { + description "base type to specify available Ethernet link + speeds"; + } + + identity SPEED_10MB { + base ETHERNET_SPEED; + description "10 Mbps Ethernet"; + } + + identity SPEED_100MB { + base ETHERNET_SPEED; + description "100 Mbps Ethernet"; + } + + identity SPEED_1GB { + base ETHERNET_SPEED; + description "1 Gbps Ethernet"; + } + + identity SPEED_2500MB { + base ETHERNET_SPEED; + description "2.5 Gbps Ethernet"; + } + + identity SPEED_5GB { + base ETHERNET_SPEED; + description "5 Gbps Ethernet"; + } + + identity SPEED_10GB { + base ETHERNET_SPEED; + description "10 Gbps Ethernet"; + } + + identity SPEED_25GB { + base ETHERNET_SPEED; + description "25 Gbps Ethernet"; + } + + identity SPEED_40GB { + base ETHERNET_SPEED; + description "40 Gbps Ethernet"; + } + + identity SPEED_50GB { + base ETHERNET_SPEED; + description "50 Gbps Ethernet"; + } + + identity SPEED_100GB { + base ETHERNET_SPEED; + description "100 Gbps Ethernet"; + } + + identity SPEED_200GB { + base ETHERNET_SPEED; + description "200 Gbps Ethernet"; + } + + identity SPEED_400GB { + base ETHERNET_SPEED; + description "400 Gbps Ethernet"; + } + + identity SPEED_600GB { + base ETHERNET_SPEED; + description "600 Gbps Ethernet"; + } + + identity SPEED_800GB { + base ETHERNET_SPEED; + description "800 Gbps Ethernet"; + } + + identity SPEED_UNKNOWN { + base ETHERNET_SPEED; + description + "Interface speed is unknown. Systems may report + speed UNKNOWN when an interface is down or unpopuplated (e.g., + pluggable not present)."; + } + + // typedef statements + + + // grouping statements + + grouping ethernet-interface-config { + description "Configuration items for Ethernet interfaces"; + + leaf mac-address { + type oc-yang:mac-address; + description + "Assigns a MAC address to the Ethernet interface. If not + specified, the corresponding operational state leaf is + expected to show the system-assigned MAC address."; + } + + leaf auto-negotiate { + type boolean; + default true; + description + "Set to TRUE to request the interface to auto-negotiate + transmission parameters with its peer interface. When + set to FALSE, the transmission parameters are specified + manually."; + reference + "IEEE 802.3-2012 auto-negotiation transmission parameters"; + } + + leaf standalone-link-training { + type boolean; + default false; + description + "Link training is automatic tuning of the SerDes transmit and + receive parameters to ensure an optimal connection over copper + links. It is normally run as part of the auto negotiation + sequence as specified in IEEE 802.3 Clause 73. + + Standalone link training is used when full auto negotiation is + not desired on an Ethernet link but link training is needed. + It is configured by setting the standalone-link-training leaf + to TRUE and augo-negotiate leaf to FALSE. + + Note: If auto-negotiate is true, then the value of standalone + link training leaf will be ignored."; + } + + leaf duplex-mode { + type enumeration { + enum FULL { + description "Full duplex mode"; + } + enum HALF { + description "Half duplex mode"; + } + } + description + "When auto-negotiate is TRUE, this optionally sets the + duplex mode that will be advertised to the peer. If + unspecified, the interface should negotiate the duplex mode + directly (typically full-duplex). When auto-negotiate is + FALSE, this sets the duplex mode on the interface directly."; + } + + leaf port-speed { + type identityref { + base ETHERNET_SPEED; + } + description + "When auto-negotiate is TRUE, this optionally sets the + port-speed mode that will be advertised to the peer for + negotiation. If unspecified, it is expected that the + interface will select the highest speed available based on + negotiation. When auto-negotiate is set to FALSE, sets the + link speed to a fixed value -- supported values are defined + by ETHERNET_SPEED identities"; + } + + leaf enable-flow-control { + type boolean; + default false; + description + "Enable or disable flow control for this interface. + Ethernet flow control is a mechanism by which a receiver + may send PAUSE frames to a sender to stop transmission for + a specified time. + + This setting should override auto-negotiated flow control + settings. If left unspecified, and auto-negotiate is TRUE, + flow control mode is negotiated with the peer interface."; + reference + "IEEE 802.3x"; + } + + leaf fec-mode { + type identityref { + base INTERFACE_FEC; + } + description + "The FEC mode applied to the physical channels associated with + the interface."; + } + } + + grouping ethernet-interface-state-counters { + description + "Ethernet-specific counters and statistics"; + + // ingress counters + + leaf in-mac-control-frames { + type oc-yang:counter64; + description + "MAC layer control frames received on the interface"; + } + + leaf in-mac-pause-frames { + type oc-yang:counter64; + description + "MAC layer PAUSE frames received on the interface"; + } + + leaf in-oversize-frames { + type oc-yang:counter64; + description + "The total number of frames received that were + longer than 1518 octets (excluding framing bits, + but including FCS octets) and were otherwise + well formed."; + } + + leaf in-undersize-frames { + type oc-yang:counter64; + description + "The total number of frames received that were + less than 64 octets long (excluding framing bits, + but including FCS octets) and were otherwise well + formed."; + reference + "RFC 2819: Remote Network Monitoring MIB - + etherStatsUndersizePkts"; + } + + leaf in-jabber-frames { + type oc-yang:counter64; + description + "Number of jabber frames received on the + interface. Jabber frames are typically defined as oversize + frames which also have a bad CRC. Implementations may use + slightly different definitions of what constitutes a jabber + frame. Often indicative of a NIC hardware problem."; + } + + leaf in-fragment-frames { + type oc-yang:counter64; + description + "The total number of frames received that were less than + 64 octets in length (excluding framing bits but including + FCS octets) and had either a bad Frame Check Sequence + (FCS) with an integral number of octets (FCS Error) or a + bad FCS with a non-integral number of octets (Alignment + Error)."; + } + + leaf in-8021q-frames { + type oc-yang:counter64; + description + "Number of 802.1q tagged frames received on the interface"; + } + + leaf in-crc-errors { + type oc-yang:counter64; + description + "The total number of frames received that + had a length (excluding framing bits, but + including FCS octets) of between 64 and 1518 + octets, inclusive, but had either a bad + Frame Check Sequence (FCS) with an integral + number of octets (FCS Error) or a bad FCS with + a non-integral number of octets (Alignment Error)"; + reference + "RFC 2819: Remote Network Monitoring MIB - + etherStatsCRCAlignErrors"; + } + + leaf in-block-errors { + type oc-yang:counter64; + description + "The number of received errored blocks. Error detection codes + are capable of detecting whether one or more errors have + occurred in a given sequence of bits – the block. It is + normally not possible to determine the exact number of errored + bits within the block"; + } + + leaf in-carrier-errors { + type oc-yang:counter64; + description + "The number of received errored frames due to a carrier issue. + The value refers to MIB counter for + dot3StatsCarrierSenseErrors + oid=1.3.6.1.2.1.10.7.2.1.11"; + reference + "RFC 1643 Definitions of Managed + Objects for the Ethernet-like Interface Types."; + } + + leaf in-interrupted-tx { + type oc-yang:counter64; + description + "The number of received errored frames due to interrupted + transmission issue. The value refers to MIB counter for + dot3StatsDeferredTransmissions + oid=1.3.6.1.2.1.10.7.2.1.7"; + reference + "RFC 1643 Definitions of Managed + Objects for the Ethernet-like Interface Types."; + } + + leaf in-late-collision { + type oc-yang:counter64; + description + "The number of received errored frames due to late collision + issue. The value refers to MIB counter for + dot3StatsLateCollisions + oid=1.3.6.1.2.1.10.7.2.1.8"; + reference + "RFC 1643 Definitions of Managed + Objects for the Ethernet-like Interface Types."; + } + + leaf in-mac-errors-rx { + type oc-yang:counter64; + description + "The number of received errored frames due to MAC errors + received. The value refers to MIB counter for + dot3StatsInternalMacReceiveErrors + oid=1.3.6.1.2.1.10.7.2.1.16"; + reference + "RFC 1643 Definitions of Managed + Objects for the Ethernet-like Interface Types."; + } + + leaf in-single-collision { + type oc-yang:counter64; + description + "The number of received errored frames due to single collision + issue. The value refers to MIB counter for + dot3StatsSingleCollisionFrames + oid=1.3.6.1.2.1.10.7.2.1.4"; + reference + "RFC 1643 Definitions of Managed + Objects for the Ethernet-like Interface Types."; + } + + leaf in-symbol-error { + type oc-yang:counter64; + description + "The number of received errored frames due to symbol error. + The value refers to MIB counter for + in-symbol-error + oid=1.3.6.1.2.1.10.7.2.1.18"; + reference + "RFC 1643 Definitions of Managed + Objects for the Ethernet-like Interface Types."; + } + + leaf in-maxsize-exceeded { + type oc-yang:counter64; + description + "The total number frames received that are well-formed but + dropped due to exceeding the maximum frame size on the interface + (e.g., MTU or MRU)"; + } + + // egress counters + + leaf out-mac-control-frames { + type oc-yang:counter64; + description + "MAC layer control frames sent on the interface"; + } + + leaf out-mac-pause-frames { + type oc-yang:counter64; + description + "MAC layer PAUSE frames sent on the interface"; + } + + leaf out-8021q-frames { + type oc-yang:counter64; + description + "Number of 802.1q tagged frames sent on the interface"; + } + + leaf out-mac-errors-tx { + type oc-yang:counter64; + description + "The number of sent errored frames due to MAC errors + transmitted. The value refers to MIB counter for + dot3StatsInternalMacTransmitErrors + oid=1.3.6.1.2.1.10.7.2.1.10"; + reference + "RFC 1643 Definitions of Managed + Objects for the Ethernet-like Interface Types."; + } + + } + + grouping ethernet-interface-state { + description + "Grouping for defining Ethernet-specific operational state"; + + leaf hw-mac-address { + type oc-yang:mac-address; + description + "Represents the 'burned-in', or system-assigned, MAC + address for the Ethernet interface."; + } + + leaf negotiated-duplex-mode { + type enumeration { + enum FULL { + description "Full duplex mode"; + } + enum HALF { + description "Half duplex mode"; + } + } + description + "When auto-negotiate is set to TRUE, and the interface has + completed auto-negotiation with the remote peer, this value + shows the duplex mode that has been negotiated."; + } + + leaf negotiated-port-speed { + type identityref { + base ETHERNET_SPEED; + } + description + "When auto-negotiate is set to TRUE, and the interface has + completed auto-negotiation with the remote peer, this value + shows the interface speed that has been negotiated."; + } + + container counters { + description "Ethernet interface counters"; + + uses ethernet-interface-state-counters; + } + } + + // data definition statements + + grouping ethernet-top { + description "top-level Ethernet config and state containers"; + + container ethernet { + description + "Top-level container for ethernet configuration + and state"; + + container config { + description "Configuration data for ethernet interfaces"; + + uses ethernet-interface-config; + + } + + container state { + + config false; + description "State variables for Ethernet interfaces"; + + uses ethernet-interface-config; + uses ethernet-interface-state; + + } + + } + } + + // augment statements + + augment "/oc-if:interfaces/oc-if:interface" { + description "Adds addtional Ethernet-specific configuration to + interfaces model"; + + uses ethernet-top { + when "oc-if:config/oc-if:type = 'ianaift:ethernetCsmacd'" { + description "Additional interface configuration parameters when + the interface type is Ethernet"; + } + } + } + + // rpc statements + + // notification statements + +} diff --git a/confdgnmi/oc/openconfig-if-ip.yang b/confdgnmi/oc/openconfig-if-ip.yang new file mode 100644 index 0000000..6bb2354 --- /dev/null +++ b/confdgnmi/oc/openconfig-if-ip.yang @@ -0,0 +1,1475 @@ +module openconfig-if-ip { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/interfaces/ip"; + + prefix "oc-ip"; + + // import some basic types + import openconfig-inet-types { prefix oc-inet; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-vlan { prefix oc-vlan; } + import openconfig-yang-types { prefix oc-yang; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This model defines data for managing configuration and + operational state on IP (IPv4 and IPv6) interfaces. + + This model reuses data items defined in the IETF YANG model for + interfaces described by RFC 7277 with an alternate structure + (particularly for operational state data) and with + additional configuration items. + + Portions of this code were derived from IETF RFC 7277. + Please reproduce this note if possible. + + IETF code is subject to the following copyright and license: + Copyright (c) IETF Trust and the persons identified as authors of + the code. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in + Section 4.c of the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info)."; + + oc-ext:openconfig-version "3.2.0"; + + revision "2023-02-06" { + description + "Add ipv6 link-local configuration."; + reference "3.2.0"; + } + + revision "2022-11-09" { + description + "Add additional IPv6 router-advertisement features."; + reference "3.1.0"; + } + + revision "2019-01-08" { + description + "Eliminate use of the 'empty' type."; + reference "3.0.0"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "2.3.1"; + } + + revision "2018-01-05" { + description + "Add logical loopback to interface."; + reference "2.3.0"; + } + + revision "2017-12-21" { + description + "Added IPv6 router advertisement configuration."; + reference "2.1.0"; + } + + revision "2017-07-14" { + description + "Added Ethernet/IP state data; Add dhcp-client; + migrate to OpenConfig types modules; Removed or + renamed opstate values"; + reference "2.0.0"; + } + + revision "2017-04-03"{ + description + "Update copyright notice."; + reference "1.1.1"; + } + + revision "2016-12-22" { + description + "Fixes to Ethernet interfaces model"; + reference "1.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // typedef statements + + typedef ip-address-origin { + type enumeration { + enum OTHER { + description + "None of the following."; + } + enum STATIC { + description + "Indicates that the address has been statically + configured - for example, using NETCONF or a Command Line + Interface."; + } + enum DHCP { + description + "Indicates an address that has been assigned to this + system by a DHCP server."; + } + enum LINK_LAYER { + description + "Indicates an address created by IPv6 stateless + autoconfiguration that embeds a link-layer address in its + interface identifier."; + } + enum RANDOM { + description + "Indicates an address chosen by the system at + random, e.g., an IPv4 address within 169.254/16, an + RFC 4941 temporary address, or an RFC 7217 semantically + opaque address."; + reference + "RFC 4941: Privacy Extensions for Stateless Address + Autoconfiguration in IPv6 + RFC 7217: A Method for Generating Semantically Opaque + Interface Identifiers with IPv6 Stateless + Address Autoconfiguration (SLAAC)"; + } + } + description + "The origin of an address."; + } + + typedef neighbor-origin { + type enumeration { + enum OTHER { + description + "None of the following."; + } + enum STATIC { + description + "Indicates that the mapping has been statically + configured - for example, using NETCONF or a Command Line + Interface."; + } + enum DYNAMIC { + description + "Indicates that the mapping has been dynamically resolved + using, e.g., IPv4 ARP or the IPv6 Neighbor Discovery + protocol."; + } + } + description + "The origin of a neighbor entry."; + } + + // grouping statements + + grouping ip-common-global-config { + description + "Shared configuration data for IPv4 or IPv6 assigned + globally on an interface."; + + leaf dhcp-client { + type boolean; + default false; + description + "Enables a DHCP client on the interface in order to request + an address"; + } + } + + grouping ip-common-counters-state { + description + "Operational state for IP traffic statistics for IPv4 and + IPv6"; + + container counters { + description + "Packet and byte counters for IP transmission and + reception for the address family."; + + + leaf in-pkts { + type oc-yang:counter64; + description + "The total number of IP packets received for the specified + address family, including those received in error"; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf in-octets { + type oc-yang:counter64; + description + "The total number of octets received in input IP packets + for the specified address family, including those received + in error."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf in-error-pkts { + // TODO: this counter combines several error conditions -- + // could consider breaking them out to separate leaf nodes + type oc-yang:counter64; + description + "Number of IP packets discarded due to errors for the + specified address family, including errors in the IP + header, no route found to the IP destination, invalid + address, unknown protocol, etc."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf in-forwarded-pkts { + type oc-yang:counter64; + description + "The number of input packets for which the device was not + their final IP destination and for which the device + attempted to find a route to forward them to that final + destination."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf in-forwarded-octets { + type oc-yang:counter64; + description + "The number of octets received in input IP packets + for the specified address family for which the device was + not their final IP destination and for which the + device attempted to find a route to forward them to that + final destination."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf in-discarded-pkts { + type oc-yang:counter64; + description + "The number of input IP packets for the + specified address family, for which no problems were + encountered to prevent their continued processing, but + were discarded (e.g., for lack of buffer space)."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf out-pkts { + type oc-yang:counter64; + description + "The total number of IP packets for the + specified address family that the device supplied + to the lower layers for transmission. This includes + packets generated locally and those forwarded by the + device."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf out-octets { + type oc-yang:counter64; + description + "The total number of octets in IP packets for the + specified address family that the device + supplied to the lower layers for transmission. This + includes packets generated locally and those forwarded by + the device."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf out-error-pkts { + // TODO: this counter combines several error conditions -- + // could consider breaking them out to separate leaf nodes + type oc-yang:counter64; + description + "Number of IP packets for the specified address family + locally generated and discarded due to errors, including + no route found to the IP destination."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf out-forwarded-pkts { + type oc-yang:counter64; + description + "The number of packets for which this entity was not their + final IP destination and for which it was successful in + finding a path to their final destination."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf out-forwarded-octets { + type oc-yang:counter64; + description + "The number of octets in packets for which this entity was + not their final IP destination and for which it was + successful in finding a path to their final destination."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + + leaf out-discarded-pkts { + type oc-yang:counter64; + description + "The number of output IP packets for the + specified address family for which no problem was + encountered to prevent their transmission to their + destination, but were discarded (e.g., for lack of + buffer space)."; + reference + "RFC 4293 - Management Information Base for the + Internet Protocol (IP)"; + } + } + + } + + + + grouping ipv4-global-config { + description + "Configuration data for IPv4 interfaces across + all addresses assigned to the interface"; + + leaf enabled { + type boolean; + default true; + description + "Controls whether IPv4 is enabled or disabled on this + interface. When IPv4 is enabled, this interface is + connected to an IPv4 stack, and the interface can send + and receive IPv4 packets."; + } + + leaf mtu { + type uint16 { + range "68..max"; + } + units octets; + description + "The size, in octets, of the largest IPv4 packet that the + interface will send and receive. + + The server may restrict the allowed values for this leaf, + depending on the interface's type. + + If this leaf is not configured, the operationally used MTU + depends on the interface's type."; + reference + "RFC 791: Internet Protocol"; + } + + uses ip-common-global-config; + + + } + + grouping ipv4-address-config { + + description + "Per IPv4 adresss configuration data for the + interface."; + + leaf ip { + type oc-inet:ipv4-address; + description + "The IPv4 address on the interface."; + } + + leaf prefix-length { + type uint8 { + range "0..32"; + } + description + "The length of the subnet prefix."; + } + } + + grouping ipv4-neighbor-config { + description + "Per IPv4 neighbor configuration data. Neighbor + entries are analagous to static ARP entries, i.e., they + create a correspondence between IP and link-layer addresses"; + + leaf ip { + type oc-inet:ipv4-address; + description + "The IPv4 address of the neighbor node."; + } + leaf link-layer-address { + type oc-yang:phys-address; + mandatory true; + description + "The link-layer address of the neighbor node."; + } + } + + grouping ipv4-address-state { + description + "State variables for IPv4 addresses on the interface"; + + leaf origin { + type ip-address-origin; + description + "The origin of this address, e.g., statically configured, + assigned by DHCP, etc.."; + } + } + + grouping ipv4-neighbor-state { + description + "State variables for IPv4 neighbor entries on the interface."; + + leaf origin { + type neighbor-origin; + description + "The origin of this neighbor entry, static or dynamic."; + } + } + + grouping ipv6-global-config { + description + "Configuration data at the global level for each + IPv6 interface"; + + leaf enabled { + type boolean; + default true; + description + "Controls whether IPv6 is enabled or disabled on this + interface. When IPv6 is enabled, this interface is + connected to an IPv6 stack, and the interface can send + and receive IPv6 packets."; + } + + leaf mtu { + type uint32 { + range "1280..max"; + } + units octets; + description + "The size, in octets, of the largest IPv6 packet that the + interface will send and receive. + + The server may restrict the allowed values for this leaf, + depending on the interface's type. + + If this leaf is not configured, the operationally used MTU + depends on the interface's type."; + reference + "RFC 2460: Internet Protocol, Version 6 (IPv6) Specification + Section 5"; + } + + leaf dup-addr-detect-transmits { + type uint32; + default 1; + description + "The number of consecutive Neighbor Solicitation messages + sent while performing Duplicate Address Detection on a + tentative address. A value of zero indicates that + Duplicate Address Detection is not performed on + tentative addresses. A value of one indicates a single + transmission with no follow-up retransmissions."; + reference + "RFC 4862: IPv6 Stateless Address Autoconfiguration"; + } + + uses ip-common-global-config; + } + + grouping ipv6-address-config { + description "Per-address configuration data for IPv6 interfaces"; + + leaf ip { + type oc-inet:ipv6-address; + description + "The IPv6 address on the interface."; + } + + leaf prefix-length { + type uint8 { + range "0..128"; + } + mandatory true; + description + "The length of the subnet prefix."; + } + + leaf type { + type oc-inet:ipv6-address-type; + default GLOBAL_UNICAST; + description + "Specifies the explicit type of the IPv6 address being assigned + to the subinterface. By default, addresses are assumed to be + global unicast. Where a link-local address is to be explicitly + configured, this leaf should be set to LINK_LOCAL."; + } + + } + + grouping ipv6-address-state { + description + "Per-address operational state data for IPv6 interfaces"; + + leaf origin { + type ip-address-origin; + description + "The origin of this address, e.g., static, dhcp, etc."; + } + + leaf status { + type enumeration { + enum PREFERRED { + description + "This is a valid address that can appear as the + destination or source address of a packet."; + } + enum DEPRECATED { + description + "This is a valid but deprecated address that should + no longer be used as a source address in new + communications, but packets addressed to such an + address are processed as expected."; + } + enum INVALID { + description + "This isn't a valid address, and it shouldn't appear + as the destination or source address of a packet."; + } + enum INACCESSIBLE { + description + "The address is not accessible because the interface + to which this address is assigned is not + operational."; + } + enum UNKNOWN { + description + "The status cannot be determined for some reason."; + } + enum TENTATIVE { + description + "The uniqueness of the address on the link is being + verified. Addresses in this state should not be + used for general communication and should only be + used to determine the uniqueness of the address."; + } + enum DUPLICATE { + description + "The address has been determined to be non-unique on + the link and so must not be used."; + } + enum OPTIMISTIC { + description + "The address is available for use, subject to + restrictions, while its uniqueness on a link is + being verified."; + } + } + description + "The status of an address. Most of the states correspond + to states from the IPv6 Stateless Address + Autoconfiguration protocol."; + reference + "RFC 4293: Management Information Base for the + Internet Protocol (IP) + - IpAddressStatusTC + RFC 4862: IPv6 Stateless Address Autoconfiguration"; + } + } + + grouping ipv6-neighbor-config { + description + "Per-neighbor configuration data for IPv6 interfaces"; + + leaf ip { + type oc-inet:ipv6-address; + description + "The IPv6 address of the neighbor node."; + } + + leaf link-layer-address { + type oc-yang:phys-address; + mandatory true; + description + "The link-layer address of the neighbor node."; + } + } + + grouping ipv6-neighbor-state { + description "Per-neighbor state variables for IPv6 interfaces"; + + leaf origin { + type neighbor-origin; + description + "The origin of this neighbor entry."; + } + leaf is-router { + type boolean; + description + "Indicates that the neighbor node acts as a router."; + } + leaf neighbor-state { + type enumeration { + enum INCOMPLETE { + description + "Address resolution is in progress, and the link-layer + address of the neighbor has not yet been + determined."; + } + enum REACHABLE { + description + "Roughly speaking, the neighbor is known to have been + reachable recently (within tens of seconds ago)."; + } + enum STALE { + description + "The neighbor is no longer known to be reachable, but + until traffic is sent to the neighbor no attempt + should be made to verify its reachability."; + } + enum DELAY { + description + "The neighbor is no longer known to be reachable, and + traffic has recently been sent to the neighbor. + Rather than probe the neighbor immediately, however, + delay sending probes for a short while in order to + give upper-layer protocols a chance to provide + reachability confirmation."; + } + enum PROBE { + description + "The neighbor is no longer known to be reachable, and + unicast Neighbor Solicitation probes are being sent + to verify reachability."; + } + } + description + "The Neighbor Unreachability Detection state of this + entry."; + reference + "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) + Section 7.3.2"; + } + } + + grouping ip-vrrp-ipv6-config { + description + "IPv6-specific configuration data for VRRP on IPv6 + interfaces"; + + leaf virtual-link-local { + type oc-inet:ip-address; + description + "For VRRP on IPv6 interfaces, sets the virtual link local + address"; + } + } + + grouping ip-vrrp-ipv6-state { + description + "IPv6-specific operational state for VRRP on IPv6 interfaces"; + + uses ip-vrrp-ipv6-config; + } + + grouping ip-vrrp-tracking-config { + description + "Configuration data for tracking interfaces + in a VRRP group"; + + leaf-list track-interface { + type leafref { + path "/oc-if:interfaces/oc-if:interface/oc-if:name"; + } + // TODO: we may need to add some restriction to ethernet + // or IP interfaces. + description + "Sets a list of one or more interfaces that should + be tracked for up/down events to dynamically change the + priority state of the VRRP group, and potentially + change the mastership if the tracked interface going + down lowers the priority sufficiently. Any of the tracked + interfaces going down will cause the priority to be lowered. + Some implementations may only support a single + tracked interface."; + } + + leaf priority-decrement { + type uint8 { + range 0..254; + } + default 0; + description "Set the value to subtract from priority when + the tracked interface goes down"; + } + } + + grouping ip-vrrp-tracking-state { + description + "Operational state data for tracking interfaces in a VRRP + group"; + } + + grouping ip-vrrp-tracking-top { + description + "Top-level grouping for VRRP interface tracking"; + + container interface-tracking { + description + "Top-level container for VRRP interface tracking"; + + container config { + description + "Configuration data for VRRP interface tracking"; + + uses ip-vrrp-tracking-config; + } + + container state { + + config false; + + description + "Operational state data for VRRP interface tracking"; + + uses ip-vrrp-tracking-config; + uses ip-vrrp-tracking-state; + } + } + } + + grouping ip-vrrp-config { + description + "Configuration data for VRRP on IP interfaces"; + + leaf virtual-router-id { + type uint8 { + range 1..255; + } + description + "Set the virtual router id for use by the VRRP group. This + usually also determines the virtual MAC address that is + generated for the VRRP group"; + } + + leaf-list virtual-address { + type oc-inet:ip-address; + description + "Configure one or more virtual addresses for the + VRRP group"; + } + + leaf priority { + type uint8 { + range 1..254; + } + default 100; + description + "Specifies the sending VRRP interface's priority + for the virtual router. Higher values equal higher + priority"; + } + + leaf preempt { + type boolean; + default true; + description + "When set to true, enables preemption by a higher + priority backup router of a lower priority master router"; + } + + leaf preempt-delay { + type uint16 { + range 0..3600; + } + default 0; + description + "Set the delay the higher priority router waits + before preempting"; + } + + leaf accept-mode { + type boolean; + // TODO: should we adopt the RFC default given the common + // operational practice of setting to true? + default false; + description + "Configure whether packets destined for + virtual addresses are accepted even when the virtual + address is not owned by the router interface"; + } + + leaf advertisement-interval { + type uint16 { + range 1..4095; + } + // TODO this range is theoretical -- needs to be validated + // against major implementations. + units "centiseconds"; + default 100; + description + "Sets the interval between successive VRRP + advertisements -- RFC 5798 defines this as a 12-bit + value expressed as 0.1 seconds, with default 100, i.e., + 1 second. Several implementation express this in units of + seconds"; + } + } + + grouping ip-vrrp-state { + description + "Operational state data for VRRP on IP interfaces"; + + leaf current-priority { + type uint8; + description "Operational value of the priority for the + interface in the VRRP group"; + } + } + + grouping ip-vrrp-top { + description + "Top-level grouping for Virtual Router Redundancy Protocol"; + + container vrrp { + description + "Enclosing container for VRRP groups handled by this + IP interface"; + + reference "RFC 5798 - Virtual Router Redundancy Protocol + (VRRP) Version 3 for IPv4 and IPv6"; + + list vrrp-group { + key "virtual-router-id"; + description + "List of VRRP groups, keyed by virtual router id"; + + leaf virtual-router-id { + type leafref { + path "../config/virtual-router-id"; + } + description + "References the configured virtual router id for this + VRRP group"; + } + + container config { + description + "Configuration data for the VRRP group"; + + uses ip-vrrp-config; + } + + container state { + + config false; + + description + "Operational state data for the VRRP group"; + + uses ip-vrrp-config; + uses ip-vrrp-state; + } + + uses ip-vrrp-tracking-top; + } + } + } + + grouping ipv6-ra-config { + description + "Configuration parameters for IPv6 router advertisements."; + + leaf interval { + type uint32; + units seconds; + description + "The interval between periodic router advertisement neighbor + discovery messages sent on this interface expressed in + seconds."; + } + + leaf lifetime { + type uint32; + units seconds; + description + "The lifetime advertised in the router advertisement neighbor + discovery message on this interface."; + } + + leaf suppress { + type boolean; + default false; + description + "When set to true, router advertisement neighbor discovery + messages are not transmitted on this interface."; + } + + leaf managed { + type boolean; + default false; + description + "When set to true, the managed address configuration (M) flag is set in + the advertised router advertisement. The M flag indicates that there are + addresses available via DHCPv6."; + reference "RFC4861: Neighbor Discovery for IPv6, section 4.2"; + } + + leaf other-config { + type boolean; + default false; + description + "When set to true, the other configuration (O) flag is set in the + advertised router advertisement. The O flag indicates that there is + other configuration available via DHCPv6 (e.g., DNS servers)."; + reference "RFC4861: Neighbor Discovery for IPv6, section 4.2"; + } + } + + grouping ipv6-ra-prefix-config { + description + "Configuration parameters for an individual prefix within an IPv6 + router advertisement."; + + leaf prefix { + type oc-inet:ipv6-prefix; + description + "IPv6 prefix to be advertised within the router advertisement + message."; + } + + leaf valid-lifetime { + type uint32; + units seconds; + description + "The length of time that the prefix is valid relative to the time + the packet was sent."; + reference "RFC4861: Neighbor Discovery for IPv6, section 4.6.2"; + } + + leaf preferred-lifetime { + type uint32; + units seconds; + description + "The length of time that the address within the prefix remains + in the preferred state, i.e., unrestricted use is allowed by + upper-layer protocols. See RFC4862 for a complete definition + of preferred behaviours."; + reference "RFC4861: Neighbor Discovery for IPv6, section 4.6.2"; + } + + leaf disable-advertisement { + type boolean; + description + "When set to true, the prefix is not advertised within + router advertisement messages that are sent as a result of + router soliciation messages."; + } + + leaf disable-autoconfiguration { + type boolean; + description + "When set to true, the prefix is marked as not to be used for stateless + address configuration. This is achieved by setting the autonomous address + configuration bit for the prefix."; + reference "RFC4861: Neighbor Discovery for IPv6, section 4.6.1"; + } + + leaf enable-onlink { + type boolean; + description + "When set to true, the prefix is marked as being on link by setting the + L-bit for the prefix within a router advertisement."; + reference "RFC4861: Neighbor Discovery for IPv6, section 4.6.1"; + } + } + + grouping ipv4-proxy-arp-config { + description + "Configuration parameters for IPv4 proxy ARP"; + + leaf mode { + type enumeration { + enum DISABLE { + description + "The system should not respond to ARP requests that + do not specify an IP address configured on the local + subinterface as the target address."; + } + enum REMOTE_ONLY { + description + "The system responds to ARP requests only when the + sender and target IP addresses are in different + subnets."; + } + enum ALL { + description + "The system responds to ARP requests where the sender + and target IP addresses are in different subnets, as well + as those where they are in the same subnet."; + } + } + default "DISABLE"; + description + "When set to a value other than DISABLE, the local system should + respond to ARP requests that are for target addresses other than + those that are configured on the local subinterface using its own + MAC address as the target hardware address. If the REMOTE_ONLY + value is specified, replies are only sent when the target address + falls outside the locally configured subnets on the interface, + whereas with the ALL value, all requests, regardless of their + target address are replied to."; + reference "RFC1027: Using ARP to Implement Transparent Subnet Gateways"; + } + } + + grouping ipv4-top { + description "Top-level configuration and state for IPv4 + interfaces"; + + container ipv4 { + description + "Parameters for the IPv4 address family."; + + container addresses { + description + "Enclosing container for address list"; + + list address { + key "ip"; + description + "The list of configured IPv4 addresses on the interface."; + + leaf ip { + type leafref { + path "../config/ip"; + } + description "References the configured IP address"; + } + + container config { + description "Configuration data for each configured IPv4 + address on the interface"; + + uses ipv4-address-config; + + } + + container state { + + config false; + description "Operational state data for each IPv4 address + configured on the interface"; + + uses ipv4-address-config; + uses ipv4-address-state; + } + + } + } + + container proxy-arp { + description + "Configuration and operational state parameters + relating to proxy ARP. This functionality allows a + system to respond to ARP requests that are not + explicitly destined to the local system."; + + container config { + description + "Configuration parameters for proxy ARP"; + uses ipv4-proxy-arp-config; + } + + container state { + config false; + description + "Operational state parameters for proxy ARP"; + uses ipv4-proxy-arp-config; + } + } + + container neighbors { + description + "Enclosing container for neighbor list"; + + list neighbor { + key "ip"; + description + "A list of mappings from IPv4 addresses to + link-layer addresses. + + Entries in this list are used as static entries in the + ARP Cache."; + reference + "RFC 826: An Ethernet Address Resolution Protocol"; + + leaf ip { + type leafref { + path "../config/ip"; + } + description "References the configured IP address"; + } + + container config { + description "Configuration data for each configured IPv4 + address on the interface"; + + uses ipv4-neighbor-config; + + } + + container state { + + config false; + description "Operational state data for each IPv4 address + configured on the interface"; + + uses ipv4-neighbor-config; + uses ipv4-neighbor-state; + } + } + } + + uses oc-if:sub-unnumbered-top; + + container config { + description + "Top-level IPv4 configuration data for the interface"; + + uses ipv4-global-config; + } + + container state { + + config false; + description + "Top level IPv4 operational state data"; + + uses ipv4-global-config; + uses ip-common-counters-state; + } + } + } + + grouping ipv6-top { + description + "Top-level configuration and state for IPv6 interfaces"; + + container ipv6 { + description + "Parameters for the IPv6 address family."; + + container addresses { + description + "Enclosing container for address list"; + + list address { + key "ip"; + description + "The list of configured IPv6 addresses on the interface."; + + leaf ip { + type leafref { + path "../config/ip"; + } + description "References the configured IP address"; + } + + container config { + description + "Configuration data for each IPv6 address on + the interface"; + + uses ipv6-address-config; + + } + + container state { + + config false; + description + "State data for each IPv6 address on the + interface"; + + uses ipv6-address-config; + uses ipv6-address-state; + } + } + } + + container router-advertisement { + description + "Configuration and operational state parameters relating to + router advertisements."; + + container config { + description + "Configuration parameters relating to router advertisements + for IPv6."; + uses ipv6-ra-config; + } + + container state { + config false; + description + "Operational state parameters relating to router + advertisements for IPv6."; + uses ipv6-ra-config; + } + + container prefixes { + description + "Container for a list of prefixes that are included in the + router advertisement message."; + + list prefix { + key "prefix"; + + description + "List of prefixes that are to be included in the IPv6 + router-advertisement messages for the interface. The list + is keyed by the IPv6 prefix in CIDR representation. + + Prefixes that are listed are those that are to be + advertised in router advertisement messages. Where there + are IPv6 global addresses configured on an interface and + the prefix is not listed in the prefix list, it MUST NOT + be advertised in the router advertisement message."; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + description + "Reference to the IPv6 prefix key for the prefix list."; + } + + container config { + description + "Configuration parameters corresponding to an IPv6 prefix + within the router advertisement."; + + uses ipv6-ra-prefix-config; + } + + container state { + config false; + description + "Operational state parameters corresponding to an IPv6 prefix + within the router advertisement."; + + uses ipv6-ra-prefix-config; + } + } + } + } + + container neighbors { + description + "Enclosing container for list of IPv6 neighbors"; + + list neighbor { + key "ip"; + description + "List of IPv6 neighbors"; + + leaf ip { + type leafref { + path "../config/ip"; + } + description + "References the configured IP neighbor address"; + } + + container config { + description "Configuration data for each IPv6 address on + the interface"; + + uses ipv6-neighbor-config; + + } + + container state { + + config false; + description "State data for each IPv6 address on the + interface"; + + uses ipv6-neighbor-config; + uses ipv6-neighbor-state; + } + } + } + uses oc-if:sub-unnumbered-top; + + container config { + description "Top-level config data for the IPv6 interface"; + + uses ipv6-global-config; + } + + container state { + config false; + description + "Top-level operational state data for the IPv6 interface"; + + uses ipv6-global-config; + uses ip-common-counters-state; + + } + } + } + + // augment statements + + augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" + + "oc-if:subinterface" { + description + "IPv4 address family configuration for + interfaces"; + + uses ipv4-top; + + } + + augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" + + "oc-if:subinterface" { + description + "IPv6 address family configuration for + interfaces"; + + uses ipv6-top; + + } + + // VRRP for IPv4 interfaces + + augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" + + "oc-if:subinterface/oc-ip:ipv4/oc-ip:addresses/oc-ip:address" { + + description + "Additional IP addr family configuration for + interfaces"; + + uses ip-vrrp-top; + + } + + // VRRP for IPv6 interfaces + + augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" + + "oc-if:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address" { + description + "Additional IP addr family configuration for + interfaces"; + + uses ip-vrrp-top; + + } + + augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" + + "oc-if:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address/" + + "vrrp/vrrp-group/config" { + description + "Additional VRRP data for IPv6 interfaces"; + + uses ip-vrrp-ipv6-config; + } + + augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" + + "oc-if:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address/vrrp/" + + "vrrp-group/state" { + description + "Additional VRRP data for IPv6 interfaces"; + + uses ip-vrrp-ipv6-state; + } + + // Augments for for routed VLANs + + augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan" { + description + "IPv4 address family configuration for + interfaces"; + + uses ipv4-top; + } + + augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan" { + description + "IPv6 address family configuration for + interfaces"; + + uses ipv6-top; + } + + // VRRP for routed VLAN interfaces + + augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" + + "oc-ip:ipv4/oc-ip:addresses/oc-ip:address" { + description + "Additional IP addr family configuration for + interfaces"; + + uses ip-vrrp-top; + + } + + augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" + + "oc-ip:ipv6/oc-ip:addresses/oc-ip:address" { + description + "Additional IP addr family configuration for + interfaces"; + + uses ip-vrrp-top; + + } + + augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" + + "oc-ip:ipv6/oc-ip:addresses/oc-ip:address/vrrp/vrrp-group/config" { + description + "Additional VRRP data for IPv6 interfaces"; + + uses ip-vrrp-ipv6-config; + } + + + augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" + + "oc-ip:ipv6/oc-ip:addresses/oc-ip:address/vrrp/vrrp-group/state" { + description + "Additional VRRP data for IPv6 interfaces"; + + uses ip-vrrp-ipv6-state; + } + + // rpc statements + + // notification statements +} diff --git a/confdgnmi/oc/openconfig-if-tunnel.yang b/confdgnmi/oc/openconfig-if-tunnel.yang new file mode 100644 index 0000000..3003699 --- /dev/null +++ b/confdgnmi/oc/openconfig-if-tunnel.yang @@ -0,0 +1,120 @@ +module openconfig-if-tunnel { + yang-version "1"; + + namespace "http://openconfig.net/yang/interfaces/tunnel"; + + prefix "oc-tun"; + + import openconfig-interfaces { prefix oc-if; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-inet-types { prefix oc-inet; } + import openconfig-if-ip { prefix oc-ip; } + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This model adds extensions to the OpenConfig interfaces + model to configure tunnel interfaces on a network + device."; + + oc-ext:openconfig-version "0.1.1"; + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.1.1"; + } + + revision "2018-01-05" { + description + "Initial tunnel model"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + grouping tunnel-top { + description + "Top-level grouping for parameters related to + a tunnel interface."; + + container tunnel { + description + "In the case that the interface is logical tunnel + interface, the parameters for the tunnel are + specified within this subtree. Tunnel interfaces + have only a single logical subinterface associated + with them."; + + container config { + description + "Configuration parameters associated with the + tunnel interface"; + uses tunnel-config; + } + + container state { + config false; + description + "Operational state parameters associated with + the tunnel interface."; + uses tunnel-config; + } + + uses oc-ip:ipv4-top; + uses oc-ip:ipv6-top; + } + } + + grouping tunnel-config { + description + "Configuraton parameters relating to a tunnel + interface."; + + leaf src { + type oc-inet:ip-address; + description + "The source address that should be used for the + tunnel."; + } + + leaf dst { + type oc-inet:ip-address; + description + "The destination address for the tunnel."; + } + + leaf ttl { + type uint8 { + range "1..255"; + } + description + "The time-to-live (or hop limit) that should be utilised + for the IP packets used for the tunnel transport."; + } + + leaf gre-key { + type uint32; + description + "The GRE key to be specified for the tunnel. The + key is used to identify a traffic flow within + a tunnel."; + reference + "RFC2890: Key and Sequence Number Extensions to GRE"; + } + } + + augment "/oc-if:interfaces/oc-if:interface" { + description + "Augment to add tunnel configuration to interfaces"; + uses tunnel-top; + } +} diff --git a/confdgnmi/oc/openconfig-inet-types.yang b/confdgnmi/oc/openconfig-inet-types.yang new file mode 100644 index 0000000..3d3ed42 --- /dev/null +++ b/confdgnmi/oc/openconfig-inet-types.yang @@ -0,0 +1,478 @@ +module openconfig-inet-types { + + yang-version "1"; + namespace "http://openconfig.net/yang/types/inet"; + prefix "oc-inet"; + + import openconfig-extensions { prefix "oc-ext"; } + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module contains a set of Internet address related + types for use in OpenConfig modules. + + Portions of this code were derived from IETF RFC 6021. + Please reproduce this note if possible. + + IETF code is subject to the following copyright and license: + Copyright (c) IETF Trust and the persons identified as authors of + the code. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in + Section 4.c of the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info)."; + + oc-ext:openconfig-version "0.6.0"; + + revision "2023-02-06" { + description + "Add ipv6-link-local and ipv6-address-type"; + reference "0.6.0"; + } + + revision "2021-08-17" { + description + "Add ip-address-zoned typedef as a union between ipv4-address-zoned + and ipv6-address-zoned types."; + reference "0.5.0"; + } + + revision "2021-07-14" { + description + "Use auto-generated regex for ipv4 pattern statements: + - ipv4-address + - ipv4-address-zoned + - ipv4-prefix"; + reference "0.4.1"; + } + + revision "2021-01-07" { + description + "Remove module extension oc-ext:regexp-posix by making pattern regexes + conform to RFC7950. + + Types impacted: + - ipv4-address + - ipv4-address-zoned + - ipv6-address + - domain-name"; + reference "0.4.0"; + } + + revision "2020-10-12" { + description + "Fix anchors for domain-name pattern."; + reference "0.3.5"; + } + + revision "2020-06-30" { + description + "Add OpenConfig POSIX pattern extensions and add anchors for domain-name + pattern."; + reference "0.3.4"; + } + + revision "2019-04-25" { + description + "Fix regex bug for ipv6-prefix type"; + reference "0.3.3"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.3.2"; + } + + revision 2017-08-24 { + description + "Minor formatting fixes."; + reference "0.3.1"; + } + + revision 2017-07-06 { + description + "Add domain-name and host typedefs"; + reference "0.3.0"; + } + + revision 2017-04-03 { + description + "Add ip-version typedef."; + reference "0.2.0"; + } + + revision 2017-04-03 { + description + "Update copyright notice."; + reference "0.1.1"; + } + + revision 2017-01-26 { + description + "Initial module for inet types"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // IPv4 and IPv6 types. + + typedef ipv4-address { + type string { + pattern + '([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|' + + '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}'; + oc-ext:posix-pattern + '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|' + + '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3})$'; + } + description + "An IPv4 address in dotted quad notation using the default + zone."; + } + + typedef ipv4-address-zoned { + type string { + pattern + '([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|' + + '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}(%[a-zA-Z0-9_]+)'; + oc-ext:posix-pattern + '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|' + + '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}(%[a-zA-Z0-9_]+))$'; + } + description + "An IPv4 address in dotted quad notation. This type allows + specification of a zone index to disambiguate identical + address values. For link-local addresses, the index is + typically the interface index or interface name."; + } + + typedef ipv6-address { + type string { + pattern + // Must support compression through different lengths + // therefore this regexp is complex. + '(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')'; + oc-ext:posix-pattern + // Must support compression through different lengths + // therefore this regexp is complex. + '^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')$'; + } + description + "An IPv6 address represented as either a full address; shortened + or mixed-shortened formats, using the default zone."; + } + + typedef ipv6-address-zoned { + type string { + pattern + // Must support compression through different lengths + // therefore this regexp is complex. + '^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')(%[a-zA-Z0-9_]+)$'; + oc-ext:posix-pattern + // Must support compression through different lengths + // therefore this regexp is complex. + '^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')(%[a-zA-Z0-9_]+)$'; + } + description + "An IPv6 address represented as either a full address; shortened + or mixed-shortened formats. This type allows specification of + a zone index to disambiguate identical address values. For + link-local addresses, the index is typically the interface + index or interface name."; + } + + typedef ipv4-prefix { + type string { + pattern + '([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|' + + '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}/([0-9]|[12][0-9]|' + + '3[0-2])'; + oc-ext:posix-pattern + '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|' + + '[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}/([0-9]|[12][0-9]|' + + '3[0-2]))$'; + } + description + "An IPv4 prefix represented in dotted quad notation followed by + a slash and a CIDR mask (0 <= mask <= 32)."; + } + + typedef ipv6-prefix { + type string { + pattern + '(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9])'; + oc-ext:posix-pattern + '^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9])$'; + } + description + "An IPv6 prefix represented in full, shortened, or mixed + shortened format followed by a slash and CIDR mask + (0 <= mask <= 128)."; + } + + typedef ip-address { + type union { + type ipv4-address; + type ipv6-address; + } + description + "An IPv4 or IPv6 address with no prefix specified."; + } + + typedef ip-address-zoned { + type union { + type ipv4-address-zoned; + type ipv6-address-zoned; + } + description + "An IPv4 or IPv6 address with no prefix specified and an optional + zone index."; + } + + typedef ip-prefix { + type union { + type ipv4-prefix; + type ipv6-prefix; + } + description + "An IPv4 or IPv6 prefix."; + } + + typedef ip-version { + type enumeration { + enum UNKNOWN { + value 0; + description + "An unknown or unspecified version of the Internet + protocol."; + } + enum IPV4 { + value 4; + description + "The IPv4 protocol as defined in RFC 791."; + } + enum IPV6 { + value 6; + description + "The IPv6 protocol as defined in RFC 2460."; + } + } + description + "This value represents the version of the IP protocol. + Note that integer representation of the enumerated values + are not specified, and are not required to follow the + InetVersion textual convention in SMIv2."; + reference + "RFC 791: Internet Protocol + RFC 2460: Internet Protocol, Version 6 (IPv6) Specification + RFC 4001: Textual Conventions for Internet Network Addresses"; + } + + typedef ipv6-address-type { + type enumeration { + enum GLOBAL_UNICAST { + description + "The IPv6 address is a global unicast address type and must be in + the format defined in RFC 4291 section 2.4."; + } + enum LINK_LOCAL_UNICAST { + description + "The IPv6 address is a Link-Local unicast address type and must be + in the format defined in RFC 4291 section 2.4."; + } + } + description + "The value represents the type of IPv6 address"; + reference + "RFC 4291: IP Version 6 Addressing Architecture + section 2.5"; + } + + typedef domain-name { + type string { + length "1..253"; + pattern + '(((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' + + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' + + '|\.)'; + oc-ext:posix-pattern + '^(((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' + + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' + + '|\.)$'; + } + description + "The domain-name type represents a DNS domain name. + Fully quallified left to the models which utilize this type. + + Internet domain names are only loosely specified. Section + 3.5 of RFC 1034 recommends a syntax (modified in Section + 2.1 of RFC 1123). The pattern above is intended to allow + for current practice in domain name use, and some possible + future expansion. It is designed to hold various types of + domain names, including names used for A or AAAA records + (host names) and other records, such as SRV records. Note + that Internet host names have a stricter syntax (described + in RFC 952) than the DNS recommendations in RFCs 1034 and + 1123, and that systems that want to store host names in + schema nodes using the domain-name type are recommended to + adhere to this stricter standard to ensure interoperability. + + The encoding of DNS names in the DNS protocol is limited + to 255 characters. Since the encoding consists of labels + prefixed by a length bytes and there is a trailing NULL + byte, only 253 characters can appear in the textual dotted + notation. + + Domain-name values use the US-ASCII encoding. Their canonical + format uses lowercase US-ASCII characters. Internationalized + domain names MUST be encoded in punycode as described in RFC + 3492"; + } + + typedef host { + type union { + type ip-address; + type domain-name; + } + description + "The host type represents either an unzoned IP address or a DNS + domain name."; + } + + typedef as-number { + type uint32; + description + "A numeric identifier for an autonomous system (AS). An AS is a + single domain, under common administrative control, which forms + a unit of routing policy. Autonomous systems can be assigned a + 2-byte identifier, or a 4-byte identifier which may have public + or private scope. Private ASNs are assigned from dedicated + ranges. Public ASNs are assigned from ranges allocated by IANA + to the regional internet registries (RIRs)."; + reference + "RFC 1930 Guidelines for creation, selection, and registration + of an Autonomous System (AS) + RFC 4271 A Border Gateway Protocol 4 (BGP-4)"; + } + + typedef dscp { + type uint8 { + range "0..63"; + } + description + "A differentiated services code point (DSCP) marking within the + IP header."; + reference + "RFC 2474 Definition of the Differentiated Services Field + (DS Field) in the IPv4 and IPv6 Headers"; + } + + typedef ipv6-flow-label { + type uint32 { + range "0..1048575"; + } + description + "The IPv6 flow-label is a 20-bit value within the IPv6 header + which is optionally used by the source of the IPv6 packet to + label sets of packets for which special handling may be + required."; + reference + "RFC 2460 Internet Protocol, Version 6 (IPv6) Specification"; + } + + typedef port-number { + type uint16; + description + "A 16-bit port number used by a transport protocol such as TCP + or UDP."; + reference + "RFC 768 User Datagram Protocol + RFC 793 Transmission Control Protocol"; + } + + typedef uri { + type string; + description + "An ASCII-encoded Uniform Resource Identifier (URI) as defined + in RFC 3986."; + reference + "RFC 3986 Uniform Resource Identifier (URI): Generic Syntax"; + } + + typedef url { + type string; + description + "An ASCII-encoded Uniform Resource Locator (URL) as defined + in RFC 3986, section 1.1.3"; + reference + "RFC 3986, paragraph 1.1.3"; + } + +} diff --git a/confdgnmi/oc/openconfig-interfaces.yang b/confdgnmi/oc/openconfig-interfaces.yang new file mode 100644 index 0000000..e6f0617 --- /dev/null +++ b/confdgnmi/oc/openconfig-interfaces.yang @@ -0,0 +1,1112 @@ +module openconfig-interfaces { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/interfaces"; + + prefix "oc-if"; + + // import some basic types + import ietf-interfaces { prefix ietf-if; } + import openconfig-yang-types { prefix oc-yang; } + import openconfig-types { prefix oc-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-transport-types { prefix oc-opt-types; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Model for managing network interfaces and subinterfaces. This + module also defines convenience types / groupings for other + models to create references to interfaces: + + base-interface-ref (type) - reference to a base interface + interface-ref (grouping) - container for reference to a + interface + subinterface + interface-ref-state (grouping) - container for read-only + (opstate) reference to interface + subinterface + + This model reuses data items defined in the IETF YANG model for + interfaces described by RFC 7223 with an alternate structure + (particularly for operational state data) and with + additional configuration items. + + Portions of this code were derived from IETF RFC 7223. + Please reproduce this note if possible. + + IETF code is subject to the following copyright and license: + Copyright (c) IETF Trust and the persons identified as authors of + the code. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in + Section 4.c of the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info)."; + + oc-ext:openconfig-version "3.0.0"; + + revision "2022-10-25" { + description + "change loopback-mode to align with available modes"; + reference "3.0.0"; + } + + revision "2021-04-06" { + description + "Add leaves for management and cpu interfaces"; + reference "2.5.0"; + } + + revision "2019-11-19" { + description + "Update description of interface name."; + reference "2.4.3"; + } + + revision "2019-07-10" { + description + "Remove redundant nanosecond units statements to reflect + universal definition of timeticks64 type."; + reference "2.4.2"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "2.4.1"; + } + + revision "2018-08-07" { + description + "Add leaf to indicate whether an interface is physical or + logical."; + reference "2.4.0"; + } + + revision "2018-07-02" { + description + "Add in-pkts and out-pkts in counters"; + reference "2.3.2"; + } + + revision "2018-04-24" { + description + "Clarified behavior of last-change state leaf"; + reference "2.3.1"; + } + + revision "2018-01-05" { + description + "Add logical loopback to interface."; + reference "2.3.0"; + } + + revision "2017-12-22" { + description + "Add IPv4 proxy ARP configuration."; + reference "2.2.0"; + } + + revision "2017-12-21" { + description + "Added IPv6 router advertisement configuration."; + reference "2.1.0"; + } + + revision "2017-07-14" { + description + "Added Ethernet/IP state data; Add dhcp-client; + migrate to OpenConfig types modules; Removed or + renamed opstate values"; + reference "2.0.0"; + } + + revision "2017-04-03" { + description + "Update copyright notice."; + reference "1.1.1"; + } + + revision "2016-12-22" { + description + "Fixes to Ethernet interfaces model"; + reference "1.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // typedef statements + + typedef base-interface-ref { + type leafref { + path "/oc-if:interfaces/oc-if:interface/oc-if:name"; + } + description + "Reusable type for by-name reference to a base interface. + This type may be used in cases where ability to reference + a subinterface is not required."; + } + + typedef interface-id { + type string; + description + "User-defined identifier for an interface, generally used to + name a interface reference. The id can be arbitrary but a + useful convention is to use a combination of base interface + name and subinterface index."; + } + + // grouping statements + + grouping interface-ref-common { + description + "Reference leafrefs to interface / subinterface"; + + leaf interface { + type leafref { + path "/oc-if:interfaces/oc-if:interface/oc-if:name"; + } + description + "Reference to a base interface. If a reference to a + subinterface is required, this leaf must be specified + to indicate the base interface."; + } + + leaf subinterface { + type leafref { + path "/oc-if:interfaces/" + + "oc-if:interface[oc-if:name=current()/../interface]/" + + "oc-if:subinterfaces/oc-if:subinterface/oc-if:index"; + } + description + "Reference to a subinterface -- this requires the base + interface to be specified using the interface leaf in + this container. If only a reference to a base interface + is requuired, this leaf should not be set."; + } + } + + grouping interface-ref-state-container { + description + "Reusable opstate w/container for a reference to an + interface or subinterface"; + + container state { + config false; + description + "Operational state for interface-ref"; + + uses interface-ref-common; + } + } + + grouping interface-ref { + description + "Reusable definition for a reference to an interface or + subinterface"; + + container interface-ref { + description + "Reference to an interface or subinterface"; + + container config { + description + "Configured reference to interface / subinterface"; + oc-ext:telemetry-on-change; + + uses interface-ref-common; + } + + uses interface-ref-state-container; + } + } + + grouping interface-ref-state { + description + "Reusable opstate w/container for a reference to an + interface or subinterface"; + + container interface-ref { + description + "Reference to an interface or subinterface"; + + uses interface-ref-state-container; + } + } + + grouping base-interface-ref-state { + description + "Reusable opstate w/container for a reference to a + base interface (no subinterface)."; + + container state { + config false; + description + "Operational state for base interface reference"; + + leaf interface { + type base-interface-ref; + description + "Reference to a base interface."; + } + } + } + + + grouping interface-common-config { + description + "Configuration data data nodes common to physical interfaces + and subinterfaces"; + + leaf description { + type string; + description + "A textual description of the interface. + + A server implementation MAY map this leaf to the ifAlias + MIB object. Such an implementation needs to use some + mechanism to handle the differences in size and characters + allowed between this leaf and ifAlias. The definition of + such a mechanism is outside the scope of this document. + + Since ifAlias is defined to be stored in non-volatile + storage, the MIB implementation MUST map ifAlias to the + value of 'description' in the persistently stored + datastore. + + Specifically, if the device supports ':startup', when + ifAlias is read the device MUST return the value of + 'description' in the 'startup' datastore, and when it is + written, it MUST be written to the 'running' and 'startup' + datastores. Note that it is up to the implementation to + + decide whether to modify this single leaf in 'startup' or + perform an implicit copy-config from 'running' to + 'startup'. + + If the device does not support ':startup', ifAlias MUST + be mapped to the 'description' leaf in the 'running' + datastore."; + reference + "RFC 2863: The Interfaces Group MIB - ifAlias"; + } + + leaf enabled { + type boolean; + default "true"; + description + "This leaf contains the configured, desired state of the + interface. + + Systems that implement the IF-MIB use the value of this + leaf in the 'running' datastore to set + IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry + has been initialized, as described in RFC 2863. + + Changes in this leaf in the 'running' datastore are + reflected in ifAdminStatus, but if ifAdminStatus is + changed over SNMP, this leaf is not affected."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + } + + grouping interface-phys-config { + description + "Configuration data for physical interfaces"; + + leaf name { + type string; + description + "The name of the interface. + + A device MAY restrict the allowed values for this leaf, + possibly depending on the type of the interface. + For system-controlled interfaces, this leaf is the + device-specific name of the interface. The 'config false' + list interfaces/interface[name]/state contains the currently + existing interfaces on the device. + + If a client tries to create configuration for a + system-controlled interface that is not present in the + corresponding state list, the server MAY reject + the request if the implementation does not support + pre-provisioning of interfaces or if the name refers to + an interface that can never exist in the system. A + NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case. + + The IETF model in RFC 7223 provides YANG features for the + following (i.e., pre-provisioning and arbitrary-names), + however they are omitted here: + + If the device supports pre-provisioning of interface + configuration, the 'pre-provisioning' feature is + advertised. + + If the device allows arbitrarily named user-controlled + interfaces, the 'arbitrary-names' feature is advertised. + + When a configured user-controlled interface is created by + the system, it is instantiated with the same name in the + /interfaces/interface[name]/state list."; + } + + leaf type { + type identityref { + base ietf-if:interface-type; + } + mandatory true; + description + "The type of the interface. + + When an interface entry is created, a server MAY + initialize the type leaf with a valid value, e.g., if it + is possible to derive the type from the name of the + interface. + + If a client tries to set the type of an interface to a + value that can never be used by the system, e.g., if the + type is not supported or if the type does not match the + name of the interface, the server MUST reject the request. + A NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf mtu { + type uint16; + description + "Set the max transmission unit size in octets + for the physical interface. If this is not set, the mtu is + set to the operational default -- e.g., 1514 bytes on an + Ethernet interface."; + } + + leaf loopback-mode { + type oc-opt-types:loopback-mode-type; + description + "Sets the loopback type on the interface. Setting the + mode to something besides NONE activates the loopback in + the specified mode."; + } + + uses interface-common-config; + } + + grouping interface-phys-holdtime-config { + description + "Configuration data for interface hold-time settings -- + applies to physical interfaces."; + + leaf up { + type uint32; + units milliseconds; + default 0; + description + "Dampens advertisement when the interface + transitions from down to up. A zero value means dampening + is turned off, i.e., immediate notification."; + } + + leaf down { + type uint32; + units milliseconds; + default 0; + description + "Dampens advertisement when the interface transitions from + up to down. A zero value means dampening is turned off, + i.e., immediate notification."; + } + } + + grouping interface-phys-holdtime-state { + description + "Operational state data for interface hold-time."; + } + + grouping interface-phys-holdtime-top { + description + "Top-level grouping for setting link transition + dampening on physical and other types of interfaces."; + + container hold-time { + description + "Top-level container for hold-time settings to enable + dampening advertisements of interface transitions."; + + container config { + description + "Configuration data for interface hold-time settings."; + oc-ext:telemetry-on-change; + + uses interface-phys-holdtime-config; + } + + container state { + + config false; + + description + "Operational state data for interface hold-time."; + + uses interface-phys-holdtime-config; + uses interface-phys-holdtime-state; + } + } + } + + grouping interface-common-state { + description + "Operational state data (in addition to intended configuration) + at the global level for this interface"; + + oc-ext:operational; + + leaf ifindex { + type uint32; + description + "System assigned number for each interface. Corresponds to + ifIndex object in SNMP Interface MIB"; + reference + "RFC 2863 - The Interfaces Group MIB"; + oc-ext:telemetry-on-change; + } + + leaf admin-status { + type enumeration { + enum UP { + description + "Ready to pass packets."; + } + enum DOWN { + description + "Not ready to pass packets and not in some test mode."; + } + enum TESTING { + //TODO: This is generally not supported as a configured + //admin state, though it's in the standard interfaces MIB. + //Consider removing it. + description + "In some test mode."; + } + } + //TODO:consider converting to an identity to have the + //flexibility to remove some values defined by RFC 7223 that + //are not used or not implemented consistently. + mandatory true; + description + "The desired state of the interface. In RFC 7223 this leaf + has the same read semantics as ifAdminStatus. Here, it + reflects the administrative state as set by enabling or + disabling the interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + oc-ext:telemetry-on-change; + } + + leaf oper-status { + type enumeration { + enum UP { + value 1; + description + "Ready to pass packets."; + } + enum DOWN { + value 2; + description + "The interface does not pass any packets."; + } + enum TESTING { + value 3; + description + "In some test mode. No operational packets can + be passed."; + } + enum UNKNOWN { + value 4; + description + "Status cannot be determined for some reason."; + } + enum DORMANT { + value 5; + description + "Waiting for some external event."; + } + enum NOT_PRESENT { + value 6; + description + "Some component (typically hardware) is missing."; + } + enum LOWER_LAYER_DOWN { + value 7; + description + "Down due to state of lower-layer interface(s)."; + } + } + //TODO:consider converting to an identity to have the + //flexibility to remove some values defined by RFC 7223 that + //are not used or not implemented consistently. + mandatory true; + description + "The current operational state of the interface. + + This leaf has the same semantics as ifOperStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifOperStatus"; + oc-ext:telemetry-on-change; + } + + leaf last-change { + type oc-types:timeticks64; + description + "This timestamp indicates the absolute time of the last + state change of the interface (e.g., up-to-down transition). + This is different than the SNMP ifLastChange object in the + standard interface MIB in that it is not relative to the + system boot time (i.e,. sysUpTime). + + The value is the timestamp in nanoseconds relative to + the Unix Epoch (Jan 1, 1970 00:00:00 UTC)."; + oc-ext:telemetry-on-change; + } + + leaf logical { + type boolean; + description + "When set to true, the interface is a logical interface + which does not have an associated physical port or + channel on the system."; + oc-ext:telemetry-on-change; + } + + leaf management { + type boolean; + description + "When set to true, the interface is a dedicated + management interface that is not connected to dataplane + interfaces. It may be used to connect the system to an + out-of-band management network, for example."; + oc-ext:telemetry-on-change; + } + + leaf cpu { + type boolean; + description + "When set to true, the interface is for traffic + that is handled by the system CPU, sometimes also called the + control plane interface. On systems that represent the CPU + interface as an Ethernet interface, for example, this leaf + should be used to distinguish the CPU interface from dataplane + interfaces."; + oc-ext:telemetry-on-change; + } + } + + + grouping interface-counters-state { + description + "Operational state representing interface counters + and statistics."; + + //TODO: we may need to break this list of counters into those + //that would appear for physical vs. subinterface or logical + //interfaces. For now, just replicating the full stats + //grouping to both interface and subinterface. + + oc-ext:operational; + + container counters { + description + "A collection of interface-related statistics objects."; + + leaf in-octets { + type oc-yang:counter64; + description + "The total number of octets received on the interface, + including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInOctets"; + } + + leaf in-pkts { + type oc-yang:counter64; + description + "The total number of packets received on the interface, + including all unicast, multicast, broadcast and bad packets + etc."; + reference + "RFC 2819: Remote Network Monitoring Management Information + Base"; + } + + leaf in-unicast-pkts { + type oc-yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were not addressed to a + multicast or broadcast address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts"; + } + + leaf in-broadcast-pkts { + type oc-yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a broadcast + address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInBroadcastPkts"; + } + + leaf in-multicast-pkts { + type oc-yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a multicast + address at this sub-layer. For a MAC-layer protocol, + this includes both Group and Functional addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInMulticastPkts"; + } + + leaf in-discards { + type oc-yang:counter64; + description + "The number of inbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being deliverable to a higher-layer + protocol. One possible reason for discarding such a + packet could be to free up buffer space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + + + reference + "RFC 2863: The Interfaces Group MIB - ifInDiscards"; + } + + leaf in-errors { + type oc-yang:counter64; + description + "For packet-oriented interfaces, the number of inbound + packets that contained errors preventing them from being + deliverable to a higher-layer protocol. For character- + oriented or fixed-length interfaces, the number of + inbound transmission units that contained errors + preventing them from being deliverable to a higher-layer + protocol. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInErrors"; + } + + leaf in-unknown-protos { + type oc-yang:counter64; + description + "For packet-oriented interfaces, the number of packets + received via the interface that were discarded because + of an unknown or unsupported protocol. For + character-oriented or fixed-length interfaces that + support protocol multiplexing, the number of + transmission units received via the interface that were + discarded because of an unknown or unsupported protocol. + For any interface that does not support protocol + multiplexing, this counter is not present. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos"; + } + + leaf in-fcs-errors { + type oc-yang:counter64; + description + "Number of received packets which had errors in the + frame check sequence (FCS), i.e., framing errors. + + Discontinuities in the value of this counter can occur + when the device is re-initialization as indicated by the + value of 'last-clear'."; + } + + leaf out-octets { + type oc-yang:counter64; + description + "The total number of octets transmitted out of the + interface, including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutOctets"; + } + + leaf out-pkts { + type oc-yang:counter64; + description + "The total number of packets transmitted out of the + interface, including all unicast, multicast, broadcast, + and bad packets etc."; + reference + "RFC 2819: Remote Network Monitoring Management Information + Base"; + } + + leaf out-unicast-pkts { + type oc-yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and that were not addressed + to a multicast or broadcast address at this sub-layer, + including those that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts"; + } + + leaf out-broadcast-pkts { + type oc-yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and that were addressed to a + broadcast address at this sub-layer, including those + that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutBroadcastPkts"; + } + + + leaf out-multicast-pkts { + type oc-yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and that were addressed to a + multicast address at this sub-layer, including those + that were discarded or not sent. For a MAC-layer + protocol, this includes both Group and Functional + addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutMulticastPkts"; + } + + leaf out-discards { + type oc-yang:counter64; + description + "The number of outbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being transmitted. One possible reason + for discarding such a packet could be to free up buffer + space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutDiscards"; + } + + leaf out-errors { + type oc-yang:counter64; + description + "For packet-oriented interfaces, the number of outbound + packets that could not be transmitted because of errors. + For character-oriented or fixed-length interfaces, the + number of outbound transmission units that could not be + transmitted because of errors. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'last-clear'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutErrors"; + } + + leaf carrier-transitions { + type oc-yang:counter64; + description + "Number of times the interface state has transitioned + between up and down since the time the device restarted + or the last-clear time, whichever is most recent."; + oc-ext:telemetry-on-change; + } + + leaf last-clear { + type oc-types:timeticks64; + description + "Timestamp of the last time the interface counters were + cleared. + + The value is the timestamp in nanoseconds relative to + the Unix Epoch (Jan 1, 1970 00:00:00 UTC)."; + oc-ext:telemetry-on-change; + } + } + } + + // data definition statements + + grouping sub-unnumbered-config { + description + "Configuration data for unnumbered subinterfaces"; + + leaf enabled { + type boolean; + default false; + description + "Indicates that the subinterface is unnumbered. By default + the subinterface is numbered, i.e., expected to have an + IP address configuration."; + } + } + + grouping sub-unnumbered-state { + description + "Operational state data unnumbered subinterfaces"; + } + + grouping sub-unnumbered-top { + description + "Top-level grouping unnumbered subinterfaces"; + + container unnumbered { + description + "Top-level container for setting unnumbered interfaces. + Includes reference the interface that provides the + address information"; + + container config { + description + "Configuration data for unnumbered interface"; + oc-ext:telemetry-on-change; + + uses sub-unnumbered-config; + } + + container state { + + config false; + + description + "Operational state data for unnumbered interfaces"; + + uses sub-unnumbered-config; + uses sub-unnumbered-state; + } + + uses oc-if:interface-ref; + } + } + + grouping subinterfaces-config { + description + "Configuration data for subinterfaces"; + + leaf index { + type uint32; + default 0; + description + "The index of the subinterface, or logical interface number. + On systems with no support for subinterfaces, or not using + subinterfaces, this value should default to 0, i.e., the + default subinterface."; + } + + uses interface-common-config; + + } + + grouping subinterfaces-state { + description + "Operational state data for subinterfaces"; + + oc-ext:operational; + + leaf name { + type string; + description + "The system-assigned name for the sub-interface. This MAY + be a combination of the base interface name and the + subinterface index, or some other convention used by the + system."; + oc-ext:telemetry-on-change; + } + + uses interface-common-state; + uses interface-counters-state; + } + + grouping subinterfaces-top { + description + "Subinterface data for logical interfaces associated with a + given interface"; + + container subinterfaces { + description + "Enclosing container for the list of subinterfaces associated + with a physical interface"; + + list subinterface { + key "index"; + + description + "The list of subinterfaces (logical interfaces) associated + with a physical interface"; + + leaf index { + type leafref { + path "../config/index"; + } + description + "The index number of the subinterface -- used to address + the logical interface"; + } + + container config { + description + "Configurable items at the subinterface level"; + oc-ext:telemetry-on-change; + + uses subinterfaces-config; + } + + container state { + + config false; + description + "Operational state data for logical interfaces"; + + uses subinterfaces-config; + uses subinterfaces-state; + } + } + } + } + + grouping interfaces-top { + description + "Top-level grouping for interface configuration and + operational state data"; + + container interfaces { + description + "Top level container for interfaces, including configuration + and state data."; + + + list interface { + key "name"; + + description + "The list of named interfaces on the device."; + + leaf name { + type leafref { + path "../config/name"; + } + description + "References the name of the interface"; + //TODO: need to consider whether this should actually + //reference the name in the state subtree, which + //presumably would be the system-assigned name, or the + //configured name. Points to the config/name now + //because of YANG 1.0 limitation that the list + //key must have the same "config" as the list, and + //also can't point to a non-config node. + } + + container config { + description + "Configurable items at the global, physical interface + level"; + oc-ext:telemetry-on-change; + + uses interface-phys-config; + } + + container state { + + config false; + description + "Operational state data at the global interface level"; + + uses interface-phys-config; + uses interface-common-state; + uses interface-counters-state; + } + + uses interface-phys-holdtime-top; + uses subinterfaces-top; + } + } + } + + uses interfaces-top; + +} diff --git a/confdgnmi/oc/openconfig-platform-common.yang b/confdgnmi/oc/openconfig-platform-common.yang new file mode 100644 index 0000000..9bb8cd1 --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-common.yang @@ -0,0 +1,227 @@ +submodule openconfig-platform-common { + + yang-version "1"; + + belongs-to openconfig-platform { + prefix "oc-platform"; + } + + import openconfig-platform-types { prefix oc-platform-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-types { prefix oc-types; } + + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This modules contains common groupings that are used in multiple + components within the platform module."; + + oc-ext:openconfig-version "0.22.0"; + + revision "2022-12-20" { + description + "Add threshold and threshold-exceeded for resource usage."; + reference "0.22.0"; + } + + revision "2022-12-19" { + description + "Update last-high-watermark timestamp documentation."; + reference "0.21.1"; + } + + revision "2022-09-26" { + description + "Add state data for base-mac-address."; + reference "0.21.0"; + } + + revision "2022-08-31" { + description + "Add new state data for component CLEI code."; + reference "0.20.0"; + } + + revision "2022-07-28" { + description + "Add grouping for component power management"; + reference "0.19.0"; + } + + revision "2022-07-11" { + description + "Add switchover ready"; + reference "0.18.0"; + } + + revision "2022-06-10" { + description + "Specify units and epoch for switchover and reboot times."; + reference "0.17.0"; + } + + revision "2022-04-21" { + description + "Add platform utilization."; + reference "0.16.0"; + } + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + // grouping statements + + grouping platform-utilization-top { + description + "Top level of utilization."; + + container utilization { + description + "Utilization of the component."; + + container resources { + description + "Enclosing container for the resources in this component."; + + list resource { + key "name"; + description + "List of resources, keyed by resource name."; + + leaf name { + type leafref { + path "../config/name"; + } + description + "References the resource name."; + } + + container config { + description + "Configuration data for each resource."; + + uses platform-utilization-resource-config; + } + + container state { + config false; + description + "Operational state data for each resource."; + + uses platform-utilization-resource-config; + uses platform-utilization-resource-state; + } + } + } + } + } + + grouping platform-utilization-resource-config { + description + "Configuration data for utilization resource."; + + leaf name { + type string; + description + "Resource name within the component."; + } + + leaf used-threshold-upper { + type oc-types:percentage; + description + "The used percentage value (used / (used + free) * 100) that + when crossed will set utilization-threshold-exceeded to 'true'."; + } + + leaf used-threshold-upper-clear { + type oc-types:percentage; + description + "The used percentage value (used / (used + free) * 100) that when + crossed will set utilization-threshold-exceeded to 'false'."; + } + } + + grouping platform-utilization-resource-state { + description + "Operational state data for utilization resource."; + + leaf used { + type uint64; + description + "Number of entries currently in use for the resource."; + } + + leaf committed { + type uint64; + description + "Number of entries currently reserved for this resource. This is only + relevant to tables which allocate a block of resource for a given + feature."; + } + + leaf free { + type uint64; + description + "Number of entries available to use."; + } + + leaf max-limit { + type uint64; + description + "Maximum number of entries available for the resource. The value + is the theoretical maximum resource utilization possible."; + } + + leaf high-watermark { + type uint64; + description + "A watermark of highest number of entries used for this resource."; + } + + leaf last-high-watermark { + type oc-types:timeticks64; + description + "The timestamp when the high-watermark was last updated. The value + is the timestamp in nanoseconds relative to the Unix Epoch + (Jan 1, 1970 00:00:00 UTC)."; + } + + leaf used-threshold-upper-exceeded { + type boolean; + description + "This value is set to true when the used percentage value + (used / (used + free) * 100) has crossed the used-threshold-upper for this + resource and false when the used percentage value has crossed the configured + used-threshold-upper-clear value for this resource."; + } + } + + grouping component-power-management { + description + "Common grouping for managing component power"; + + leaf power-admin-state { + type oc-platform-types:component-power-type; + default POWER_ENABLED; + description + "Enable or disable power to the component"; + } + } + + // data definition statements + + // augment statements + + // rpc statements + + // notification statements +} diff --git a/confdgnmi/oc/openconfig-platform-controller-card.yang b/confdgnmi/oc/openconfig-platform-controller-card.yang new file mode 100644 index 0000000..1bea20f --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-controller-card.yang @@ -0,0 +1,81 @@ +module openconfig-platform-controller-card { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/controller-card"; + + prefix "oc-ctrl-card"; + + import openconfig-platform { prefix oc-platform; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data related to CONTROLLER_CARD components in + the openconfig-platform model"; + + oc-ext:openconfig-version "0.1.0"; + + revision "2022-07-28" { + description + "Initial revision"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + // grouping statements + + grouping controller-card-config { + description + "Configuration data for controller card components"; + + uses oc-platform:component-power-management; + } + + // data definition statements + + // augment statements + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:controller-card/oc-platform:config" { + description + "Adding controller card data to physical inventory. This subtree + is only valid when the type of the component is CONTROLLER_CARD."; + + uses controller-card-config; + } + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:controller-card/oc-platform:state" { + description + "Adding controller card data to physical inventory. This subtree + is only valid when the type of the component is CONTROLLER_CARD."; + + uses controller-card-config; + } + + // rpc statements + + // notification statements + +} + diff --git a/confdgnmi/oc/openconfig-platform-cpu.yang b/confdgnmi/oc/openconfig-platform-cpu.yang new file mode 100644 index 0000000..4182c77 --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-cpu.yang @@ -0,0 +1,72 @@ +module openconfig-platform-cpu { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/cpu"; + + prefix "oc-cpu"; + + import openconfig-platform { prefix oc-platform; } + import openconfig-types { prefix oc-types; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data related to FAN components in the + OpenConfig platform model."; + + oc-ext:openconfig-version "0.1.1"; + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.1.1"; + } + + revision "2018-01-30" { + description + "Initial revision"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + grouping component-cpu-utilization { + description + "Per-component CPU statistics"; + + container utilization { + description + "Statistics representing CPU utilization of the + component."; + + container state { + config false; + description + "Operational state variables relating to the utilization + of the CPU."; + + uses oc-types:avg-min-max-instant-stats-pct; + } + } + } + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:cpu" { + description + "Adding CPU utilization data to component model"; + + uses component-cpu-utilization; + } +} diff --git a/confdgnmi/oc/openconfig-platform-fabric.yang b/confdgnmi/oc/openconfig-platform-fabric.yang new file mode 100644 index 0000000..95d106c --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-fabric.yang @@ -0,0 +1,81 @@ +module openconfig-platform-fabric { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/fabric"; + + prefix "oc-fabric"; + + import openconfig-platform { prefix oc-platform; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data related to FABRIC components in + the openconfig-platform model"; + + oc-ext:openconfig-version "0.1.0"; + + revision "2022-07-28" { + description + "Initial revision"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + // grouping statements + + grouping fabric-config { + description + "Configuration data for fabric components"; + + uses oc-platform:component-power-management; + } + + // data definition statements + + // augment statements + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:fabric/oc-platform:config" { + description + "Adding fabric data to physical inventory. This subtree + is only valid when the type of the component is FABRIC."; + + uses fabric-config; + } + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:fabric/oc-platform:state" { + description + "Adding fabric data to physical inventory. This subtree + is only valid when the type of the component is FABRIC."; + + uses fabric-config; + } + + // rpc statements + + // notification statements + +} + diff --git a/confdgnmi/oc/openconfig-platform-fan.yang b/confdgnmi/oc/openconfig-platform-fan.yang new file mode 100644 index 0000000..cd4a381 --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-fan.yang @@ -0,0 +1,76 @@ +module openconfig-platform-fan { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/fan"; + + prefix "oc-fan"; + + import openconfig-platform { prefix oc-platform; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data related to FAN components in the + OpenConfig platform model."; + + oc-ext:openconfig-version "0.1.1"; + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.1.1"; + } + + revision "2018-01-18" { + description + "Initial revision"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // identity statements + + // typedef statements + + // grouping statements + + grouping fan-state { + description + "Operational state data for fan components"; + + leaf speed { + type uint32; + units rpm; + description + "Current (instantaneous) fan speed"; + } + } + + + // data definition statements + + // augment statements + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:fan/oc-platform:state" { + description + "Adding fan data to component model"; + + uses fan-state; + } + +} + diff --git a/confdgnmi/oc/openconfig-platform-linecard.yang b/confdgnmi/oc/openconfig-platform-linecard.yang new file mode 100644 index 0000000..8ac1cfb --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-linecard.yang @@ -0,0 +1,139 @@ +module openconfig-platform-linecard { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/linecard"; + + prefix "oc-linecard"; + + import openconfig-platform { prefix oc-platform; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data related to LINECARD components in + the openconfig-platform model"; + + oc-ext:openconfig-version "1.0.0"; + + revision "2022-07-28" { + description + "Remove leaf power-admin-state and use a common definition + instead."; + reference "1.0.0"; + } + + revision "2022-04-21" { + description + "Add platform utilization to linecard."; + reference "0.2.0"; + } + + revision "2020-05-10" { + description + "Remove when statement that references read-only entity from + a read-write context."; + reference "0.1.2"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.1.1"; + } + + revision "2017-08-03" { + description + "Initial revision"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + // grouping statements + + grouping linecard-config { + description + "Configuration data for linecard components"; + + uses oc-platform:component-power-management; + } + + grouping linecard-state { + description + "Operational state data for linecard components"; + + leaf slot-id { + type string; + description + "Identifier for the slot or chassis position in which the + linecard is installed"; + } + } + + grouping linecard-top { + description + "Top-level grouping for linecard data"; + + container linecard { + description + "Top-level container for linecard data"; + + container config { + description + "Configuration data for linecards"; + + uses linecard-config; + } + + container state { + + config false; + + description + "Operational state data for linecards"; + + uses linecard-config; + uses linecard-state; + } + uses oc-platform:platform-utilization-top; + } + } + + // data definition statements + + // augment statements + + augment "/oc-platform:components/oc-platform:component" { + description + "Adding linecard data to physical inventory. This subtree + is only valid when the type of the component is LINECARD."; + + uses linecard-top; + } + + // rpc statements + + // notification statements + +} + diff --git a/confdgnmi/oc/openconfig-platform-port.yang b/confdgnmi/oc/openconfig-platform-port.yang new file mode 100644 index 0000000..68f5eab --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-port.yang @@ -0,0 +1,321 @@ +module openconfig-platform-port { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/port"; + + prefix "oc-port"; + + // import some basic types + import openconfig-platform { prefix oc-platform; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-if-ethernet { prefix oc-eth; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data related to PORT components in the + openconfig-platform model"; + + oc-ext:openconfig-version "1.0.0"; + + revision "2023-01-19" { + description + "Add clarification of the definition of a physical channel, and + example configurations."; + reference "1.0.0"; + } + + revision "2021-10-01" { + description + "Fix indentation for 'list group'"; + reference "0.4.2"; + } + + revision "2021-06-16" { + description + "Remove trailing whitespace"; + reference "0.4.1"; + } + + revision "2021-04-22" { + description + "Adding support for flexible port breakout."; + reference "0.4.0"; + } + + revision "2020-05-06" { + description + "Ensure that when statements in read-write contexts + reference only read-write leaves."; + reference "0.3.3"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.3.2"; + } + + revision "2018-11-07" { + description + "Fixed error in when statement path"; + reference "0.3.1"; + } + + revision "2018-01-20" { + description + "Added augmentation for interface-to-port reference"; + reference "0.3.0"; + } + + revision "2017-11-17" { + description + "Corrected augmentation path for port data"; + reference "0.2.0"; + } + + revision "2016-10-24" { + description + "Initial revision"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + // grouping statements + + grouping group-config { + description + "Configuration data for the breakout group."; + + leaf index { + type uint8; + description + "Each index specifies breakouts that are identical in + terms of speed and the number of physical channels."; + } + + leaf num-breakouts { + type uint8; + description + "Sets the number of interfaces using this breakout group."; + } + + leaf breakout-speed { + type identityref { + base oc-eth:ETHERNET_SPEED; + } + description + "Speed of interfaces in this breakout group, supported + values are defined by the ETHERNET_SPEED identity."; + } + + leaf num-physical-channels { + type uint8; + description + "Sets the number of lanes or physical channels assigned + to the interfaces in this breakout group. This leaf need + not be set if there is only one breakout group where all + the interfaces are of equal speed and have equal number + of physical channels. + + The physical channels referred to by this leaf are + electrical channels towards the transceiver."; + } + } + + grouping group-state { + description + "Operational state data for the port breakout group."; + } + + grouping port-breakout-top { + description + "Top-level grouping for port breakout data."; + + container breakout-mode { + description + "Top-level container for port breakout-mode data."; + + container groups { + description + "Top level container for breakout groups data. + + When a device has the capability to break a port into + interfaces of different speeds and different number of + physical channels, it can breakout a 400G OSFP port with + 8 physical channels (with support for 25G NRZ, 50G PAM4 + and 100G PAM4) into mixed speed interfaces. Particularly, to + break out into two 100G ports with different modulation, and a 200G + port, a user must configure 1 interface with 2 physical channels + 1 interface with 4 physical channels and 1 interface with + 2 physical channels. With this configuration the interface in + 1st breakout group would use 50G PAM4 modulation, interface + in 2nd breakout group would use 25G NRZ modulation and the + interface in 3rd breakout group would use 100G PAM4 modulation + This configuration would result in 3 entries in the breakout + groups list. The example configuration for this case is shown below: + + { + \"groups\": { + \"group\": [ + { + \"config\": { + \"breakout-speed\": \"SPEED_100GB\", + \"index\": 0, + \"num-breakouts\": 1, + \"num-physical-channels\": 2 + }, + \"index\": 0 + }, + { + \"config\": { + \"breakout-speed\": \"SPEED_100GB\", + \"index\": 1, + \"num-breakouts\": 1, + \"num-physical-channels\": 4 + }, + \"index\": 1 + }, + { + \"config\": { + \"breakout-speed\": \"SPEED_200GB\", + \"index\": 2, + \"num-breakouts\": 1, + \"num-physical-channels\": 2 + }, + \"index\": 2 + } + ] + } + } + + When a device does not have the capability to break a port + into interfaces of different speeds and different number of + physical channels, in order to breakout a 400G OSFP port with + 8 physical channels into 50G breakout ports it would use 8 interfaces + with 1 physical channel each. This would result in 1 entry in the + breakout groups list. The example configuration for this case is + shown below: + + { + \"groups\": { + \"group\": [ + { + \"config\": { + \"breakout-speed\": \"SPEED_50GB\", + \"index\": 0, + \"num-breakouts\": 8, + \"num-physical-channels\": 1 + }, + \"index\": 0 + } + ] + } + } + + Similarly, if a 400G-DR4 interface (8 electrical channels at 50Gbps) + is to be broken out into 4 100Gbps ports, the following configuration + is used: + + { + \"groups\": { + \"group\": [ + { + \"config\": { + \"breakout-speed\": \"SPEED_100GB\", + \"index\": 0, + \"num-breakouts\": 4, + \"num-physical-channels\": 2 + }, + \"index\": 0 + } + ] + } + }"; + + list group { + key "index"; + description + "List of breakout groups."; + + leaf index { + type leafref { + path "../config/index"; + } + description + "Index of the breakout group entry in the breakout groups list."; + } + + container config { + description + "Configuration data for breakout group."; + uses group-config; + } + + container state { + config false; + description + "Operational state data for breakout group."; + + uses group-config; + uses group-state; + } + } + } + } + } + + // data definition statements + + // augment statements + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:port" { + description + "Adding port breakout data to physical platform data. This subtree + is only valid when the type of the component is PORT."; + + uses port-breakout-top; + } + + augment "/oc-if:interfaces/oc-if:interface/oc-if:state" { + description + "Adds a reference from the base interface to the corresponding + port component in the device inventory."; + + leaf hardware-port { + type leafref { + path "/oc-platform:components/oc-platform:component/" + + "oc-platform:name"; + } + description + "For non-channelized interfaces, references the hardware port + corresponding to the base interface."; + } + } + + // rpc statements + + // notification statements + +} diff --git a/confdgnmi/oc/openconfig-platform-psu.yang b/confdgnmi/oc/openconfig-platform-psu.yang new file mode 100644 index 0000000..02d6e96 --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-psu.yang @@ -0,0 +1,146 @@ +module openconfig-platform-psu { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/psu"; + + prefix "oc-platform-psu"; + + // import some basic types + import openconfig-extensions { prefix oc-ext; } + import openconfig-types { prefix oc-types; } + import openconfig-platform { prefix oc-platform; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines a schema for power supply components in + the OpenConfig platform model."; + + oc-ext:openconfig-version "0.2.1"; + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.2.1"; + } + + revision "2018-01-16" { + description + "Changed admin state leaf name"; + reference "0.2.0"; + } + + revision "2017-12-21" { + description + "Initial revision"; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // identity statements + + // typedef statements + + // grouping statements + + grouping psu-config { + description + "Configuration data for power supply components"; + + leaf enabled { + type boolean; + default true; + description + "Adminsitrative control on the on/off state of the power + supply unit."; + } + } + + grouping psu-state { + description + "Operational state data for power supply components"; + + + // TODO(aashaikh): May need to convert some of these to + // interval statistics once decided on which leaves to include. + leaf capacity { + type oc-types:ieeefloat32; + units watts; + description + "Maximum power capacity of the power supply."; + } + + leaf input-current { + type oc-types:ieeefloat32; + units amps; + description + "The input current draw of the power supply."; + } + + leaf input-voltage { + type oc-types:ieeefloat32; + units volts; + description + "Input voltage to the power supply."; + } + + leaf output-current { + type oc-types:ieeefloat32; + units amps; + description + "The output current supplied by the power supply."; + } + + leaf output-voltage { + type oc-types:ieeefloat32; + units volts; + description + "Output voltage supplied by the power supply."; + } + + leaf output-power { + type oc-types:ieeefloat32; + units watts; + description + "Output power supplied by the power supply."; + } + } + + // data definition statements + + // augment statements + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:power-supply/oc-platform:config" { + description + "Adds power supply data to component operational state."; + + uses psu-config; + } + + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:power-supply/oc-platform:state" { + description + "Adds power supply data to component operational state."; + + uses psu-config; + uses psu-state; + } + + + // rpc statements + + // notification statements +} \ No newline at end of file diff --git a/confdgnmi/oc/openconfig-platform-software.yang b/confdgnmi/oc/openconfig-platform-software.yang new file mode 100644 index 0000000..96fd456 --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-software.yang @@ -0,0 +1,100 @@ +module openconfig-platform-software { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/software-module"; + + prefix "oc-sw-module"; + + import openconfig-platform { + prefix oc-platform; + } + + import openconfig-extensions { + prefix oc-ext; + } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data related to software components in + the openconfig-platform model"; + + oc-ext:openconfig-version "0.1.1"; + + revision "2021-06-16" { + description + "Remove trailing whitespace"; + reference "0.1.1"; + } + + revision "2021-01-18" { + description + "Initial revision."; + reference "0.1.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // extension statements + // feature statements + // identity statements + identity SOFTWARE_MODULE_TYPE { + description + "Base identity for defining various types of software + modules."; + } + + identity USERSPACE_PACKAGE_BUNDLE { + base SOFTWARE_MODULE_TYPE; + description + "A collection of userspace software modules that are grouped, and + possibly versioned, together. A package bundle may have + subcomponents that represent individual elements in the bundle + and their properties."; + } + + identity USERSPACE_PACKAGE { + base SOFTWARE_MODULE_TYPE; + description + "An individual software package that runs in user space. The + package may be part of a package bundle."; + } + + // typedef statements + // grouping statements + grouping sw-module-state { + description + "Operational state data for software module components"; + + leaf module-type { + type identityref { + base SOFTWARE_MODULE_TYPE; + } + description + "Type of the software module"; + } + } + + // data definition statements + // augment statements + augment "/oc-platform:components/oc-platform:component/" + + "oc-platform:software-module/oc-platform:state" { + description + "Adding software module operational data to physical inventory. + This subtree is only valid when the type of the component is + SOFTWARE_MODULE."; + + uses sw-module-state; + } +} + diff --git a/confdgnmi/oc/openconfig-platform-transceiver.yang b/confdgnmi/oc/openconfig-platform-transceiver.yang new file mode 100644 index 0000000..cd460ce --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-transceiver.yang @@ -0,0 +1,891 @@ +module openconfig-platform-transceiver { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform/transceiver"; + + prefix "oc-transceiver"; + + // import some basic types + import ietf-yang-types { prefix yang; } + import openconfig-platform { prefix oc-platform; } + import openconfig-platform-types { prefix oc-platform-types; } + import openconfig-platform-port { prefix oc-port; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-transport-types { prefix oc-opt-types; } + import openconfig-types { prefix oc-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-yang-types { prefix oc-yang; } + import openconfig-alarm-types { prefix oc-alarm-types; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines configuration and operational state data + for transceivers (i.e., pluggable optics). The module should be + used in conjunction with the platform model where other + physical entity data are represented. + + In the platform model, a component of type=TRANSCEIVER is + expected to be a subcomponent of a PORT component. This + module defines a concrete schema for the associated data for + components with type=TRANSCEIVER. + + A transceiver will always contain physical-channel(s), however + when a line side optical-channel is present (i.e. ZR+ optics) + the physical-channel will reference its optical-channel. + In this case, the optical-channels components must be + subcomponents of the transceiver. The relationship between the + physical-channel and the optical-channel allows for multiple + optical-channels to be associated with a transceiver in addition + to ensuring certain leaves (i.e. output-power) are not duplicated + in multiple components. + + If a transceiver contains a digital signal processor (DSP), such + as with ZR+ optics, the modeling will utilize hierarchical + components as follows: + PORT --> TRANSCEIVER --> OPTICAL_CHANNEL(s) + The signal will then traverse through a series of + terminal-device/logical-channels as required. The first + logical-channel connected to the OPTICAL_CHANNEL will utilize the + assignment/optical-channel leaf to create the relationship. At the + conclusion of the series of logical-channels, the logical-channel + will be associated to its host / client side based on: + * If the TRANSCEIVER is directly within a router or switch, then + it will use the logical-channel ingress leaf to specify the + interface it is associated with. + * If the TRANSCEIVER is within a dedicated terminal (Layer 1) + device, then it will use the logical-channel ingress leaf to + specify a physical-channel within a TRANSCEIVER component + (i.e. gray optic) that it is associated with."; + + oc-ext:openconfig-version "0.10.1"; + + revision "2023-02-10" { + description + "Fixing linting issues."; + reference "0.10.1"; + } + + revision "2023-01-12" { + description + "Add laser power and temperature thresholds"; + reference "0.10.0"; + } + + revision "2021-07-29" { + description + "Add several media-lane-based VDM defined by CMIS to physical channel"; + reference "0.9.0"; + } + + revision "2021-02-23" { + description + "Add leafref to an optical channel from a physical channel."; + reference "0.8.0"; + } + + revision "2020-05-06" { + description + "Ensure that when statements in read-write contexts reference + only read-write leaves."; + reference "0.7.1"; + } + + revision "2018-11-25" { + description + "Add augment for leafref to transceiver component; + Correct paths in physical channels leafref."; + reference "0.7.0"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.6.1"; + } + + revision "2018-11-16" { + description + "Added transceiver FEC configuration and state"; + reference "0.6.0"; + } + + revision "2018-05-15" { + description + "Remove internal-temp state leaf, since we prefer + the generic /components/component/state/temperature + container for temperature information."; + reference "0.5.0"; + } + + revision "2018-01-22" { + description + "Fixed physical-channel path reference"; + reference "0.4.1"; + } + + revision "2017-09-18" { + description + "Use openconfig-yang-types module"; + reference "0.4.0"; + } + + revision "2017-07-08" { + description + "Adds clarification on aggregate power measurement data"; + reference "0.3.0"; + } + + revision "2016-12-22" { + description + "Adds preconfiguration data and clarified units"; + reference "0.2.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // identity statements + + // typedef statements + + // grouping statements + + grouping optical-power-state { + description + "Reusable leaves related to optical power state -- these + are read-only state values. If avg/min/max statistics are + not supported, the target is expected to just supply the + instant value"; + + container output-power { + description + "The output optical power of a physical channel in units + of 0.01dBm, which may be associated with individual + physical channels, or an aggregate of multiple physical + channels (i.e., for the overall transceiver). For an + aggregate, this may be a measurement from a photodetector + or a a calculation performed on the device by summing up + all of the related individual physical channels. + Values include the instantaneous, average, minimum, and + maximum statistics. If avg/min/max statistics are not + supported, the target is expected to just supply the + instant value"; + + uses oc-types:avg-min-max-instant-stats-precision2-dBm; + } + + container input-power { + description + "The input optical power of a physical channel in units + of 0.01dBm, which may be associated with individual + physical channels, or an aggregate of multiple physical + channels (i.e., for the overall transceiver). For an + aggregate, this may be a measurement from a photodetector + or a a calculation performed on the device by summing up + all of the related individual physical channels. + Values include the instantaneous, average, minimum, and + maximum statistics. If avg/min/max statistics are not + supported, the target is expected to just supply the + instant value"; + + uses oc-types:avg-min-max-instant-stats-precision2-dBm; + } + + container laser-bias-current { + description + "The current applied by the system to the transmit laser to + achieve the output power. The current is expressed in mA + with up to two decimal precision. Values include the + instantaneous, average, minimum, and maximum statistics. + If avg/min/max statistics are not supported, the target is + expected to just supply the instant value"; + + uses oc-types:avg-min-max-instant-stats-precision2-mA; + } + } + + grouping output-optical-frequency { + description + "Reusable leaves related to optical output power -- this is + typically configurable on line side and read-only on the + client-side"; + + leaf output-frequency { + type oc-opt-types:frequency-type; + description + "The frequency in MHz of the individual physical channel + (e.g. ITU C50 - 195.0THz and would be reported as + 195,000,000 MHz in this model). This attribute is not + configurable on most client ports."; + } + } + + + grouping physical-channel-config { + description + "Configuration data for physical client channels"; + + leaf index { + type uint16 { + range 0..max; + } + description + "Index of the physical channnel or lane within a physical + client port"; + } + + leaf associated-optical-channel { + type leafref { + path "/oc-platform:components/oc-platform:component/" + + "oc-platform:name"; + } + description + "A physical channel may reference an optical channel + component. If the physical channel does make this optional + reference, then a limited set of leaves will apply within + the physical channel to avoid duplication within the optical + channel."; + } + + leaf description { + type string; + description + "Text description for the client physical channel"; + } + + leaf tx-laser { + type boolean; + description + "Enable (true) or disable (false) the transmit label for the + channel"; + } + + uses physical-channel-config-extended { + when "../../../config/module-functional-type = 'oc-opt-types:TYPE_STANDARD_OPTIC'" { + description + "When the physical channel is of TYPE_STANDARD_OPTIC, the + extended config will be used"; + } + } + } + + grouping physical-channel-config-extended { + description + "Extended configuration data for physical client channels + for applications where the full physical channel config and + state are used. In some cases, such as when the physical + channel has a leafref to an optical channel component and the + module-functional-type is TYPE_DIGITAL_COHERENT_OPTIC this + grouping will NOT be used."; + + leaf target-output-power { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "Target output optical power level of the optical channel, + expressed in increments of 0.01 dBm (decibel-milliwats)"; + } + } + + grouping physical-channel-state { + description + "Operational state data for client channels. In some cases, + such as when the physical channel has a leafref to an optical + channel component and the module-functional-type is + TYPE_DIGITAL_COHERENT_OPTIC this grouping will NOT be used."; + + leaf laser-age { + type oc-types:percentage; + description + "Laser age (0% at beginning of life, 100% end of life) in integer + percentage. This term is defined by Common Management Interface + Specification (CMIS)."; + + reference "QSFP-DD CMIS 5.0 Table 8-122"; + } + + container laser-temperature { + description + "Laser temperature for the cooled laser in degrees Celsius with 1 + decimal precision. This term is defined by Common Management + Interface Specification (CMIS). Values include the instantaneous, + average, minimum, and maximum statistics. If avg/min/max statistics + are not supported, the target is expected to just supply the + instant value."; + + reference "QSFP-DD CMIS 5.0 Table 8-122"; + + uses oc-platform-types:avg-min-max-instant-stats-precision1-celsius; + } + + container target-frequency-deviation { + description + "The difference in MHz with 1 decimal precision between the target + center frequency and the actual current center frequency . This term + is defined by Common Management Interface Specification (CMIS) and + referred to as laser frequency error or laser ferquency deviation. + Values include the instantaneous, average, minimum, and maximum + statistics. If avg/min/max statistics are not supported, the target + is expected to just supply the instant value."; + + reference "QSFP-DD CMIS 5.0 Section Table 8-122"; + + uses oc-opt-types:avg-min-max-instant-stats-precision1-mhz; + } + + container tec-current { + description + "The amount of current flowing to the TC of a cooled laser in percentage + with 2 decimal precision. This term is defined by Common Management + Interface Specification (CMIS). Values include the instantaneous, + average, minimum, and maximum statistics. If avg/min/max statistics + are not supported, the target is expected to just supply the instant + value."; + + reference "QSFP-DD CMIS 5.0 Table 8-122"; + + uses oc-opt-types:avg-min-max-instant-stats-precision2-pct; + } + + uses physical-channel-state-extended { + when "../../../state/module-functional-type = 'oc-opt-types:TYPE_STANDARD_OPTIC'" { + description + "When the physical channel is of TYPE_STANDARD_OPTIC, the + extended state will be used"; + } + } + } + + grouping physical-channel-state-extended { + description + "Extended operational state data for physical client channels + for applications where the full physical channel config and + state are used. In some cases, such as when the physical + channel has a leafref to an optical channel component and the + module-functional-type is TYPE_DIGITAL_COHERENT_OPTIC this + grouping will NOT be used."; + + uses output-optical-frequency; + uses optical-power-state; + } + + grouping physical-channel-top { + description + "Top-level grouping for physical client channels"; + + container physical-channels { + description + "Enclosing container for client channels"; + + list channel { + key "index"; + description + "List of client channels, keyed by index within a physical + client port. A physical port with a single channel would + have a single zero-indexed element"; + + leaf index { + type leafref { + path "../config/index"; + } + description + "Reference to the index number of the channel"; + } + + container config { + description + "Configuration data for physical channels"; + + uses physical-channel-config; + } + + container state { + + config false; + + description + "Operational state data for channels"; + + uses physical-channel-config; + uses physical-channel-state; + } + } + } + } + + grouping transceiver-threshold-top { + description + "Top-level grouping for transceiver alarm thresholds for + various sensors."; + + container thresholds { + description + "Enclosing container for transceiver alarm thresholds."; + + list threshold { + key "severity"; + config false; + description + "List of transceiver alarm thresholds, indexed by + alarm severity."; + + leaf severity { + type leafref { + path "../state/severity"; + } + config false; + description + "The severity applied to the group of thresholds. + An implementation's highest severity threshold + should be mapped to OpenConfig's `CRITICAL` + severity level."; + } + + container state { + config false; + description + "Operational alarm thresholds for the transceiver."; + + uses transceiver-threshold-state; + } + } + } + } + + grouping port-transceiver-config { + description + "Configuration data for client port transceivers"; + + leaf enabled { + type boolean; + description + "Turns power on / off to the transceiver -- provides a means + to power on/off the transceiver (in the case of SFP, SFP+, + QSFP,...) or enable high-power mode (in the case of CFP, + CFP2, CFP4) and is optionally supported (device can choose to + always enable). True = power on / high power, False = + powered off"; + } + + leaf form-factor-preconf { + type identityref { + base oc-opt-types:TRANSCEIVER_FORM_FACTOR_TYPE; + } + description + "Indicates the type of optical transceiver used on this + port. If the client port is built into the device and not + pluggable, then non-pluggable is the corresponding state. If + a device port supports multiple form factors (e.g. QSFP28 + and QSFP+, then the value of the transceiver installed shall + be reported. If no transceiver is present, then the value of + the highest rate form factor shall be reported + (QSFP28, for example). + + The form factor is included in configuration data to allow + pre-configuring a device with the expected type of + transceiver ahead of deployment. The corresponding state + leaf should reflect the actual transceiver type plugged into + the system."; + } + + leaf ethernet-pmd-preconf { + type identityref { + base oc-opt-types:ETHERNET_PMD_TYPE; + } + description + "The Ethernet PMD is a property of the optical transceiver + used on the port, indicating the type of physical connection. + It is included in configuration data to allow pre-configuring + a port/transceiver with the expected PMD. The actual PMD is + indicated by the ethernet-pmd state leaf."; + } + + leaf fec-mode { + type identityref { + base oc-platform-types:FEC_MODE_TYPE; + } + description + "The FEC mode indicates the mode of operation for the + transceiver's FEC. This defines typical operational modes + and does not aim to specify more granular FEC capabilities."; + } + + leaf module-functional-type { + type identityref { + base oc-opt-types:TRANSCEIVER_MODULE_FUNCTIONAL_TYPE; + } + description + "Indicates the module functional type which represents the + functional capability of the transceiver. For example, this + would specify the module is a digital coherent optic or a + standard grey optic that performs on-off keying."; + } + } + + grouping port-transceiver-state { + description + "Operational state data for client port transceivers"; + + leaf present { + type enumeration { + enum PRESENT { + description + "Transceiver is present on the port"; + } + enum NOT_PRESENT { + description + "Transceiver is not present on the port"; + } + } + description + "Indicates whether a transceiver is present in + the specified client port."; + } + + leaf form-factor { + type identityref { + base oc-opt-types:TRANSCEIVER_FORM_FACTOR_TYPE; + } + description + "Indicates the type of optical transceiver used on this + port. If the client port is built into the device and not + pluggable, then non-pluggable is the corresponding state. If + a device port supports multiple form factors (e.g. QSFP28 + and QSFP+, then the value of the transceiver installed shall + be reported. If no transceiver is present, then the value of + the highest rate form factor shall be reported + (QSFP28, for example)."; + } + + leaf connector-type { + type identityref { + base oc-opt-types:FIBER_CONNECTOR_TYPE; + } + description + "Connector type used on this port"; + } + + leaf vendor { + type string { + length 1..16; + } + description + "Full name of transceiver vendor. 16-octet field that + contains ASCII characters, left-aligned and padded on the + right with ASCII spaces (20h)"; + } + + leaf vendor-part { + type string { + length 1..16; + } + description + "Transceiver vendor's part number. 16-octet field that + contains ASCII characters, left-aligned and padded on the + right with ASCII spaces (20h). If part number is undefined, + all 16 octets = 0h"; + } + + leaf vendor-rev { + type string { + length 1..2; + } + description + "Transceiver vendor's revision number. 2-octet field that + contains ASCII characters, left-aligned and padded on the + right with ASCII spaces (20h)"; + } + + //TODO: these compliance code leaves should be active based on + //the type of port + leaf ethernet-pmd { + type identityref { + base oc-opt-types:ETHERNET_PMD_TYPE; + } + description + "Ethernet PMD (physical medium dependent sublayer) that the + transceiver supports. The SFF/QSFP MSAs have registers for + this and CFP MSA has similar."; + } + + leaf sonet-sdh-compliance-code { + type identityref { + base oc-opt-types:SONET_APPLICATION_CODE; + } + description + "SONET/SDH application code supported by the port"; + } + + leaf otn-compliance-code { + type identityref { + base oc-opt-types:OTN_APPLICATION_CODE; + } + description + "OTN application code supported by the port"; + } + + leaf serial-no { + type string { + length 1..16; + } + description + "Transceiver serial number. 16-octet field that contains + ASCII characters, left-aligned and padded on the right with + ASCII spaces (20h). If part serial number is undefined, all + 16 octets = 0h"; + } + + leaf date-code { + type oc-yang:date-and-time; + description + "Representation of the transceiver date code, typically + stored as YYMMDD. The time portion of the value is + undefined and not intended to be read."; + } + + leaf fault-condition { + type boolean; + description + "Indicates if a fault condition exists in the transceiver"; + } + + leaf fec-status { + type identityref { + base oc-platform-types:FEC_STATUS_TYPE; + } + description + "Operational status of FEC"; + } + + leaf fec-uncorrectable-blocks { + type yang:counter64; + description + "The number of blocks that were uncorrectable by the FEC"; + } + + leaf fec-uncorrectable-words { + type yang:counter64; + description + "The number of words that were uncorrectable by the FEC"; + } + + leaf fec-corrected-bytes { + type yang:counter64; + description + "The number of bytes that were corrected by the FEC"; + } + + leaf fec-corrected-bits { + type yang:counter64; + description + "The number of bits that were corrected by the FEC"; + } + + container pre-fec-ber { + description + "Bit error rate before forward error correction -- computed + value with 18 decimal precision. Note that decimal64 + supports values as small as i x 10^-18 where i is an + integer. Values smaller than this should be reported as 0 + to inidicate error free or near error free performance. + Values include the instantaneous, average, minimum, and + maximum statistics. If avg/min/max statistics are not + supported, the target is expected to just supply the + instant value"; + + uses oc-opt-types:avg-min-max-instant-stats-precision18-ber; + } + + container post-fec-ber { + description + "Bit error rate after forward error correction -- computed + value with 18 decimal precision. Note that decimal64 + supports values as small as i x 10^-18 where i is an + integer. Values smaller than this should be reported as 0 + to inidicate error free or near error free performance. + Values include the instantaneous, average, minimum, and + maximum statistics. If avg/min/max statistics are not + supported, the target is expected to just supply the + instant value"; + + uses oc-opt-types:avg-min-max-instant-stats-precision18-ber; + } + + container supply-voltage { + description + "Supply voltage to the transceiver in volts with 2 decimal + precision. Values include the instantaneous, average, minimum, + and maximum statistics. If avg/min/max statistics are not + supported, the target is expected to just supply the instant + value."; + + uses oc-platform-types:avg-min-max-instant-stats-precision2-volts; + } + + uses optical-power-state; + } + + grouping transceiver-threshold-state { + description + "Grouping for all alarm threshold configs for a particular + severity level."; + leaf severity { + type identityref { + base oc-alarm-types:OPENCONFIG_ALARM_SEVERITY; + } + description + "The type of alarm to which the thresholds apply."; + } + leaf laser-temperature-upper { + type decimal64 { + fraction-digits 1; + } + units celsius; + description + "The upper temperature threshold for the laser temperature sensor."; + } + leaf laser-temperature-lower { + type decimal64 { + fraction-digits 1; + } + units celsius; + description + "The lower temperature threshold for the laser temperature sensor."; + } + leaf output-power-upper{ + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The upper power threshold for the laser output power."; + } + leaf output-power-lower{ + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The lower power threshold for the laser output power."; + } + leaf input-power-upper{ + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The upper power threshold for the laser input power."; + } + leaf input-power-lower{ + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The lower power threshold for the laser input power."; + } + } + + grouping port-transceiver-top { + description + "Top-level grouping for client port transceiver data"; + + container transceiver { + description + "Top-level container for client port transceiver data"; + + container config { + description + "Configuration data for client port transceivers"; + + uses port-transceiver-config; + } + + container state { + + config false; + + description + "Operational state data for client port transceivers"; + + uses port-transceiver-config; + uses port-transceiver-state; + } + // physical channels are associated with a transceiver + // component + uses physical-channel-top; + uses transceiver-threshold-top; + } + } + + // data definition statements + + // augment statements + + augment "/oc-platform:components/oc-platform:component" { + description + "Adding transceiver data to physical inventory. This subtree is + only valid when the type of the component is TRANSCEIVER."; + + uses port-transceiver-top; + } + + augment "/oc-if:interfaces/oc-if:interface/oc-if:state" { + description + "Adds a reference from an interface to the corresponding + transceiver component."; + + leaf transceiver { + type leafref { + path "/oc-platform:components/" + + "oc-platform:component[oc-platform:name=current()/../oc-port:hardware-port]/" + + "oc-platform:subcomponents/oc-platform:subcomponent/" + + "oc-platform:name"; + } + description + "Provides a reference to the transceiver subcomponent that + corresponds to the physical port component for this interface. + The device must only populate this leaf with a reference to + a component of type TRANSCEIVER."; + } + } + + augment "/oc-if:interfaces/oc-if:interface/oc-if:state" { + description + "Adds a reference from the base interface to its corresponding + physical channels."; + + leaf-list physical-channel { + type leafref { + path "/oc-platform:components/" + + "oc-platform:component[oc-platform:name=current()/../oc-transceiver:transceiver]/" + + "oc-transceiver:transceiver/" + + "oc-transceiver:physical-channels/oc-transceiver:channel/" + + "oc-transceiver:index"; + } + description + "For a channelized interface, list of references to the + physical channels (lanes) corresponding to the interface. + The physical channels are elements of a transceiver component + in the platform model."; + } + } + + // rpc statements + + // notification statements + +} diff --git a/confdgnmi/oc/openconfig-platform-types.yang b/confdgnmi/oc/openconfig-platform-types.yang new file mode 100644 index 0000000..970a9ce --- /dev/null +++ b/confdgnmi/oc/openconfig-platform-types.yang @@ -0,0 +1,528 @@ +module openconfig-platform-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform-types"; + + prefix "oc-platform-types"; + + import openconfig-types { prefix oc-types; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines data types (e.g., YANG identities) + to support the OpenConfig component inventory model."; + + oc-ext:openconfig-version "1.5.0"; + + revision "2022-07-28" { + description + "Add grouping for component power management"; + reference "1.5.0"; + } + + revision "2022-03-27" { + description + "Add identity for BIOS"; + reference "1.4.0"; + } + + revision "2022-02-02" { + description + "Add support for component reboot and switchover."; + reference "1.3.0"; + } + + revision "2021-07-29" { + description + "Add several avg-min-max-instant-stats groupings"; + reference "1.2.0"; + } + + revision "2021-01-18" { + description + "Add identity for software modules"; + reference "1.1.0"; + } + + revision "2019-06-03" { + description + "Add OpenConfig component operating system patch type."; + reference "1.0.0"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.10.1"; + } + + revision "2018-11-16" { + description + "Added FEC_MODE_TYPE and FEC_STATUS_TYPE"; + reference "0.10.0"; + } + + revision "2018-05-05" { + description + "Added min-max-time to + avg-min-max-instant-stats-precision1-celsius, + added new CONTROLLER_CARD identity"; + reference "0.9.0"; + } + + revision "2018-01-16" { + description + "Added new per-component common data; add temp alarm"; + reference "0.8.0"; + } + + revision "2017-12-14" { + description + "Added anchor containers for component data, added new + component types"; + reference "0.7.0"; + } + + revision "2017-08-16" { + description + "Added power state enumerated type"; + reference "0.6.0"; + } + + revision "2016-12-22" { + description + "Added temperature state variable to component"; + reference "0.5.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // grouping statements + grouping avg-min-max-instant-stats-precision1-celsius { + description + "Common grouping for recording temperature values in + Celsius with 1 decimal precision. Values include the + instantaneous, average, minimum, and maximum statistics"; + + leaf instant { + type decimal64 { + fraction-digits 1; + } + units celsius; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 1; + } + units celsius; + description + "The arithmetic mean value of the statistic over the + sampling period."; + } + + leaf min { + type decimal64 { + fraction-digits 1; + } + units celsius; + description + "The minimum value of the statistic over the sampling + period"; + } + + leaf max { + type decimal64 { + fraction-digits 1; + } + units celsius; + description + "The maximum value of the statistic over the sampling + period"; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping avg-min-max-instant-stats-precision2-volts { + description + "Common grouping for recording voltage values in + volts with 2 decimal precision. Values include the + instantaneous, average, minimum, and maximum statistics. + If supported by the device, the time interval over which + the statistics are computed, and the times at which the + minimum and maximum values occurred, are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units volts; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units volts; + description + "The arithmetic mean value of the statistic over the + sampling period."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units volts; + description + "The minimum value of the statistic over the sampling + period"; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units volts; + description + "The maximum value of the statistic over the sampling + period"; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping component-redundant-role-switchover-reason { + description + "Common grouping for recording the reason of a component's + redundant role switchover. For example two supervisors in + a device, one as primary the other as secondary, switchover + can happen in different scenarios, e.g. user requested, + system error, priority contention, etc."; + + leaf trigger { + type component-redundant-role-switchover-reason-trigger; + description + "Records the generic triggers, e.g. user or system + initiated the switchover."; + } + + leaf details { + type string; + description + "Records detailed description of why the switchover happens. + For example, when system initiated the switchover, this leaf + can be used to record the specific reason, e.g. due to critical + errors of the routing daemon in the primary role."; + } + } + + // identity statements + identity OPENCONFIG_HARDWARE_COMPONENT { + description + "Base identity for hardware related components in a managed + device. Derived identities are partially based on contents + of the IANA Entity MIB."; + reference + "IANA Entity MIB and RFC 6933"; + } + + identity OPENCONFIG_SOFTWARE_COMPONENT { + description + "Base identity for software-related components in a managed + device"; + } + + // hardware types + identity CHASSIS { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Chassis component, typically with multiple slots / shelves"; + } + + identity BACKPLANE { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Backplane component for aggregating traffic, typically + contained in a chassis component"; + } + + identity FABRIC { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Interconnect between ingress and egress ports on the + device (e.g., a crossbar switch)."; + } + + identity POWER_SUPPLY { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Component that is supplying power to the device"; + } + + identity FAN { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Cooling fan, or could be some other heat-reduction component"; + } + + identity SENSOR { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Physical sensor, e.g., a temperature sensor in a chassis"; + } + + identity FRU { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Replaceable hardware component that does not have a more + specific defined schema."; + } + + identity LINECARD { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Linecard component, typically inserted into a chassis slot"; + } + + identity CONTROLLER_CARD { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "A type of linecard whose primary role is management or control + rather than data forwarding."; + } + + identity PORT { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Physical port, e.g., for attaching pluggables and networking + cables"; + } + + identity TRANSCEIVER { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Pluggable module present in a port"; + } + + identity CPU { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "Processing unit, e.g., a management processor"; + } + + identity STORAGE { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "A storage subsystem on the device (disk, SSD, etc.)"; + } + + identity INTEGRATED_CIRCUIT { + base OPENCONFIG_HARDWARE_COMPONENT; + description + "A special purpose processing unit, typically for traffic + switching/forwarding (e.g., switching ASIC, NPU, forwarding + chip, etc.)"; + } + + identity OPERATING_SYSTEM { + base OPENCONFIG_SOFTWARE_COMPONENT; + description + "Operating system running on a component"; + } + + identity OPERATING_SYSTEM_UPDATE { + base OPENCONFIG_SOFTWARE_COMPONENT; + description + "An operating system update - which should be a subcomponent + of the `OPERATING_SYSTEM` running on a component. An update is + defined to be a set of software changes that are atomically + installed (and uninstalled) together. Multiple updates may be + present for the Operating System. A system should not list all + installed software packages using this type -- but rather + updates that are bundled together as a single installable + item"; + } + + identity BIOS { + base OPENCONFIG_SOFTWARE_COMPONENT; + description + "Legacy BIOS or UEFI firmware interface responsible for + initializing hardware components and first stage boot loader."; + } + + identity BOOT_LOADER { + base OPENCONFIG_SOFTWARE_COMPONENT; + description + "Software layer responsible for loading and booting the + device OS or network OS."; + } + + identity SOFTWARE_MODULE { + base OPENCONFIG_SOFTWARE_COMPONENT; + description + "A base identity for software modules installed and/or + running on the device. Modules include user-space programs + and kernel modules that provide specific functionality. + A component with type SOFTWARE_MODULE should also have a + module type that indicates the specific type of software module"; + } + + identity COMPONENT_OPER_STATUS { + description + "Current operational status of a platform component"; + } + + identity ACTIVE { + base COMPONENT_OPER_STATUS; + description + "Component is enabled and active (i.e., up)"; + } + + identity INACTIVE { + base COMPONENT_OPER_STATUS; + description + "Component is enabled but inactive (i.e., down)"; + } + + identity DISABLED { + base COMPONENT_OPER_STATUS; + description + "Component is administratively disabled."; + } + + identity FEC_MODE_TYPE { + description + "Base identity for FEC operational modes."; + } + + identity FEC_ENABLED { + base FEC_MODE_TYPE; + description + "FEC is administratively enabled."; + } + + identity FEC_DISABLED { + base FEC_MODE_TYPE; + description + "FEC is administratively disabled."; + } + + identity FEC_AUTO { + base FEC_MODE_TYPE; + description + "System will determine whether to enable or disable + FEC on a transceiver."; + } + + identity FEC_STATUS_TYPE { + description + "Base identity for FEC operational statuses."; + } + + identity FEC_STATUS_LOCKED { + base FEC_STATUS_TYPE; + description + "FEC is operationally locked."; + } + + identity FEC_STATUS_UNLOCKED { + base FEC_STATUS_TYPE; + description + "FEC is operationally unlocked."; + } + + // typedef statements + typedef component-power-type { + type enumeration { + enum POWER_ENABLED { + description + "Enable power on the component"; + } + enum POWER_DISABLED { + description + "Disable power on the component"; + } + } + description + "A generic type reflecting whether a hardware component + is powered on or off"; + } + + identity COMPONENT_REBOOT_REASON { + description + "Base entity for component reboot reasons."; + } + + identity REBOOT_USER_INITIATED { + base COMPONENT_REBOOT_REASON; + description + "User initiated the reboot of the componenent."; + } + + identity REBOOT_POWER_FAILURE { + base COMPONENT_REBOOT_REASON; + description + "The component reboots due to power failure."; + } + + identity REBOOT_CRITICAL_ERROR { + base COMPONENT_REBOOT_REASON; + description + "The component reboots due to critical errors."; + } + + typedef component-redundant-role { + type enumeration { + enum PRIMARY { + description + "Component is acting the primary role."; + } + enum SECONDARY { + description + "Component is acting the secondary role."; + } + } + description + "A generic type reflecting the component's redundanty role. + For example, a device might have dual supervisors components + for redundant purpose, with one being the primary and the + other secondary."; + } + + typedef component-redundant-role-switchover-reason-trigger { + type enumeration { + enum USER_INITIATED { + description + "User initiated the switchover, e.g. via command line."; + } + enum SYSTEM_INITIATED { + description + "The system initiated the switchover, e.g. due to + critical errors in the component of the primar role."; + } + } + description + "Records how the role switchover is triggered."; + } +} diff --git a/confdgnmi/oc/openconfig-platform.yang b/confdgnmi/oc/openconfig-platform.yang new file mode 100644 index 0000000..4a6d874 --- /dev/null +++ b/confdgnmi/oc/openconfig-platform.yang @@ -0,0 +1,1200 @@ +module openconfig-platform { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/platform"; + + prefix "oc-platform"; + + import openconfig-platform-types { prefix oc-platform-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-alarm-types { prefix oc-alarm-types; } + import openconfig-yang-types { prefix oc-yang; } + import openconfig-types { prefix oc-types; } + + include openconfig-platform-common; + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines a data model for representing a system + component inventory, which can include hardware or software + elements arranged in an arbitrary structure. The primary + relationship supported by the model is containment, e.g., + components containing subcomponents. + + It is expected that this model reflects every field replacable + unit on the device at a minimum (i.e., additional information + may be supplied about non-replacable components). + + Every element in the inventory is termed a 'component' with each + component expected to have a unique name and type, and optionally + a unique system-assigned identifier and FRU number. The + uniqueness is guaranteed by the system within the device. + + Components may have properties defined by the system that are + modeled as a list of key-value pairs. These may or may not be + user-configurable. The model provides a flag for the system + to optionally indicate which properties are user configurable. + + Each component also has a list of 'subcomponents' which are + references to other components. Appearance in a list of + subcomponents indicates a containment relationship as described + above. For example, a linecard component may have a list of + references to port components that reside on the linecard. + + This schema is generic to allow devices to express their own + platform-specific structure. It may be augmented by additional + component type-specific schemas that provide a common structure + for well-known component types. In these cases, the system is + expected to populate the common component schema, and may + optionally also represent the component and its properties in the + generic structure. + + The properties for each component may include dynamic values, + e.g., in the 'state' part of the schema. For example, a CPU + component may report its utilization, temperature, or other + physical properties. The intent is to capture all platform- + specific physical data in one location, including inventory + (presence or absence of a component) and state (physical + attributes or status)."; + + oc-ext:openconfig-version "0.22.0"; + + revision "2022-12-20" { + description + "Add threshold and threshold-exceeded for resource usage."; + reference "0.22.0"; + } + + revision "2022-12-19" { + description + "Update last-high-watermark timestamp documentation."; + reference "0.21.1"; + } + + revision "2022-09-26" { + description + "Add state data for base-mac-address."; + reference "0.21.0"; + } + + revision "2022-08-31" { + description + "Add new state data for component CLEI code."; + reference "0.20.0"; + } + + revision "2022-07-28" { + description + "Add container for controller card component"; + reference "0.19.0"; + } + + revision "2022-07-11" { + description + "Add switchover ready"; + reference "0.18.0"; + } + + revision "2022-06-10" { + description + "Specify units and epoch for switchover and reboot times."; + reference "0.17.0"; + } + + revision "2022-04-21" { + description + "Add platform utilization."; + reference "0.16.0"; + } + + revision "2022-02-02" { + description + "Add new state data for component reboot and + switchover."; + reference "0.15.0"; + } + + revision "2021-08-13" { + description + "Add container for PCIe error statistics"; + reference "0.14.0"; + } + + revision "2021-01-18" { + description + "Add container for software module component"; + reference "0.13.0"; + } + + revision "2019-04-16" { + description + "Fix bug in parent path reference"; + reference "0.12.2"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.12.1"; + } + + revision "2018-06-29" { + description + "Added location description for components"; + reference "0.12.0"; + } + + revision "2018-06-03" { + description + "Added parent reference, empty flag and preconfiguration + for components"; + reference "0.11.0"; + } + + revision "2018-04-20" { + description + "Added new per-component state data: mfg-date and removable"; + reference "0.10.0"; + } + + revision "2018-01-30" { + description + "Amended approach for modelling CPU - rather than having + a local CPU utilisation state variable, a component with + a CPU should create a subcomponent of type CPU to report + statistics."; + reference "0.9.0"; + } + + revision "2018-01-16" { + description + "Added new per-component common data; add temp alarm; + moved hardware-port reference to port model"; + reference "0.8.0"; + } + + revision "2017-12-14" { + description + "Added anchor containers for component data, added new + component types"; + reference "0.7.0"; + } + + revision "2017-08-16" { + description + "Added power state enumerated type"; + reference "0.6.0"; + } + + revision "2016-12-22" { + description + "Added temperature state variable to component"; + reference "0.5.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // grouping statements + + + grouping platform-component-properties-config { + description + "System-defined configuration data for component properties"; + + leaf name { + type string; + description + "System-supplied name of the property -- this is typically + non-configurable"; + } + + leaf value { + type union { + type string; + type boolean; + type int64; + type uint64; + type decimal64 { + fraction-digits 2; + } + } + description + "Property values can take on a variety of types. Signed and + unsigned integer types may be provided in smaller sizes, + e.g., int8, uint16, etc."; + } + } + + grouping platform-component-properties-state { + description + "Operational state data for component properties"; + + leaf configurable { + type boolean; + description + "Indication whether the property is user-configurable"; + } + } + + grouping platform-component-properties-top { + description + "Top-level grouping "; + + container properties { + description + "Enclosing container "; + + list property { + key "name"; + description + "List of system properties for the component"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference to the property name."; + } + + container config { + description + "Configuration data for each property"; + + uses platform-component-properties-config; + } + + container state { + + config false; + + description + "Operational state data for each property"; + + uses platform-component-properties-config; + uses platform-component-properties-state; + } + } + } + } + + grouping platform-subcomponent-ref-config { + description + "Configuration data for subcomponent references"; + + leaf name { + type leafref { + path "../../../../../component/config/name"; + } + description + "Reference to the name of the subcomponent"; + } + } + + grouping platform-subcomponent-ref-state { + description + "Operational state data for subcomponent references"; + + } + + grouping platform-subcomponent-ref-top { + description + "Top-level grouping for list of subcomponent references"; + + container subcomponents { + description + "Enclosing container for subcomponent references"; + + list subcomponent { + key "name"; + description + "List of subcomponent references"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference to the name list key"; + } + + container config { + description + "Configuration data for the subcomponent"; + + uses platform-subcomponent-ref-config; + } + + container state { + + config false; + + description + "Operational state data for the subcomponent"; + + uses platform-subcomponent-ref-config; + uses platform-subcomponent-ref-state; + } + } + } + } + + grouping platform-component-config { + description + "Configuration data for components"; + + leaf name { + type string; + description + "Device name for the component -- this may not be a + configurable parameter on many implementations. Where + component preconfiguration is supported, for example, + the component name may be configurable."; + } + } + + grouping platform-component-state { + description + "Operational state data for device components."; + + leaf type { + type union { + type identityref { + base oc-platform-types:OPENCONFIG_HARDWARE_COMPONENT; + } + type identityref { + base oc-platform-types:OPENCONFIG_SOFTWARE_COMPONENT; + } + } + description + "Type of component as identified by the system"; + } + + leaf id { + type string; + description + "Unique identifier assigned by the system for the + component"; + } + + leaf location { + type string; + description + "System-supplied description of the location of the + component within the system. This could be a bay position, + slot number, socket location, etc. For component types that + have an explicit slot-id attribute, such as linecards, the + system should populate the more specific slot-id."; + } + + leaf description { + type string; + description + "System-supplied description of the component"; + } + + leaf mfg-name { + type string; + description + "System-supplied identifier for the manufacturer of the + component. This data is particularly useful when a + component manufacturer is different than the overall + device vendor."; + } + + leaf mfg-date { + type oc-yang:date; + description + "System-supplied representation of the component's + manufacturing date."; + } + + leaf hardware-version { + type string; + description + "For hardware components, this is the hardware revision of + the component."; + } + + leaf firmware-version { + type string; + description + "For hardware components, this is the version of associated + firmware that is running on the component, if applicable."; + } + + leaf software-version { + type string; + description + "For software components such as operating system or other + software module, this is the version of the currently + running software."; + } + + leaf serial-no { + type string; + description + "System-assigned serial number of the component."; + } + + leaf part-no { + type string; + description + "System-assigned part number for the component. This should + be present in particular if the component is also an FRU + (field replaceable unit)"; + } + + leaf clei-code { + type string; + description + "Common Language Equipment Identifier (CLEI) code of the + component. This should be present in particular if the + component is also an FRU (field replaceable unit)"; + } + + leaf removable { + type boolean; + description + "If true, this component is removable or is a field + replaceable unit"; + } + + leaf oper-status { + type identityref { + base oc-platform-types:COMPONENT_OPER_STATUS; + } + description + "If applicable, this reports the current operational status + of the component."; + } + + leaf empty { + type boolean; + default false; + description + "The empty leaf may be used by the device to indicate that a + component position exists but is not populated. Using this + flag, it is possible for the management system to learn how + many positions are available (e.g., occupied vs. empty + linecard slots in a chassis)."; + } + + leaf parent { + type leafref { + path "../../../component/config/name"; + } + description + "Reference to the name of the parent component. Note that + this reference must be kept synchronized with the + corresponding subcomponent reference from the parent + component."; + } + + leaf redundant-role { + type oc-platform-types:component-redundant-role; + description + "For components that have redundant roles (e.g. two + supervisors in a device, one as primary the other as secondary), + this reports the role of the component."; + } + + container last-switchover-reason { + description + "For components that have redundant roles (e.g. two + supervisors in a device, one as primary the other as secondary), + this reports the reason of the last change of the + component's role."; + + uses oc-platform-types:component-redundant-role-switchover-reason; + } + + leaf last-switchover-time { + type oc-types:timeticks64; + units "nanoseconds"; + description + "For components that have redundant roles (e.g. two + supervisors in a device, one as primary the other as + secondary), this reports the time of the last change of + the component's role. The value is the timestamp in + nanoseconds relative to the Unix Epoch (Jan 1, 1970 00:00:00 UTC)."; + + } + + leaf last-reboot-reason { + type identityref { + base oc-platform-types:COMPONENT_REBOOT_REASON; + } + description + "This reports the reason of the last reboot of the component."; + } + + leaf last-reboot-time { + type oc-types:timeticks64; + units "nanoseconds"; + description + "This reports the time of the last reboot of the component. The + value is the timestamp in nanoseconds relative to the Unix Epoch + (Jan 1, 1970 00:00:00 UTC)."; + } + + leaf switchover-ready { + type boolean; + description + "For components that have redundant roles, this reports a value + that indicates if the component is ready to support failover. + + The components with a redundant-role should reflect the overall + system's switchover status. For example, two supervisors in a + device, one as primary and the other as secondary, should both + report the same value."; + } + + leaf base-mac-address { + type oc-yang:mac-address; + description + "This is a MAC address representing the root or primary MAC + address for a component. Components such as CHASSIS and + CONTROLLER_CARD are expected to provide a base-mac-address. The + base mac-address for CHASSIS and a PRIMARY CONTROLLER_CARD may + contain the same value."; + } + + } + + grouping platform-component-temp-alarm-state { + description + "Temperature alarm data for platform components"; + + // TODO(aashaikh): consider if these leaves could be in a + // reusable grouping (not temperature-specific); threshold + // may always need to be units specific. + + leaf alarm-status { + type boolean; + description + "A value of true indicates the alarm has been raised or + asserted. The value should be false when the alarm is + cleared."; + } + + leaf alarm-threshold { + type uint32; + description + "The threshold value that was crossed for this alarm."; + } + + leaf alarm-severity { + type identityref { + base oc-alarm-types:OPENCONFIG_ALARM_SEVERITY; + } + description + "The severity of the current alarm."; + } + } + + grouping platform-component-power-state { + description + "Power-related operational state for device components."; + + leaf allocated-power { + type uint32; + units watts; + description + "Power allocated by the system for the component."; + } + + leaf used-power { + type uint32; + units watts; + description + "Actual power used by the component."; + } + } + + grouping platform-component-temp-state { + description + "Temperature state data for device components"; + + container temperature { + description + "Temperature in degrees Celsius of the component. Values include + the instantaneous, average, minimum, and maximum statistics. If + avg/min/max statistics are not supported, the target is expected + to just supply the instant value"; + + uses oc-platform-types:avg-min-max-instant-stats-precision1-celsius; + uses platform-component-temp-alarm-state; + } + } + + grouping platform-component-memory-state { + description + "Per-component memory statistics"; + + container memory { + description + "For components that have associated memory, these values + report information about available and utilized memory."; + + leaf available { + type uint64; + units bytes; + description + "The available memory physically installed, or logically + allocated to the component."; + } + + // TODO(aashaikh): consider if this needs to be a + // min/max/avg statistic + leaf utilized { + type uint64; + units bytes; + description + "The memory currently in use by processes running on + the component, not considering reserved memory that is + not available for use."; + } + } + } + + grouping pcie-uncorrectable-errors { + description + "PCIe uncorrectable error statistics."; + + leaf total-errors { + type oc-yang:counter64; + description + "Total number of uncorrectable errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf undefined-errors { + type oc-yang:counter64; + description + "Number of undefined errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf data-link-errors { + type oc-yang:counter64; + description + "Number of data-link errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf surprise-down-errors { + type oc-yang:counter64; + description + "Number of unexpected link down errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf poisoned-tlp-errors { + type oc-yang:counter64; + description + "Number of poisoned TLP errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf flow-control-protocol-errors { + type oc-yang:counter64; + description + "Number of flow control protocol errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf completion-timeout-errors { + type oc-yang:counter64; + description + "Number of completion timeout errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf completion-abort-errors { + type oc-yang:counter64; + description + "Number of completion abort errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf unexpected-completion-errors { + type oc-yang:counter64; + description + "Number of unexpected completion errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf receiver-overflow-errors { + type oc-yang:counter64; + description + "Number of receiver overflow errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf malformed-tlp-errors { + type oc-yang:counter64; + description + "Number of malformed TLP errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf ecrc-errors { + type oc-yang:counter64; + description + "Number of ECRC errors detected by PCIe device since the system + booted, according to PCIe AER driver."; + } + + leaf unsupported-request-errors { + type oc-yang:counter64; + description + "Number of unsupported request errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf acs-violation-errors { + type oc-yang:counter64; + description + "Number of access control errors detected by PCIe device since + the system booted, according to PCIe AER driver."; + } + + leaf internal-errors { + type oc-yang:counter64; + description + "Number of internal errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf blocked-tlp-errors { + type oc-yang:counter64; + description + "Number of blocked TLP errors detected by PCIe device since + the system booted, according to PCIe AER driver."; + } + + leaf atomic-op-blocked-errors { + type oc-yang:counter64; + description + "Number of atomic operation blocked errors detected by PCIe + device since the system booted, according to PCIe AER driver."; + } + + leaf tlp-prefix-blocked-errors { + type oc-yang:counter64; + description + "Number of TLP prefix blocked errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + } + + grouping pcie-correctable-errors { + description + "PCIe correctable error statistics."; + + leaf total-errors { + type oc-yang:counter64; + description + "Total number of correctable errors detected by PCIe device + since the system booted, according to PCIe AER driver."; + } + + leaf receiver-errors { + type oc-yang:counter64; + description + "Number of receiver errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf bad-tlp-errors { + type oc-yang:counter64; + description + "Number of TLPs with bad LCRC detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf bad-dllp-errors { + type oc-yang:counter64; + description + "Number of DLLPs with bad LCRC detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf relay-rollover-errors { + type oc-yang:counter64; + description + "Number of relay rollover errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf replay-timeout-errors { + type oc-yang:counter64; + description + "Number of replay timeout errors detected by PCIe device since the + system booted, according to PCIe AER driver."; + } + + leaf advisory-non-fatal-errors { + type oc-yang:counter64; + description + "Number of advisory non fatal errors detected by PCIe device since + the system booted, according to PCIe AER driver."; + } + + leaf internal-errors { + type oc-yang:counter64; + description + "Number of internal errors detected by PCIe device since the system + booted, according to PCIe AER driver."; + } + + leaf hdr-log-overflow-errors { + type oc-yang:counter64; + description + "Number of header log overflow errors detected by PCIe device since + the system booted, according to PCIe AER driver."; + } + } + + grouping platform-component-pcie-state { + description + "Per-component PCIe error statistics"; + + container pcie { + description + "Components that are connected to the system over the Peripheral + Component Interconnect Express (PCIe), report the fatal, non-fatal + and correctable PCIe error counts."; + + container fatal-errors { + description + "The count of the fatal PCIe errors."; + uses pcie-uncorrectable-errors; + } + + container non-fatal-errors { + description + "The count of the non-fatal PCIe errors."; + uses pcie-uncorrectable-errors; + } + + container correctable-errors { + description + "The count of the correctable PCIe errors."; + uses pcie-correctable-errors; + } + } + } + + grouping platform-anchors-top { + description + "This grouping is used to add containers for components that + are common across systems, but do not have a defined schema + within the openconfig-platform module. Containers should be + added to this grouping for components that are expected to + exist in multiple systems, with corresponding modules + augmenting the config/state containers directly."; + + container chassis { + description + "Data for chassis components"; + + container config { + description + "Configuration data for chassis components"; + } + + container state { + config false; + description + "Operational state data for chassis components"; + } + + uses platform-utilization-top; + } + +// TODO(aashaikh): linecard container is already defined in +// openconfig-platform-linecard; will move to this module +// in future. + /* + container linecard { + description + "Data for linecard components"; + + container config { + description + "Configuration data for linecard components"; + } + + container state { + config false; + description + "Operational state data for linecard components"; + } + } + */ + + container port { + description + "Data for physical port components"; + + container config { + description + "Configuration data for physical port components"; + } + + container state { + config false; + description + "Operational state data for physical port components"; + } + } + +// TODO(aashaikh): transceiver container is already defined in +// openconfig-platform-transceiver; will move to this module +// in future. + /* + container transceiver { + description + "Data for transceiver components"; + + container config { + description + "Configuration data for transceiver components"; + } + + container state { + config false; + description + "Operational state data for transceiver components"; + } + } + */ + + container power-supply { + description + "Data for power supply components"; + + container config { + description + "Configuration data for power supply components"; + } + + container state { + config false; + description + "Operational state data for power supply components"; + } + } + + container fan { + description + "Data for fan components"; + + container config { + description + "Configuration data for fan components"; + } + + container state { + config false; + description + "Operational state data for fan components"; + } + } + + container fabric { + description + "Data for fabric components"; + + container config { + description + "Configuration data for fabric components"; + } + + container state { + config false; + description + "Operational state data for fabric components"; + } + } + + container storage { + description + "Data for storage components"; + + container config { + description + "Configuration data for storage components"; + } + + container state { + config false; + description + "Operational state data for storage components"; + } + } + + container cpu { + description + "Data for cpu components"; + + container config { + description + "Configuration data for cpu components"; + } + + container state { + config false; + description + "Operational state data for cpu components"; + } + } + + container integrated-circuit { + description + "Data for chip components, such as ASIC, NPUs, etc."; + + container config { + description + "Configuration data for chip components"; + } + + container state { + config false; + description + "Operational state data for chip components"; + } + + uses platform-utilization-top; + } + + container backplane { + description + "Data for backplane components"; + + container config { + description + "Configuration data for backplane components"; + } + + container state { + config false; + description + "Operational state data for backplane components"; + } + } + + container software-module { + description + "Data for software module components, i.e., for components + with type=SOFTWARE_MODULE"; + + container config { + description + "Configuration data for software module components"; + } + + container state { + config false; + description + "Operational state data for software module components"; + } + } + + container controller-card { + description + "Data for controller card components, i.e., for components + with type=CONTROLLER_CARD"; + + container config { + description + "Configuration data for controller card components. Note that disabling + power to the primary supervisor should be rejected, and the operator is + required to perform a switchover first."; + } + + container state { + config false; + description + "Operational state data for controller card components"; + } + } + } + + grouping platform-component-top { + description + "Top-level grouping for components in the device inventory"; + + container components { + description + "Enclosing container for the components in the system."; + + list component { + key "name"; + description + "List of components, keyed by component name."; + + leaf name { + type leafref { + path "../config/name"; + } + description + "References the component name"; + } + + container config { + description + "Configuration data for each component"; + + uses platform-component-config; + } + + container state { + + config false; + + description + "Operational state data for each component"; + + uses platform-component-config; + uses platform-component-state; + uses platform-component-temp-state; + uses platform-component-memory-state; + uses platform-component-power-state; + uses platform-component-pcie-state { + when "./type = 'oc-platform-types:STORAGE' or " + + "'oc-platform-types:INTEGRATED_CIRCUIT' or " + + "'oc-platform-types:FRU'"; + } + } + + uses platform-component-properties-top; + uses platform-subcomponent-ref-top; + uses platform-anchors-top; + } + } + } + + + // data definition statements + + uses platform-component-top; + + + // augments + + +} diff --git a/confdgnmi/oc/openconfig-transport-types.yang b/confdgnmi/oc/openconfig-transport-types.yang new file mode 100644 index 0000000..494c672 --- /dev/null +++ b/confdgnmi/oc/openconfig-transport-types.yang @@ -0,0 +1,1543 @@ +module openconfig-transport-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/transport-types"; + + prefix "oc-opt-types"; + + import openconfig-platform-types { prefix oc-platform-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-types { prefix oc-types; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module contains general type definitions and identities + for optical transport models."; + + oc-ext:openconfig-version "0.18.1"; + + revision "2023-02-08" { + description + "Add ETH_100GBASE_DR PMD type"; + reference "0.18.1"; + } + + revision "2022-12-05" { + description + "Fix trailing whitespace"; + reference "0.17.1"; + } + + revision "2022-10-18" { + description + "Add ETH_400GMSA_PSM4 PMD type"; + reference "0.17.0"; + } + + revision "2022-09-26" { + description + "Add SFP28 and SFP56 form factor identities."; + reference "0.16.0"; + } + + revision "2021-07-29" { + description + "Add several avg-min-max-instant-stats groupings"; + reference "0.15.0"; + } + + revision "2021-03-22" { + description + "Add client mapping mode identityref."; + reference "0.14.0"; + } + + revision "2021-02-26" { + description + "Additional PMD types, form factors, and protocol types."; + reference "0.13.0"; + } + + revision "2020-08-12" { + description + "Additional tributary rates."; + reference "0.12.0"; + } + + revision "2020-04-24" { + description + "Add 400G protocol and additional tributary half rates."; + reference "0.11.0"; + } + + revision "2020-04-22" { + description + "Add AOC and DAC connector identities."; + reference "0.10.0"; + } + + revision "2019-06-27" { + description + "Add FIBER_JUMPER_TYPE identityref."; + reference "0.9.0"; + } + + revision "2019-06-21" { + description + "Generalize and rename optical port type identity"; + reference "0.8.0"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.7.1"; + } + + revision "2018-10-23" { + description + "Added frame mapping protocols for logical channels assignments + and tributary slot granularity for OTN logical channels"; + reference "0.7.0"; + } + + revision "2018-05-16" { + description + "Added interval,min,max time to interval stats."; + reference "0.6.0"; + } + + revision "2017-08-16" { + description + "Added ODU Cn protocol type"; + reference "0.5.0"; + } + + revision "2016-12-22" { + description + "Fixes and additions for terminal optics model"; + reference "0.4.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // typedef statements + + typedef frequency-type { + type uint64; + units "MHz"; + description + "Type for optical spectrum frequency values"; + } + + typedef admin-state-type { + type enumeration { + enum ENABLED { + description + "Sets the channel admin state to enabled"; + } + enum DISABLED { + description + "Sets the channel admin state to disabled"; + } + enum MAINT { + description + "Sets the channel to maintenance / diagnostic mode"; + } + } + description "Administrative state modes for + logical channels in the transponder model."; + } + + typedef loopback-mode-type { + type enumeration { + enum NONE { + description + "No loopback is applied"; + } + enum FACILITY { + description + "A loopback which directs traffic normally transmitted + on the port back to the device as if received on the same + port from an external source."; + } + enum TERMINAL { + description + "A loopback which directs traffic received from an external + source on the port back out the transmit side of the same + port."; + } + } + default NONE; + description + "Loopback modes for transponder logical channels"; + } + + identity FRAME_MAPPING_PROTOCOL { + description + "Base identity for frame mapping protocols that can be used + when mapping Ethernet, OTN or other client signals to OTN + logical channels."; + } + + identity AMP { + base FRAME_MAPPING_PROTOCOL; + description "Asynchronous Mapping Procedure"; + } + + identity GMP { + base FRAME_MAPPING_PROTOCOL; + description "Generic Mapping Procedure"; + } + + identity BMP { + base FRAME_MAPPING_PROTOCOL; + description "Bit-synchronous Mapping Procedure"; + } + + identity CBR { + base FRAME_MAPPING_PROTOCOL; + description "Constant Bit Rate Mapping Procedure"; + } + + identity GFP_T { + base FRAME_MAPPING_PROTOCOL; + description "Transparent Generic Framing Protocol"; + } + + identity GFP_F { + base FRAME_MAPPING_PROTOCOL; + description "Framed-Mapped Generic Framing Protocol"; + } + + identity TRIBUTARY_SLOT_GRANULARITY { + description + "Base identity for tributary slot granularity for OTN + logical channels."; + } + + identity TRIB_SLOT_1.25G { + base TRIBUTARY_SLOT_GRANULARITY; + description + "The tributary slot with a bandwidth of approximately 1.25 Gb/s + as defined in ITU-T G.709 standard."; + } + + identity TRIB_SLOT_2.5G { + base TRIBUTARY_SLOT_GRANULARITY; + description + "The tributary slot with a bandwidth of approximately 2.5 Gb/s + as defined in ITU-T G.709 standard."; + } + + identity TRIB_SLOT_5G { + base TRIBUTARY_SLOT_GRANULARITY; + description + "The tributary slot with a bandwidth of approximately 5 Gb/s + as defined in ITU-T G.709 standard."; + } + + // grouping statements + + grouping avg-min-max-instant-stats-precision2-ps-nm { + description + "Common grouping for recording picosecond per nanometer + values with 2 decimal precision. Values include the + instantaneous, average, minimum, and maximum statistics. + Statistics are computed and reported based on a moving time + interval (e.g., the last 30s). If supported by the device, + the time interval over which the statistics are computed, and + the times at which the minimum and maximum values occurred, + are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units ps-nm; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units ps-nm; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units ps-nm; + description + "The minimum value of the statistic over the time interval."; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units ps-nm; + description + "The maximum value of the statistic over the time interval."; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping avg-min-max-instant-stats-precision2-ps { + description + "Common grouping for recording picosecond values with + 2 decimal precision. Values include the + instantaneous, average, minimum, and maximum statistics. + Statistics are computed and reported based on a moving time + interval (e.g., the last 30s). If supported by the device, + the time interval over which the statistics are computed, and + the times at which the minimum and maximum values occurred, + are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units ps; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units ps; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units ps; + description + "The minimum value of the statistic over the time interval."; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units ps; + description + "The maximum value of the statistic over the time interval."; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping avg-min-max-instant-stats-precision2-ps2 { + description + "Common grouping for recording picosecond^2 values with + 2 decimal precision. Values include the + instantaneous, average, minimum, and maximum statistics. + Statistics are computed and reported based on a moving time + interval (e.g., the last 30s). If supported by the device, + the time interval over which the statistics are computed, and + the times at which the minimum and maximum values occurred, + are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units ps^2; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units ps^2; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units ps^2; + description + "The minimum value of the statistic over the time interval."; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units ps^2; + description + "The maximum value of the statistic over the time + interval."; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping avg-min-max-instant-stats-precision18-ber { + description + "Common grouping for recording bit error rate (BER) values + with 18 decimal precision. Note that decimal64 supports + values as small as i x 10^-18 where i is an integer. Values + smaller than this should be reported as 0 to inidicate error + free or near error free performance. Values include the + instantaneous, average, minimum, and maximum statistics. + Statistics are computed and reported based on a moving time + interval (e.g., the last 30s). If supported by the device, + the time interval over which the statistics are computed, and + the times at which the minimum and maximum values occurred, + are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 18; + } + units bit-errors-per-second; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 18; + } + units bit-errors-per-second; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 18; + } + units bit-errors-per-second; + description + "The minimum value of the statistic over the time + interval."; + } + + leaf max { + type decimal64 { + fraction-digits 18; + } + units bit-errors-per-second; + description + "The maximum value of the statistic over the time + interval."; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping avg-min-max-instant-stats-precision1-mhz { + description + "Common grouping for recording frequency values in MHz with + 1 decimal precision. Values include the instantaneous, average, + minimum, and maximum statistics. Statistics are computed and + reported based on a moving time interval (e.g., the last 30s). + If supported by the device, the time interval over which the + statistics are computed, and the times at which the minimum and + maximum values occurred, are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 1; + } + units MHz; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 1; + } + units MHz; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 1; + } + units MHz; + description + "The minimum value of the statistic over the time interval."; + } + + leaf max { + type decimal64 { + fraction-digits 1; + } + units MHz; + description + "The maximum value of the statistic over the time interval."; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping avg-min-max-instant-stats-precision1-krads { + description + "Common grouping for recording kiloradian per second (krad/s) values + with 1 decimal precision. Values include the instantaneous, + average, minimum, and maximum statistics. Statistics are computed + and reported based on a moving time interval (e.g., the last 30s). + If supported by the device, the time interval over which the + statistics are computed, and the times at which the minimum and + maximum values occurred, are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 1; + } + units "krad/s"; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 1; + } + units "krad/s"; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 1; + } + units "krad/s"; + description + "The minimum value of the statistic over the time interval."; + } + + leaf max { + type decimal64 { + fraction-digits 1; + } + units "krad/s"; + description + "The maximum value of the statistic over the time interval."; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + grouping avg-min-max-instant-stats-precision2-pct { + description + "Common grouping for percentage statistics with 2 decimal precision. + Values include the instantaneous, average, minimum, and maximum + statistics. Statistics are computed and reported based on a moving + time interval (e.g., the last 30s). If supported by the device, + the time interval over which the statistics are computed, and the + times at which the minimum and maximum values occurred, are also + reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units percentage; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units percentage; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units percentage; + description + "The minimum value of the statistic over the time interval."; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units percentage; + description + "The maximum value of the statistic over the time interval."; + } + + uses oc-types:stat-interval-state; + uses oc-types:min-max-time; + } + + + // identity statements + + identity TRIBUTARY_PROTOCOL_TYPE { + description + "Base identity for protocol framing used by tributary + signals."; + } + + identity PROT_1GE { + base TRIBUTARY_PROTOCOL_TYPE; + description "1G Ethernet protocol"; + } + + identity PROT_OC48 { + base TRIBUTARY_PROTOCOL_TYPE; + description "OC48 protocol"; + } + + identity PROT_STM16 { + base TRIBUTARY_PROTOCOL_TYPE; + description "STM 16 protocol"; + } + + identity PROT_10GE_LAN { + base TRIBUTARY_PROTOCOL_TYPE; + description "10G Ethernet LAN protocol"; + } + + identity PROT_10GE_WAN { + base TRIBUTARY_PROTOCOL_TYPE; + description "10G Ethernet WAN protocol"; + } + + identity PROT_OC192 { + base TRIBUTARY_PROTOCOL_TYPE; + description "OC 192 (9.6GB) port protocol"; + } + + identity PROT_STM64 { + base TRIBUTARY_PROTOCOL_TYPE; + description "STM 64 protocol"; + } + + identity PROT_OTU2 { + base TRIBUTARY_PROTOCOL_TYPE; + description "OTU 2 protocol"; + } + + identity PROT_OTU2E { + base TRIBUTARY_PROTOCOL_TYPE; + description "OTU 2e protocol"; + } + + identity PROT_OTU1E { + base TRIBUTARY_PROTOCOL_TYPE; + description "OTU 1e protocol"; + } + + identity PROT_ODU2 { + base TRIBUTARY_PROTOCOL_TYPE; + description "ODU 2 protocol"; + } + + identity PROT_ODU2E { + base TRIBUTARY_PROTOCOL_TYPE; + description "ODU 2e protocol"; + } + + identity PROT_40GE { + base TRIBUTARY_PROTOCOL_TYPE; + description "40G Ethernet port protocol"; + } + + identity PROT_OC768 { + base TRIBUTARY_PROTOCOL_TYPE; + description "OC 768 protocol"; + } + + identity PROT_STM256 { + base TRIBUTARY_PROTOCOL_TYPE; + description "STM 256 protocol"; + } + + identity PROT_OTU3 { + base TRIBUTARY_PROTOCOL_TYPE; + description "OTU 3 protocol"; + } + + identity PROT_ODU3 { + base TRIBUTARY_PROTOCOL_TYPE; + description "ODU 3 protocol"; + } + + identity PROT_100GE { + base TRIBUTARY_PROTOCOL_TYPE; + description "100G Ethernet protocol"; + } + + identity PROT_100G_MLG { + base TRIBUTARY_PROTOCOL_TYPE; + description "100G MLG protocol"; + } + + identity PROT_OTU4 { + base TRIBUTARY_PROTOCOL_TYPE; + description "OTU4 signal protocol (112G) for transporting + 100GE signal"; + } + + identity PROT_OTUCN { + base TRIBUTARY_PROTOCOL_TYPE; + description "OTU Cn protocol"; + } + + identity PROT_ODUCN { + base TRIBUTARY_PROTOCOL_TYPE; + description "ODU Cn protocol"; + } + + identity PROT_ODU4 { + base TRIBUTARY_PROTOCOL_TYPE; + description "ODU 4 protocol"; + } + + identity PROT_400GE { + base TRIBUTARY_PROTOCOL_TYPE; + description "400G Ethernet protocol"; + } + + identity PROT_OTSIG { + base TRIBUTARY_PROTOCOL_TYPE; + description "Optical tributary signal group protocol"; + } + + identity PROT_ODUFLEX_CBR { + base TRIBUTARY_PROTOCOL_TYPE; + description "ODU Flex with CBR protocol"; + } + + identity PROT_ODUFLEX_GFP { + base TRIBUTARY_PROTOCOL_TYPE; + description "ODU Flex with GFP protocol"; + } + + identity TRANSCEIVER_FORM_FACTOR_TYPE { + description + "Base identity for identifying the type of pluggable optic + transceiver (i.e,. form factor) used in a port."; + } + + identity CFP { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "C form-factor pluggable, that can support up to a + 100 Gb/s signal with 10x10G or 4x25G physical channels"; + } + + identity CFP2 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "1/2 C form-factor pluggable, that can support up to a + 200 Gb/s signal with 10x10G, 4x25G, or 8x25G physical + channels"; + } + + identity CFP2_ACO { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "CFP2 analog coherent optics transceiver, supporting + 100 Gb, 200Gb, and 250 Gb/s signal."; + } + + identity CFP4 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "1/4 C form-factor pluggable, that can support up to a + 100 Gb/s signal with 10x10G or 4x25G physical channels"; + } + + identity QSFP { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "OriginalQuad Small Form-factor Pluggable transceiver that can + support 4x1G physical channels. Not commonly used."; + } + + identity QSFP_PLUS { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Quad Small Form-factor Pluggable transceiver that can support + up to 4x10G physical channels."; + } + + identity QSFP28 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "QSFP pluggable optic with support for up to 4x28G physical + channels"; + } + + identity QSFP56_DD_TYPE1 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "QSFP DD pluggable optic with support for up to 8x56G physical + channels. Type 1 uses eight optical and electrical signals."; + } + + identity QSFP56_DD_TYPE2 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "QSFP DD pluggable optic with support for up to 4x112G physical + channels. Type 2 uses four optical and eight electrical + signals."; + } + + identity CPAK { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Cisco CPAK transceiver supporting 100 Gb/s."; + } + + identity SFP { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Small form-factor pluggable transceiver supporting up to + 10 Gb/s signal"; + } + + identity SFP_PLUS { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Enhanced small form-factor pluggable transceiver supporting + up to 16 Gb/s signals, including 10 GbE and OTU2"; + } + + identity SFP28 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Small form-factor pluggable transceiver supporting up to + 25 Gb/s signal"; + } + + identity SFP56 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Small form-factor pluggable transceiver supporting up to + 50 Gb/s signal"; + } + + identity XFP { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "10 Gigabit small form factor pluggable transceiver supporting + 10 GbE and OTU2"; + } + + identity X2 { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "10 Gigabit small form factor pluggable transceiver supporting + 10 GbE using a XAUI inerface and 4 data channels."; + } + + identity OSFP { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Octal small form factor pluggable transceiver supporting + 400 Gb/s."; + } + + identity NON_PLUGGABLE { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Represents a port that does not require a pluggable optic, + e.g., with on-board optics like COBO"; + } + + identity OTHER { + base TRANSCEIVER_FORM_FACTOR_TYPE; + description + "Represents a transceiver form factor not otherwise listed"; + } + + identity FIBER_CONNECTOR_TYPE { + description + "Type of optical fiber connector"; + } + + identity SC_CONNECTOR { + base FIBER_CONNECTOR_TYPE; + description + "SC type fiber connector"; + } + + identity LC_CONNECTOR { + base FIBER_CONNECTOR_TYPE; + description + "LC type fiber connector"; + } + + identity MPO_CONNECTOR { + base FIBER_CONNECTOR_TYPE; + description + "MPO (multi-fiber push-on/pull-off) type fiber connector + 1x12 fibers"; + } + + identity AOC_CONNECTOR { + base FIBER_CONNECTOR_TYPE; + description + "AOC (active optical cable) type fiber connector"; + } + + identity DAC_CONNECTOR { + base FIBER_CONNECTOR_TYPE; + description + "DAC (direct attach copper) type fiber connector"; + } + + identity ETHERNET_PMD_TYPE { + description + "Ethernet compliance codes (PMD) supported by transceivers"; + } + + identity ETH_10GBASE_LRM { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 10GBASE_LRM"; + } + + identity ETH_10GBASE_LR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 10GBASE_LR"; + } + + identity ETH_10GBASE_ZR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 10GBASE_ZR"; + } + + identity ETH_10GBASE_ER { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 10GBASE_ER"; + } + + identity ETH_10GBASE_SR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 10GBASE_SR"; + } + + identity ETH_40GBASE_CR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 40GBASE_CR4"; + } + + identity ETH_40GBASE_SR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 40GBASE_SR4"; + } + + identity ETH_40GBASE_LR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 40GBASE_LR4"; + } + + identity ETH_40GBASE_ER4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 40GBASE_ER4"; + } + + identity ETH_40GBASE_PSM4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 40GBASE_PSM4"; + } + + identity ETH_4X10GBASE_LR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 4x10GBASE_LR"; + } + + identity ETH_4X10GBASE_SR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 4x10GBASE_SR"; + } + + identity ETH_100G_AOC { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100G_AOC"; + } + + identity ETH_100G_ACC { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100G_ACC"; + } + + identity ETH_100GBASE_SR10 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_SR10"; + } + + identity ETH_100GBASE_SR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_SR4"; + } + + identity ETH_100GBASE_LR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_LR4"; + } + + identity ETH_100GBASE_ER4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_ER4"; + } + + identity ETH_100GBASE_CWDM4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_CWDM4"; + } + + identity ETH_100GBASE_CLR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_CLR4"; + } + + identity ETH_100GBASE_PSM4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_PSM4"; + } + + identity ETH_100GBASE_CR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_CR4"; + } + + identity ETH_100GBASE_FR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_FR"; + } + + identity ETH_100GBASE_DR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 100GBASE_DR"; + } + + identity ETH_400GBASE_ZR { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 400GBASE_ZR"; + } + + identity ETH_400GBASE_LR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 400GBASE_LR4"; + } + + identity ETH_400GBASE_FR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 400GBASE_FR4"; + } + + identity ETH_400GBASE_LR8 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 400GBASE_LR8"; + } + + identity ETH_400GBASE_DR4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 400GBASE_DR4"; + } + + identity ETH_400GMSA_PSM4 { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: 400GMSA_PSM4"; + } + + identity ETH_UNDEFINED { + base ETHERNET_PMD_TYPE; + description "Ethernet compliance code: undefined"; + } + + identity SONET_APPLICATION_CODE { + description + "Supported SONET/SDH application codes"; + } + + identity VSR2000_3R2 { + base SONET_APPLICATION_CODE; + description + "SONET/SDH application code: VSR2000_3R2"; + } + + identity VSR2000_3R3 { + base SONET_APPLICATION_CODE; + description + "SONET/SDH application code: VSR2000_3R3"; + } + + identity VSR2000_3R5 { + base SONET_APPLICATION_CODE; + description + "SONET/SDH application code: VSR2000_3R5"; + } + + identity SONET_UNDEFINED { + base SONET_APPLICATION_CODE; + description + "SONET/SDH application code: undefined"; + } + + identity OTN_APPLICATION_CODE { + description + "Supported OTN application codes"; + } + + identity P1L1_2D1 { + base OTN_APPLICATION_CODE; + description + "OTN application code: P1L1_2D1"; + } + + identity P1S1_2D2 { + base OTN_APPLICATION_CODE; + description + "OTN application code: P1S1_2D2"; + } + + identity P1L1_2D2 { + base OTN_APPLICATION_CODE; + description + "OTN application code: P1L1_2D2"; + } + + identity OTN_UNDEFINED { + base OTN_APPLICATION_CODE; + description + "OTN application code: undefined"; + } + + identity TRIBUTARY_RATE_CLASS_TYPE { + description + "Rate of tributary signal _- identities will typically reflect + rounded bit rate."; + } + + identity TRIB_RATE_1G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1G tributary signal rate"; + } + + identity TRIB_RATE_2.5G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "2.5G tributary signal rate"; + } + + identity TRIB_RATE_10G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "10G tributary signal rate"; + } + + identity TRIB_RATE_40G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "40G tributary signal rate"; + } + + identity TRIB_RATE_100G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "100G tributary signal rate"; + } + + identity TRIB_RATE_150G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "150G tributary signal rate"; + } + + identity TRIB_RATE_200G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "200G tributary signal rate"; + } + + identity TRIB_RATE_250G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "250G tributary signal rate"; + } + + identity TRIB_RATE_300G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "300G tributary signal rate"; + } + + identity TRIB_RATE_350G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "350G tributary signal rate"; + } + + identity TRIB_RATE_400G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "400G tributary signal rate"; + } + + identity TRIB_RATE_450G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "450G tributary signal rate"; + } + + identity TRIB_RATE_500G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "500G tributary signal rate"; + } + + identity TRIB_RATE_550G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "550G tributary signal rate"; + } + + identity TRIB_RATE_600G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "600G tributary signal rate"; + } + + identity TRIB_RATE_650G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "650G tributary signal rate"; + } + + identity TRIB_RATE_700G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "700G tributary signal rate"; + } + + identity TRIB_RATE_750G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "750G tributary signal rate"; + } + + identity TRIB_RATE_800G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "800G tributary signal rate"; + } + + identity TRIB_RATE_850G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "850G tributary signal rate"; + } + + identity TRIB_RATE_900G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "900G tributary signal rate"; + } + + identity TRIB_RATE_950G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "950G tributary signal rate"; + } + + identity TRIB_RATE_1000G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1000G tributary signal rate"; + } + + identity TRIB_RATE_1050G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1050G tributary signal rate"; + } + + identity TRIB_RATE_1100G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1100G tributary signal rate"; + } + + identity TRIB_RATE_1150G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1150G tributary signal rate"; + } + + identity TRIB_RATE_1200G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1200G tributary signal rate"; + } + + identity TRIB_RATE_1250G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1250G tributary signal rate"; + } + + identity TRIB_RATE_1300G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1300G tributary signal rate"; + } + + identity TRIB_RATE_1350G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1350G tributary signal rate"; + } + + identity TRIB_RATE_1400G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1400G tributary signal rate"; + } + + identity TRIB_RATE_1450G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1450G tributary signal rate"; + } + + identity TRIB_RATE_1500G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1500G tributary signal rate"; + } + + identity TRIB_RATE_1550G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1550G tributary signal rate"; + } + + identity TRIB_RATE_1600G { + base TRIBUTARY_RATE_CLASS_TYPE; + description + "1600G tributary signal rate"; + } + + identity LOGICAL_ELEMENT_PROTOCOL_TYPE { + description + "Type of protocol framing used on the logical channel or + tributary"; + } + + identity PROT_ETHERNET { + base LOGICAL_ELEMENT_PROTOCOL_TYPE; + description + "Ethernet protocol framing"; + } + + identity PROT_OTN { + base LOGICAL_ELEMENT_PROTOCOL_TYPE; + description + "OTN protocol framing"; + } + + identity OPTICAL_CHANNEL { + base oc-platform-types:OPENCONFIG_HARDWARE_COMPONENT; + description + "Optical channels act as carriers for transport traffic + directed over a line system. They are represented as + physical components in the physical inventory model."; + } + + identity FIBER_JUMPER_TYPE { + description + "Types of fiber jumpers used for connecting device ports"; + } + + identity FIBER_JUMPER_SIMPLEX { + base FIBER_JUMPER_TYPE; + description + "Simplex fiber jumper"; + } + + identity FIBER_JUMPER_MULTI_FIBER_STRAND { + base FIBER_JUMPER_TYPE; + description + "One strand of a fiber jumper which contains multiple fibers + within it, such as an MPO based fiber jumper"; + } + + identity OPTICAL_PORT_TYPE { + description + "Type definition for optical transport port types"; + } + + identity INGRESS { + base OPTICAL_PORT_TYPE; + description + "Ingress port, corresponding to a signal entering + a line system device such as an amplifier or wavelength + router."; + } + + identity EGRESS { + base OPTICAL_PORT_TYPE; + description + "Egress port, corresponding to a signal exiting + a line system device such as an amplifier or wavelength + router."; + } + + identity ADD { + base OPTICAL_PORT_TYPE; + description + "Add port, corresponding to a signal injected + at a wavelength router."; + } + + identity DROP { + base OPTICAL_PORT_TYPE; + description + "Drop port, corresponding to a signal dropped + at a wavelength router."; + } + + identity MONITOR { + base OPTICAL_PORT_TYPE; + description + "Monitor port, corresponding to a signal used by an optical + channel monitor. This is used to represent the connection + that a channel monitor port is connected to, typically on a + line system device. This connection may be via physical cable + and faceplate ports or internal to the device"; + } + + identity TERMINAL_CLIENT { + base OPTICAL_PORT_TYPE; + description + "Client-facing port on a terminal optics device (e.g., + transponder or muxponder)."; + } + + identity TERMINAL_LINE { + base OPTICAL_PORT_TYPE; + description + "Line-facing port on a terminal optics device (e.g., + transponder or muxponder)."; + } + + identity CLIENT_MAPPING_MODE { + description + "Type definition for optical transport client mapping modes."; + } + + identity MODE_1X100G { + base CLIENT_MAPPING_MODE; + description + "1 x 100G client mapping mode."; + } + + identity MODE_1X200G { + base CLIENT_MAPPING_MODE; + description + "1 x 200G client mapping mode."; + } + + identity MODE_1X400G { + base CLIENT_MAPPING_MODE; + description + "1 x 400G client mapping mode."; + } + + identity MODE_2X100G { + base CLIENT_MAPPING_MODE; + description + "2 x 100G client mapping mode."; + } + + identity MODE_2X200G { + base CLIENT_MAPPING_MODE; + description + "2 x 200G client mapping mode."; + } + + identity MODE_3X100G { + base CLIENT_MAPPING_MODE; + description + "3 x 100G client mapping mode."; + } + + identity MODE_4X100G { + base CLIENT_MAPPING_MODE; + description + "4 x 100G client mapping mode."; + } + + identity TRANSCEIVER_MODULE_FUNCTIONAL_TYPE { + description + "Type definition for transceiver module functional types."; + } + + identity TYPE_STANDARD_OPTIC { + base TRANSCEIVER_MODULE_FUNCTIONAL_TYPE; + description + "Standard optic using a grey wavelength (i.e. 1310, 1550, etc.) + and on-off-keying (OOK) modulation."; + } + + identity TYPE_DIGITAL_COHERENT_OPTIC { + base TRANSCEIVER_MODULE_FUNCTIONAL_TYPE; + description + "Digital coherent module which transmits a phase / amplitude + modulated signal and uses a digital signal processor to receive + and decode the received signal."; + } +} diff --git a/confdgnmi/oc/openconfig-types.yang b/confdgnmi/oc/openconfig-types.yang new file mode 100644 index 0000000..89e32d5 --- /dev/null +++ b/confdgnmi/oc/openconfig-types.yang @@ -0,0 +1,471 @@ +module openconfig-types { + yang-version "1"; + + namespace "http://openconfig.net/yang/openconfig-types"; + + prefix "oc-types"; + + // import statements + import openconfig-extensions { prefix oc-ext; } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module contains a set of general type definitions that + are used across OpenConfig models. It can be imported by modules + that make use of these types."; + + oc-ext:openconfig-version "0.6.0"; + + revision "2019-04-16" { + description + "Clarify definition of timeticks64."; + reference "0.6.0"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "0.5.1"; + } + + revision "2018-05-05" { + description + "Add grouping of min-max-time and + included them to all stats with min/max/avg"; + reference "0.5.0"; + } + + revision "2018-01-16" { + description + "Add interval to min/max/avg stats; add percentage stat"; + reference "0.4.0"; + } + + revision "2017-08-16" { + description + "Apply fix for ieetfloat32 length parameter"; + reference "0.3.3"; + } + + revision "2017-01-13" { + description + "Add ADDRESS_FAMILY identity"; + reference "0.3.2"; + } + + revision "2016-11-14" { + description + "Correct length of ieeefloat32"; + reference "0.3.1"; + } + + revision "2016-11-11" { + description + "Additional types - ieeefloat32 and routing-password"; + reference "0.3.0"; + } + + revision "2016-05-31" { + description + "OpenConfig public release"; + reference "0.2.0"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + typedef percentage { + type uint8 { + range "0..100"; + } + description + "Integer indicating a percentage value"; + } + + typedef std-regexp { + type string; + description + "This type definition is a placeholder for a standard + definition of a regular expression that can be utilised in + OpenConfig models. Further discussion is required to + consider the type of regular expressions that are to be + supported. An initial proposal is POSIX compatible."; + } + + typedef timeticks64 { + type uint64; + units "nanoseconds"; + description + "The timeticks64 represents the time, modulo 2^64 in + nanoseconds between two epochs. The leaf using this + type must define the epochs that tests are relative to."; + } + + typedef ieeefloat32 { + type binary { + length "4"; + } + description + "An IEEE 32-bit floating point number. The format of this number + is of the form: + 1-bit sign + 8-bit exponent + 23-bit fraction + The floating point value is calculated using: + (-1)**S * 2**(Exponent-127) * (1+Fraction)"; + } + + typedef routing-password { + type string; + description + "This type is indicative of a password that is used within + a routing protocol which can be returned in plain text to the + NMS by the local system. Such passwords are typically stored + as encrypted strings. Since the encryption used is generally + well known, it is possible to extract the original value from + the string - and hence this format is not considered secure. + Leaves specified with this type should not be modified by + the system, and should be returned to the end-user in plain + text. This type exists to differentiate passwords, which + may be sensitive, from other string leaves. It could, for + example, be used by the NMS to censor this data when + viewed by particular users."; + } + + typedef stat-interval { + type uint64; + units nanoseconds; + description + "A time interval over which a set of statistics is computed. + A common usage is to report the interval over which + avg/min/max stats are computed and reported."; + } + + grouping stat-interval-state { + description + "Reusable leaf definition for stats computation interval"; + + leaf interval { + type oc-types:stat-interval; + description + "If supported by the system, this reports the time interval + over which the min/max/average statistics are computed by + the system."; + } + } + + grouping min-max-time { + description + "Common grouping for recording the absolute time at which + the minimum and maximum values occurred in the statistics"; + + leaf min-time { + type oc-types:timeticks64; + description + "The absolute time at which the minimum value occurred. + The value is the timestamp in nanoseconds relative to + the Unix Epoch (Jan 1, 1970 00:00:00 UTC)."; + } + + leaf max-time { + type oc-types:timeticks64; + description + "The absolute time at which the maximum value occurred. + The value is the timestamp in nanoseconds relative to + the Unix Epoch (Jan 1, 1970 00:00:00 UTC)."; + } + } + + grouping avg-min-max-stats-precision1 { + description + "Common nodes for recording average, minimum, and + maximum values for a statistic. These values all have + fraction-digits set to 1. Statistics are computed + and reported based on a moving time interval (e.g., the last + 30s). If supported by the device, the time interval over which + the statistics are computed is also reported."; + + leaf avg { + type decimal64 { + fraction-digits 1; + } + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 1; + } + description + "The minimum value of the statistic over the time + interval."; + } + + leaf max { + type decimal64 { + fraction-digits 1; + } + description + "The maximum value of the statitic over the time + interval."; + } + + uses stat-interval-state; + uses min-max-time; + } + + grouping avg-min-max-instant-stats-precision1 { + description + "Common grouping for recording an instantaneous statistic value + in addition to avg-min-max stats"; + + leaf instant { + type decimal64 { + fraction-digits 1; + } + description + "The instantaneous value of the statistic."; + } + + uses avg-min-max-stats-precision1; + } + + grouping avg-min-max-instant-stats-precision2-dB { + description + "Common grouping for recording dB values with 2 decimal + precision. Values include the instantaneous, average, + minimum, and maximum statistics. Statistics are computed + and reported based on a moving time interval (e.g., the last + 30s). If supported by the device, the time interval over which + the statistics are computed, and the times at which the minimum + and maximum values occurred, are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The minimum value of the statistic over the time interval."; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The maximum value of the statistic over the time + interval."; + } + + uses stat-interval-state; + uses min-max-time; + } + + grouping avg-min-max-instant-stats-precision2-dBm { + description + "Common grouping for recording dBm values with 2 decimal + precision. Values include the instantaneous, average, + minimum, and maximum statistics. Statistics are computed + and reported based on a moving time interval (e.g., the last + 30s). If supported by the device, the time interval over which + the statistics are computed, and the times at which the minimum + and maximum values occurred, are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The minimum value of the statistic over the time + interval."; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The maximum value of the statistic over the time interval."; + } + + uses stat-interval-state; + uses min-max-time; + } + + grouping avg-min-max-instant-stats-precision2-mA { + description + "Common grouping for recording mA values with 2 decimal + precision. Values include the instantaneous, average, + minimum, and maximum statistics. Statistics are computed + and reported based on a moving time interval (e.g., the last + 30s). If supported by the device, the time interval over which + the statistics are computed, and the times at which the minimum + and maximum values occurred, are also reported."; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The arithmetic mean value of the statistic over the + time interval."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The minimum value of the statistic over the time + interval."; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The maximum value of the statistic over the time + interval."; + } + + uses stat-interval-state; + uses min-max-time; + } + + grouping avg-min-max-instant-stats-pct { + description + "Common grouping for percentage statistics. + Values include the instantaneous, average, + minimum, and maximum statistics. Statistics are computed + and reported based on a moving time interval (e.g., the last + 30s). If supported by the device, the time interval over which + the statistics are computed, and the times at which the minimum + and maximum values occurred, are also reported."; + + leaf instant { + type oc-types:percentage; + description + "The instantaneous percentage value."; + } + + leaf avg { + type oc-types:percentage; + description + "The arithmetic mean value of the percentage measure of the + statistic over the time interval."; + } + + leaf min { + type oc-types:percentage; + description + "The minimum value of the percentage measure of the + statistic over the time interval."; + } + + leaf max { + type oc-types:percentage; + description + "The maximum value of the percentage measure of the + statistic over the time interval."; + } + + uses stat-interval-state; + uses min-max-time; + } + + identity ADDRESS_FAMILY { + description + "A base identity for all address families"; + } + + identity IPV4 { + base ADDRESS_FAMILY; + description + "The IPv4 address family"; + } + + identity IPV6 { + base ADDRESS_FAMILY; + description + "The IPv6 address family"; + } + + identity MPLS { + base ADDRESS_FAMILY; + description + "The MPLS address family"; + } + + identity L2_ETHERNET { + base ADDRESS_FAMILY; + description + "The 802.3 Ethernet address family"; + } + +} diff --git a/confdgnmi/oc/openconfig-vlan-types.yang b/confdgnmi/oc/openconfig-vlan-types.yang new file mode 100644 index 0000000..09af398 --- /dev/null +++ b/confdgnmi/oc/openconfig-vlan-types.yang @@ -0,0 +1,283 @@ +module openconfig-vlan-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/vlan-types"; + + prefix "oc-vlan-types"; + + // import some basic types + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module defines configuration and state variables for VLANs, + in addition to VLAN parameters associated with interfaces"; + + oc-ext:openconfig-version "3.2.0"; + + revision "2022-05-24" { + description + "Remove module extension oc-ext:regexp-posix by making pattern regexes + conform to RFC6020/7950. + + Types impacted: + - vlan-range + - qinq-id + - qinq-id-range"; + reference "3.2.0"; + } + + revision "2020-06-30" { + description + "Add OpenConfig POSIX pattern extensions."; + reference "3.1.1"; + } + + revision "2019-01-31" { + description + "Add TPID_ANY wildcard match and a QinQ list type."; + reference "3.1.0"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "3.0.1"; + } + + revision "2018-02-14" { + description + "Fix bug with name of 802.1ad identity."; + reference "3.0.0"; + } + + revision "2017-07-14" { + description + "Move top-level vlan data to network-instance; Update + identities to comply to style guide; fixed pattern + quoting; corrected trunk vlan types; added TPID config to + base interface."; + reference "2.0.0"; + } + + revision "2016-05-26" { + description + "OpenConfig public release"; + reference "1.0.2"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // extension statements + + // feature statements + + // identity statements + + identity TPID_TYPES { + description + "Base identity for TPID values that can be matched or that override + the VLAN ethertype value"; + } + + identity TPID_0X8100 { + base TPID_TYPES; + description + "Default TPID value for 802.1q single-tagged VLANs."; + } + + identity TPID_0X88A8 { + base TPID_TYPES; + description + "TPID value for 802.1ad provider bridging, QinQ or + stacked VLANs."; + } + + identity TPID_0X9100 { + base TPID_TYPES; + description + "Alternate TPID value."; + } + + identity TPID_0X9200 { + base TPID_TYPES; + description + "Alternate TPID value."; + } + + identity TPID_ANY { + base TPID_TYPES; + description + "A wildcard that matches any of the generally used TPID values + for singly- or multiply-tagged VLANs. Equivalent to matching + any of TPID_0X8100, TPID_0X88A8, TPID_0X9100 and TPID_0x9200. + This value is only applicable where the TPID of a packet is + being matched."; + } + + // typedef statements + + // TODO: typedefs should be defined in a vlan-types.yang file. + typedef vlan-id { + type uint16 { + range 1..4094; + } + description + "Type definition representing a single-tagged VLAN"; + } + + typedef vlan-range { + type string { + // range specified as [lower]..[upper] + pattern '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.(409[0-4]|' + + '40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{1,2}|' + + '[1-9])'; + oc-ext:posix-pattern '^(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.(409[0-4]|' + + '40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{1,2}|' + + '[1-9])$'; + } + description + "Type definition representing a range of single-tagged + VLANs. A range is specified as x..y where x and y are + valid VLAN IDs (1 <= vlan-id <= 4094). The range is + assumed to be inclusive, such that any VLAN-ID matching + x <= VLAN-ID <= y falls within the range."; + } + + typedef qinq-id { + type string { + pattern + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.' + + '((409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])|\*)'; + oc-ext:posix-pattern + '^(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.' + + '((409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])|\*)$'; + } + description + "Type definition representing a single double-tagged/QinQ VLAN + identifier. The format of a QinQ VLAN-ID is x.y where X is the + 'outer' VLAN identifier, and y is the 'inner' VLAN identifier. + Both x and y must be valid VLAN IDs (1 <= vlan-id <= 4094) + with the exception that y may be equal to a wildcard (*). In + cases where y is set to the wildcard, this represents all inner + VLAN identifiers where the outer VLAN identifier is equal to + x."; + } + + typedef qinq-id-range { + type union { + type string { + // match cases where the range is specified as x..y.z + pattern + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.' + + '((409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])|\*)'; + oc-ext:posix-pattern + '^(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.' + + '((409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])|\*)$'; + } + type string { + // match cases where the range is specified as x.y..z + pattern + '(\*|(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9]))\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])'; + oc-ext:posix-pattern + '^(\*|(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9]))\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])$'; + } + } + description + "A type definition representing a range of double-tagged/QinQ + VLAN identifiers. The format of a QinQ VLAN-ID range can be + specified in two formats. Where the range is outer VLAN IDs + the range is specified as x..y.z. In this case outer VLAN + identifiers meeting the criteria x <= outer-vlan-id <= y are + accepted if and only if the inner VLAN-ID is equal to y - or + any inner-tag if the wildcard is specified. Alternatively the + ange can be specified as x.y..z. In this case only VLANs with an + outer-vlan-id qual to x are accepted (x may again be the + wildcard). Inner VLANs are accepted if they meet the inequality + y <= inner-vlan-id <= z."; + } + + typedef vlan-mode-type { + type enumeration { + enum ACCESS { + description "Access mode VLAN interface (No 802.1q header)"; + } + enum TRUNK { + description "Trunk mode VLAN interface"; + } + } + description + "VLAN interface mode (trunk or access)"; + } + + typedef vlan-ref { + type union { + type vlan-id; + type string; + // TODO: string should be changed to leafref to reference + // an existing VLAN. this is not allowed in YANG 1.0 but + // is expected to be in YANG 1.1. + // type leafref { + // path "vlan:vlans/vlan:vlan/vlan:config/vlan:name"; + // } + } + description + "Reference to a VLAN by name or id"; + } + + typedef vlan-stack-action { + type enumeration { + enum PUSH { + description + "Push a VLAN onto the VLAN stack."; + } + enum POP { + description + "Pop a VLAN from the VLAN stack."; + } + enum SWAP { + description + "Swap the VLAN at the top of the VLAN stack."; + } + // TODO: add push-push, pop-pop, push-swap etc + } + description + "Operations that can be performed on a VLAN stack."; + } + + +} diff --git a/confdgnmi/oc/openconfig-vlan.yang b/confdgnmi/oc/openconfig-vlan.yang new file mode 100644 index 0000000..905d481 --- /dev/null +++ b/confdgnmi/oc/openconfig-vlan.yang @@ -0,0 +1,1001 @@ +module openconfig-vlan { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/vlan"; + + prefix "oc-vlan"; + + // import some basic types + import openconfig-vlan-types { prefix oc-vlan-types; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-if-ethernet { prefix oc-eth; } + import openconfig-if-aggregate { prefix oc-lag; } + import iana-if-type { prefix ianaift; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module defines configuration and state variables for VLANs, + in addition to VLAN parameters associated with interfaces"; + + oc-ext:openconfig-version "3.2.2"; + + revision "2023-02-07" { + description + "Remove prefix from enums in when statements"; + reference "3.2.2"; + } + + revision "2021-07-28" { + description + "Add prefix to qualify when statements"; + reference "3.2.1"; + } + + revision "2019-04-16" { + description + "Update import prefix for iana-if-type module"; + reference "3.2.0"; + } + + revision "2019-01-31" { + description + "Revise QinQ matching and add input/output VLAN stack operations."; + reference "3.1.0"; + } + + revision "2018-11-21" { + description + "Add OpenConfig module metadata extensions."; + reference "3.0.2"; + } + + revision "2018-06-05" { + description + "Fix bugs in when statements."; + reference "3.0.1"; + } + + revision "2018-02-14" { + description + "Fix bug with name of 802.1ad identity."; + reference "3.0.0"; + } + + revision "2017-07-14" { + description + "Move top-level vlan data to network-instance; Update + identities to comply to style guide; fixed pattern + quoting; corrected trunk vlan types; added TPID config to + base interface."; + reference "2.0.0"; + } + + revision "2016-05-26" { + description + "OpenConfig public release"; + reference "1.0.2"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + // grouping statements + + grouping vlan-config { + description "VLAN configuration container."; + + leaf vlan-id { + type oc-vlan-types:vlan-id; + description "Interface VLAN id."; + } + + leaf name { + type string; + description "Interface VLAN name."; + } + + leaf status { + type enumeration { + enum ACTIVE { + description "VLAN is active"; + } + enum SUSPENDED { + description "VLAN is inactive / suspended"; + } + } + default ACTIVE; + description "Admin state of the VLAN"; + } + + } + + grouping vlan-state { + description "State variables for VLANs"; + + // placeholder + + } + + grouping vlan-tpid-config { + description + "TPID configuration for dot1q-enabled interfaces"; + + leaf tpid { + type identityref { + base oc-vlan-types:TPID_TYPES; + } + default oc-vlan-types:TPID_0X8100; + description + "Optionally set the tag protocol identifier field (TPID) that + is accepted on the VLAN"; + } + } + + grouping vlan-tpid-state { + description + "TPID opstate for dot1q-enabled interfaces"; + + // placeholder + + } + + grouping vlan-members-state { + description + "List of interfaces / subinterfaces belonging to the VLAN."; + + container members { + description + "Enclosing container for list of member interfaces"; + + list member { + config false; + description + "List of references to interfaces / subinterfaces + associated with the VLAN."; + + uses oc-if:base-interface-ref-state; + } + } + } + + grouping vlan-switched-config { + description + "VLAN related configuration that is part of the physical + Ethernet interface."; + + leaf interface-mode { + type oc-vlan-types:vlan-mode-type; + description + "Set the interface to access or trunk mode for + VLANs"; + } + + leaf native-vlan { + when "../interface-mode = 'TRUNK'" { + description + "Native VLAN is valid for trunk mode interfaces"; + } + type oc-vlan-types:vlan-id; + description + "Set the native VLAN id for untagged frames arriving on + a trunk interface. Tagged frames sent on an interface + configured with a native VLAN should have their tags + stripped prior to transmission. This configuration is only + valid on a trunk interface."; + } + + leaf access-vlan { + when "../interface-mode = 'ACCESS'" { + description + "Access VLAN assigned to the interfaces"; + } + type oc-vlan-types:vlan-id; + description + "Assign the access vlan to the access port."; + } + + leaf-list trunk-vlans { + when "../interface-mode = 'TRUNK'" { + description + "Allowed VLANs may be specified for trunk mode + interfaces."; + } + type union { + type oc-vlan-types:vlan-id; + type oc-vlan-types:vlan-range; + } + description + "Specify VLANs, or ranges thereof, that the interface may + carry when in trunk mode. If not specified, all VLANs are + allowed on the interface. Ranges are specified in the form + x..y, where x kp=%s, op=%r, oldv=%s, newv=%s, state=%r", kp, op, oldv, newv, changes) - csnode = _confd.cs_node_cd(None, _confd.pp_kpath(kp)) + csnode = _confd.cs_node_cd(None, str(kp)) if op == _confd.MOP_CREATED: log.debug("_confd.MOP_CREATED") # TODO CREATE not handled for now @@ -500,11 +500,12 @@ def make_gnmi_json_value(self, value, csnode): def get_updates(self, trans, path_str, save_flags): log.debug("==> path_str=%s", path_str) - csnode = _confd.cs_node_cd(None, path_str) + tagpath = '/' + '/'.join(tag for tag, _ in parse_instance_path(path_str)) + csnode = _confd.cs_node_cd(None, tagpath) updates = [] def add_update_json(keypath, _value): - save_id = trans.save_config(save_flags, _confd.pp_kpath(keypath)) + save_id = trans.save_config(save_flags, str(keypath)) with socket() as save_sock: _confd.stream_connect(sock=save_sock, id=save_id, flags=0, ip=self.addr, port=self.port) diff --git a/confdgnmi/src/confd_gnmi_client.py b/confdgnmi/src/confd_gnmi_client.py index 29a8f27..807a45e 100755 --- a/confdgnmi/src/confd_gnmi_client.py +++ b/confdgnmi/src/confd_gnmi_client.py @@ -1,23 +1,33 @@ #!/usr/bin/env python3 +from __future__ import annotations import argparse import json import logging import ssl import sys from contextlib import closing +from typing import Optional from time import sleep import grpc from grpc import channel_ready_future, insecure_channel, secure_channel, \ ssl_channel_credentials +from grpc._channel import _MultiThreadedRendezvous import gnmi_pb2 from confd_gnmi_common import HOST, PORT, make_xpath_path, VERSION, \ common_optparse_options, common_optparse_process, make_gnmi_path, \ - get_data_type, get_sub_mode + datatype_str_to_int, subscription_mode_str_to_int from gnmi_pb2_grpc import gNMIStub log = logging.getLogger('confd_gnmi_client') +log_rpc = logging.getLogger('confd_gnmi_rpc') # "gNMI RPC only" dedicated logger + +def logged_rpc_call(rpc_name: str, request, rpc_call): + log_rpc.debug("RPC - %sRequest:\n%s", rpc_name, str(request)) + response = rpc_call() + log_rpc.debug("RPC - %sResponse:\n%s", rpc_name, str(response)) + return response class ConfDgNMIClient: @@ -26,7 +36,7 @@ def __init__(self, host=HOST, port=PORT, metadata=None, insecure=False, server_crt_file=None, username="admin", password="admin"): if metadata is None: metadata = [('username', username), ('password', password)] - log.info("==> host=%s, port=%i, metadata-%s", host, port, metadata) + log.info("==> host=%s, port=%i, metadata-%s", host, int(port), metadata) if insecure: self.channel = insecure_channel("{}:{}".format(host, port)) else: @@ -52,23 +62,23 @@ def __init__(self, host=HOST, port=PORT, metadata=None, insecure=False, def close(self): self.channel.close() - def get_capabilities(self): + def get_capabilities(self) -> gnmi_pb2.CapabilityResponse: log.info("==>") request = gnmi_pb2.CapabilityRequest() log.debug("Calling stub.Capabilities") - response = self.stub.Capabilities(request, metadata=self.metadata) - log.info("<== response=%s", response) + response = logged_rpc_call("Capability", request, + lambda: self.stub.Capabilities(request, metadata=self.metadata)) return response @staticmethod - def make_subscription_list(prefix, paths, mode, encoding): + def make_subscription_list(prefix, paths, mode, encoding, + stream_mode=gnmi_pb2.SubscriptionMode.ON_CHANGE): log.debug("==> mode=%s", mode) qos = gnmi_pb2.QOSMarking(marking=1) subscriptions = [] for path in paths: if mode == gnmi_pb2.SubscriptionList.STREAM: - sub = gnmi_pb2.Subscription(path=path, - mode=gnmi_pb2.SubscriptionMode.ON_CHANGE) + sub = gnmi_pb2.Subscription(path=path, mode=stream_mode) else: sub = gnmi_pb2.Subscription(path=path) subscriptions.append(sub) @@ -163,23 +173,36 @@ def read_subscribe_responses(responses, read_count=-1): log.info("<==") # TODO this API would change with more subscription support - def subscribe(self, subscription_list, read_fun=None, + def subscribe(self, requests, read_fun=None, poll_interval=0.0, poll_count=0, read_count=-1, subscription_end_delay=0.0, interactive_poll=False): log.info("==>") - responses = self.stub.Subscribe( - ConfDgNMIClient.generate_subscriptions(subscription_list, - poll_interval=poll_interval, - poll_count=poll_count, - subscription_end_delay=subscription_end_delay, - interactive_poll=interactive_poll), - metadata=self.metadata) + if isinstance(requests, gnmi_pb2.SubscriptionList): + requests = ConfDgNMIClient.generate_subscriptions(requests, + poll_interval=poll_interval, + poll_count=poll_count, + subscription_end_delay=subscription_end_delay, + interactive_poll=interactive_poll) + responses = logged_rpc_call("Subscribe", requests, + lambda: self.stub.Subscribe(requests, metadata=self.metadata)) if read_fun is not None: read_fun(responses, read_count) log.info("<== responses=%s", responses) return responses - def get(self, prefix, paths, get_type, encoding): + def get_public(self, + prefix: Optional[str] = None, paths: list[str] = [], + get_type: Optional[int] = None, encoding: Optional[int] = None) \ + -> gnmi_pb2.GetResponse: + sanitized_params = { + 'prefix': None if prefix is None else make_gnmi_path(prefix), + 'paths': [make_gnmi_path(p) for p in paths], + 'get_type': get_type, + 'encoding': gnmi_pb2.Encoding.JSON if encoding is None else encoding, + } + return self.get(**sanitized_params) + + def get(self, prefix, paths, get_type, encoding) -> gnmi_pb2.GetResponse: log.info("==> prefix=%s paths=%s get_type=%s encoding=%s self.metadata=%s", prefix, paths, get_type, encoding, self.metadata) path = [] @@ -189,10 +212,10 @@ def get(self, prefix, paths, get_type, encoding): type=get_type, encoding=encoding, extension=[]) - response = self.stub.Get(request, metadata=self.metadata) - - log.info("<== response.notification=%s", response.notification) - return response.notification + response = logged_rpc_call("Get", request, + lambda: self.stub.Get(request, metadata=self.metadata)) + log.info("<== response=%s", response) + return response def set(self, prefix, path_vals): log.info("==> prefix=%s path_vals=%s", prefix, path_vals) @@ -201,14 +224,16 @@ def set(self, prefix, path_vals): up = gnmi_pb2.Update(path=pv[0], val=pv[1]) update.append(up) request = gnmi_pb2.SetRequest(prefix=prefix, update=update) - response = self.stub.Set(request, metadata=self.metadata) + response = logged_rpc_call("Set", request, + lambda: self.stub.Set(request, metadata=self.metadata)) log.info("<== response=%s", response) return response def delete(self, prefix, paths): log.info("==> prefix=%s paths=%s", prefix, paths) request = gnmi_pb2.SetRequest(prefix=prefix, delete=paths) - response = self.stub.Set(request, metadata=self.metadata) + response = logged_rpc_call("(delete) Set", request, + lambda: self.stub.Set(request, metadata=self.metadata)) log.info("<== response=%s", response) return response @@ -303,8 +328,8 @@ def encoding_int_to_str(encoding: int, no_error = True) -> str: paths = [make_gnmi_path(p) for p in opt.paths] vals = [gnmi_pb2.TypedValue(json_ietf_val=v.encode()) for v in opt.vals] - datatype = get_data_type(opt.datatype) - subscription_mode = get_sub_mode(opt.submode) + datatype = datatype_str_to_int(opt.datatype) + subscription_mode = subscription_mode_str_to_int(opt.submode) poll_interval: float = opt.pollinterval poll_count: int = opt.pollcount interactive_poll: bool = opt.interactivepoll @@ -317,7 +342,7 @@ def encoding_int_to_str(encoding: int, no_error = True) -> str: datatype, subscription_mode, poll_interval, poll_count, read_count, subscription_end_delay, interactive_poll) if opt.submode != "STREAM": - read_count = -1; + read_count = -1 encoding = dict(JSON=gnmi_pb2.Encoding.JSON, JSON_IETF=gnmi_pb2.Encoding.JSON_IETF)[opt.encoding] @@ -349,9 +374,9 @@ def encoding_int_to_str(encoding: int, no_error = True) -> str: interactive_poll=interactive_poll) print(".... subscription done") elif opt.operation == "get": - notification = client.get(prefix, paths, datatype, encoding) - print("Get - Notifications:") - for n in notification: + get_response = client.get(prefix, paths, datatype, encoding) + print("Get - response Notifications:") + for n in get_response.notification: ConfDgNMIClient.print_notification(n) elif opt.operation in ("set", "delete"): if opt.operation == "set": diff --git a/confdgnmi/src/confd_gnmi_common.py b/confdgnmi/src/confd_gnmi_common.py index fa3961e..c860f01 100644 --- a/confdgnmi/src/confd_gnmi_common.py +++ b/confdgnmi/src/confd_gnmi_common.py @@ -1,6 +1,7 @@ from enum import Enum import logging -from typing import Tuple, Dict +from typing import Tuple, Dict, List, Iterable +import re import gnmi_pb2 @@ -83,28 +84,31 @@ def make_name_keys(elem_string) -> Tuple[str, Dict[str, str]]: return name, keys +def parse_instance_path(xpath_string) -> Iterable[Tuple[str, List[Tuple[str, str]]]]: + """Parse instance path to an iterable of (tag, keys) tuples. + + Instance paths are a limited form of XPath expressions - only + predicates in the form of a key assignment are accepted. + """ + + tag_rx = re.compile(r'/?(?P[^/\[\]]+)(?P(?:\[[^\]]*\])*)') + predicate_rx = re.compile(r'\[([^=]+)=([^\]]*)\]') + + for match in tag_rx.finditer(xpath_string): + mdict = match.groupdict() + keys = [pred.groups() for pred in predicate_rx.finditer(mdict['preds'])] + yield (mdict['tag'], keys) + + # Crate gNMI Path object from string representation of path # see: https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#222-paths # TODO tests -def make_gnmi_path(xpath_string, origin=None, target=None) -> gnmi_pb2.Path: - """ - Create gnmi path from string path - :param xpath_string: - :param origin: - :param target: - :return: - """ - log.debug("==> path_string=%s origin=%s target=%s", - xpath_string, origin, target) - elems = [] - elem_strings = xpath_string.split('/') - log.debug("elem_strings=%s", elem_strings) - for e in elem_strings: - if e != '': - (name, keys) = make_name_keys(e) - elem = gnmi_pb2.PathElem(name=name, key=keys) - elems.append(elem) - path = gnmi_pb2.Path(elem=elems, target=target, origin=origin) +def make_gnmi_path(xpath_string: str, origin: str = None, target: str = None) -> gnmi_pb2.Path: + """ Create gNMI path from input string. """ + log.debug("==> xpath_string=%s origin=%s target=%s", xpath_string, origin, target) + path_elms = [gnmi_pb2.PathElem(name=tag, key=dict(keys)) + for tag, keys in parse_instance_path(xpath_string)] + path = gnmi_pb2.Path(elem=path_elms, target=target, origin=origin) log.debug("<== path=%s", path) return path @@ -193,20 +197,40 @@ def remove_path_prefix(path, prefix): target=path.target) -def get_data_type(datatype_str): - datatype_map = { - "ALL": gnmi_pb2.GetRequest.DataType.ALL, - "CONFIG": gnmi_pb2.GetRequest.DataType.CONFIG, - "STATE": gnmi_pb2.GetRequest.DataType.STATE, - "OPERATIONAL": gnmi_pb2.GetRequest.DataType.OPERATIONAL, - } - return datatype_map[datatype_str] - - -def get_sub_mode(mode_str): - mode_map = { - "ONCE": gnmi_pb2.SubscriptionList.ONCE, - "POLL": gnmi_pb2.SubscriptionList.POLL, - "STREAM": gnmi_pb2.SubscriptionList.STREAM, - } - return mode_map[mode_str] +def _convert_enum_format(constructor, value, exception_str, do_return_unknown, unknown_value): + """ Private. Convert between string/int enumeration values using the input `constructor`. + If unknown/unsupported value is encountered, either raise exception or return value + depending on input parameters. """ + try: + if isinstance(value, str): + # If the input is "UNKNOWN(x)" string - that ve most probably + # created previously, convert it back to raw integer "x". + if mtch := re.match(value, r'UNKNOWN\(([0-9]+)\)') is not None: + return int(mtch.groups()[0]) + return constructor(value) + except ValueError as ex: + if do_return_unknown: + return unknown_value + raise ValueError(exception_str) from ex + +def datatype_str_to_int(data_type: str, no_error=False) -> int: + """ Convert text representation of DataType to standardized integer. """ + return _convert_enum_format(gnmi_pb2.GetRequest.DataType.Value, data_type, + f'Unknown DataType! ({data_type})', no_error, -1) + +def encoding_str_to_int(encoding: str, no_error=False) -> int: + """ Convert text representation of Encoding to standardized integer. """ + return _convert_enum_format(gnmi_pb2.Encoding.Value, encoding, + f'Unknown Encoding! ({encoding})', no_error, -1) + +def encoding_int_to_str(encoding: int, no_error=False) -> str: + """ Convert integer representation of Encoding to standardized string. """ + return _convert_enum_format(gnmi_pb2.Encoding.Name, encoding, + f'Unknown Encoding value! ({encoding})', + no_error, f'UNKNOWN({encoding})') + +def subscription_mode_str_to_int(mode: str, no_error=False) -> int: + """ Convert text representation of SubscriptionList to standardized integer. """ + return _convert_enum_format(gnmi_pb2.SubscriptionList.Mode.Value, mode, + f'Unknown subscription mode! ({mode})', + no_error, f'UNKNOWN({mode})') diff --git a/confdgnmi/tests/client_server_test_base.py b/confdgnmi/tests/client_server_test_base.py index 0d780eb..cc6d2b6 100644 --- a/confdgnmi/tests/client_server_test_base.py +++ b/confdgnmi/tests/client_server_test_base.py @@ -9,7 +9,7 @@ import gnmi_pb2 from confd_gnmi_client import ConfDgNMIClient -from confd_gnmi_common import make_gnmi_path, get_data_type, \ +from confd_gnmi_common import make_gnmi_path, datatype_str_to_int, \ make_formatted_path from confd_gnmi_demo_adapter import GnmiDemoServerAdapter from confd_gnmi_server import AdapterType, ConfDgNMIServicer @@ -107,9 +107,9 @@ def verify_get_response_updates(self, prefix, paths, path_value, assert_fun = GrpcBase.assert_updates log.debug("prefix=%s paths=%s pv_list=%s datatype=%s encoding=%s", prefix, paths, path_value, datatype, encoding) - notification = self.client.get(prefix, paths, datatype, encoding) - log.debug("notification=%s", notification) - for n in notification: + get_response = self.client.get(prefix, paths, datatype, encoding) + log.debug("notification=%s", get_response.notification) + for n in get_response.notification: log.debug("n=%s", n) if prefix: assert (n.prefix == prefix) @@ -251,7 +251,7 @@ def _test_get_subscribe(self, is_subscribe=False, @pytest.mark.parametrize("data_type", ["CONFIG", "STATE"]) def test_get(self, request, data_type): log.info("testing get") - self._test_get_subscribe(datatype=get_data_type(data_type)) + self._test_get_subscribe(datatype=datatype_str_to_int(data_type)) def encoding_test_decorator(self, func): capabilities = self.client.get_capabilities() @@ -274,14 +274,14 @@ def test_get_encoding(self, request, data_type): @self.encoding_test_decorator def test_it(encoding): - self._test_get_subscribe(datatype=get_data_type(data_type), + self._test_get_subscribe(datatype=datatype_str_to_int(data_type), encoding=encoding) @pytest.mark.parametrize("data_type", ["CONFIG", "STATE"]) def test_subscribe_once(self, request, data_type): log.info("testing subscribe_once") self._test_get_subscribe(is_subscribe=True, - datatype=get_data_type(data_type)) + datatype=datatype_str_to_int(data_type)) @pytest.mark.parametrize("data_type", ["CONFIG", "STATE"]) def test_subscribe_once_encoding(self, request, data_type): @@ -290,7 +290,7 @@ def test_subscribe_once_encoding(self, request, data_type): @self.encoding_test_decorator def test_it(encoding): self._test_get_subscribe(is_subscribe=True, - datatype=get_data_type(data_type), + datatype=datatype_str_to_int(data_type), encoding=encoding) @pytest.mark.long @@ -300,7 +300,7 @@ def test_it(encoding): def test_subscribe_poll(self, request, data_type, poll_args): log.info("testing subscribe_poll") self._test_get_subscribe(is_subscribe=True, - datatype=get_data_type(data_type), + datatype=datatype_str_to_int(data_type), subscription_mode=gnmi_pb2.SubscriptionList.POLL, poll_interval=poll_args[0], poll_count=poll_args[1]) @@ -417,8 +417,8 @@ def test_subscribe_stream(self, request, data_type): path_value = [[]] # empty element means no check path_value.extend(self._changes_list_to_pv(changes_list)) - prefix_str = "interfaces{}".format(prefix_state_str) - prefix = make_gnmi_path("/" + GnmiDemoServerAdapter.NS_INTERFACES + prefix_str) + prefix_str = "{{prefix}}interfaces{}".format(prefix_state_str) + prefix = make_gnmi_path("/" + prefix_str.format(prefix=GnmiDemoServerAdapter.NS_INTERFACES)) paths = [GrpcBase.mk_gnmi_if_path(self.list_paths_str[1], if_state_str, "N/A")] @@ -432,13 +432,15 @@ def test_subscribe_stream(self, request, data_type): kwargs["assert_fun"] = GrpcBase.assert_in_updates if self.adapter_type == AdapterType.DEMO: + prefix_pfx = prefix_str.format(prefix='') GnmiDemoServerAdapter.load_config_string( - self._changes_list_to_xml(changes_list, prefix_str)) + self._changes_list_to_xml(changes_list, prefix_pfx)) if self.adapter_type == AdapterType.API: + prefix_pfx = prefix_str.format(prefix='if:') sleep(1) thr = threading.Thread( target=self._send_change_list_to_confd_thread, - args=(prefix_str, changes_list,)) + args=(prefix_pfx, changes_list,)) thr.start() self.verify_sub_sub_response_updates(**kwargs) @@ -461,8 +463,8 @@ def test_set(self, request): # fetch with get and see value has changed datatype = gnmi_pb2.GetRequest.DataType.CONFIG encoding = gnmi_pb2.Encoding.JSON_IETF - notification = self.client.get(prefix, paths, datatype, encoding) - for n in notification: + get_response = self.client.get(prefix, paths, datatype, encoding) + for n in get_response.notification: log.debug("n=%s", n) assert (n.prefix == prefix) GrpcBase.assert_updates(n.update, [(paths[0], "iana-if-type:fastEther")])