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

[cli] Add SAI sniffer #23

Closed
wants to merge 1 commit into from
Closed

[cli] Add SAI sniffer #23

wants to merge 1 commit into from

Conversation

ayurkiv-nvda
Copy link
Owner

What I did

How I did it

How to verify it

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

SDK_SNIFFER_FILENAME_EXT = '.pcap'
SAI_SNIFFER_FILENAME_EXT = '.log'
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check extension


ignore = sniffer_env_variable_set(enable=True, env_variable_name=ENV_VARIABLE_SX_SNIFFER,
env_variable_string=sdk_sniffer_env_variable_string)
if not ignore:
err = restart_swss()
err = 0#restart_swss()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

"""Enable SAI Sniffer"""
click.echo("Enabling SAI sniffer")
sai_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.")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

# Write the modified content back to the configuration file
with open(TMP_SNIFFER_CONF_FILE, 'w') as file:
file.write(config_content if config_content[-1] != '=' else '[program:syncd]\n')
file.close()

def conf_file_copy(src, dest):
command = ['docker', 'cp', str(src), str(dest)]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use different files for SDK and SAI sniffer

conf_file.write(line)
conf_file.truncate()
conf_file.close()
def env_variable_delete(variable_to_remove):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete file?

if not ignore:
err = restart_swss()
err = 0 #restart_swss()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create separate function for it (split)

ignore = sniffer_env_variable_set(enable=False, env_variable_name=ENV_VARIABLE_SAI_SNIFFER_ENABLE) or sniffer_env_variable_set(enable=False, env_variable_name=ENV_VARIABLE_SAI_SNIFFER_FILE)
if not ignore:
err = 0 #restart_swss()
if err is not 0:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not err

@@ -25,6 +25,7 @@
try:
import os
import time
import re

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADD Unit tests

@@ -25,6 +25,7 @@
try:
import os
import time
import re
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Signed-off-by: Andriy Yurkiv <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant