a5bd61e0d0d136132bf2e4348a3916944469907d
[one.git] / tests / data_plane / vpp_lite_topo / test_driver / basic_l2.sh
1 source config.sh
2 source odl_utils.sh
3 source topologies/basic_topo_l2.sh
4
5 ODL_CONFIG_FILE1="vpp1.json"
6 ODL_CONFIG_FILE2="vpp2.json"
7
8 if [ "$1" == "clean" ] ; then
9   basic_topo_clean
10   exit 0
11 fi
12
13 if [[ $(id -u) != 0 ]]; then
14   echo "Error: run this as a root."
15   exit 1
16 fi
17
18 function test_basic
19 {
20   if [ "$3" != "no_setup" ] ; then
21     basic_topo_setup
22   fi
23
24   maybe_pause
25   test_result=1
26
27   ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
28   rc=$?
29
30   maybe_pause
31   assert_rc_ok $rc basic_topo_clean "No response received!"
32
33   # test done
34
35   basic_topo_clean
36   print_status $rc "No ICM response!"
37   exit $test_result
38 }
39
40 function test_single_icmp
41 {
42   if [ "$3" != "no_setup" ] ; then
43     basic_topo_setup no_odl
44   fi
45
46   maybe_pause
47   test_result=1
48
49   ip netns exec vppns1 "${1}" -c 1 "${2}"
50   rc=$?
51
52   check_counters "vpp1" "10" $3   $4   $5   $6   $7   $8
53   assert_rc_ok $? "basic_topo_clean no_odl" "Counters do not match!"
54
55   # test done
56   maybe_pause
57   basic_topo_clean no_odl
58   print_status $rc "No ICM response!"
59   exit $test_result
60 }