-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
SDK_SNIFFER_FILENAME_EXT = '.pcap' | ||
SAI_SNIFFER_FILENAME_EXT = '.log' |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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)] |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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 | |||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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]>
8ee8c96
to
069bc68
Compare
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)