[pytest/Mgmtvrf] fix 'Host Unreachable' error when setup Mgmt vrf configs#1647
[pytest/Mgmtvrf] fix 'Host Unreachable' error when setup Mgmt vrf configs#1647irene-pan1202 wants to merge 1 commit intosonic-net:masterfrom
Conversation
…figs
Localhost is not defined before using
Signed-off-by: [email protected]
| return testbed_devices['localhost'] | ||
|
|
||
| @pytest.fixture(scope='module',autouse=True) | ||
| def setup_mvrf(duthost, testbed_devices, testbed, localhost): |
There was a problem hiding this comment.
@irene-pan1202 I think there is no need to define the localhost fixture again in the script. You can use the localhost object already in the testbed_devices fixture supplied to setup_mvrf(). For example, in setup_mvrf():
localhost = testbed_devices["localhost"]
BTW, the localhost supplied to setup_mvrf() is redundant and can be removed.
There was a problem hiding this comment.
@wangxin As you say, other test items that require localhost need to use the localhost object in the testbed_devices fixture individually?
But at #1432, localhost = testbed_devices ['localhost'] has been replaced by localhost in test_snmp_fact test case. Which way is better?
Just like test_vrf.py, because many test items need to use localhost, so define the localhost fixture?
There was a problem hiding this comment.
Currently there are two ways to get access to the localhost object. The first one is to get it from testbed_devices fixture. The second one is defined in https://github.com/Azure/sonic-mgmt/blob/master/tests/common/plugins/ansible_fixtures.py
IMO, both of these definitions need improvement.
There was discussion about improving testbed_devices fixture here: #1475 (comment)
The localhost fixture defined in ansible_fixtures.py should be moved to tests/conftest.py.
But anyway, the localhost object is already defined (already defined twice), there is no need to define it again in the test script.
Localhost is not defined before using when setup Management vrf configs before the start of testsuite, it will cause 'Host Unreachable' error
I am not quite sure about your statement of the root cause. The localhost is defined indeed. Did you get a chance to test your fix? According to #1615 (comment), the setup mgmt vrf failed because the console hangs after execution of command sudo config vrf add mgmt.
…ux-kernel submodules (sonic-net#7064) sonic-swss * Add table descriptions for dynamic buffer calculation to the documents (sonic-net#1664) * Remove vxlanmgrd dependency on orchagent (sonic-net#1647) sonic-utilities * [show] Fix 'show mac' output, when FDB entry with Vlan 1 is present (sonic-net#1368) * [warm-reboot]: Check empty key before issuing redis hget (sonic-net#1496) * [generate-dump] Remove Arista specific logic (sonic-net#1482) * [warm-reboot]: added automated recover for ISSU file (sonic-net#1466) * [warm-reboot] Check if warm restart flag is set when issuing a warm-reboot (sonic-net#1460) * [show][config] fix for show/config muxcable hwmode model value; fix show/config muxcable return codes; (sonic-net#1494) sonic-linux-kernel * [net] Disable prio and cls cgroups to make working cgroup2 sock matching (sonic-net#198) Signed-off-by: Danny Allen <[email protected]>
…tically (#23788) #### Why I did it src/sonic-sairedis ``` * 8645610d - (HEAD -> 202505, origin/202505) [meta] do not fail bulk operations if MODE_IGNORE_ERROR (sonic-net#1647) (3 days ago) [mssonicbld] ``` #### How I did it #### How to verify it #### Description for the changelog
…tically (#24336) #### Why I did it src/sonic-sairedis ``` * 90d34ee9 - (HEAD -> 202505, origin/202505) Revert "[meta] do not fail bulk operations if MODE_IGNORE_ERROR (sonic-net#1647)" (sonic-net#1671) (35 hours ago) [Nikola Dancejic] ``` #### How I did it #### How to verify it #### Description for the changelog
Description of PR
Summary:
Localhost is not defined before using when setup Management vrf configs before the start of testsuite, it will cause 'Host Unreachable' error
Fixes # (issue) #1615
Type of change
Approach
How did you do it?
Defined localhost before using
How did you verify/test it?
Perform pytest to confirm Mgmt vrf tests are passed.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation