From d71f3821ca942c61564e20b629cb06e0bdce8242 Mon Sep 17 00:00:00 2001 From: SuvarnaMeenakshi <50386592+SuvarnaMeenakshi@users.noreply.github.com> Date: Wed, 26 Jul 2023 11:37:08 -0700 Subject: [PATCH] [IPv6][SNMP]: Remove skip of IPv6 loopback testing (#8824) What is the motivation for this PR? SNMP over Loopback ipv6 is currently being skipped. sonic-net/sonic-buildimage#15487 -fixes snmp over ipv6. After the above fix, SNMP over Loopback and management should work. How did you do it? Remove skip of ipv6. How did you verify/test it? Test on vs testbed with single-asic image with sonic-buildimage 15487 fix. Prerequisite PRs: sonic-net/sonic-buildimage#15688 sonic-net/sonic-buildimage#15487 (cherry picked from commit bcf44a11cf821b590b562d2476e730b56aeb6961) --- tests/common/helpers/snmp_helpers.py | 2 -- tests/snmp/test_snmp_loopback.py | 6 ------ 2 files changed, 8 deletions(-) diff --git a/tests/common/helpers/snmp_helpers.py b/tests/common/helpers/snmp_helpers.py index 77ce7cfee2..b01a318a91 100644 --- a/tests/common/helpers/snmp_helpers.py +++ b/tests/common/helpers/snmp_helpers.py @@ -62,10 +62,8 @@ def get_snmp_output(ip, duthost, nbr, creds_all_duts, oid='.1.3.6.1.2.1.1.1.0'): ipaddr = ipaddress.ip_address(ip) iptables_cmd = "iptables" - # TODO : Fix snmp query over loopback v6 and remove this check and add IPv6 ACL table/rule. if isinstance(ipaddr, ipaddress.IPv6Address): iptables_cmd = "ip6tables" - return None ip_tbl_rule_add = "sudo {} -I INPUT 1 -p udp --dport 161 -d {} -j ACCEPT".format( iptables_cmd, ip) diff --git a/tests/snmp/test_snmp_loopback.py b/tests/snmp/test_snmp_loopback.py index 23a33d4021..825d064e4b 100644 --- a/tests/snmp/test_snmp_loopback.py +++ b/tests/snmp/test_snmp_loopback.py @@ -1,5 +1,4 @@ import pytest -import ipaddress from tests.common.helpers.snmp_helpers import get_snmp_facts, get_snmp_output from tests.common.devices.eos import EosHost @@ -23,14 +22,9 @@ def test_snmp_loopback(duthosts, enum_rand_one_per_hwsku_frontend_hostname, nbrh # Get first neighbor VM information nbr = nbrhosts[list(nbrhosts.keys())[0]] - # TODO: Fix snmp query over Management IPv6 adderess and add SNMP test over management IPv6 address. for ip in config_facts[u'LOOPBACK_INTERFACE'][u'Loopback0']: loip = ip.split('/')[0] - loip = ipaddress.ip_address(loip) - # TODO: Fix SNMP query over IPv6 and remove the below check. - if not isinstance(loip, ipaddress.IPv4Address): - continue result = get_snmp_output(loip, duthost, nbr, creds_all_duts) assert result is not None, 'No result from snmpget' assert len(result['stdout_lines']) > 0, 'No result from snmpget'