[ptf map] address ptf map indexing issue #2483
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of PR
Summary:
Fixes #2480
Type of change
Approach
What is the motivation for this PR?
test_lag_2 is failing on single DUT and KVM testbeds.
How did you do it?
For DUTs that doesn't have ptf port to map, the ptf_map would be an empty dictionary. Indexing it with dut_index will cause KeyError. Ignore these KeyErrors.
Signed-off-by: Ying Xie ying.xie@microsoft.com
How did you verify/test it?
platform linux2 -- Python 2.7.12, pytest-4.6.5, py-1.9.0, pluggy-0.13.1
ansible: 2.8.12
rootdir: /var/src/sonic-mgmt/tests, inifile: pytest.ini
plugins: ansible-2.2.2, forked-1.3.0, xdist-1.28.0, html-1.22.1, repeat-0.8.0, metadata-1.10.0
collected 24 items
pc/test_lag_2.py::test_lag[str-dx010-acs-1|PortChannel0005-single_lag] PASSED