Skip to content

Commit

Permalink
UDLD OC Yang and REST Support
Browse files Browse the repository at this point in the history
  • Loading branch information
dr412113 committed Jun 10, 2020
1 parent 5bc12d0 commit 3013113
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 58 deletions.
4 changes: 2 additions & 2 deletions L2/UDLD/SONiC_UDLD_FDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
152 changes: 96 additions & 56 deletions L2/UDLD/openconfig-udld-ext.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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";

Expand All @@ -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";

Expand All @@ -99,70 +98,94 @@ 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";
}

}
}

container counters {
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 ";

Expand All @@ -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 {
Expand All @@ -197,20 +220,20 @@ 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;
}

}
}
}


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 {
Expand Down Expand Up @@ -241,7 +264,7 @@ module openconfig-udld-ext {
}


grouping udld-top {
grouping udld-ext-top {
description
"Top-level grouping for UDLD model";

Expand All @@ -253,7 +276,7 @@ module openconfig-udld-ext {
description
"Configuration data ";

uses udld-global-config;
uses udld-ext-global-config;
}

container state {
Expand All @@ -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;

}

0 comments on commit 3013113

Please sign in to comment.