From 9b3d5d8e3b3e5f5c50ac8c43fb07433c06953198 Mon Sep 17 00:00:00 2001 From: SuvarnaMeenakshi <50386592+SuvarnaMeenakshi@users.noreply.github.com> Date: Sun, 11 Aug 2024 19:05:10 -0700 Subject: [PATCH] Modify snmp link local test to use config cli (#13070) Modify snmp_link_local_test to test after configuring link local snmp agent address using config snmpagentaddress cli. Pre requisite: sonic-net/sonic-utilities#3215 Signed-off-by: Suvarna Meenakshi --- tests/snmp/test_snmp_link_local.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/snmp/test_snmp_link_local.py b/tests/snmp/test_snmp_link_local.py index a9a8eae750..7f8f58ff68 100644 --- a/tests/snmp/test_snmp_link_local.py +++ b/tests/snmp/test_snmp_link_local.py @@ -22,7 +22,8 @@ def test_snmp_link_local_ip(duthosts, nbrhosts, tbinfo, localhost, creds_all_duts): """ Test SNMP query to DUT over link local IP - - Send SNMP query over link local IP from one of the BGP Neighbors + - configure eth0's link local IP as snmpagentaddress + - Query over linklocal IP from within snmp docker - Get SysDescr from snmpfacts - compare result from snmp query over link local IP and snmpfacts """ @@ -44,13 +45,9 @@ def test_snmp_link_local_ip(duthosts, link_local_ip = ip.split()[1] break # configure link local IP in config_db - duthost.shell( - 'sonic-db-cli CONFIG_DB hset "MGMT_INTERFACE|eth0|{}" \ - "gwaddr" "fe80::1"' - .format(link_local_ip)) # Restart snmp service to regenerate snmpd.conf with # link local IP configured in MGMT_INTERFACE - duthost.shell("systemctl restart snmp") + duthost.shell("config snmpagentaddress add {}%eth0".format(link_local_ip)) stdout_lines = duthost.shell("docker exec snmp snmpget \ -v2c -c {} {}%eth0 {}" .format(creds_all_duts[duthost.hostname]