Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mvrf] test_ntp fixed issue: "Host unreachable" #4003

Merged
merged 1 commit into from
Sep 2, 2021

Conversation

AndriiLozovyi
Copy link
Contributor

Signed-off-by: Andrii-Yosafat Lozovyi andrii-yosafatx.lozovyi@intel.com

Description of PR

Summary: Mvrf test_ntp gets stuck when executing cmd sudo ip vrf exec mgmt ntpd -gq or sudo cgexec -g l3mdev:mgmt ntpd -gq, which eventually lead to test case fail with error:

>           raise AnsibleConnectionFailure("Host unreachable", dark=cb.unreachable, contacted=cb.contacted)
E           AnsibleConnectionFailure: Host unreachable

This may happen because connection with ntp servers defined in CONFIG_DB are not synchronized:

~$ ntpstat
unsynchronised
   polling server every 8 s

So in order to avoid test case getting stuck and failed, test will check ntp connection before enabling mvrf (because after mvrf is enabled ntp connection gets lost) and if it was not synchronized, will setup ntp server on ptf and configure ntp on dut.
Fixes # (issue)

Type of change

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

Back port request

  • 201911

Approach

What is the motivation for this PR?

Avoid test_ntp being stuck on executing cmd sudo ip vrf exec mgmt ntpd -gq or sudo cgexec -g l3mdev:mgmt ntpd -gq and make test case pass.

How did you do it?

Added setup of ntp server on ptf in case ntp is not synchronized.

How did you verify/test it?

Run mvrf/test_mgmtvrf.py::TestServices::test_ntp on Sonic master and 202012 images:
mvrf/test_mgmtvrf.py::TestServices::test_ntp PASSED

Any platform specific information?

SONiC Software Version: SONiC.202012.26723-dirty-20210802.085152
Distribution: Debian 10.10
Kernel: 4.19.0-12-2-amd64
Build commit: 2a41adcdc
Build date: Mon Aug  2 14:04:09 UTC 2021
Built by: AzDevOps@sonic-build-workers-000K4X
Platform: x86_64-arista_7170_64c
HwSKU: Arista-7170-64C

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

Documentation

@AndriiLozovyi AndriiLozovyi requested a review from a team as a code owner August 10, 2021 13:04
@AndriiLozovyi
Copy link
Contributor Author

@wangxin, Could you please take a look ?

Signed-off-by: Andrii-Yosafat Lozovyi <andrii-yosafatx.lozovyi@intel.com>
@lguohan
Copy link
Contributor

lguohan commented Aug 14, 2021

added to kvmtest

@lguohan
Copy link
Contributor

lguohan commented Aug 14, 2021

looks like this test failed. it is not relavant to ntp, but do you plan look at it as well?

mvrf/test_mgmtvrf.py::TestReboot::test_warmboot 
-------------------------------- live log call ---------------------------------
18:04:34 __init__.pytest_runtest_call             L0039 ERROR  | Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 1464, in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 81, in get_result
    _reraise(*ex)  # noqa
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 174, in pytest_pyfunc_call
    testfunction(**testargs)
  File "/var/src/s/tests/mvrf/test_mgmtvrf.py", line 249, in test_warmboot
    reboot(duthost, localhost, reboot_type="warm")
  File "/var/src/s/tests/common/reboot.py", line 175, in reboot
    raise Exception('warmboot-finalizer never reached state "activating" on {}'.format(hostname))
Exception: warmboot-finalizer never reached state "activating" on vlab-03

@AndriiLozovyi
Copy link
Contributor Author

@lguohan,
I will look up to this test case once I'll be out of my high prioritized tasks.
Сould you please provide on which sonic image was this run ?
Also if there are no comment's on PR, could it be merged ?
Thanks

@yxieca
Copy link
Collaborator

yxieca commented Aug 26, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yxieca yxieca merged commit 7cf6355 into sonic-net:master Sep 2, 2021
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
Description of PR
Summary: Mvrf test_ntp gets stuck when executing cmd sudo ip vrf exec mgmt ntpd -gq or sudo cgexec -g l3mdev:mgmt ntpd -gq, which eventually lead to test case fail with error:

>           raise AnsibleConnectionFailure("Host unreachable", dark=cb.unreachable, contacted=cb.contacted)
E           AnsibleConnectionFailure: Host unreachable
This may happen because connection with ntp servers defined in CONFIG_DB are not synchronized:

~$ ntpstat
unsynchronised
   polling server every 8 s
So in order to avoid test case getting stuck and failed, test will check ntp connection before enabling mvrf (because after mvrf is enabled ntp connection gets lost) and if it was not synchronized, will setup ntp server on ptf and configure ntp on dut.
Fixes # (issue)

Approach
What is the motivation for this PR?
Avoid test_ntp being stuck on executing cmd sudo ip vrf exec mgmt ntpd -gq or sudo cgexec -g l3mdev:mgmt ntpd -gq and make test case pass.

How did you do it?
Added setup of ntp server on ptf in case ntp is not synchronized.

How did you verify/test it?
Run mvrf/test_mgmtvrf.py::TestServices::test_ntp on Sonic master and 202012 images:
mvrf/test_mgmtvrf.py::TestServices::test_ntp PASSED

Signed-off-by: Andrii-Yosafat Lozovyi <andrii-yosafatx.lozovyi@intel.com>
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