snmpset tests re-written.
This commit is contained in:
parent
d15879890d
commit
44d7d898bb
2 changed files with 75 additions and 119 deletions
28
test/lib.sh
28
test/lib.sh
|
|
@ -216,6 +216,7 @@ fi
|
|||
|
||||
if $SNMPCHECK; then
|
||||
snmpget="$(type -p snmpget) -On -c public -v2c localhost "
|
||||
snmpset="$(type -p snmpset) -On -c public -v2c localhost "
|
||||
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 "
|
||||
|
|
@ -266,6 +267,33 @@ if $SNMPCHECK; then
|
|||
expectpart "$($snmpgetnextstr $name)" 0 "$name2 = $type: $value"
|
||||
fi
|
||||
}
|
||||
|
||||
function validate_set(){
|
||||
oid=$1
|
||||
type=$2
|
||||
value=$3
|
||||
|
||||
case $type in
|
||||
"INTEGER")
|
||||
set_type="i"
|
||||
;;
|
||||
"STRING")
|
||||
set_type="s"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $type == "INTEGER" ]; then
|
||||
set_type="i"
|
||||
fi
|
||||
|
||||
new "Setting value $value to OID $oid with type $set_type"
|
||||
|
||||
if [ $type == "STRING" ]; then
|
||||
expectpart "$($snmpset $oid $set_type "$value")" 0 "$type: \"$value\""
|
||||
else
|
||||
expectpart "$($snmpset $oid $set_type "$value")" 0 "$type: $value"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# Check sanity between --with-restconf setting and if nginx is started by systemd or not
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue