Skip to content

[pytest/Mgmtvrf] fix 'Host Unreachable' error when setup Mgmt vrf configs#1647

Open
irene-pan1202 wants to merge 1 commit intosonic-net:masterfrom
irene-pan1202:mgmt_vrf
Open

[pytest/Mgmtvrf] fix 'Host Unreachable' error when setup Mgmt vrf configs#1647
irene-pan1202 wants to merge 1 commit intosonic-net:masterfrom
irene-pan1202:mgmt_vrf

Conversation

@irene-pan1202
Copy link
Contributor

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

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

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

…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):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@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.

Copy link
Contributor Author

@irene-pan1202 irene-pan1202 May 8, 2020

Choose a reason for hiding this comment

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

@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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

@irene-pan1202 irene-pan1202 requested a review from a team as a code owner March 2, 2022 17:37
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…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]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…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
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…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
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