Skip to content

Run test_announce_routes.py only with add-topo#2741

Merged
wangxin merged 3 commits intosonic-net:masterfrom
wangxin:add-topo-ann-routes
Feb 8, 2021
Merged

Run test_announce_routes.py only with add-topo#2741
wangxin merged 3 commits intosonic-net:masterfrom
wangxin:add-topo-ann-routes

Conversation

@wangxin
Copy link
Collaborator

@wangxin wangxin commented Jan 6, 2021

Description of PR

Summary:
Fixes # (issue)

Type of change

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

Approach

What is the motivation for this PR?

Although the test_announce_routes.py script is always executed by the run_tests.sh
tool while preparing DUT, not every vendor uses run_tests.sh to trigger testing.
People usually forget to run test_announce_routes.py after a new topology is
deployed. Since announcing routes just need to be executed once after a new topology
is deployed, life could be a little bit easier if we announce routes together with
add-topo.

How did you do it?

Changes in this PR:

  • Added new ansible module announce_routes.py for announcing routes.
  • Added new playbook announce_routes.yml for starting exabgp processes on PTF and
    call the announce_routes module.
  • Updated the add-topo.yml to run the new playbook.
  • Removed the fib at tests/common/plugins/fib.py
  • Removed the tests/test_announce_routes.py script
  • The tests/decap/test_decap.py script was dependent on the fib plugin. Updated this test
    to generate fib_info file from redis DB information.
  • Updated the IP_decap_test.py script not to test all the FIB entries to limit
    test execution time.

How did you verify/test it?

Test run remove-topo and add-topo on both VS setup and physical setup.
Test run run_tests.sh.
Test run tests/decap/test_decap.py

Any platform specific information?

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

Documentation

@wangxin wangxin requested a review from a team January 6, 2021 09:39
Copy link
Collaborator

Choose a reason for hiding this comment

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

run_test.sh will set some environment variable, including ANSIBLE_CONFIG, ANSIBLE_LIBRARY and ANSIBLE_CONNECTION_PLUGINS. Can we run pytest without these variables?

Copy link
Contributor

Choose a reason for hiding this comment

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

we need to set ANSIBLE_CONFIG for sure. I encountered failure recently when running pytest directly

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch! Thanks!
My sonic-mgmt used for testing already has these environment variables exported. That's why the issue was not caught in my testing. Indeed I noticed another issue, currently it only works for VS setup. The reason is that the inventory file used for VS setup veos_vtb has host information of PTF. For physical test setups, the veos file does not have PTF host information, the script would fail. I need to figure out how to make it work for physical test setups as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated this PR with a new approach. Updated PR description.

@lgtm-com
Copy link

lgtm-com bot commented Jan 13, 2021

This pull request introduces 2 alerts when merging 78ae80f41090df9ef262a07026f099dec0a1dd2b into 6feb19a - view on LGTM.com

new alerts:

  • 1 for Testing equality to None
  • 1 for Result of integer division may be truncated

@lgtm-com
Copy link

lgtm-com bot commented Jan 13, 2021

This pull request introduces 2 alerts when merging dabda62d720f6ade76c9dc33c5a1e32f9a9ec78e into 6feb19a - view on LGTM.com

new alerts:

  • 1 for Testing equality to None
  • 1 for Result of integer division may be truncated

@lgtm-com
Copy link

lgtm-com bot commented Jan 13, 2021

This pull request introduces 1 alert when merging b75dde2a32865b7c76aaf40ce982bb4cdaaf45b7 into 6feb19a - view on LGTM.com

new alerts:

  • 1 for Result of integer division may be truncated

@lgtm-com
Copy link

lgtm-com bot commented Jan 13, 2021

This pull request introduces 1 alert when merging 9b7a104053d5cdcd5f7c33ef563e4f7d18a6c2b3 into 6feb19a - view on LGTM.com

new alerts:

  • 1 for Result of integer division may be truncated

@lgtm-com
Copy link

lgtm-com bot commented Jan 13, 2021

