Skip to content

Vnet vxlan pytest conversion#2113

Merged
theasianpianist merged 28 commits intosonic-net:masterfrom
theasianpianist:vnet-vxlan-pytest
Aug 31, 2020
Merged

Vnet vxlan pytest conversion#2113
theasianpianist merged 28 commits intosonic-net:masterfrom
theasianpianist:vnet-vxlan-pytest

Conversation

@theasianpianist
Copy link
Contributor

@theasianpianist theasianpianist commented Aug 18, 2020

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?

Migrate VNET VxLAN test to pytest framework

How did you do it?

  • Create test module for VNET VxLAN
  • Copy necessary Jinja templates to pytest-specific template directory

How did you verify/test it?

  • Run pytest and check that all cases (Disabled, Enabled, Cleanup) succeed
  • Run with scaled options (num_vnet, num_routes, num_endpoints) and check that the given values are reflected in the generated config files
  • Run with --skip_cleanup and verify that cleanup step is skipped
  • Run with --ipv6_vxlan_test and verify correct values in generated config files

Any platform specific information?

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

Documentation

Run this test with:

./run_tests.sh -i <inventory file> -d <DUT name> -n <testbed name> -u -c vxlan/test_vnet_vxlan.py

Use extra CLI parameters as following:

./run_tests.sh ...(same as above)... -e "--param_with_value=<value> --param_without_value"

Scaled VNET test:

--num_vnet=<x>
--num_routes=<y>
--num_endpoints=<z>

Other:

--skip_cleanup (don't remove VNET info after test ends)

* Create pytest specific versions of VNET configuration templates
* Add VNET VxLAN pytest module

Signed-off-by: Lawrence Lee <[email protected]>
* Fix template formatting
* Correct config file location for PTF host

Signed-off-by: Lawrence Lee <[email protected]>
* Control whitespace in rendered templates to preserve formatting

Signed-off-by: Lawrence Lee <[email protected]>
Copy link
Contributor

@daall daall left a comment

Choose a reason for hiding this comment

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

See comments. I did not look super closely at the j2 templates, please check with @prsunny.

for vnet in vc.VNET_CONFIG['vnet_id_list']:
duthost.shell("docker exec -i database redis-cli -n 4 del \"VNET|{}\"".format(vnet))

def cleanup_vxlan_tunnels(duthost):
Copy link
Contributor

Choose a reason for hiding this comment

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

We would also want to do cleanup of Vlans. This can be ported once ansible fix is available

@prsunny
Copy link
Contributor

prsunny commented Aug 20, 2020

@volodymyrsamotiy , please review

@daall daall requested a review from a team August 20, 2020 16:34
* Move parser addoption method to test specific conftest.py
* Bundle parameters for scaled vnet test into dictionary
* Bundle general vnet test parameters into dictionary

Signed-off-by: Lawrence Lee <[email protected]>
* Change all imports to match
* Create vnet_config fixture for value that was previously in constants file

Signed-off-by: Lawrence Lee <[email protected]>
* Return instead of yield in setup function
* Make variable name clearer
* Add pytest topology marker

Signed-off-by: Lawrence Lee <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Aug 21, 2020

This pull request introduces 3 alerts when merging 0bf7d59 into dd43ab3 - view on LGTM.com

new alerts:

  • 2 for 'import *' may pollute namespace
  • 1 for Unused import

@theasianpianist
Copy link
Contributor Author

retest vsimage please

@prsunny
Copy link
Contributor

prsunny commented Aug 27, 2020

@volodymyrsamotiy for viz

Copy link
Contributor

@daall daall left a comment

Choose a reason for hiding this comment

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

Two really small suggestions, nothing blocking. Be sure to double-check with @prsunny and @volodymyrsamotiy before merging this. :)

* Fix typo
* Update `safe_open_template` method docstring

Signed-off-by: Lawrence Lee <[email protected]>
@theasianpianist theasianpianist changed the title Vnet vxlan pytest Vnet vxlan pytest conversion Aug 31, 2020
@theasianpianist theasianpianist merged commit 578442d into sonic-net:master Aug 31, 2020
@theasianpianist theasianpianist deleted the vnet-vxlan-pytest branch August 31, 2020 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants