smr_rtr_disjoint.sh revision af093531
1source config.sh
2source odl_utils.sh
3source topologies/smr_rtr_disjoint.sh
4
5# set odl config json file names; they are common among all rtr tests
6ODL_CONFIG_FILE1="vpp1.json"
7ODL_CONFIG_FILE2="vpp2.json"
8ODL_CONFIG_FILE3="elp1.json"
9ODL_CONFIG_FILE4="elp2.json"
10
11if [ "$1" == "clean" ] ; then
12  smr_rtr_disjoint_clean
13  exit 0
14fi
15
16if [[ $(id -u) != 0 ]]; then
17  echo "Error: run this as a root."
18  exit 1
19fi
20
21function test_ns_ping {
22  if [ "$1" != "${1#*[0-9].[0-9]}" ]; then
23    ip netns exec $2 ping -w 15 -c 1 "${1}"
24    rc=$?
25  elif [ "$1" != "${1#*:[0-9a-fA-F]}" ]; then
26    ip netns exec $2 ping6 -w 15 -c 1 "${1}"
27    rc=$?
28  else
29    echo "Unrecognized IP format '$1'"
30  fi
31  return $rc
32}
33
34function test_smr_rtr_disjoint {
35  # CONFIGURE
36  smr_rtr_disjoint_setup
37
38  if [ "$2" == "wait" ] ; then
39    read -p  "press any key to continue .." -n1
40  fi
41
42  test_result=1
43  rc=0
44
45  # TEST IP6 over IP4
46  test_ns_ping $1 vpp1-ns
47
48  rc=$?
49
50  if [ $rc -ne 0 ] ; then
51    echo "IPv6 over IPv4 test failed: No ICMP response received within specified timeout limit!"
52  else
53    echo "IPv6 over IPv4 test passed."
54    test_result=0
55  fi
56
57  if [ "$2" == "wait" ] ; then
58    read -p  "press any key to continue .." -n1
59  fi
60
61  # RECONFIGURE
62  smr_rtr_disjoint_reconfigure
63
64  if [ "$2" == "wait" ] ; then
65    read -p  "Forwarding reconfigured press any key to continue .." -n1
66  fi
67
68  # TEST IP6 over disjoint IP4 and IP6 underlay
69  test_ns_ping $1 vpp1-ns
70
71  rc=$?
72
73  if [ $rc -ne 0 ] ; then
74    echo "SMR + disjoint locators test failed: No ICMP response received within specified timeout limit!"
75  else
76    echo "SMR + disjoint locators test passed."
77    test_result=0
78  fi
79
80  if [ "$2" == "wait" ] ; then
81    read -p  "press any key to continue .." -n1
82  fi
83
84  # CLEANUP
85  smr_rtr_disjoint_clean
86
87  exit $test_result
88}
89