smr_rtr_disjoint.sh revision bf231ba7
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  maybe_pause
39
40  test_result=1
41  rc=0
42
43  # TEST IP6 over IP4
44  test_ns_ping $1 vpp1-ns
45  assert_rc_ok $? smr_rtr_disjoint_clean "No icmp received!"
46
47  maybe_pause
48
49  # RECONFIGURE
50  smr_rtr_disjoint_reconfigure
51
52  maybe_pause
53
54  # TEST IP6 over disjoint IP4 and IP6 underlay
55  test_ns_ping $1 vpp1-ns
56  rc=$?
57
58  maybe_pause
59  # CLEANUP
60  smr_rtr_disjoint_clean
61  print_status $rc "No ICMP response!"
62  exit $test_result
63}
64