#!/usr/local/bin/expect -f source ../gated.tcl source pim.tcl # This script tests for correct PIMv2 neighbor functionality 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). # # # # 128.223.91/24 # ---------------------- test plane # | | # A1 B1 # rincon seaside # FreeBSD FreeBSD # 2.2.2 2.2.2 # A B # | | # ----------------------- control plane # | # 128.223.163.129 # controller # # # The controller must connect to the test routers on a LAN other than the # test plane, since interfaces on the test plane will not always be up. # # This section needs to be configured with the machine information # # OSPF area set ospfarea 128.223.163.0 # rincon set A 128.223.163.127 set A1 128.223.91.127 set Aconfig /root/gated-confs/pim_nbrs_test.conf set Agated /home/kurtw/gated-multi/src/gated/gated # seaside set B 128.223.163.126 set B1 128.223.91.126 set Bconfig /root/gated-confs/pim_nbrs_test.conf # # NOTE: the machine running this script must connect to A on an interface # OTHER THAN A1. If A is the local machine, then we must connect to # B over an interface other than A1. # # # Shouldn't need to change anything below here # trap shutdown SIGINT proc shutdown {} { cleanup exit } proc cleanup {} { global A B A1 B1 puts "-----------------------------------------------------------------------" puts "Cleaning up..." stop_gated $A stop_gated $B interface_up $A $A1 interface_up $B $B1 puts "ok" } # 0) Clean up puts "-----------------------------------------------------------------------" puts "Step 0: Clean up" cleanup # 1) Start gated on router A puts "-----------------------------------------------------------------------" puts "Step 1: Start gated on router $A" save_file $A $Aconfig "\ traceoptions \"gated.trace\" 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" } # 2) Start gated on router B, and wait 15 seconds ( puts "-----------------------------------------------------------------------" puts "Step 2: Start gated on router $B and wait 15 seconds" save_file $B $Bconfig "\ traceoptions \"gated.trace\" 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" } sleep 15 set AifIndex [IP2IntfIndex $A $A1] set BifIndex [IP2IntfIndex $B $B1] # 3) Verify that A and B have neighbor state for each other puts "-----------------------------------------------------------------------" puts "Step 3: Verify that $A has neighbor state for $B" set ret [snmpget $A ${pimNeighborEntry}.2.${B1}] if { $ret == $AifIndex } { puts "ok" } else { puts "failed" exit } puts "-----------------------------------------------------------------------" puts "Step 4: Verify that $B has neighbor state for $A" set ret [snmpget $B ${pimNeighborEntry}.2.${A1}] if { $ret == $BifIndex } { puts "ok" } else { puts "failed" exit } # The interface neighbor should timeout in <= 105 seconds set deadtimeout 110 # 5) Take router A's interface down, and wait deadtimeout seconds. puts "-----------------------------------------------------------------------" puts "Step 5: Take router $A's interface $A1 down, and wait $deadtimeout seconds." if { [interface_down $A $A1] == 0 } { puts "failed" exit } else { puts "ok" } sleep $deadtimeout # 6) Verify that B has no neighbor state for A puts "-----------------------------------------------------------------------" puts "Step 6: Verify that $B has no neighbor state for $A" set ret [snmpget $B ${pimNeighborEntry}.2.${A1}] if { $ret == "no_such_variable" } { puts "ok" } else { puts "failed" exit } # 7) Bring router A's interface back up, and wait 35 seconds puts "-----------------------------------------------------------------------" puts "Step 7: Bring router $A's interface $A1 back up, and wait 35 seconds" if { [interface_up $A $A1] == 0 } { puts "failed to bring up interface" exit } puts "ok" sleep 35 # 8) Verify that A and B have neighbor state for each other puts "-----------------------------------------------------------------------" puts "Step 8: Verify that $A has neighbor state for $B" set ret [snmpget $A ${pimNeighborEntry}.2.${B1}] if { $ret == $AifIndex } { puts "ok" } else { puts "failed" exit } puts "-----------------------------------------------------------------------" puts "Step 9: Verify that $B has neighbor state for $A" set ret [snmpget $B ${pimNeighborEntry}.2.${A1}] if { $ret == $BifIndex } { puts "ok" } else { puts "failed" exit } # 10) Clean up cleanup puts "TEST SUCCESSFULLY COMPLETED!"