Skip to content

Commit

Permalink
Merge pull request sonic-net#17 from dr412113/udld-oc-yang-update
Browse files Browse the repository at this point in the history
UDLD OC Yang and REST Support
NarendraBandarupalli authored Sep 17, 2020

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
2 parents a696a65 + 3013113 commit 108309c
Showing 2 changed files with 383 additions and 8 deletions.
74 changes: 66 additions & 8 deletions L2/UDLD/SONiC_UDLD_FDS.md
Original file line number Diff line number Diff line change
@@ -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.

```
<REST-SERVER:PORT>/restconf/data/openconfig-udld-ext:udld
<REST-SERVER:PORT>/restconf/data/openconfig-udld-ext:udld/config/admin-enable
<REST-SERVER:PORT>/restconf/data/openconfig-udld-ext:udld/config/aggressive
<REST-SERVER:PORT>/restconf/data/openconfig-udld-ext:udld/interfaces/interface=Ethernet0
<REST-SERVER:PORT>/restconf/data/openconfig-udld-ext:udld/interfaces/interface=Ethernet0/config/admin-enable
<REST-SERVER:PORT>/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
```
```
317 changes: 317 additions & 0 deletions L2/UDLD/openconfig-udld-ext.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
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; }


organization
"SONiC";

contact
"SONiC";

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-ext-interface-counters {
description
"Definition of global and per-interface counters";

leaf pdu-sent {
type yang:counter64;
default 0;
description
"The number of frames transmitted out.";
}

leaf pdu-received {
type yang:counter64;
default 0;
description
"The number of udld frames received.";
}

leaf pdu-recv-error {
type yang:counter64;
default 0;
description
"The number of UDLD frames received with errors.";
}

}


grouping udld-ext-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-ext-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-ext-common-config;
}


grouping udld-ext-interface-state {
description
"Operational state data for UDLD on each interface";

container local-info {
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 "index";
description
"Each Neighbor info";

leaf index {
type uint16;
description
"Index number of neighbor port";
}

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-ext-interface-counters;
}
}


grouping udld-ext-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-ext-interface-config;
}

container state {

config false;

description
"Operational state data ";

uses udld-ext-interface-config;
uses udld-ext-interface-state;
}

}
}
}


grouping udld-ext-global-config {
description
"Configuration data for global UDLD parameters";

uses udld-ext-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-ext-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-ext-global-config;
}

container state {

config false;

description
"Operational state data for UDLD";

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-ext-interface-top;
}
}

// data definition statements

uses udld-ext-top;

}

0 comments on commit 108309c

Please sign in to comment.