This pull request introduces 1 alert when merging 23a94db49b3f616835c5cf239ae84136fbf581dc into 6feb19a - view on LGTM.com

new alerts:

  • 1 for Result of integer division may be truncated

@wangxin
Copy link
Collaborator Author

wangxin commented Jan 29, 2021

@neethajohn @bingwang-ms Can you check again?

@yxieca
Copy link
Collaborator

yxieca commented Jan 29, 2021

Is there a way to keep the route announce code at one place? I am thinking the pytest test_announce_route.py invokes fib plug to announce route. That code is very similar to what you added. Can you refactor the code to a single place, you can use symbolic link if have to. Just so that we won't have these 2 chunk of code out of sync.

Although the test_announce_routes.py script is always executed by the run_tests.sh
tool while preparing DUT, not every vendor uses run_tests.sh to trigger testing.
People usually forget to run test_announce_routes.py after a new topology is
deployed. Since announcing routes just need to be executed once after a new topology
is deployed, life could be a little bit easier if we announce routes together with
add-topo.

Changes in this PR:
* Added new ansible module `announce_routes.py` for announcing routes.
* Added new playbook `announce_routes.yml` for starting exabgp processes on PTF and
  call the announce_routes module.
* Updated the add-topo.yml to run the new playbook.
* Removed the fib at tests/common/plugins/fib.py
* Removed the tests/test_announce_routes.py script
* The tests/decap/test_decap.py script was dependent on the fib plugin. Updated this test
  to generate fib_info file from redis DB information.
* Updated the IP_decap_test.py script not to test all the FIB entries to limit
  test execution time.

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
@wangxin
Copy link
Collaborator Author

wangxin commented Feb 5, 2021

I have deprecated the fib plugin. Now there is no code duplication.

@lgtm-com
Copy link

lgtm-com bot commented Feb 5, 2021

This pull request fixes 2 alerts when merging 890f45c into 7abdb38 - view on LGTM.com

fixed alerts:

  • 2 for Unused import


when:
- ptf_host_user is defined
- ptf_host_pass is defined
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this check?

  when:
    - ptf_host_user is defined
    - ptf_host_pass is defined

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed it is unnecessary. I'll remove this check.

@lgtm-com
Copy link

lgtm-com bot commented Feb 7, 2021

This pull request fixes 2 alerts when merging b65b5d8 into 42ca406 - view on LGTM.com

fixed alerts:

  • 2 for Unused import

@wangxin wangxin merged commit dee1b38 into sonic-net:master Feb 8, 2021
wangxin added a commit that referenced this pull request Feb 19, 2021
In PR #2741, the fib plugin for announcing routes have been deprecated.
Announcing routes is done together with add-topo. The test_dir_bcast.py
script dependent on the fib plugin was missed in PR #2741.

Since the routes have already been announced during add-topo, there
is no need to do that for test_dir_bcast.py again. To fix the issue, we can
simply removes the dependency of the fib plugin for test_dir_bcast.py.

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
@wangxin wangxin deleted the add-topo-ann-routes branch March 5, 2021 00:51
wangxin added a commit that referenced this pull request Mar 12, 2021
In PR #2741, test script for announcing IP routes to PTF docker container was deprecated.
The function of announcing IP routes is moved to 'testbed-cli.sh add-topo'. Then we do
not need to run the test script to announce IP routes after a new topology is deployed.

However, there are still occasions that people may want to re-announce the IP routes to
PTF docker containers. Because announcing routes is part of add-topo, then the only
possible way to re-announce routes is to run 'testbed-cli.sh remove-topo' and
'testbed-cli.sh add-topo'. This is inconvenient and time consuming.

This change added a new 'announce-routes' sub-command to the testbed-cli.sh tool.
We can now just re-announce IP routes using command like below:
    ./testbed-cli.sh -t vtestbed.csv vms-kvm-t0 password.txt

Other changes:
* Corrected the inv_name field in vtestbed.csv file.
* Moved the 'announce_routes.py' module from ansible/roles/vm_set/library to ansible/library

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
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.

4 participants