Skip to content

Convert 'read_mac' ansible test to pytest#2322

Merged
wangxin merged 3 commits intosonic-net:masterfrom
ayurkiv-nvda:master_read_mac
Nov 5, 2020
Merged

Convert 'read_mac' ansible test to pytest#2322
wangxin merged 3 commits intosonic-net:masterfrom
ayurkiv-nvda:master_read_mac

Conversation

@ayurkiv-nvda
Copy link
Copy Markdown
Contributor

@ayurkiv-nvda ayurkiv-nvda commented Oct 9, 2020

Signed-off-by: Andriy Yurkiv [email protected]

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?

Migrating tests from ansible to pytest framework

How did you do it?

Converted read_mac ansible test to pytest.
Old ansible test :https://github.com/Azure/sonic-mgmt/blob/master/ansible/roles/test/tasks/read_mac_metadata.yml

How did you verify/test it?

py.test read_mac/test_read_mac_metadata.py --iteration <iter> --image1 <image1URL> --image2 <image2URL> --minigraph1 <file1> --minigraph2 <file2> --inventory ../ansible/inventory --host-pattern <host> --module-path ../ansible/library/  --testbed <host>-<topology> --testbed_file ../ansible/testbed.csv --show-capture=no --capture=no --log-cli-level info -ra

iteration, image1 and image2 params are mandatory
minigraph1 and minigraph2 are optional

Any platform specific information?

N/A

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

any

Documentation

'read mac' test flow:

  • Download sonic image
  • Install it
  • Reboot
  • Apply new minigraph (optional)
  • Check if MAC is correct on interfaces
  • Check MTU on interfaces
  • Repeat N times with different images

Note
This test has at least 2 parameters that cannot be defined as default (image1 and image2)
Because of this backward compatibility currently does not work (I mean ability to run test using ansible-playbook)

ansible-playbook test_sonic.yml -i inventory --limit {DUT_NAME} -e testbed_name={TESTBED_NAME} -e testbed_type={TESTBED_TYPE} -e testcase_name=read_mac -e iterations={ITERATIONS} -e image1={IMAGE1} -e image2={IMAGE2}

Current implementation of ansible to pytest wrapper does not allow to pass python input params. And this may be motivation to improve it fuctionality in future

@ghost
Copy link
Copy Markdown

ghost commented Oct 9, 2020

CLA assistant check
All CLA requirements met.

@wangxin wangxin self-requested a review October 16, 2020 00:46
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.

This test checked router MAC address in config_db after image upgrade and minigraph loading. Would it be easier to add a router MAC check in the upgrading tests than creating a new test?

@ayurkiv-nvda
Copy link
Copy Markdown
Contributor Author

This test checked router MAC address in config_db after image upgrade and minigraph loading. Would it be easier to add a router MAC check in the upgrading tests than creating a new test?

This test was written to verify some specific flow. There was a bug, when sometimes after sonic upgrade there wasn't MAC address on interfaces. Firstly was developed YML script to reproduce this issue (cyclic upgrade), then this script was modified and commited to sonic-mgmt repository. And now I manage to rewrite this test to pytest
So I think that it a good idea do not throw away this test, because it helps to validate this specific flow (cyclic sonic upgrade)

@wangxin
Copy link
Copy Markdown
Collaborator

wangxin commented Oct 23, 2020

@ayurkiv-nvda You made a point of cylic sonic upgrade. Can you please address my other comments?

@ayurkiv-nvda
Copy link
Copy Markdown
Contributor Author

@wangxin I fixed all your comments. Can you please approve and merge if there are no more remarks?
Thank you!

@keboliu
Copy link
Copy Markdown
Contributor

keboliu commented Nov 4, 2020

retest vsimage please

@wangxin
Copy link
Copy Markdown
Collaborator

wangxin commented Nov 5, 2020

retest this please

@wangxin wangxin merged commit 1dea226 into sonic-net:master Nov 5, 2020
@ayurkiv-nvda ayurkiv-nvda deleted the master_read_mac branch August 12, 2021 07:50
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
swss:
* a3bfd96 2022-06-18 | Enhance mock test for dynamic buffer manager for port removing and qos reload flows (sonic-net#2262) (HEAD -> 202205, github/202205) [Stephen Sun]
* b17d6c0 2022-05-28 | Support mock_test infra for dynamic buffer manager and fix issues found during mock test (sonic-net#2234) [Stephen Sun]
* 3fb23a1 2022-06-16 | [aclorch] Fix and simplify DTel watchlist tables and entries (sonic-net#2155) [Mickey Spiegel]
* 9ace643 2022-06-16 | [intfmgr]: Set proxy_arp kernel param (sonic-net#2334) [Lawrence Lee]
* 013609a 2022-06-14 | [crmorch] Prevent exceededLogCounter from resetting when low and high values are equal (sonic-net#2327) [Alexander Allen]
* 83a1306 2022-06-13 | Fix key generation in removeDecapTunnel (sonic-net#2322) [Myron Sosyak]
* 3d018ad 2022-06-15 | Apply `DSCP_TO_TC_MAP` from `PORT_QOS_MAP|global` to switch level (sonic-net#2314) [bingwang-ms]

Signed-off-by: Ying Xie <[email protected]>
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.

3 participants