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

[202205]Use device loopback IP address to send SNMP query from neighboring ceos or vsonic (#8802) #8972

Merged
merged 2 commits into from
Jul 14, 2023

Conversation

SuvarnaMeenakshi
Copy link
Contributor

@SuvarnaMeenakshi SuvarnaMeenakshi commented Jul 13, 2023

Description of PR

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?
cherry-pick of #8802
sonic-net/sonic-buildimage#15487 modifies snmpd in SONiC to listen on management and loopback ip by default instead of listening on any IP. test_interop_protocol.py::test_snmp sends a query to the neighbor device using the link ip address. After the above change to listen on management and loopback ip, the snmp query will fail. Hence, modifying the test to send SNMP query to SONiC DUT from neighboring vsonic/eos using Loopback IP of SONiC DUT.

How did you do it?
Get loopback IPv4 address DUT and use that to query from neighbor device. Added a generic helped function to send SNMP query to DUT from a neighbor.

(cherry picked from commit d66965a)

How did you verify/test it?

Tested on single asic VS testbed.

/data/sonic-mgmt/tests$ ./run_tests.sh -n vms-kvm-t0 -d vlab-01 -c macsec/test_interop_protocol.py::TestInteropProtocol::test_snmp -f vtestbed.yaml -i ../ansible/veos_vtb -e "--skip_sanity --disable_loganalyzer --neighbor_type=sonic  --completeness_level=confident --allow_recover --neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI --maxfail=1" -u
=== Running tests in groups ===
Running: pytest macsec/test_interop_protocol.py::TestInteropProtocol::test_snmp --inventory ../ansible/veos_vtb --host-pattern vlab-01 --testbed vms-kvm-t0 --testbed_file vtestbed.yaml --log-cli-level warning --log-file-level debug --kube_master unset --showlocals --assert plain --show-capture no -rav --allow_recover --ignore=ptftests --ignore=acstests --ignore=saitests --ignore=scripts --ignore=k8s --ignore=sai_qualify --junit-xml=logs/tr.xml --log-file=logs/test.log --skip_sanity --disable_loganalyzer --neighbor_type=sonic --completeness_level=confident --allow_recover --neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI --maxfail=1
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature
============================================================================================= test session starts =============================================================================================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.11.0, pluggy-0.13.1
ansible: 2.8.12
rootdir: /data
..
macsec/test_interop_protocol.py::TestInteropProtocol::test_snmp[128_SCI] PASSED                                                                                                                         [ 50%]
macsec/test_interop_protocol.py::TestInteropProtocol::test_snmp[256_XPN_SCI] PASSED                                                                                                                     [100%]

============================================================================================== warnings summary ===============================================================================================
/usr/local/lib/python2.7/dist-packages/_pytest/mark/structures.py:335
  /usr/local/lib/python2.7/dist-packages/_pytest/mark/structures.py:335: PytestUnknownMarkWarning: Unknown pytest.mark.disable_loganalyzer - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
    PytestUnknownMarkWarning,

-- Docs: https://docs.pytest.org/en/latest/warnings.html
--------------------------------------------------------------------------- generated xml file: /data/sonic-mgmt/tests/logs/tr.xml ----------------------------------------------------------------------------
=================================================================================== 2 passed, 1 warnings in 383.36 seconds ====================================================================================
INFO:root:Can not get Allure report URL. Please check logs
:/data/sonic-mgmt/tests$ ./run_tests.sh -n vms-kvm-t0 -d vlab-01 -c snmp/test_snmp_loopback.py -f vtestbed.yaml -i ../ansible/veos_vtb -e "--skip_sanity --disable_loganalyzer --neighbor_type=sonic" -u
=== Running tests in groups ===
Running: pytest snmp/test_snmp_loopback.py --inventory ../ansible/veos_vtb --host-pattern vlab-01 --testbed vms-kvm-t0 --testbed_file vtestbed.yaml --log-cli-level warning --log-file-level debug --kube_master unset --showlocals --assert plain --show-capture no -rav --allow_recover --ignore=ptftests --ignore=acstests --ignore=saitests --ignore=scripts --ignore=k8s --ignore=sai_qualify --junit-xml=logs/tr.xml --log-file=logs/test.log --skip_sanity --disable_loganalyzer --neighbor_type=sonic
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature
============================================================================================= test session starts =============================================================================================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.11.0, pluggy-0.13.1
ansible: 2.8.12
rootdir: /data
...
snmp/test_snmp_loopback.py::test_snmp_loopback[vlab-01] PASSED                                                                                                                                          [100%]

============================================================================================== warnings summary ===============================================================================================
/usr/local/lib/python2.7/dist-packages/_pytest/mark/structures.py:335
  /usr/local/lib/python2.7/dist-packages/_pytest/mark/structures.py:335: PytestUnknownMarkWarning: Unknown pytest.mark.bsl - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
    PytestUnknownMarkWarning,

-- Docs: https://docs.pytest.org/en/latest/warnings.html
--------------------------------------------------------------------------- generated xml file: /data/sonic-mgmt/tests/logs/tr.xml ----------------------------------------------------------------------------
==================================================================================== 1 passed, 1 warnings in 78.92 seconds ====================================================================================
INFO:root:Can not get Allure report URL. Please check logs

Any platform specific information?

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

Documentation

SuvarnaMeenakshi and others added 2 commits July 13, 2023 17:47
…os or vsonic (sonic-net#8802)

What is the motivation for this PR?
sonic-net/sonic-buildimage#15487 modifies snmpd in SONiC to listen on management and loopback ip by default instead of listening on any IP.
test_interop_protocol.py::test_snmp sends a query to the neighbor device using the link ip address.
After the above change to listen on management and loopback ip, the snmp query will fail.
Hence, modifying the test to send SNMP query to SONiC DUT from neighboring vsonic/eos using Loopback IP of SONiC DUT.

How did you do it?
Get loopback IPv4 address DUT and use that to query from neighbor device.
Added a generic helped function to send SNMP query to DUT from a neighbor.

(cherry picked from commit d66965a)
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
@wangxin wangxin merged commit 712f338 into sonic-net:202205 Jul 14, 2023
2 checks passed
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