Added snmpwalk tests for system.

This commit is contained in:
Kristofer Hallin 2022-06-07 21:36:40 +02:00 committed by Olof hagsand
parent 7eafd2e400
commit 461ebd38d6

View file

@ -15,6 +15,7 @@ fi
snmpd=$(type -p snmpd) snmpd=$(type -p snmpd)
snmpget="$(type -p snmpget) -On -c public -v2c localhost " snmpget="$(type -p snmpget) -On -c public -v2c localhost "
snmpwalk="$(type -p snmpwalk) -On -c public -v2c localhost " snmpwalk="$(type -p snmpwalk) -On -c public -v2c localhost "
snmpwalkstr="$(type -p snmpwalk) s-c public -v2c localhost "
snmpgetnext="$(type -p snmpgetnext) -On -c public -v2c localhost " snmpgetnext="$(type -p snmpgetnext) -On -c public -v2c localhost "
snmptable="$(type -p snmptable) -c public -v2c localhost " snmptable="$(type -p snmptable) -c public -v2c localhost "
@ -211,6 +212,24 @@ validate_oid $NAME_ORTABLE2 $NAME_ORTABLE2 "STRING" "Entry 2 description"
new "Get table sysORTable $OID_ORTABLE" new "Get table sysORTable $OID_ORTABLE"
expectpart "$($snmptable $OID_ORTABLE)" 0 ".*Entry 1 description.*" "IP-MIB::ip" "1:7:10:33.44" expectpart "$($snmptable $OID_ORTABLE)" 0 ".*Entry 1 description.*" "IP-MIB::ip" "1:7:10:33.44"
expectpart "$($snmptable $OID_ORTABLE)" 0 ".*Entry 2 description.*" "IF-MIB::ifTable" "129:20:58:31.11" expectpart "$($snmptable $OID_ORTABLE)" 0 ".*Entry 2 description.*" "IF-MIB::ifTable" "129:20:58:31.11"
expectpart "$($snmptable $NAME_ORTABLE)" 0 ".*Entry 1 description.*" "IP-MIB::ip" "1:7:10:33.44"
expectpart "$($snmptable $NAME_ORTABLE)" 0 ".*Entry 2 description.*" "IF-MIB::ifTable" "129:20:58:31.11"
new "Walk the tabbles..."
expectpart "$($snmpwalkstr system)" 0 "SNMPv2-MIB::sysDescr = STRING: System description." \
"SNMPv2-MIB::sysUpTime = Timeticks: (11223344) 1 day, 7:10:33.44" \
"SNMPv2-MIB::sysContact = STRING: clixon@clicon.com." \
"SNMPv2-MIB::sysName = STRING: Test." \
"SNMPv2-MIB::sysLocation = STRING: Clixon HQ." \
"SNMPv2-MIB::sysServices = INTEGER: 72" \
"SNMPv2-MIB::sysORIndex.1 = INTEGER: 1" \
"SNMPv2-MIB::sysORIndex.2 = INTEGER: 2" \
"SNMPv2-MIB::sysORID.1 = OID: IP-MIB::ip" \
"SNMPv2-MIB::sysORID.2 = OID: IF-MIB::ifTable" \
"SNMPv2-MIB::sysORDescr.1 = STRING: Entry 1 description." \
"SNMPv2-MIB::sysORDescr.2 = STRING: Entry 2 description." \
"SNMPv2-MIB::sysORUpTime.1 = Timeticks: (11223344) 1 day, 7:10:33.44" \
"SNMPv2-MIB::sysORUpTime.2 = Timeticks: (1122111111) 129 days, 20:58:31.11"
new "Cleaning up" new "Cleaning up"
testexit testexit