Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / net-snmp / testing / tests / T122proxysetfail
1 #!/bin/sh
2
3 . ../eval_tools.sh
4
5 HEADER Proxy illegal SET handling support
6
7 SKIPIFNOT USING_UCD_SNMP_PROXY_MODULE
8 SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
9
10 #
11 # Begin test
12 #
13
14 # standard V3 configuration for initial user
15 . ./Sv3config
16 # config the proxy
17 CONFIGAGENT proxy -t 2 -r 1 -v 2c -c testcommunity udp:localhost:7676 system
18
19 # Start the agent without initializing the system mib.
20 ORIG_AGENT_FLAGS="$AGENT_FLAGS"
21 AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -Dproxy"
22 STARTAGENT
23
24 # test to see that the current agent doesn't support the system mib
25 #CAPTURE "snmpget -On -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
26
27 #CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
28
29 #if test "$snmp_last_test_result" = 1; then
30   # test the proxy subagent by first running it...
31
32   SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
33   SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
34   SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
35   SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
36   SNMP_CONFIG_FILE="$SNMP_TMPDIR/proxy.conf"
37   echo "rwcommunity testcommunity" >> $SNMP_CONFIG_FILE
38 #  echo "syscontact testcontact" >> $SNMP_CONFIG_FILE
39   AGENT_FLAGS="$ORIG_AGENT_FLAGS -Dmib_init"
40   ORIG_SNMP_SNMPD_PORT=$SNMP_SNMPD_PORT
41   SNMP_SNMPD_PORT="7676"
42   STARTAGENT
43   SNMP_SNMPD_PORT=$ORIG_SNMP_SNMPD_PORT
44
45   # test to see that the agent now supports the system mib
46   CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0"
47
48   
49   # we don't know the real value, unfortunately, so we test for what
50   # we should *not* get back.
51   CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
52
53   if test "$snmp_last_test_result" = 0; then
54
55     # test to see that the agent now supports the system mib
56     CAPTURE "snmpset -On -Ir $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0 i 42"
57
58     CHECK ".1.3.6.1.2.1.1.4.0 = Wrong Type"
59
60   fi
61
62   # stop the subagent
63   STOPAGENT
64
65   SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
66   SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
67 #fi
68
69 # stop the master agent
70 STOPAGENT
71
72 # all done (whew)
73 FINISHED