From 30131131b1ed6a289226d727e0c6026fdc6c3b96 Mon Sep 17 00:00:00 2001 From: Dhanasekar Rathinavel Date: Tue, 9 Jun 2020 00:06:57 -0700 Subject: [PATCH] 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; }