From 5bc12d082afb185ee261955113435717b9124b60 Mon Sep 17 00:00:00 2001 From: Dhanasekar Rathinavel Date: Tue, 9 Jun 2020 00:06:57 -0700 Subject: [PATCH 1/2] UDLD OC Yang and REST Support --- L2/UDLD/SONiC_UDLD_FDS.md | 74 ++++++++- L2/UDLD/openconfig-udld-ext.yang | 277 +++++++++++++++++++++++++++++++ 2 files changed, 343 insertions(+), 8 deletions(-) create mode 100644 L2/UDLD/openconfig-udld-ext.yang diff --git a/L2/UDLD/SONiC_UDLD_FDS.md b/L2/UDLD/SONiC_UDLD_FDS.md index 47892f97fe30..7b3c0e8a9b47 100644 --- a/L2/UDLD/SONiC_UDLD_FDS.md +++ b/L2/UDLD/SONiC_UDLD_FDS.md @@ -23,11 +23,13 @@ UDLD - Uni-directional Link Detection Protocol * [Switch State Service Design](#switch-state-service-design) * [Orchestration Agent](#orchestration-agent) * [SAI](#sai) - * [CLI](#cli) - * [Configuration Commands](#configuration-commands) - * [Show Commands](#show-commands) - * [Debug Commands](#debug-commands) - * [Clear Commands](#clear-commands) + * [User Interface](#user-interface) + * [Data Models](#data-models) + * [CLI](#cli) + * [Configuration Commands](#configuration-commands) + * [Show Commands](#show-commands) + * [Debug Commands](#debug-commands) + * [Clear Commands](#clear-commands) * [Flow Diagrams](#flow-diagrams) * [Error Handling](#error-handling) * [Serviceability and Debug](#serviceability-and-debug) @@ -301,7 +303,53 @@ No SAI changes required ## 3.6 User Interface ### 3.6.1 Data Models -Openconfig YANG model is not available for UDLD, so custom SONIC YANG will be supported. YANG file is available here [UDLD-YANG](sonic-udld.yang) +Openconfig YANG model is not available for UDLD, we are proposing the following openconfig extension for UDLD [OC-UDLD-EXT-YANG](openconfig-udld-ext.yang). +KLISH CLIs continue to use SONIC YANG.[SONIC-UDLD-YANG](sonic-udld.yang) + +UDLD Openconfig YANG tree: +``` +module: openconfig-udld-ext + +--rw udld + +--rw config + | +--rw admin-enable? boolean + | +--rw aggressive? boolean + | +--rw msg-time? uint8 + | +--rw multiplier? uint8 + +--ro state + | +--ro admin-enable? boolean + | +--ro aggressive? boolean + | +--ro msg-time? uint8 + | +--ro multiplier? uint8 + +--rw interfaces + +--rw interface* [name] + +--rw name -> ../config/name + +--rw config + | +--rw name? oc-if:base-interface-ref + | +--rw admin-enable? boolean + | +--rw aggressive? boolean + +--ro state + +--ro name? oc-if:base-interface-ref + +--ro admin-enable? boolean + +--ro aggressive? boolean + +--ro local-info + | +--ro device-id? string + | +--ro device-name? string + | +--ro status? identityref + +--ro neighbors-info + | +--ro neighbor* [ifname index] + | +--ro ifname oc-if:base-interface-ref + | +--ro index uint16 + | +--ro device-id? string + | +--ro device-name? string + | +--ro status? identityref + | +--ro port-id? string + | +--ro msg-time? uint8 + | +--ro timeout-interval? uint8 + +--ro counters + +--ro frame-out? yang:counter64 + +--ro frame-in? yang:counter64 + +--ro frame-error-in? yang:counter64 +``` ### 3.6.2 CLI @@ -518,7 +566,17 @@ Note: This command is available as part of CLICK CLI only ### 3.6.3 REST API Support -REST APIs is supported in this release +All REST operations are supported. +Below listed are some of the supported REST URI's. + +``` +/restconf/data/openconfig-udld-ext:udld +/restconf/data/openconfig-udld-ext:udld/config/admin-enable +/restconf/data/openconfig-udld-ext:udld/config/aggressive +/restconf/data/openconfig-udld-ext:udld/interfaces/interface=Ethernet0 +/restconf/data/openconfig-udld-ext:udld/interfaces/interface=Ethernet0/config/admin-enable +/restconf/data/openconfig-udld-ext:udld/interfaces/interface=Ethernet0/config/aggressive +``` # 4 Flow Diagrams @@ -690,4 +748,4 @@ Errdisable Cause Status udld disabled Timeout for Auto-recovery: 300 seconds -``` \ No newline at end of file +``` diff --git a/L2/UDLD/openconfig-udld-ext.yang b/L2/UDLD/openconfig-udld-ext.yang new file mode 100644 index 000000000000..31bd55605b63 --- /dev/null +++ b/L2/UDLD/openconfig-udld-ext.yang @@ -0,0 +1,277 @@ +module openconfig-udld-ext { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/udld/extension"; + + prefix "oc-udld-ext"; + + import openconfig-interfaces { prefix oc-if; } + import ietf-yang-types { prefix yang; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-udld-types { prefix oc-udld-types; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines configuration and operational state data + for the UDLD protocol."; + + oc-ext:openconfig-version "0.1.0"; + + revision "2020-05-04" { + description + "Initial public 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 + + + // grouping statements + + grouping udld-interface-counters { + description + "Definition of global and per-interface counters"; + + leaf frame-out { + type yang:counter64; + default 0; + description + "The number of frames transmitted out."; + } + + leaf frame-in { + type yang:counter64; + default 0; + description + "The number of udld frames received."; + } + + leaf frame-error-in { + type yang:counter64; + default 0; + description + "The number of UDLD frames received with errors."; + } + + } + + + grouping udld-common-config { + description + "Groups UDLD enable and mode config common to both Global and interface level"; + + leaf admin-enable { + type boolean; + default false; + description + "Enable/Disable UDLD"; + } + + leaf aggressive { + type boolean; + default false; + description + "Enable/Disable aggressive mode of UDLD"; + } + } + + + grouping udld-interface-config { + description + "Configuration data for UDLD on each interface"; + + leaf name { + type oc-if:base-interface-ref; + description + "Reference to the UDLD Ethernet interface"; + } + uses udld-common-config; + } + + grouping udld-interface-info-common { + leaf device-id { + type string; + description + "device id(MAC)"; + } + + leaf device-name { + type string; + description + "device name"; + } + + leaf status { + type identityref { + base oc-udld-types:UDLD_PORT_STATUS; + } + description + "UDLD port status"; + } + } + + + grouping udld-interface-state { + description + "Operational state data for UDLD on each interface"; + + container local-info { + uses udld-interface-info-common; + } + container neighbors-info { + list neighbor { + key "ifname index"; + + leaf ifname { + type oc-if:base-interface-ref; + description + "Reference of local port on which UDLD is configured."; + } + + leaf index { + type uint16; + default 0; + description + "Index number of neighbor port"; + } + + uses udld-interface-info-common; + } + } + + container counters { + description + "UDLD counters on each interface"; + + uses udld-interface-counters; + } + } + + + grouping udld-interface-top { + description + "Top-level grouping "; + + container interfaces { + description + "Enclosing container "; + + list interface { + key "name"; + description + "List of interfaces on which UDLD is enabled / available"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference to the UDLD Ethernet interface"; + } + + container config { + description + "Configuration data for UDLD on each interface"; + + uses udld-interface-config; + } + + container state { + + config false; + + description + "Operational state data "; + + uses udld-interface-config; + uses udld-interface-state; + } + + } + } + } + + + grouping udld-global-config { + description + "Configuration data for global UDLD parameters"; + + uses udld-common-config; + + leaf msg-time { + type uint8 { + range "1..30" { + error-message "Invalid UDLD message time value."; + } + } + units seconds; + default 1; + description + "It is the time interval at which periodic hellos are + exchanged. Default is 1 second"; + } + + leaf multiplier { + type uint8 { + range "3..10" { + error-message "Invalid UDLD multiplier value."; + } + } + default 3; + description + "This multiplier value is used to determine the timeout + interval (i.e. message-time x multiplier value) after + which UDLD declares the state of the link."; + } + + } + + + grouping udld-top { + description + "Top-level grouping for UDLD model"; + + container udld { + description + "Top-level container for UDLD configuration and state data"; + + container config { + description + "Configuration data "; + + uses udld-global-config; + } + + container state { + + config false; + + description + "Operational state data for UDLD"; + + uses udld-global-config; + } + + uses udld-interface-top; + } + } + + // data definition statements + + uses udld-top; + +} From 30131131b1ed6a289226d727e0c6026fdc6c3b96 Mon Sep 17 00:00:00 2001 From: Dhanasekar Rathinavel Date: Tue, 9 Jun 2020 00:06:57 -0700 Subject: [PATCH 2/2] UDLD OC Yang and REST Support --- L2/UDLD/SONiC_UDLD_FDS.md | 4 +- L2/UDLD/openconfig-udld-ext.yang | 152 +++++++++++++++++++------------ 2 files changed, 98 insertions(+), 58 deletions(-) diff --git a/L2/UDLD/SONiC_UDLD_FDS.md b/L2/UDLD/SONiC_UDLD_FDS.md index 7b3c0e8a9b47..9ba3b389d611 100644 --- a/L2/UDLD/SONiC_UDLD_FDS.md +++ b/L2/UDLD/SONiC_UDLD_FDS.md @@ -303,10 +303,10 @@ No SAI changes required ## 3.6 User Interface ### 3.6.1 Data Models -Openconfig YANG model is not available for UDLD, we are proposing the following openconfig extension for UDLD [OC-UDLD-EXT-YANG](openconfig-udld-ext.yang). +OpenConfig YANG model is not available for UDLD, we are proposing the following openconfig extension for UDLD [OC-UDLD-EXT-YANG](openconfig-udld-ext.yang). KLISH CLIs continue to use SONIC YANG.[SONIC-UDLD-YANG](sonic-udld.yang) -UDLD Openconfig YANG tree: +UDLD OpenConfig YANG tree: ``` module: openconfig-udld-ext +--rw udld diff --git a/L2/UDLD/openconfig-udld-ext.yang b/L2/UDLD/openconfig-udld-ext.yang index 31bd55605b63..782b766d536c 100644 --- a/L2/UDLD/openconfig-udld-ext.yang +++ b/L2/UDLD/openconfig-udld-ext.yang @@ -13,12 +13,11 @@ module openconfig-udld-ext { import openconfig-udld-types { prefix oc-udld-types; } - // meta - organization "OpenConfig working group"; + organization + "SONiC"; contact - "OpenConfig working group - www.openconfig.net"; + "SONiC"; description "This module defines configuration and operational state data @@ -42,25 +41,25 @@ module openconfig-udld-ext { // grouping statements - grouping udld-interface-counters { + grouping udld-ext-interface-counters { description "Definition of global and per-interface counters"; - leaf frame-out { + leaf pdu-sent { type yang:counter64; default 0; description "The number of frames transmitted out."; } - leaf frame-in { + leaf pdu-received { type yang:counter64; default 0; description "The number of udld frames received."; } - leaf frame-error-in { + leaf pdu-recv-error { type yang:counter64; default 0; description @@ -70,7 +69,7 @@ module openconfig-udld-ext { } - grouping udld-common-config { + grouping udld-ext-common-config { description "Groups UDLD enable and mode config common to both Global and interface level"; @@ -90,7 +89,7 @@ module openconfig-udld-ext { } - grouping udld-interface-config { + grouping udld-ext-interface-config { description "Configuration data for UDLD on each interface"; @@ -99,57 +98,81 @@ module openconfig-udld-ext { description "Reference to the UDLD Ethernet interface"; } - uses udld-common-config; - } - - grouping udld-interface-info-common { - leaf device-id { - type string; - description - "device id(MAC)"; - } - - leaf device-name { - type string; - description - "device name"; - } - - leaf status { - type identityref { - base oc-udld-types:UDLD_PORT_STATUS; - } - description - "UDLD port status"; - } + uses udld-ext-common-config; } - grouping udld-interface-state { + grouping udld-ext-interface-state { description "Operational state data for UDLD on each interface"; container local-info { - uses udld-interface-info-common; + description + "Local info"; + leaf status { + type identityref { + base oc-udld-types:UDLD_PORT_STATUS; + } + description + "UDLD port status"; + } } container neighbors-info { + description + "List of Neighbors"; list neighbor { - key "ifname index"; - - leaf ifname { - type oc-if:base-interface-ref; - description - "Reference of local port on which UDLD is configured."; - } + key "index"; + description + "Each Neighbor info"; leaf index { type uint16; - default 0; description "Index number of neighbor port"; } - uses udld-interface-info-common; + leaf device-id { + type string; + description + "device id(MAC)"; + } + + leaf device-name { + type string; + description + "device name"; + } + + leaf status { + type identityref { + base oc-udld-types:UDLD_PORT_STATUS; + } + description + "UDLD port status"; + } + + leaf port-id { + type string; + description + "Neighbor port name"; + } + + leaf msg-time { + type uint8; + units seconds; + default 1; + description + "Neighbor message time"; + } + + leaf timeout-interval { + type uint8; + units seconds; + default 1; + description + "Neighbor timeout interval"; + } + } } @@ -157,12 +180,12 @@ module openconfig-udld-ext { description "UDLD counters on each interface"; - uses udld-interface-counters; + uses udld-ext-interface-counters; } } - grouping udld-interface-top { + grouping udld-ext-interface-top { description "Top-level grouping "; @@ -187,7 +210,7 @@ module openconfig-udld-ext { description "Configuration data for UDLD on each interface"; - uses udld-interface-config; + uses udld-ext-interface-config; } container state { @@ -197,8 +220,8 @@ module openconfig-udld-ext { description "Operational state data "; - uses udld-interface-config; - uses udld-interface-state; + uses udld-ext-interface-config; + uses udld-ext-interface-state; } } @@ -206,11 +229,11 @@ module openconfig-udld-ext { } - grouping udld-global-config { + grouping udld-ext-global-config { description "Configuration data for global UDLD parameters"; - uses udld-common-config; + uses udld-ext-common-config; leaf msg-time { type uint8 { @@ -241,7 +264,7 @@ module openconfig-udld-ext { } - grouping udld-top { + grouping udld-ext-top { description "Top-level grouping for UDLD model"; @@ -253,7 +276,7 @@ module openconfig-udld-ext { description "Configuration data "; - uses udld-global-config; + uses udld-ext-global-config; } container state { @@ -263,15 +286,32 @@ module openconfig-udld-ext { description "Operational state data for UDLD"; - uses udld-global-config; + uses udld-ext-global-config; + + container local-device-info { + description + "Local Device info"; + leaf device-id { + type string; + description + "device id(MAC)"; + } + + leaf device-name { + type string; + description + "device name"; + } + } + } - uses udld-interface-top; + uses udld-ext-interface-top; } } // data definition statements - uses udld-top; + uses udld-ext-top; }