-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SONiC Yang model support for LLDP #8120
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"LLDP_GLOBAL_TEST": { | ||
"desc": "LLDP test global LLDP table" | ||
}, | ||
"LLDP_GLOBAL_TEST_INVALID_HELLO": { | ||
"desc": "LLDP test global table with invalid hello value", | ||
"eStrKey" : "InvalidValue", | ||
"eStr": ["hello_time"] | ||
}, | ||
"LLDP_GLOBAL_TEST_INVALID_MULTIPLIER": { | ||
"desc": "LLDP test global table with invalid multiplier value", | ||
"eStrKey" : "InvalidValue", | ||
"eStr": ["multiplier"] | ||
}, | ||
"LLDP_PORT_TEST": { | ||
"desc": "LLDP test LLDP port table" | ||
}, | ||
"LLDP_PORT_TEST_INVALID_IFNAME": { | ||
"desc": "LLDP test port table with invalid ifname", | ||
"eStrKey" : "LeafRef", | ||
"eStr": ["Eth"] | ||
}, | ||
"LLDP_PORT_TEST_INVALID_MODE": { | ||
"desc": "LLDP test port table with invalid mode", | ||
"eStrKey" : "InvalidValue", | ||
"eStr": ["mode"] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{ | ||
"LLDP_GLOBAL_TEST": { | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP": { | ||
"sonic-lldp:GLOBAL": { | ||
"mode": "TRANSMIT", | ||
"enabled": "true", | ||
"hello_time": "20", | ||
"multiplier": "5", | ||
"supp_mgmt_address_tlv": "true", | ||
"supp_system_capabilities_tlv": "false", | ||
"system_name": "sonic", | ||
"system_description": "sonic-system" | ||
} | ||
} | ||
} | ||
}, | ||
"LLDP_GLOBAL_TEST_INVALID_ID": { | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP": { | ||
"sonic-lldp:GLOBAL": { | ||
"mode": "TRANSMIT", | ||
"enabled": "true", | ||
"hello_time": "10", | ||
"multiplier": "5", | ||
"supp_mgmt_address_tlv": "true", | ||
"supp_system_capabilities_tlv": "false", | ||
"system_name": "sonic", | ||
"system_description": "sonic-system" | ||
} | ||
} | ||
} | ||
}, | ||
"LLDP_GLOBAL_TEST_INVALID_HELLO": { | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP": { | ||
"sonic-lldp:GLOBAL": { | ||
"mode": "TRANSMIT", | ||
"enabled": "true", | ||
"hello_time": "test", | ||
"multiplier": "5", | ||
"supp_mgmt_address_tlv": "true", | ||
"supp_system_capabilities_tlv": "false", | ||
"system_name": "sonic", | ||
"system_description": "sonic-system" | ||
} | ||
} | ||
} | ||
}, | ||
"LLDP_GLOBAL_TEST_INVALID_MULTIPLIER": { | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP": { | ||
"sonic-lldp:GLOBAL": { | ||
"mode": "TRANSMIT", | ||
"enabled": "true", | ||
"hello_time": "10", | ||
"multiplier": "xyz", | ||
"supp_mgmt_address_tlv": "true", | ||
"supp_system_capabilities_tlv": "false", | ||
"system_name": "sonic", | ||
"system_description": "sonic-system" | ||
} | ||
} | ||
} | ||
}, | ||
"LLDP_GLOBAL_TEST_DEFAULT_SUPP_MGMT_ADDR_TLV": { | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP": { | ||
"sonic-lldp:GLOBAL": { | ||
"mode": "TRANSMIT", | ||
"enabled": "true", | ||
"hello_time": "10", | ||
"multiplier": "5", | ||
"supp_mgmt_address_tlv": "false", | ||
"supp_system_capabilities_tlv": "false", | ||
"system_name": "sonic", | ||
"system_description": "sonic-system" | ||
} | ||
} | ||
} | ||
}, | ||
"LLDP_PORT_TEST": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP_PORT": { | ||
"LLDP_PORT_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"mode": "TRANSMIT", | ||
"enabled": "true" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"LLDP_PORT_TEST_INVALID_IFNAME": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP_PORT": { | ||
"LLDP_PORT_LIST": [ | ||
{ | ||
"ifname": "Eth", | ||
"mode": "TRANSMIT", | ||
"enabled": "true" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"LLDP_PORT_TEST_INVALID_MODE": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-lldp:sonic-lldp": { | ||
"sonic-lldp:LLDP_PORT": { | ||
"LLDP_PORT_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"mode": "TRANSMITTING", | ||
"enabled": "true" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
module sonic-lldp { | ||
namespace "http://github.com/Azure/sonic-lldp"; | ||
prefix slldp; | ||
yang-version 1.1; | ||
|
||
import sonic-port { | ||
prefix prt; | ||
} | ||
|
||
import sonic-extension { | ||
prefix sonic-ext; | ||
} | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description | ||
"SONiC LLDP yang model"; | ||
|
||
revision 2021-07-08 { | ||
description | ||
"Initial revision."; | ||
} | ||
|
||
grouping lldp_mode_config { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason by grouping is used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enabled and mode leaf is used in Global and per Port config. So it was grouped and used in these nodes. However usage of grouping is leading to compilation error, its commented for now. But ideally since its used in two places, grouping is defined. |
||
leaf enabled { | ||
type boolean; | ||
description | ||
"Enable/Disable LLDP"; | ||
} | ||
|
||
leaf mode { | ||
type enumeration { | ||
enum RECEIVE; | ||
enum TRANSMIT; | ||
} | ||
|
||
description | ||
"RX/TX mode for LLDP frames"; | ||
} | ||
} | ||
|
||
container sonic-lldp { | ||
container LLDP { | ||
container GLOBAL { | ||
|
||
leaf hello_time { | ||
type uint8 { | ||
range "5..254" { | ||
error-message "Invalid hello timer value."; | ||
} | ||
} | ||
default 30; | ||
units seconds; | ||
description | ||
"It is the time interval at which periodic hellos are | ||
exchanged. Default is 30 seconds"; | ||
} | ||
|
||
leaf multiplier { | ||
type uint8 { | ||
range "1..10" { | ||
error-message "Invalid LLDP multiplier value."; | ||
} | ||
} | ||
default 4; | ||
description | ||
"This multiplier value is used to determine the timeout | ||
interval (i.e. hello-time x multiplier value) after | ||
which LLDP neighbor entry is deleted."; | ||
} | ||
|
||
leaf system_name { | ||
type string; | ||
description | ||
"System administratively assigned name"; | ||
} | ||
|
||
leaf system_description { | ||
type string; | ||
description | ||
"System description"; | ||
} | ||
|
||
leaf supp_mgmt_address_tlv { | ||
type boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no default value for this field? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added default value |
||
default false; | ||
description | ||
"Suppress sending of Management Address TLV in LLDP frames"; | ||
} | ||
|
||
leaf supp_system_capabilities_tlv { | ||
type boolean; | ||
default false; | ||
description | ||
"Suppress sending of System Capabilities TLV in LLDP frames"; | ||
} | ||
|
||
leaf enabled { | ||
type boolean; | ||
default true; | ||
description | ||
"Enable/Disable LLDP"; | ||
} | ||
|
||
leaf mode { | ||
type enumeration { | ||
enum RECEIVE; | ||
enum TRANSMIT; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no default value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is optional field, so user can set the mode to either tx-only or rx-only and 'both tx and rx' is controlled by enabled field |
||
|
||
description | ||
"RX/TX mode for LLDP frames"; | ||
} | ||
|
||
//uses lldp_mode_config; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should use the grouping, Praveen mentioned in the last meeting that only few lines are required in the infra, @praveen-li please provide the infra code for testing. |
||
} | ||
} | ||
|
||
container LLDP_PORT { | ||
list LLDP_PORT_LIST { | ||
key "ifname"; | ||
|
||
leaf ifname { | ||
type leafref { | ||
path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; | ||
} | ||
description | ||
"Reference of port on which LLDP to be configured."; | ||
} | ||
|
||
leaf enabled { | ||
type boolean; | ||
default true; | ||
description | ||
"Enable/Disable LLDP"; | ||
} | ||
|
||
leaf mode { | ||
type enumeration { | ||
enum RECEIVE; | ||
enum TRANSMIT; | ||
} | ||
|
||
description | ||
"RX/TX mode for LLDP frames"; | ||
} | ||
//uses lldp_mode_config; | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW what is the source of this config?, this config is not listed on https://github.com/Azure/SONiC/wiki/Configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LLDP parameters were directly configured via lldpcli. To support north bound interfaces,these configs were added by Broadcom to configure LLDP global and per port parameters and store the same in Config DB.