Debian Codegraph @

testing/fulltests/default/T111agentxset_simple

raw
1 #!/bin/sh
2
3 . ../support/simple_eval_tools.sh
4
5 HEADER AgentX SET support
6
7 SKIPIFNOT USING_AGENTX_MASTER_MODULE
8 SKIPIFNOT USING_AGENTX_SUBAGENT_MODULE
9 SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
10 SKIPIF NETSNMP_DISABLE_SET_SUPPORT
11 SKIPIF NETSNMP_NO_WRITE_SUPPORT
12
13 #
14 # Begin test
15 #
16
17 # standard V3 configuration for initial user
18 . ./Sv3config
19
20 # Start the agent without initializing the system mib.
21 if [ "x$SNMP_TRANSPORT_SPEC" = "xunix" ];then
22 ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
23 else
24 ORIG_AGENT_FLAGS="$AGENT_FLAGS -x tcp:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT}"
25 fi
26 AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib,winExtDLL -DAgentX"
27 STARTAGENT
28
29 # test to see that the current agent doesn't support the system mib
30 CAPTURE "snmpget -On -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0"
31
32 CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
33
34 if test "$snmp_last_test_result" = 1; then
35 # test the AgentX subagent by first running it...
36
37 SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
38 SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
39 SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
40 SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
41 AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I system_mib"
42 SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
43 echo "psyscontact testcontact" >> $SNMP_CONFIG_FILE
44 STARTAGENT
45
46 # test to see that the agent now supports the system mib
47 CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0"
48
49 CHECK ".1.3.6.1.2.1.1.4.0 = STRING: \"*testcontact"
50
51 if test "$snmp_last_test_result" = 1; then
52
53 # test to see that the agent now supports setting the system mib
54 CAPTURE "snmpset -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0 s newtestcontact"
55
56 CHECK ".1.3.6.1.2.1.1.4.0 = STRING: \"*newtestcontact"
57
58 if test "$snmp_last_test_result" = 1; then
59
60 # test to see that the agent now supports the system mib
61 CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0"
62
63 CHECK ".1.3.6.1.2.1.1.4.0 = STRING: \"*newtestcontact"
64 fi
65 fi
66
67 # stop the subagent
68 STOPAGENT
69
70 SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
71 SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
72 fi
73
74 # stop the master agent
75 STOPAGENT
76
77 # all done (whew)
78 FINISHED