📄 test_rib_fea1.sh
字号:
#!/usr/bin/env bash## $XORP: xorp/bgp/harness/test_rib_fea1.sh,v 1.17 2006/08/16 22:10:14 atanu Exp $### Test BGP, RIB and FEA interaction.## This script started with no arguments will start all required process and# terminate them at the end of the tests.## Preconditons# 1) Run a finder process# 2) Run a FEA process.# 3) Run a RIB process.# 4) Run xorp "../xorp_bgp"# 5) Run "./test_peer -s peer1"# 6) Run "./test_peer -s peer2"# 7) Run "./test_peer -s peer3"# 8) Run "./coord"#set -eonexit(){ last=$? if [ $last = "0" ] then echo "$0: Tests Succeeded" else echo "$0: Tests Failed" fi trap '' 0 2}trap onexit 0 2# srcdir is set by make for check targetif [ "X${srcdir}" = "X" ] ; then srcdir=`dirname $0` ; fi. ${srcdir}/xrl_shell_funcs.sh "". ${srcdir}/../xrl_shell_funcs.sh "". ${srcdir}/../../rib/xrl_shell_funcs.sh ""HOST=127.0.0.1AS=65008# EBGP - IPV4PORT1=10001PEER_PORT1=20001PEER1_AS=64001# EBGP - IPV4PORT2=10002PEER_PORT2=20002PEER2_AS=64002# IBGP - IPV4PORT3=10003PEER_PORT3=20003PEER3_AS=$AS# EBGP - IPV6PORT1_IPV6=10004PEER_PORT1_IPV6=20004PEER1_AS_IPV6=64004# EBGP - IPV6PORT2_IPV6=10005PEER_PORT2_IPV6=20005PEER2_AS_IPV6=64005# IBGP - IPV6PORT3_IPV6=10006PEER_PORT3_IPV6=20006PEER3_AS_IPV6=$ASHOLDTIME=0# Next Hops#NH1=10.10.10.10#NH2=20.20.20.20NH1=172.16.1.1NH2=172.16.2.1NH1_IPV6=40:40:40:40:40:40:40:40NH2_IPV6=50:50:50:50:50:50:50:50VIF0="vif0"VIF1="vif1"VIF0_IPV6="vif2"VIF1_IPV6="vif3"configure_bgp(){ LOCALHOST=$HOST ID=192.150.187.78 local_config $AS $ID # EBGP - IPV4 PEER=$HOST NEXT_HOP=192.150.187.78 PORT=$PORT1;PEER_PORT=$PEER_PORT1;PEER_AS=$PEER1_AS IPTUPLE="$LOCALHOST $PORT $PEER $PEER_PORT" add_peer $IPTUPLE $PEER_AS $NEXT_HOP $HOLDTIME set_parameter $IPTUPLE MultiProtocol.IPv4.Unicast true enable_peer $IPTUPLE # EBGP - IPV4 PEER=$HOST NEXT_HOP=192.150.187.78 PORT=$PORT2;PEER_PORT=$PEER_PORT2;PEER_AS=$PEER2_AS IPTUPLE="$LOCALHOST $PORT $PEER $PEER_PORT" add_peer $IPTUPLE $PEER_AS $NEXT_HOP $HOLDTIME set_parameter $IPTUPLE MultiProtocol.IPv4.Unicast true enable_peer $IPTUPLE # IBGP - IPV4 PEER=$HOST NEXT_HOP=192.150.187.78 PORT=$PORT3;PEER_PORT=$PEER_PORT3;PEER_AS=$PEER3_AS IPTUPLE="$LOCALHOST $PORT $PEER $PEER_PORT" add_peer $IPTUPLE $PEER_AS $NEXT_HOP $HOLDTIME set_parameter $IPTUPLE MultiProtocol.IPv4.Unicast true enable_peer $IPTUPLE # EBGP - IPV6 PEER=$HOST NEXT_HOP=192.150.187.78 PORT=$PORT1_IPV6;PEER_PORT=$PEER_PORT1_IPV6;PEER_AS=$PEER1_AS_IPV6 IPTUPLE="$LOCALHOST $PORT $PEER $PEER_PORT" add_peer $IPTUPLE $PEER_AS $NEXT_HOP $HOLDTIME set_parameter $IPTUPLE MultiProtocol.IPv6.Unicast true enable_peer $IPTUPLE # EBGP - IPV6 PEER=$HOST NEXT_HOP=192.150.187.78 PORT=$PORT2_IPV6;PEER_PORT=$PEER_PORT2_IPV6;PEER_AS=$PEER2_AS_IPV6 IPTUPLE="$LOCALHOST $PORT $PEER $PEER_PORT" add_peer $IPTUPLE $PEER_AS $NEXT_HOP $HOLDTIME set_parameter $IPTUPLE MultiProtocol.IPv6.Unicast true enable_peer $IPTUPLE # IBGP - IPV6 PEER=$HOST NEXT_HOP=192.150.187.78 PORT=$PORT3_IPV6;PEER_PORT=$PEER_PORT3_IPV6;PEER_AS=$PEER3_AS_IPV6 IPTUPLE="$LOCALHOST $PORT $PEER $PEER_PORT" add_peer $IPTUPLE $PEER_AS $NEXT_HOP $HOLDTIME set_parameter $IPTUPLE MultiProtocol.IPv6.Unicast true enable_peer $IPTUPLE}configure_rib(){ echo "Configuring rib" export CALLXRL RIB_FUNCS=${srcdir}/../../rib/xrl_shell_funcs.sh $RIB_FUNCS make_rib_errors_fatal}configure_fea(){ echo "Configuring fea" export CALLXRL FEA_FUNCS=${srcdir}/../../fea/xrl_shell_funcs.sh local tid=$($FEA_FUNCS start_fea_transaction) $FEA_FUNCS create_interface $tid $VIF0 $FEA_FUNCS create_interface $tid $VIF1 $FEA_FUNCS create_interface $tid $VIF0_IPV6 $FEA_FUNCS create_interface $tid $VIF1_IPV6 $FEA_FUNCS enable_interface $tid $VIF0 $FEA_FUNCS enable_interface $tid $VIF1 $FEA_FUNCS enable_interface $tid $VIF0_IPV6 $FEA_FUNCS enable_interface $tid $VIF1_IPV6 $FEA_FUNCS create_vif $tid $VIF0 $VIF0 $FEA_FUNCS create_vif $tid $VIF1 $VIF1 $FEA_FUNCS create_vif $tid $VIF0_IPV6 $VIF0_IPV6 $FEA_FUNCS create_vif $tid $VIF1_IPV6 $VIF1_IPV6 $FEA_FUNCS enable_vif $tid $VIF0 $VIF0 $FEA_FUNCS enable_vif $tid $VIF1 $VIF1 $FEA_FUNCS enable_vif $tid $VIF0_IPV6 $VIF0_IPV6 $FEA_FUNCS enable_vif $tid $VIF1_IPV6 $VIF1_IPV6 $FEA_FUNCS create_address4 $tid $VIF0 $VIF0 $NH1 $FEA_FUNCS create_address4 $tid $VIF1 $VIF1 $NH2 $FEA_FUNCS create_address6 $tid $VIF0_IPV6 $VIF0_IPV6 $NH1_IPV6 $FEA_FUNCS create_address6 $tid $VIF1_IPV6 $VIF1_IPV6 $NH2_IPV6 $FEA_FUNCS set_prefix4 $tid $VIF0 $VIF0 $NH1 24 $FEA_FUNCS set_prefix4 $tid $VIF1 $VIF1 $NH2 24 $FEA_FUNCS set_prefix6 $tid $VIF0_IPV6 $VIF0_IPV6 $NH1_IPV6 24 $FEA_FUNCS set_prefix6 $tid $VIF1_IPV6 $VIF1_IPV6 $NH2_IPV6 24 $FEA_FUNCS commit_fea_transaction $tid}unconfigure_fea(){ echo "Unconfigure fea"}config_peers(){ coord reset coord target $HOST $PORT1 coord initialise attach peer1 coord peer1 establish AS $PEER1_AS \ holdtime $HOLDTIME \ id 10.10.10.1 \ keepalive false coord peer1 assert established coord target $HOST $PORT2 coord initialise attach peer2 coord peer2 establish AS $PEER2_AS \ holdtime $HOLDTIME \ id 10.10.10.2 \ keepalive false coord peer2 assert established coord target $HOST $PORT3 coord initialise attach peer3 coord peer3 establish AS $PEER3_AS \ holdtime $HOLDTIME \ id 10.10.10.3 \ keepalive false coord peer3 assert established}config_peers_ipv6(){ coord reset coord target $HOST $PORT1_IPV6 coord initialise attach peer1 coord peer1 establish AS $PEER1_AS_IPV6 \ holdtime $HOLDTIME \ id 10.10.10.1 \ keepalive false \ ipv6 true coord peer1 assert established coord target $HOST $PORT2_IPV6 coord initialise attach peer2 coord peer2 establish AS $PEER2_AS_IPV6 \ holdtime $HOLDTIME \ id 10.10.10.2 \ keepalive false \ ipv6 true coord peer2 assert established coord target $HOST $PORT3_IPV6 coord initialise attach peer3 coord peer3 establish AS $PEER3_AS_IPV6 \ holdtime $HOLDTIME \ id 10.10.10.3 \ keepalive false \ ipv6 true coord peer3 assert established}NLRI1=10.10.10.0/24NLRI2=20.20.20.20/24NLRI3=30.30.30.30/24NLRI4=40.40.40.40/24test1(){ echo "TEST1 - Exercise the next hop resolver" config_peers PACKET1="packet update origin 2 aspath $PEER1_AS nexthop 128.16.0.1 nlri $NLRI1 nlri $NLRI2" PACKET2="packet update origin 2 aspath $PEER1_AS nexthop 128.16.1.1 nlri $NLRI3 nlri $NLRI4" # 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 not coord peer2 trie recv lookup $NLRI2 not coord peer2 trie recv lookup $NLRI3 not coord peer2 trie recv lookup $NLRI4 not # Lets get it to resolve. add_route4 connected true false 128.16.0.0/16 $NH1 # Add a different route. add_route4 connected true false 128.16.0.0/24 $NH2 # Delete the better route. delete_route4 connected true false 128.16.0.0/24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -