lisp_ip4o6.sh revision d746f963
1#!/usr/bin/env bash
2
3function ping_lisp {
4  local RESULTS
5  RESULTS=$(ssh_tg "ping -c 10 6.0.2.2")
6  if [ $? -ne 0 ] ; then
7      echo "Can not ping other machine"
8      ssh_vpp1 "sudo rm -r ${TMP_DIR}"
9      ssh_vpp2 "sudo rm -r ${TMP_DIR}"
10      exit -1
11  fi
12}
13
14post_curl "add-mapping" ${ODL_ADD_CONFIG1}
15post_curl "add-mapping" ${ODL_ADD_CONFIG2}
16
17rsync -avz ${VPP_CONFIG_DIR}${VPP_CONFIG1} ${USER}@${VPP1_IP}:${TMP_DIR}/vpp1.conf
18rsync -avz ${VPP_CONFIG_DIR}${VPP_CONFIG2} ${USER}@${VPP2_IP}:${TMP_DIR}/vpp2.conf
19
20ssh_vpp1 "sudo vpp_api_test < ${TMP_DIR}/vpp1.conf"
21ssh_vpp2 "sudo vpp_api_test < ${TMP_DIR}/vpp2.conf"
22
23ssh_tg "sudo ip addr add 6.0.1.2/24 dev ${TG_INT1}"
24ssh_tg "sudo ip link set ${TG_INT1} up"
25ssh_tg "sudo ip route add 6.0.2.0/24 via 6.0.1.1"
26ssh_tg "sudo ip netns exec net2 ip addr add 6.0.2.2/24 dev ${TG_INT2}"
27ssh_tg "sudo ip netns exec net2 ip link set lo up"
28ssh_tg "sudo ip netns exec net2 ip link set ${TG_INT2} up"
29ssh_tg "sudo ip netns exec net2 ip route add 6.0.1.0/24 via 6.0.2.1"
30
31ping_lisp
32
33rsync -avz ${VPP_CONFIG_DIR}${VPP_RECONF2}  ${USER}@${VPP2_IP}:${TMP_DIR}/vpp2_reconf.conf
34
35ssh_vpp2 "sudo vpp_api_test < ${TMP_DIR}/vpp2_reconf.conf"
36
37post_curl "update-mapping" ${ODL_REPLACE_CONFIG2}
38
39ping_lisp
40