Skip to content

Commit

Permalink
create sniffer folder if not exist (#1659)
Browse files Browse the repository at this point in the history
- What I did
following the change in PR sonic-net/sonic-buildimage#7830, the folder needs to be created when the first time enables the sniffer function.

- How I did it
check whether the path to store the sniffer file is existing or not, if not, create it.

- How to verify it
run command "config platform mlnx sniffer sdk enable", can see sniffer function can be enabled successfully.
  • Loading branch information
keboliu authored Jun 20, 2021
1 parent 45e7b71 commit a75a2e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/plugins/mlnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

# generate sniffer target file name include a time stamp.
def sniffer_filename_generate(path, filename_prefix, filename_ext):
if not os.path.exists(path):
os.makedirs(path)
time_stamp = time.strftime("%Y%m%d%H%M%S")
filename = path + filename_prefix + time_stamp + filename_ext
return filename
Expand Down

0 comments on commit a75a2e8

Please sign in to comment.