-
Notifications
You must be signed in to change notification settings - Fork 750
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
[ptf_runner] Save ptf log to script executing host in case of failure #823
Conversation
The PTF log and pcap files are useful for debugging in case of PTF script failed. However, these files are in the PTF container and could be lost when the PTF container is re-deployed. This improvement is to save the log and pcap files to the script executing host when the PTF script is failed. Signed-off-by: Xin Wang <xinw@mellanox.com>
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.
how to align the ptf log with the test?
please also check the location of the log analyzer output and advise to have them all in the same location.
if this already done, great.
@liat-grozovik PTF log files save location: Log analyzer output files save location: To avoid overwritten, timestampe appended to the PTF logfiles while saving them to sonic-mgmt. |
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.
Since this PR changes default behavior, I am just thinking maybe it is better to have all new copy logic under some condition.
So we don't change default behavior and if some option is passed only then logs are copied to specified location.
For example something like: ansible-playbook <some_test>.yml ... -e save-ptf-log=</dest/location/>
@wangxin, what do you think?
@@ -51,5 +51,36 @@ | |||
|
|||
- debug: var=out.stdout_lines | |||
|
|||
- name: Set default PTF log filename | |||
set_fact: | |||
ptf_log_file: "/root/ptf.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.
Here default PTF log file is set to /root/ptf.log
, but all tests use /tmp/
.
I believe it would be better to change this default to /tmp/
as well, so we have all logs in one place.
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.
This code is to specify where to get the PTF log and pcap files from the PTF container.
When PTF log file is not explicitly specified while calling ptf_runner.yml, PTF saves default log and pcap files to /root/ptf.log and /root/ptf.pcap on PTF container.
If explicit log file parameter is parsed from the PTF command line, this default value will be overwritten with custom log file location.
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.
Let's save the logs in succesful runs too.
@volodymyrsamotiy I agree that your proposal has two advantages:
|
The previous commit changed the default behavior. This change is to add an option for specifying whether to save ptf log in case of failure. For example: ansible-playbook <some_test>.yml ... -e save_ptf_log=yes
@volodymyrsamotiy |
@pavel-shirshov can you please review as well? if all good, we can move on and merge. |
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.
How can we know that target dir 'test/{{ inventory_hostname }}/ptf/' is valid?
@pavel-shirshov |
…#823) * [ptf_runner] Save ptf log to script executing host in case of failure The PTF log and pcap files are useful for debugging in case of PTF script failed. However, these files are in the PTF container and could be lost when the PTF container is re-deployed. This improvement is to save the log and pcap files to the script executing host when the PTF script is failed. Signed-off-by: Xin Wang <xinw@mellanox.com> * [ptf_runner] Add option for specifying whether to save ptf log The previous commit changed the default behavior. This change is to add an option for specifying whether to save ptf log in case of failure. For example: ansible-playbook <some_test>.yml ... -e save_ptf_log=yes
Description of PR
Summary:
Fixes # (issue)
The PTF log and pcap files are useful for debugging in case of PTF
script failed. However, these files are in the PTF container and could
be lost when the PTF container is re-deployed.
This improvement is to save the log and pcap files to the script
executing host when the PTF script is failed.
Type of change
Approach
How did you do it?
When the PTF script failed, copy the PTF log and pcap files to sonic-mgmt container for later debugging.
How did you verify/test it?
Tested on Mellanox platform.
Any platform specific information?
No
Supported testbed topology if it's a new test case?
Documentation