Skip to content

Commit

Permalink
SDK sniffer upgrade
Browse files Browse the repository at this point in the history
SDK had upgraded the way of api sniffer and this feature will be enabled
by default, so make relevant changes:
1. remove deprecated sdk sniffer cli
2. collect sdk dump in show techsupport
3. update the command reference doc.

Signed-off-by: Yuanzhe, Liu <yualiu@nvidia.com>
  • Loading branch information
yuazhe committed Aug 7, 2024
1 parent 317e649 commit 1a47321
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 114 deletions.
34 changes: 0 additions & 34 deletions config/plugins/mlnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,40 +164,6 @@ def mlnx():
""" Mellanox platform configuration tasks """
pass


# 'sniffer' group
@mlnx.group()
def sniffer():
""" Utility for managing Mellanox SDK/PRM sniffer """
pass


# 'sdk' subgroup
@sniffer.group()
def sdk():
"""SDK Sniffer - Command Line to enable/disable SDK sniffer"""
pass


@sdk.command()
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false, expose_value=False,
prompt='Swss service will be restarted, continue?')
def enable():
"""Enable SDK Sniffer"""
click.echo("Enabling SDK sniffer")
sdk_sniffer_enable()
click.echo("Note: the sniffer file may exhaust the space on /var/log, please disable it when you are done with this sniffering.")


@sdk.command()
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false, expose_value=False,
prompt='Swss service will be restarted, continue?')
def disable():
"""Disable SDK Sniffer"""
click.echo("Disabling SDK sniffer")
sdk_sniffer_disable()


def sdk_sniffer_enable():
"""Enable SDK Sniffer"""
sdk_sniffer_filename = sniffer_filename_generate(SDK_SNIFFER_TARGET_PATH,
Expand Down
69 changes: 3 additions & 66 deletions doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -8448,74 +8448,11 @@ Go Back To [Beginning of the document](#) or [Beginning of this section](#platfo
### Mellanox Platform Specific Commands
There are few commands that are platform specific. Mellanox has used this feature and implemented Mellanox specific commands as follows.
config platform mlnx
**show platform mlnx sniffer**
This command is valid only on mellanox devices. The sub-commands for "config platform" gets populated only on mellanox platforms. There are no other subcommands on non-Mellanox devices and hence this command appears empty and useless in other platforms.
This command shows the SDK sniffer status
- Usage:
```
show platform mlnx sniffer
```
- Example:
```
admin@sonic:~$ show platform mlnx sniffer
sdk sniffer is disabled
```
**show platform mlnx sniffer**
Another show command available on ‘show platform mlnx’ which is the issu status.
This means if ISSU is enabled on this SKU or not. A warm boot command can be executed only when ISSU is enabled on the SKU.
- Usage:
```
show platform mlnx issu
```
- Example:
```
admin@sonic:~$ show platform mlnx issu
ISSU is enabled
```
In the case ISSU is disabled and warm-boot is called, the user will get a notification message explaining that the command cannot be invoked.
- Example:
```
admin@sonic:~$ sudo warm-reboot
ISSU is not enabled on this HWSKU
Warm reboot is not supported
```
**config platform mlnx**
This command is valid only on mellanox devices. The sub-commands for "config platform" gets populated only on mellanox platforms.
There are no other subcommands on non-Mellanox devices and hence this command appears empty and useless in other platforms.
The platform mellanox command currently includes a single sub command which is the SDK sniffer.
The SDK sniffer is a troubleshooting tool which records the RPC calls from the Mellanox SDK user API library to the sx_sdk task into a .pcap file.
This .pcap file can be replayed afterward to get the exact same configuration state on SDK and FW to reproduce and investigate issues.
A new folder will be created to store the sniffer files: "/var/log/mellanox/sniffer/". The result file will be stored in a .pcap file, which includes a time stamp of the starting time in the file name, for example, "sx_sdk_sniffer_20180224081306.pcap"
In order to have a complete .pcap file with all the RPC calls, the user should disable the SDK sniffer. Swss service will be restarted and no capturing is taken place from that moment.
It is recommended to review the .pcap file while sniffing is disabled.
Once SDK sniffer is enabled/disabled, the user is requested to approve that swss service will be restarted.
For example: To change SDK sniffer status, swss service will be restarted, continue? [y/N]:
In order to avoid that confirmation the -y / --yes option should be used.
- Usage:
```
config platform mlnx sniffer sdk [-y|--yes]
```
- Example:
```
admin@sonic:~$ config platform mlnx sniffer sdk
To change SDK sniffer status, swss service will be restarted, continue? [y/N]: y
NOTE: In order to avoid that confirmation the -y / --yes option should be used.
```
The platform mellanox command currently includes no sub command.
### Barefoot Platform Specific Commands
Expand Down
12 changes: 12 additions & 0 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,18 @@ collect_mellanox() {
fi
fi

# collect the sdk dump
local sdk_dbg_folder="/var/log/sdk_dbg"
for file in $(find $sdk_dbg_folder -name "sx_sdk_*")
do
if [[ $file != *.gz ]]
then
save_file $file sai_sdk_dump true
else
save_file $file sai_sdk_dump false
fi
done

# run 'hw-management-generate-dump.sh' script and save the result file
HW_DUMP_FILE=/usr/bin/hw-management-generate-dump.sh
if [ -f "$HW_DUMP_FILE" ]; then
Expand Down
14 changes: 0 additions & 14 deletions show/plugins/mlnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,6 @@ def is_issu_status_enabled():

return issu_enabled


@mlnx.command('sniffer')
def sniffer_status():
""" Show sniffer status """
components = ['sdk']
env_variable_strings = [ENV_VARIABLE_SX_SNIFFER]
for index in range(len(components)):
enabled = sniffer_status_get(env_variable_strings[index])
if enabled is True:
click.echo(components[index] + " sniffer is enabled")
else:
click.echo(components[index] + " sniffer is disabled")


@mlnx.command('issu')
def issu_status():
""" Show ISSU status """
Expand Down

0 comments on commit 1a47321

Please sign in to comment.