From 1a47321b832ae94475bca2b8bcdad8f13d2e5290 Mon Sep 17 00:00:00 2001 From: Yuanzhe Liu Date: Tue, 23 Jul 2024 08:16:52 +0300 Subject: [PATCH] SDK sniffer upgrade 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 --- config/plugins/mlnx.py | 34 -------------------- doc/Command-Reference.md | 69 ++-------------------------------------- scripts/generate_dump | 12 +++++++ show/plugins/mlnx.py | 14 -------- 4 files changed, 15 insertions(+), 114 deletions(-) diff --git a/config/plugins/mlnx.py b/config/plugins/mlnx.py index f61335d4f4..115b310f69 100644 --- a/config/plugins/mlnx.py +++ b/config/plugins/mlnx.py @@ -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, diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index 689ca23b73..1dfc8f9d9b 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -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 diff --git a/scripts/generate_dump b/scripts/generate_dump index 3d0ef3430d..c88b221737 100755 --- a/scripts/generate_dump +++ b/scripts/generate_dump @@ -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 diff --git a/show/plugins/mlnx.py b/show/plugins/mlnx.py index 04d6a78b0a..09eacbc70a 100644 --- a/show/plugins/mlnx.py +++ b/show/plugins/mlnx.py @@ -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 """