Skip to content

Make test_fdb dualtor ready#2705

Merged
bingwang-ms merged 3 commits intosonic-net:masterfrom
bingwang-ms:fix_test_fdb_dualtor
Jan 25, 2021
Merged

Make test_fdb dualtor ready#2705
bingwang-ms merged 3 commits intosonic-net:masterfrom
bingwang-ms:fix_test_fdb_dualtor

Conversation

@bingwang-ms
Copy link
Copy Markdown
Collaborator

@bingwang-ms bingwang-ms commented Dec 28, 2020

Signed-off-by: bingwang bingwang@microsoft.com

Description of PR

Summary:
Fixes # (issue)
This PR is to fix test_fdb exception on dualtor testbed.
An exception will be thrown when test_fdb is running on dualtor testbed.

ptf_ports_available_in_topo = ptfhost.host.options['variable_manager'].extra_vars.get("ifaces_map")
        available_ports_idx = [ idx for idx, name in ptf_ports_available_in_topo.items()
>       if conf_facts['PORT'][port_index_to_name[idx]].get('admin_status', 'down') == 'up' ]
E       KeyError: 34

It's because the number of ports on ptf containes is larger than that on DUT, since there will be an injected interface for each DUT's interface connected to VM.
For example, there are 32 ports on a dualtor DUT, but there are 36 ports on ptf. So an exception will be thrown when attempting to map ptf port indices to DUT port indices.
This PR addressed the issue by adding a check for existence of idx in port_index_to_name.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

This PR is to fix test_fdb on dualtor testbed.

How did you do it?

Adding a check for existence of idx in port_index_to_name.

How did you verify/test it?

Verified on both dualtor and single tor testbed.

 py.test --inventory ../ansible/str2,../ansible/veos --host-pattern str2-7050cx3-acs-08 --module-path ../ansible --testbed vms17-dual-t0-7050-2 --testbed_file ../ansible/testbed.csv --junit-xml=tr.xml --log-cli-level warn --collect_techsupport=False --topology=t0,any,util fdb/test_fdb.py
========================================================================================= test session starts =========================================================================================
collected 4 items                                                                                                                                                                                     

fdb/test_fdb.py::test_fdb[ethernet] PASSED                                                                                                                                                      [ 25%]
fdb/test_fdb.py::test_fdb[arp_request] PASSED                                                                                                                                                   [ 50%]
fdb/test_fdb.py::test_fdb[arp_reply] ^@PASSED                                                                                                                                                     [ 75%]
fdb/test_fdb.py::test_fdb[cleanup] PASSED                                                                                                                                                       [100%]

------------------------------------------------------------------ generated xml file: /data/Networking-acs-sonic-mgmt/tests/tr.xml -------------------------------------------------------------------
===================================================================================== 4 passed in 400.02 seconds ======================================================================================

Any platform specific information?

No.

Supported testbed topology if it's a new test case?

No.

Documentation

Signed-off-by: bingwang <bingwang@microsoft.com>
Signed-off-by: bingwang <bingwang@microsoft.com>
@bingwang-ms bingwang-ms requested a review from a team December 28, 2020 03:19
Copy link
Copy Markdown
Collaborator

@wangxin wangxin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For dualtor setup, I think we need to set active side of all mux cables to the currently selected DUT before testing. For the ports that mux cable's active side is the other ToR, packets injected to these ports will go to the other ToR. The current ToR would not be able to receive them. Checking FDB will fail.

ptf_ports_available_in_topo = ptfhost.host.options['variable_manager'].extra_vars.get("ifaces_map")
available_ports_idx = [ idx for idx, name in ptf_ports_available_in_topo.items()
if conf_facts['PORT'][port_index_to_name[idx]].get('admin_status', 'down') == 'up' ]
if idx in port_index_to_name and conf_facts['PORT'][port_index_to_name[idx]].get('admin_status', 'down') == 'up' ]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you adjust the indention? Indeed, I have been wondering why there is no syntax error here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Updated.

Signed-off-by: bingwang <bingwang@microsoft.com>
@bingwang-ms
Copy link
Copy Markdown
Collaborator Author

For dualtor setup, I think we need to set active side of all mux cables to the currently selected DUT before testing. For the ports that mux cable's active side is the other ToR, packets injected to these ports will go to the other ToR. The current ToR would not be able to receive them. Checking FDB will fail.

Thanks. I raised another PR to do this #2850

@bingwang-ms bingwang-ms merged commit 650fd18 into sonic-net:master Jan 25, 2021
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…net#14309)

Why I did it
src/sonic-dbsyncd

* 4dcfb61 - (HEAD -> 202205, origin/202205) Handled the error case of negative age (sonic-net#57) (2 days ago) [Vivek]
src/sonic-swss

* 142abdf - (HEAD -> 202205, origin/202205) swss: Fix egress queue counters in voq systems. (sonic-net#2705) (2 days ago) [Sambath Kumar Balasubramanian]
src/sonic-utilities

* 42a57f4c - (HEAD -> 202205, origin/202205) [202205] Update the ref guide to reflect the vlan brief output (sonic-net#2741) (2 days ago) [Vivek]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants