Skip to content
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

Add interface link-training command into the CLI doc #2257

Merged
merged 4 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 62 additions & 8 deletions doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 [<interface_name>]
```

- 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.
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -4410,6 +4441,29 @@ Loopback action can be drop or forward.
admin@sonic:~$ config interface ip loopback-action Ethernet0 forward

```

**config interface link-training <interface_name> (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] <interface_name> <mode>

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
Expand Down
4 changes: 1 addition & 3 deletions scripts/intfutil
Original file line number Diff line number Diff line change
Expand Up @@ -797,10 +797,8 @@ 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'
table.append((key,
lt_status.replace('_', ' '),
lt_admin,
Expand Down
14 changes: 7 additions & 7 deletions tests/intfutil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down