Debian Codegraph @

testing/fulltests/default/T068execfix_simple

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