From 56f15aeefd417fa8460ba9c28ebae036ba3695eb Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 6 Feb 2023 12:46:55 +0100 Subject: [PATCH] SNMP mem tests: increase timeout for walk and table, use single snmp tools macro --- test/lib.sh | 11 +++++++++-- test/test_snmp_entity.sh | 2 +- test/test_snmp_ifmib.sh | 10 ++++------ test/test_snmp_system.sh | 7 ------- 4 files changed, 14 insertions(+), 16 deletions(-) mode change 100644 => 100755 test/test_snmp_system.sh diff --git a/test/lib.sh b/test/lib.sh index 634216a7..36d3ee40 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -224,8 +224,15 @@ if $SNMPCHECK; then snmpgetstr="$(type -p snmpget) -c public -v2c localhost " snmpgetnext="$(type -p snmpgetnext) -On -c public -v2c localhost " snmpgetnextstr="$(type -p snmpgetnext) -c public -v2c localhost " - snmptable="$(type -p snmptable) -c public -v2c localhost " - snmpwalk="$(type -p snmpwalk) -c public -v2c localhost " + if [ $valgrindtest -ne 0 ]; then + # To avoid "Timeout: No Response from localhost" from netsnmp/snmpd set timeout to 10s + snmptable="$(type -p snmptable) -c public -v2c localhost -t 10 " + snmpwalk="$(type -p snmpwalk) -c public -v2c localhost -t 10 " + else + snmptable="$(type -p snmptable) -c public -v2c localhost " + snmpwalk="$(type -p snmpwalk) -c public -v2c localhost " + fi + snmpwalkstr="$(type -p snmpwalk) -c public -v2c localhost " snmptranslate="$(type -p snmptranslate) " if [ "${ENABLE_NETSNMP}" == "yes" ]; then diff --git a/test/test_snmp_entity.sh b/test/test_snmp_entity.sh index 49755114..038e74fd 100755 --- a/test/test_snmp_entity.sh +++ b/test/test_snmp_entity.sh @@ -519,7 +519,7 @@ expectpart "$($snmpwalk $ENTITY_OID)" 0 "SNMPv2-SMI::mib-2.47.1.1.1.1.1.1 = INTE "SNMPv2-SMI::mib-2.47.1.1.1.1.15.1 = STRING: \"Asset 123\"" \ "SNMPv2-SMI::mib-2.47.1.1.1.1.15.2 = STRING: \"Asset 456\"" \ "SNMPv2-SMI::mib-2.47.1.1.1.1.16.1 = INTEGER: 1" \ - "SNMPv2-SMI::mib-2.47.1.1.1.1.16.2 = INTEGER: 2" \ + "SNMPv2-SMI::mib-2.47.1.1.1.1.16.2 = INTEGER: 2" new "Cleaning up" testexit diff --git a/test/test_snmp_ifmib.sh b/test/test_snmp_ifmib.sh index 1b574cbc..3b6261ef 100755 --- a/test/test_snmp_ifmib.sh +++ b/test/test_snmp_ifmib.sh @@ -13,12 +13,6 @@ if [ ${ENABLE_NETSNMP} != "yes" ]; then if [ "$s" = $0 ]; then exit 0; else return 0; fi fi -snmpd=$(type -p snmpd) -snmpget="$(type -p snmpget) -On -c public -v2c localhost " -snmpgetnext="$(type -p snmpgetnext) -On -c public -v2c localhost " -snmptable="$(type -p snmptable) -c public -v2c localhost " -snmpwalk="$(type -p snmpwalk) -c public -v2c localhost " - cfg=$dir/conf_startup.xml fyang=$dir/clixon-example.yang fstate=$dir/state.xml @@ -487,6 +481,10 @@ expectpart "$($snmpwalk IF-MIB::ifRcvAddressTable)" 0 "IF-MIB::ifRcvAddressAddre "IF-MIB::ifRcvAddressType.1.\"11:bb:cc:dd:ee:ff\" = INTEGER: other(1)" \ "IF-MIB::ifRcvAddressType.2.\"aa:22:33:44:55:66\" = INTEGER: volatile(2)" +# XXX with valgrind on backend this fails with: +# Error in packet. +# Reason: (genError) A general failure occured +# Failed object: IF-MIB::ifName.2 new "Walk ifXTable" expectpart "$($snmpwalk IF-MIB::ifXTable)" 0 "IF-MIB::ifName.1 = STRING: ifname1" \ "IF-MIB::ifName.2 = STRING: ifname2" diff --git a/test/test_snmp_system.sh b/test/test_snmp_system.sh old mode 100644 new mode 100755 index 02c1486a..e5749dd9 --- a/test/test_snmp_system.sh +++ b/test/test_snmp_system.sh @@ -13,13 +13,6 @@ if [ ${ENABLE_NETSNMP} != "yes" ]; then if [ "$s" = $0 ]; then exit 0; else return 0; fi fi -snmpd=$(type -p snmpd) -snmpget="$(type -p snmpget) -On -c public -v2c localhost " -snmpwalk="$(type -p snmpwalk) -On -c public -v2c localhost " -snmpwalkstr="$(type -p snmpwalk) -c public -v2c localhost " -snmpgetnext="$(type -p snmpgetnext) -On -c public -v2c localhost " -snmptable="$(type -p snmptable) -c public -v2c localhost " - cfg=$dir/conf_startup.xml fyang=$dir/clixon-example.yang fstate=$dir/state.xml