Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/common/plugins/ptfadapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ def start_ptf_nn_agent(device_num):
ptfhost.command('supervisorctl update')

# Force a restart of ptf_nn_agent to ensure that it is in good status.
ptfhost.command('supervisorctl restart ptf_nn_agent')
# Ignore command errors so that a transient "ERROR (spawn error)" (for
# example, a port collision on the randomly-picked ptf_nn_port) does
# not bypass the surrounding retry loop with a different port.
ptfhost.command('supervisorctl restart ptf_nn_agent', module_ignore_errors=True)

# check whether ptf_nn_agent starts successfully
if "RUNNING" in ptfhost.command('supervisorctl status ptf_nn_agent',
module_ignore_errors=True)["stdout_lines"][0]:
status_lines = ptfhost.command('supervisorctl status ptf_nn_agent',
module_ignore_errors=True)["stdout_lines"]
if status_lines and "RUNNING" in status_lines[0]:
return ptf_nn_port
return None

Expand Down
Loading