From 24c8bd2bd1b48c1d7d3f3977a41e34153fc2dac9 Mon Sep 17 00:00:00 2001 From: Dante Su Date: Fri, 12 Aug 2022 02:12:21 +0000 Subject: [PATCH 1/4] LT Admin/Oper: Use 'N/A' when the data is unavailable Signed-off-by: Dante Su --- scripts/intfutil | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/intfutil b/scripts/intfutil index fb351687a8..d76502475c 100755 --- a/scripts/intfutil +++ b/scripts/intfutil @@ -797,10 +797,10 @@ class IntfLinkTrainingStatus(object): continue lt_admin = appl_db_port_status_get(self.db, key, PORT_LINK_TRAINING) if lt_admin not in ['on', 'off']: - lt_admin = '-' + lt_admin = 'N/A' lt_status = state_db_port_status_get(self.db, key, PORT_LINK_TRAINING_STATUS) - if lt_status in ['N/A', '', None]: - lt_status = 'off' + if lt_status in ['', None]: + lt_status = 'N/A' table.append((key, lt_status.replace('_', ' '), lt_admin, From bc0474a4cfb8b65e0a653433940c8b54f5e3dcd6 Mon Sep 17 00:00:00 2001 From: Dante Su Date: Fri, 12 Aug 2022 02:44:41 +0000 Subject: [PATCH 2/4] fix test failure Signed-off-by: Dante Su --- tests/intfutil_test.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/intfutil_test.py b/tests/intfutil_test.py index 2a13075919..988c5329fc 100644 --- a/tests/intfutil_test.py +++ b/tests/intfutil_test.py @@ -101,15 +101,15 @@ Interface LT Oper LT Admin Oper Admin ----------- ----------- ---------- ------ ------- Ethernet0 not trained on down up - Ethernet16 off - up up - Ethernet24 off - up up - Ethernet28 off - up up + Ethernet16 N/A N/A up up + Ethernet24 N/A N/A up up + Ethernet28 N/A N/A up up Ethernet32 trained on up up - Ethernet36 off - up up + Ethernet36 N/A N/A up up Ethernet112 off off up up -Ethernet116 off - up up -Ethernet120 off - up up -Ethernet124 off - up up +Ethernet116 N/A N/A up up +Ethernet120 N/A N/A up up +Ethernet124 N/A N/A up up """ class TestIntfutil(TestCase): From 7e200b6d46d93a6e8e2abc66ce8fd3ebb57bb7fd Mon Sep 17 00:00:00 2001 From: Dante Su Date: Fri, 12 Aug 2022 06:28:35 +0000 Subject: [PATCH 3/4] fix coverage failure Signed-off-by: Dante Su --- scripts/intfutil | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/intfutil b/scripts/intfutil index d76502475c..285863d7fb 100755 --- a/scripts/intfutil +++ b/scripts/intfutil @@ -799,8 +799,6 @@ class IntfLinkTrainingStatus(object): if lt_admin not in ['on', 'off']: lt_admin = 'N/A' lt_status = state_db_port_status_get(self.db, key, PORT_LINK_TRAINING_STATUS) - if lt_status in ['', None]: - lt_status = 'N/A' table.append((key, lt_status.replace('_', ' '), lt_admin, From 7f240e0603a849ea26c11864cde4bc827b02e8c2 Mon Sep 17 00:00:00 2001 From: Dante Su Date: Tue, 25 Oct 2022 01:34:10 +0000 Subject: [PATCH 4/4] [doc]: Update Command-Reference.md (#2257) Add interface link-training command into the CLI doc Use 'N/A' if link-training attribute is not supported in the SAI. Signed-off-by: Dante Su --- doc/Command-Reference.md | 70 +++++++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index 96993241b5..3e4e1f7076 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -441,14 +441,15 @@ The same syntax applies to all subgroups of `show` which themselves contain subc -?, -h, --help Show this message and exit. Commands: - counters Show interface counters - description Show interface status, protocol and... - naming_mode Show interface naming_mode status - neighbor Show neighbor related information - portchannel Show PortChannel information - status Show Interface status information - tpid Show Interface tpid information - transceiver Show SFP Transceiver information + counters Show interface counters + description Show interface status, protocol and... + link-training Show interface link-training information + naming_mode Show interface naming_mode status + neighbor Show neighbor related information + portchannel Show PortChannel information + status Show Interface status information + tpid Show Interface tpid information + transceiver Show SFP Transceiver information ``` Go Back To [Beginning of the document](#) or [Beginning of this section](#getting-help) @@ -3642,6 +3643,35 @@ This command displays the key fields of the interfaces such as Operational Statu Ethernet4 down up hundredGigE1/2 T0-2:hundredGigE1/30 ``` +**show interfaces link-training (Versions >= 202211)** + +This command is to display the link-training status of the selected interfaces. If **interface_name** is not specicied, this command shows the link-training status of all interfaces. + +- Usage: + ``` + show interfaces link-training status [] + ``` + +- Example: + ``` + admin@sonic:~$ show interfaces link-training status + Interface LT Oper LT Admin Oper Admin + ----------- ----------- ---------- ------ ------- + Ethernet0 trained on up up + Ethernet8 trained on up up + Ethernet16 off off down up + Ethernet24 not trained on down up + Ethernet32 off off down up + ``` + +- Example (to only display the link-training status of interface Ethernet8): + ``` + admin@sonic:~$ show interfaces link-training status Ethernet8 + Interface LT Oper LT Admin Oper Admin + ----------- ----------- ---------- ------ ------- + Ethernet8 trained on up up + ``` + **show interfaces mpls** This command is used to display the configured MPLS state for the list of configured interfaces. @@ -3840,6 +3870,7 @@ This sub-section explains the following list of configuration on the interfaces. 10) type - to set interface type 11) mpls - To add or remove MPLS operation for the interface 12) loopback-action - to set action for packet that ingress and gets routed on the same IP interface +13) link-training - to set interface link-training mode From 201904 release onwards, the “config interface” command syntax is changed and the format is as follows: @@ -4410,6 +4441,29 @@ Loopback action can be drop or forward. admin@sonic:~$ config interface ip loopback-action Ethernet0 forward ``` + +**config interface link-training (Versions >= 202211)** + +This command is used for setting link-training mode of a interface. + +- Usage: + ``` + sudo config interface link-training --help + Usage: config interface link-training [OPTIONS] + + Set interface link-training mode + + Options: + -v, --verbose Enable verbose output + -h, -?, --help Show this message and exit. + ``` + +- Example: + ``` + admin@sonic:~$ sudo config interface link-training Ethernet0 on + admin@sonic:~$ sudo config interface link-training Ethernet0 off + ``` + Go Back To [Beginning of the document](#) or [Beginning of this section](#interfaces) ## Interface Naming Mode