Debian Codegraph @

testing/fulltests/default/T069exechup_simple

raw
1 #!/bin/sh
2
3 . ../support/simple_eval_tools.sh
4
5 HEADER "eval configuration constency after SIGHUP"
6
7 SKIPIFNOT USING_UCD_SNMP_EXTENSIBLE_MODULE
8 SKIPIF NETSNMP_DISABLE_SNMPV2C
9
10 # make sure snmpset and snmpwalk can be executed
11 SNMPSET="${builddir}/apps/snmpset"
12 [ -x "$SNMPSET" ] || SKIP snmpset not compiled
13 SNMPWALK="${builddir}/apps/snmpwalk"
14 [ -x "$SNMPWALK" ] || SKIP snmpwalk not compiled
15
16 snmp_version=v2c
17 snmp_write_access='all'
18 TESTCOMMUNITY=testcommunity
19 . ./Sv2cconfig
20
21 #
22 # Begin test
23 #
24 if [ "x$OSTYPE" = xmsys ]; then
25 cmd1="true"
26 cmd2="false"
27 echo="echo"
28 else
29 cmd1="$(which true)"
30 cmd2="$(which false)"
31 echo="$(which echo)"
32 fi
33 CONFIGAGENT exec true-command $cmd1
34 CONFIGAGENT exec false-command $cmd2
35
36 STARTAGENT
37
38 # Check a full walk of UCD-SNMP-MIB::extTable
39 CAPTURE "$SNMPWALK $SNMP_FLAGS -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::extEntry"
40 CHECK 'UCD-SNMP-MIB::extNames.1 = STRING: true-command$'
41 CHECK 'UCD-SNMP-MIB::extCommand.1 = STRING: '"$cmd1"
42 CHECK 'UCD-SNMP-MIB::extResult.1 = INTEGER: 0$'
43 CHECK 'UCD-SNMP-MIB::extOutput.1 = STRING: $'
44 CHECK 'UCD-SNMP-MIB::extNames.2 = STRING: false-command$'
45 CHECK 'UCD-SNMP-MIB::extCommand.2 = STRING: '"$cmd2"'$'
46 CHECK 'UCD-SNMP-MIB::extResult.2 = INTEGER: 1$'
47 CHECK 'UCD-SNMP-MIB::extOutput.2 = STRING: $'
48
49 # Send HUP
50 HUPAGENT
51
52 # Check a full walk of UCD-SNMP-MIB::extTable
53 CAPTURE "$SNMPWALK $SNMP_FLAGS -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::extEntry"
54 CHECK 'UCD-SNMP-MIB::extNames.1 = STRING: true-command$'
55 CHECK 'UCD-SNMP-MIB::extCommand.1 = STRING: '"$cmd1"
56 CHECK 'UCD-SNMP-MIB::extResult.1 = INTEGER: 0$'
57 CHECK 'UCD-SNMP-MIB::extOutput.1 = STRING: $'
58 CHECK 'UCD-SNMP-MIB::extNames.2 = STRING: false-command$'
59 CHECK 'UCD-SNMP-MIB::extCommand.2 = STRING: '"$cmd2"'$'
60 CHECK 'UCD-SNMP-MIB::extResult.2 = INTEGER: 1$'
61 CHECK 'UCD-SNMP-MIB::extOutput.2 = STRING: $'
62 # We shouldn't have more rows.
63 CHECKANDDIE 'UCD-SNMP-MIB::extNames.3'
64 CHECKANDDIE 'UCD-SNMP-MIB::extNames.4'
65
66 STOPAGENT
67 FINISHED