#!/usr/local/bin/expect -f source ../gated.tcl # pim.tcl defines MIB variables and redefines some function from gated.tcl source pim.tcl # This script tests for correct PIMv2 prune and join functionality on a LAN # among GateD routers. # # This script must be run as root on the control machine and ssh must # be set up all all machines to allow root to connect via ssh without # a password (i.e. a .shosts file must be set up). # # Tests: # - Multiaccess network prunes and joins # - (S,G) state timeout with active receivers # # # N2 N3 # +--- B ------- R # N1 | B1 B2 R1 # S ------- A ---+ # S1 A1 A2 | # +--- C -- ... # C1 C2 # # # This script should be executed on router A. # # # This section needs to be configured with the machine information # # username for remote actions not requiring root access (e.g. ping) set username kurtw # OSPF area set ospfarea 128.223.163.0 # networks set N1 128.223.163/24 set N2 128.223.91/24 set N3 128.223.226/24 # peabody (sending host) set S 128.223.163.125 set S1 128.223.163.125 # makaha (receiving host) set R 128.223.226.128 set R1 128.223.226.128 # canejo set A 128.223.163.129 set A1 128.223.163.129 set A2 128.223.91.129 # rincon set B 128.223.91.127 set B1 128.223.91.127 set B2 128.223.226.127 # seaside set C 128.223.91.126 set C1 128.223.91.126 set C2 128.223.227.126 set Aconfig /root/gated-confs/pimdm_lan_prune_join.conf set Agated /home/kurtw/gated-multi/src/gated/gated set Bconfig /root/gated-confs/pimdm_lan_prune_join.conf set Bgated /home/kurtw/gated-multi/src/gated/gated set Cconfig /root/gated-confs/pimdm_lan_prune_join.conf set Cgated /home/kurtw/gated-multi/src/gated/gated set G 225.1.2.3 # # Shouldn't need to change anything below here # # Delay for igmp-leave triggered prune to propogate upstream # 3 seconds x number_hops + C set leavewait 8 trap shutdown SIGINT proc shutdown {} { cleanup exit } proc cleanup {} { global A B C A1 B1 C1 puts "-----------------------------------------------------------------------" puts "Cleaning up..." stop_gated $A stop_gated $B stop_gated $C puts "ok" } # 0) Clean up puts "-----------------------------------------------------------------------" puts "Step 0: Clean up" cleanup # 1) Start gated on routers A, B and C puts "-----------------------------------------------------------------------" puts "Step 1a: Start gated on router $A" save_file $A $Aconfig "\ traceoptions \"/var/log/gated.test.log\" replace all;\n\ interfaces { interface all passive; };\n\ router-id $A;\n\ icmp {};\n\ igmp yes {};\n\ ospf yes {\n\ defaults {\n\ ribs unicast multicast;\n\ };\n\ area $ospfarea {\n\ authtype none;\n\ interface all {\n\ priority 5;\n\ enable;\n\ };\n\ };\n\ };\n\ pim yes {\n\ dense \"dm0\" { interface all enable; };\n\ };\n\ " if { [start_gated $A $Agated $Aconfig] == 0 } { puts "failed" exit } else { puts "ok" } puts "-----------------------------------------------------------------------" puts "Step 1b: Start gated on router $B" save_file $B $Bconfig "\ traceoptions \"/var/log/gated.test.log\" replace all;\n\ interfaces { interface all passive; };\n\ router-id $B;\n\ icmp {};\n\ igmp yes {};\n\ ospf yes {\n\ defaults {\n\ ribs unicast multicast;\n\ };\n\ area $ospfarea {\n\ authtype none;\n\ interface all {\n\ priority 5;\n\ enable;\n\ };\n\ };\n\ };\n\ pim yes {\n\ dense \"dm0\" { interface all enable; };\n\ };\n\ " if { [start_gated $B $Bgated $Bconfig] == 0 } { puts "failed" exit } else { puts "ok" } puts "-----------------------------------------------------------------------" puts "Step 1c: Start gated on router $C and wait 60 seconds" save_file $C $Cconfig "\ traceoptions \"/var/log/gated.test.log\" replace all;\n\ interfaces { interface all passive; };\n\ router-id $C;\n\ icmp {};\n\ igmp yes {};\n\ ospf yes {\n\ defaults {\n\ ribs unicast multicast;\n\ };\n\ area $ospfarea {\n\ authtype none;\n\ interface all {\n\ priority 5;\n\ enable;\n\ };\n\ };\n\ };\n\ pim yes {\n\ dense \"dm0\" { interface all enable; };\n\ };\n\ " if { [start_gated $C $Bgated $Cconfig] == 0 } { puts "failed" exit } else { puts "ok" } # wait for unicast routes to stablize sleep 60 set AifIndex1 [IP2IntfIndex $A $A1] set AifIndex2 [IP2IntfIndex $A $A2] set BifIndex1 [IP2IntfIndex $B $B1] set BifIndex2 [IP2IntfIndex $B $B2] set CifIndex1 [IP2IntfIndex $C $C1] set CifIndex2 [IP2IntfIndex $C $C2] # 2) Verify that A doesn't consider N2 a leaf network for the N1 route. puts "-----------------------------------------------------------------------" puts "Step 2: Verify that $A doesn't consider $N2 a leaf network for the $N1 route." # Check that A has neighbors on N2 besides its own interface, specifically, B1. set ret [snmpget $A ${pimNeighborEntry}.2.${B1}] if { $ret == $AifIndex2 } { puts "ok" } else { puts "failed" exit } # 3) Verify that B considers N3 a leaf network. puts "-----------------------------------------------------------------------" puts "Step 3: Verify that $B considers $N3 a leaf network." # Check that B has NO neighbors on N3 except its own interface, B2. set ret [snmpget $B ${pimNeighborEntry}.2.${R1}] if { $ret == "no_such_variable" } { puts "ok for $R1" } else { puts "failed" exit } # 4) Join group G from host R, and wait 1 second. # This will have no effect on routing since there is no router state for G puts "-----------------------------------------------------------------------" puts -nonewline "Step 4: Join group $G from host $R, and wait 3 seconds..." if { [mtest_join $R $username $G $R1] == 0 } { puts "join failed" exit } puts "ok" sleep 1 # 5) Ping group G from host S, and wait 1 second puts "-----------------------------------------------------------------------" puts -nonewline "Step 5: Ping group $G from host $S on interface $S1 and wait 5 seconds..." set ret [send_ping $S $username $S1 $G] sleep 5 # 6) Verify that A now has N2 in the oiflist of (S,G). puts "-----------------------------------------------------------------------" puts "Step 6: Verify that $A now has $N2 in the oiflist of ($S,$G)" puts -nonewline " Querying ipMRouteNextHopState table..." set ret [snmpget $A ${ipMRouteNextHopState}.${G}.${S1}.255.255.255.255.${AifIndex2}.${G}] if { $ret == "2" } { puts "ok" } else { puts "failed with $N2 state value $ret" exit } # 7) Verify that B now has N3 in the oiflist of (S,G). puts "-----------------------------------------------------------------------" puts "Step 7: Verify that $B now has $N3 in the oiflist of ($S,$G)" puts -nonewline " Querying ipMRouteNextHopState table..." set ret [snmpget $B ${ipMRouteNextHopState}.${G}.${S1}.255.255.255.255.${BifIndex2}.${G}] if { $ret == "2" } { puts "ok" } else { puts "failed with $N3 state value $ret" exit } # 8) Verify that C has (S,G) forwarding state with null oif-list puts "-----------------------------------------------------------------------" puts "Step 8: Verify that $C has ($S1,$G) forwarding state with null oif-list" puts -nonewline " : Querying $C's ipMRouteUpstreamNeighbor table..." set ret [snmpget $C ${ipMRouteUpstreamNeighbor}.${G}.${S1}.255.255.255.255 ] if { $ret == "IpAddress: $A2" } { puts "ok" } else { puts "failed with upstream neighbor value $ret" exit } puts -nonewline " : Querying $C's ipMRouteNextHopState object..." set ret [snmpget $C ${ipMRouteNextHopState}.${G}.${S1}.255.255.255.255.${CifIndex2}.${G}] if { $ret == "no_such_variable" } { puts "ok" } else { puts "failed with return code $ret" exit } # Wait for (S,G) state to timeout puts "-----------------------------------------------------------------------" puts "Waiting for ($S1,$G) state to time out" sleep 300 # 9) Verify that both A, B and C have timed out their (S,G) state # 9a) Verify that A has timed out its (S,G) state puts "-----------------------------------------------------------------------" puts "Step 9a: Verifying that $A has timed out its ($S1,$G) state" puts -nonewline " : Querying $A's ipMRouteUpstreamNeighbor table..." set ret [snmpget $A ${ipMRouteUpstreamNeighbor}.${G}.${S1}.255.255.255.255 ] if {$ret == "no_such_variable"} { puts "ok" } else { puts "failed with upstream neighbor value $ret" exit } puts "-----------------------------------------------------------------------" puts "Step 9b: Verifying that $B has timed out its ($S1,$G) state" puts -nonewline " : Querying $B's ipMRouteUpstreamNeighbor table..." set ret [snmpget $B ${ipMRouteUpstreamNeighbor}.${G}.${S1}.255.255.255.255 ] if {$ret == "no_such_variable"} { puts "ok" } else { puts "failed with upstream neighbor value $ret" exit } puts "-----------------------------------------------------------------------" puts "Step 9c: Verifying that $C has timed out its ($S1,$G) state" puts -nonewline " : Querying $C's ipMRouteUpstreamNeighbor table..." set ret [snmpget $C ${ipMRouteUpstreamNeighbor}.${G}.${S1}.255.255.255.255 ] if {$ret == "no_such_variable"} { puts "ok" } else { puts "failed with upstream neighbor value $ret" exit } # 10) Leave group G on host R. puts "-----------------------------------------------------------------------" puts "Step 10: Leave group $G on host $R and wait $leavewait seconds..." if { [mtest_leave $R $username $G $R1] == 0 } { puts "failed" exit } puts "ok" # 11) Halt gated on A and B. puts "-----------------------------------------------------------------------" puts "Step 11: Halt gated on $A, $B and $C" puts -nonewline "Step 11a: Halt gated on $B..." if { [stop_gated $B] == 0 } { puts "failed" exit } else { puts "ok" } puts "-----------------------------------------------------------------------" puts -nonewline "Step 11b: Halt gated on $C..." if { [stop_gated $C] == 0 } { puts "failed" exit } else { puts "ok" } puts "-----------------------------------------------------------------------" puts -nonewline "Step 11c: Halt gated on $A..." if { [stop_gated $A] == 0 } { puts "failed" exit } else { puts "ok" } puts "TEST SUCCESSFULLY COMPLETED!"