📄 test_rib_fea1.sh
字号:
# Try and verify that the correct route has popped out at peer2. sleep 2 coord peer2 trie recv lookup $NLRI1 aspath "$AS,$PEER1_AS" coord peer2 trie recv lookup $NLRI2 aspath "$AS,$PEER1_AS" coord peer2 trie recv lookup $NLRI3 aspath "$AS,$PEER1_AS" coord peer2 trie recv lookup $NLRI4 aspath "$AS,$PEER1_AS" # Make sure that the connections still exist. coord peer1 assert established coord peer2 assert established coord peer3 assert established # Tidy up. Remove any routes that we may have added to the RIB. delete_route4 connected true false 128.16.0.0/16 # At this point the RIB can no longer resolve the nexthop associated # with this net so the net should no longer be present. sleep 2 coord peer2 trie recv lookup $NLRI1 not coord peer2 trie recv lookup $NLRI2 not coord peer2 trie recv lookup $NLRI3 not coord peer2 trie recv lookup $NLRI4 not}NLRI1_IPV6=10:10:10:10:10:00:00:00/80NLRI2_IPV6=20:20:20:20:20:00:00:00/80NLRI3_IPV6=30:30:30:30:30:00:00:00/80NLRI4_IPV6=40:40:40:40:40:00:00:00/80test1_ipv6(){ echo "TEST1 IPV6 - Exercise the next hop resolver" config_peers_ipv6 PACKET1="packet update origin 2 aspath $PEER1_AS_IPV6 nexthop6 128:16::1 nlri6 $NLRI1_IPV6 nlri6 $NLRI2_IPV6" PACKET2="packet update origin 2 aspath $PEER1_AS_IPV6 nexthop6 128:16:1::1 nlri6 $NLRI3_IPV6 nlri6 $NLRI4_IPV6" # XXX This next hop should not resolve. coord peer1 send $PACKET1 coord peer1 send $PACKET2 echo "Sent routes to BGP, waiting..." sleep 2 coord peer2 trie recv lookup $NLRI1_IPV6 not coord peer2 trie recv lookup $NLRI2_IPV6 not coord peer2 trie recv lookup $NLRI3_IPV6 not coord peer2 trie recv lookup $NLRI4_IPV6 not # Lets get it to resolve. add_route6 connected true false 128:16::0/32 $NH1_IPV6 # Add a different route. add_route6 connected true false 128:16::0/48 $NH2_IPV6 # Delete the better route. delete_route6 connected true false 128:16::0/48 # Try and verify that the correct route has popped out at peer2. sleep 2 coord peer2 trie recv lookup $NLRI1_IPV6 aspath "$AS,$PEER1_AS_IPV6" coord peer2 trie recv lookup $NLRI2_IPV6 aspath "$AS,$PEER1_AS_IPV6" coord peer2 trie recv lookup $NLRI3_IPV6 aspath "$AS,$PEER1_AS_IPV6" coord peer2 trie recv lookup $NLRI4_IPV6 aspath "$AS,$PEER1_AS_IPV6" # Make sure that the connections still exist. coord peer1 assert established coord peer2 assert established coord peer3 assert established # Tidy up. Remove any routes that we may have added to the RIB. delete_route6 connected true false 128:16::0/32 # At this point the RIB can no longer resolve the nexthop associated # with this net so the net should no longer be present. sleep 2 coord peer2 trie recv lookup $NLRI1_IPV6 not coord peer2 trie recv lookup $NLRI2_IPV6 not coord peer2 trie recv lookup $NLRI3_IPV6 not coord peer2 trie recv lookup $NLRI4_IPV6 not}test2(){ echo "TEST2 - Run test1 twice with the same process" test1 test1}test2_ipv6(){ echo "TEST2 IPV6 - Run test1 twice with the same process" test1_ipv6 test1_ipv6}test3(){ echo "TEST3 - Try and force a deregistration from the RIB" config_peers PACKET1="packet update origin 2 aspath $PEER1_AS nexthop 128.16.0.1 nlri 10.10.10.0/24 nlri 20.20.20.20/24" # XXX This next hop should not resolve. coord peer1 send $PACKET1 sleep 2 # Lets get it to resolve. add_route4 connected true false 128.16.0.0/16 172.16.1.2 1 # Add a different route. add_route4 connected true false 128.16.0.0/24 172.16.2.2 1 # Delete the better route. delete_route4 connected true false 128.16.0.0/24 # Try and verify that the correct route has popped out at peer2. coord peer1 assert established coord peer2 assert established coord peer3 assert established # Tidy up. Remove any routes that we may have added to the RIB. delete_route4 connected true false 128.16.0.0/16 config_peers}test4(){ # 1) Send an update packet on peer1 with a nexthop that is not resolvable. # 2) Make the next hop resolvable by adding a route to the RIB. # 3) Verify that an update packet now pops out of peer2 and peer3. echo "TEST4 - Metrics changing for a nexthop" config_peers PACKET="packet update origin 2 aspath $PEER1_AS nexthop 128.16.0.1 nlri 10.10.10.0/24" # At this point the nexthop should not resolve. coord peer1 send $PACKET # Make sure that update packet has popped out even though the nexthops # are not resolvable. sleep 2 coord peer2 trie recv lookup 10.10.10.0/24 not coord peer3 trie recv lookup 10.10.10.0/24 not # Lets get it to resolve. add_route4 connected true false 128.16.0.0/16 172.16.1.2 1 # Try and verify that the correct route has popped out at peer2. sleep 2 coord peer2 trie recv lookup 10.10.10.0/24 aspath "$AS,$PEER1_AS" coord peer3 trie recv lookup 10.10.10.0/24 aspath "$PEER1_AS" # Make sure that the connections still exist. coord peer1 assert established coord peer2 assert established coord peer3 assert established}test5(){ echo "TEST5: " echo " 1) Send two update packets with the same route" echo " 2) The nexthops are different one resolves the other doesn't" echo " 3) The route add on the RIB causes the unresolvable nexthop to resolve" config_peers PACKET1="packet update origin 2 aspath $PEER1_AS nexthop 1.2.3.4 nlri 10.10.10.0/24" PACKET2="packet update origin 2 aspath $PEER1_AS nexthop 128.16.0.1 nlri 10.10.10.0/24" # The nexthop for this packet should never be resolvable. coord peer1 send $PACKET1 # Verify that no update packets have been sent to the peers. sleep 2 coord peer2 trie recv lookup 10.10.10.0/24 not coord peer3 trie recv lookup 10.10.10.0/24 not # Make sure that the nexthop carried in PACKET2 will resolve add_route4 connected true false 128.16.0.0/16 172.16.1.2 1 sleep 2 # Sending this used to cause a fatal error in BGP. coord peer1 send $PACKET2 # Try and verify that the correct route has popped out at peer2. sleep 2 coord peer2 trie recv lookup 10.10.10.0/24 aspath "$AS,$PEER1_AS" coord peer3 trie recv lookup 10.10.10.0/24 aspath "$PEER1_AS" # Make sure that the connections still exist. coord peer1 assert established coord peer2 assert established coord peer3 assert established}test6(){ echo "TEST6: " echo " 1) Send two update packets with the same route" echo " 2) The nexthops are different one resolves the other doesn't" echo " 3) The route add on the RIB doesn't cause the unresolvable nexthop to resolve" config_peers PACKET1="packet update origin 2 aspath $PEER1_AS nexthop 1.2.3.4 nlri 10.10.10.0/32" PACKET2="packet update origin 2 aspath $PEER1_AS nexthop 128.16.0.1 nlri 10.10.10.0/32" # Make sure that the nexthop carried in PACKET2 will resolve add_route4 connected true false 128.16.0.0/16 172.16.1.2 1 sleep 2 # The nexthop for this packet should never be resolvable. coord peer1 send $PACKET1 # Verify that no update packets have been sent to the peers. sleep 2 coord peer2 trie recv lookup 10.10.10.0/32 not coord peer3 trie recv lookup 10.10.10.0/32 not # Sending this used to cause a fatal error in BGP. coord peer1 send $PACKET2 # Try and verify that the correct route has popped out at peer2. sleep 2 coord peer2 trie recv lookup 10.10.10.0/32 aspath "$AS,$PEER1_AS" coord peer3 trie recv lookup 10.10.10.0/32 aspath "$PEER1_AS" # Make sure that the connections still exist. coord peer1 assert established coord peer2 assert established coord peer3 assert established}TESTS_NOT_FIXED=''TESTS='test1 test1_ipv6 test2 test2_ipv6 test3 test4 test5 test6'# Include command line. ${srcdir}/args.shif [ $START_PROGRAMS = "yes" ]then CXRL="$CALLXRL -r 10" runit $QUIET $VERBOSE -c "$0 -s -c $*" <<EOF ../../libxipc/xorp_finder ../../fea/xorp_fea_dummy = $CXRL finder://fea/common/0.1/get_target_name ../../rib/xorp_rib = $CXRL finder://rib/common/0.1/get_target_name ../xorp_bgp = $CXRL finder://bgp/common/0.1/get_target_name ./test_peer -s peer1 = $CXRL finder://peer1/common/0.1/get_target_name ./test_peer -s peer2 = $CXRL finder://peer2/common/0.1/get_target_name ./test_peer -s peer3 = $CXRL finder://peer3/common/0.1/get_target_name ./coord = $CXRL finder://coord/common/0.1/get_target_nameEOF trap '' 0 exit $?fiif [ $CONFIGURE = "yes" ]then configure_fea set +e configure_rib set +e configure_bgp set -efifor i in $TESTSdo# Temporary fix to let TCP sockets created by call_xrl pass through TIME_WAIT TIME_WAIT=`time_wait_seconds` echo "Waiting $TIME_WAIT seconds for TCP TIME_WAIT state timeout" sleep $TIME_WAIT $idone# Local Variables:# mode: shell-script# sh-indentation: 4# End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -