diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-09-07 15:47:47 +0200 |
---|---|---|
committer | Filip Tehlar <ftehlar@cisco.com> | 2016-09-12 14:41:10 +0200 |
commit | bf231ba795387064e7c4f1781240619429a4ef29 (patch) | |
tree | 86da34369910ca1c85672ed30d4374d4ecda9ac3 /tests/data_plane/vpp_lite_topo | |
parent | 1df1d674eaace35d52973786403eb1dbe3c0d5eb (diff) |
Introduce an option for testing binary API
This patch introduces an option for choosing a configuration method in
tests. Supported methods are VAT and vpp's debug CLI.
* Added new aprameter to run.sh to define method (--cfg-method [vat|cli]).
Defaults to vat.
* When running a test separately the method can be set as follows:
$ sudo CFG_METHOD=cli ./tests/<test_case>.sh
Again, it defaults to 'vat' if not provided.
* Increased readability in test driver scripts when checking test
status
* When debugging you can stop test execution by running the test with WAIT=1:
$ sudo WAIT=1 tests/<test_case>.sh
Change-Id: If851139cff072ba2e3b3594a3345763d360f3b59
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'tests/data_plane/vpp_lite_topo')
26 files changed, 516 insertions, 416 deletions
diff --git a/tests/data_plane/vpp_lite_topo/config.sh b/tests/data_plane/vpp_lite_topo/config.sh index e4c3283..a546c52 100644 --- a/tests/data_plane/vpp_lite_topo/config.sh +++ b/tests/data_plane/vpp_lite_topo/config.sh @@ -29,6 +29,15 @@ if [ ! -f "${VPP_API_TEST}" ] ; then exit 1 fi +if [ "${CFG_METHOD}" == '' ] ; then + CFG_METHOD=vat + echo + echo "* INFO: configuration method not selected, defaulting to 'vat'" + echo "* To define the method run the test as follows:" + echo "* $ sudo CFG_METHOD=vat|cli ./tests/<tc>.sh" + echo +fi + function clean_all { echo "Clearing all VPP instances.." @@ -88,6 +97,44 @@ function clean_all if [ "$1" != "no_odl" ] ; then odl_clear_all fi +} +function maybe_pause +{ + if [ "$WAIT" == "1" ] ; then + read -p "press any key to continue .." -n1 + fi +} + + +function start_vpp +{ + # start_vpp port prefix + ${VPP_LITE_BIN} \ + unix { log /tmp/$2.log \ + full-coredump \ + cli-listen localhost:$1 } \ + api-trace { on } api-segment { prefix "$2" } +} + +function print_status +{ + # show_status rc error_msg + if [ $1 -ne 0 ] ; then + echo "Test failed: $2" + else + echo "Test passed." + test_result=0 + fi +} + +function assert_rc_ok +{ + # assert_rc_ok rc cleanup_fcn error_msg + if [ $1 -ne 0 ] ; then + echo $3 + $2 + exit $test_result + fi } diff --git a/tests/data_plane/vpp_lite_topo/run.sh b/tests/data_plane/vpp_lite_topo/run.sh index d51b552..f57e4a2 100755 --- a/tests/data_plane/vpp_lite_topo/run.sh +++ b/tests/data_plane/vpp_lite_topo/run.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -source config.sh source odl_utils.sh TESTS_DIR=tests @@ -11,13 +10,17 @@ function help echo echo This must be run with superuser privileges. echo "Usage:" - echo " ./run.sh [vhc]" + echo " ./run.sh [vhc] [--config-method vat|cli]" echo echo " -v : verbose output" echo " -c : clean" echo " -h : show help" + echo " --config-method : select configuration method. Default is VAT." } +export CFG_METHOD=vat +source config.sh + verbose=0 while [ $# -gt 0 ] ; do @@ -32,6 +35,19 @@ while [ $# -gt 0 ] ; do elif [ $arg == "-c" ] ; then clean_all exit 0 + elif [ $arg == "--config-method" ] ; then + type=$1 + shift + if [ $type != "vat" -a $type != "cli" ] ; then + echo "ERROR: expected one of 'cli' or 'vat' " + help + exit 1 + fi + export CFG_METHOD=$type + else + echo "parse error" + help + exit 1 fi done @@ -60,6 +76,8 @@ test_num=`ls -l "$TESTS_DIR"/test_* | wc -l` echo echo "Running VPP lite test suite." echo +echo "Config method: $CFG_METHOD" +echo for test_case in "$TESTS_DIR"/test_* do diff --git a/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py b/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py new file mode 100644 index 0000000..87ec8cb --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py @@ -0,0 +1,110 @@ + +mappings = {} + +class SimpleMapping(object): + + def __init__(self, cmd, cli, vat): + if cmd in mappings: + raise Exception('{} already in cmd db!'.format(cmd)) + + self.cmd = cmd + self.cli = cli + self.vat = vat + mappings[cmd] = self + + def generate(self, mode, args): + s = '' + # simply append arguments string to right command + if mode == 'vat': + s = self.vat + ' ' + args + else: + s = self.cli + ' ' + args + return s + + +class CustomMapping(SimpleMapping): + + def generate(self, mode, args): + s = '' + if mode == 'vat': + s = self.vat + else: + s = self.cli + + args = args.split(' ') + return s.format(*args) + + +class RepeatableLocators(SimpleMapping): + + def append_locs(self, locs): + pass + + def generate(self, mode, args): + name = args[:args.index(' ')] # first word is ls name + locs = args[args.index(' '):] + + if mode == 'vat': + s = self.vat + else: + s = self.cli + + s = s + ' ' + name + locs + return s + + +SimpleMapping('lisp_state', 'lisp', 'lisp_enable_disable') +SimpleMapping('lisp_map_resolver', 'lisp map-resolver', 'lisp_add_del_map_resolver') +SimpleMapping('lisp_local_eid', 'lisp eid-table', 'lisp_add_del_local_eid') +SimpleMapping('lisp_remote_mapping', 'lisp remote-mapping', 'lisp_add_del_remote_mapping') +SimpleMapping('lisp_pitr', 'lisp pitr ls', 'lisp_pitr_set_locator_set locator-set') +SimpleMapping('set_if_ip', 'set int ip address', 'sw_interface_add_del_address') + +CustomMapping('lisp_eid_map_bd', + 'lisp eid-table map vni {0} bd {1}', + 'lisp_eid_table_add_del_map vni {0} bd_index {1}') +CustomMapping('lisp_eid_map_vrf', + 'lisp eid-table map vni {0} vrf {1}', + 'lisp_eid_table_add_del_map vni {0} vrf {1}') +CustomMapping('set_if_l2_bridge', 'set interface l2 bridge {0} {1}', + 'sw_interface_set_l2_bridge {0} bd_id {1}') +CustomMapping('set_if_ip_table', 'set interface ip table {0} {1}', + 'sw_interface_set_table {0} vrf {1}') +CustomMapping('lisp_locator_set_with_locator', + 'lisp locator-set add {0} iface {1} p {2} w {3}', + 'lisp_add_del_locator_set locator-set {0} iface {1} p {2} w {3}') +CustomMapping('create_host_iface', + 'create host-interface name {0}\n' + 'set int state host-{0} up\n' + 'set int ip address host-{0} {1}', + + 'af_packet_create name {0}\n' + 'sw_interface_set_flags host-{0} admin-up link-up\n' + 'sw_interface_add_del_address host-{0} {1}') + +CustomMapping('create_host_iface_vrf', + 'create host-interface name {0}\n' + 'set int state host-{0} up\n' + 'set interface ip table host-{0} {2}\n' + 'set int ip address host-{0} {1}', + + 'af_packet_create name {0}\n' + 'sw_interface_set_flags host-{0} admin-up link-up\n' + 'sw_interface_set_table host-{0} vrf {2}\n' + 'sw_interface_add_del_address host-{0} {1}') + +CustomMapping('create_host_iface_vrf_v6', + 'create host-interface name {0}\n' + 'set int state host-{0} up\n' + 'set interface ip6 table host-{0} {2}\n' + 'set int ip address host-{0} {1}', + + 'af_packet_create name {0}\n' + 'sw_interface_set_flags host-{0} admin-up link-up\n' + 'sw_interface_set_table host-{0} vrf {2} ipv6\n' + 'sw_interface_add_del_address host-{0} {1}') + +RepeatableLocators('lisp_ls_multiple_locs', + 'lisp locator-set add', + 'lisp_add_del_locator_set locator-set') + diff --git a/tests/data_plane/vpp_lite_topo/scripts/generate_config.py b/tests/data_plane/vpp_lite_topo/scripts/generate_config.py new file mode 100755 index 0000000..87204a6 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/scripts/generate_config.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python + +""" +generate_config.py - Generate specific configuration file for VPP from + generic config file + +Usage: + ./generate_config.py <directory> <output-file-type> + +where <directory> is a system directory containing generic config file(s) + (suffixed with *.config) + <output-file-type> is one of 'vat' or 'cli' + +This script looks for *.config files in provided directory and for each +generates a specific configuration file based on output file type in form +'<filename>.cli' or '<filename>.vat' respectively. +""" + +import sys +import glob +import cmd_mappings + + +def generate_config(file_name, mode): + """ + param file_name: + param mode: one of 'vat' or 'cli' + """ + s = '' + f = open(file_name, 'r') + line_num = 0 + + for line in f: + line_num += 1 + line = line.strip() + if line == '' or line[0] == '#': + continue + + kw = line[: line.index(' ')] + args = line[ line.index(' ') + 1:] + + if kw not in cmd_mappings.mappings: + raise Exception('Conversion error at {}:{}:\n > {}\nKeyword not found:' + ' {}'.format(file_name, line_num, line, kw)) + + mapping = cmd_mappings.mappings[kw] + try: + s = s + mapping.generate(mode, args) + '\n' + except Exception as e: + raise Exception('Conversion error at {}:{}:\n > {}' + .format(file_name, line_num, line)) + + return s + + +def main(): + if len(sys.argv) != 3: + print('Error: expected 2 arguments!') + sys.exit(1) + + dir_name = sys.argv[1] + config_type = sys.argv[2] + + if config_type != 'vat' and config_type != 'cli': + print('Error: expected second parameter one of "vat" or "cli"!') + sys.exit(1) + + for f in glob.glob(dir_name + "/*.config"): + config = generate_config(f, config_type) + + output_fname = f.replace('.config', '.' + config_type) + print('\n* Generated config from {}:'.format(f)) + print(config) + print ('* Saving to {}'.format(output_fname)) + + fout = open(output_fname, 'w') + fout.write(config); + + +main() diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic.sh index 77e3d14..cd10d4c 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic.sh @@ -22,24 +22,13 @@ function test_basic basic_topo_setup fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause test_result=1 ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" - rc=$? - if [ $rc -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi - - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + assert_rc_ok $? basic_topo_clean "No ICMP response!" + maybe_pause # change IP addresses of destination RLOC echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003 echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003 @@ -52,17 +41,8 @@ function test_basic # test done - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause basic_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh index c744dc1..b3d53aa 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh @@ -21,34 +21,18 @@ function test_basic basic_topo_setup fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause test_result=1 ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" rc=$? - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - - if [ $rc -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + maybe_pause + assert_rc_ok $rc basic_topo_clean "No response received!" # test done basic_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICM response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh index 81fd0ff..79456b7 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh @@ -27,23 +27,13 @@ function test_basic_multi_traffic test_result=1 - if [ "$5" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" - if [ $? -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + assert_rc_ok $? basic_topo_clean "No response received!" ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}" - if [ $? -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + assert_rc_ok $? basic_topo_clean "No response received!" # change IP addresses of destination RLOC echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003 @@ -56,33 +46,19 @@ function test_basic_multi_traffic ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4 post_curl "update-mapping" ${ODL_CONFIG_FILE3} - if [ "$5" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" - if [ $? -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + assert_rc_ok $? basic_topo_clean "No response received!" ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}" rc=$? - if [ "$5" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause # test done - basic_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh index 9df6ebb..6d06a16 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh @@ -16,9 +16,7 @@ function test_basic_no_odl { basic_topo_setup no_odl - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 @@ -43,9 +41,7 @@ function test_basic_no_odl ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" rc=$? - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause # test done diff --git a/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh b/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh index 7d623f0..9e34d11 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh @@ -22,13 +22,12 @@ function test_multihoming multihoming_topo_setup fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + assert_rc_ok $? multihoming_topo_clean "No response received!" # do some port sweeping to see that load balancing works ip netns exec vppns1 nc -n -z "${2}" 1-1000 > /dev/null 2>&1 @@ -45,17 +44,13 @@ function test_multihoming if [ $rc -ne 0 ] ; then echo "Load balancing doesn't work!" - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause multihoming_topo_clean exit $test_result fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause # change IP addresses of destination RLOC echo "set int ip address del host-intervpp12 6.0.3.2/24" | nc 0 5003 @@ -69,17 +64,9 @@ function test_multihoming # test done - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause multihoming_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh b/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh index 64d3486..0238046 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh @@ -6,13 +6,6 @@ ODL_CONFIG_FILE1="vpp1.json" ODL_CONFIG_FILE2="vpp2.json" ODL_CONFIG_FILE3="update_vpp2.json" -function maybe_pause -{ - if [ "$1" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi -} - if [ "$1" == "clean" ] ; then multihoming_topo_clean exit 0 @@ -83,12 +76,6 @@ function test_multihoming maybe_pause $3 multihoming_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh b/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh index 3f07a7e..ea3a212 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh @@ -30,27 +30,17 @@ function test_resolver_failover test_result=1 - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vppns1 "${1}" -w 20 -c 1 "${2}" rc=$? # test done - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause basic_two_odls_clean kill $mr_id - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh b/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh index 40979e6..8ec9320 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh @@ -20,23 +20,16 @@ fi function test_rtr_single_iface { rtr_single_iface_setup - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 ip netns exec vpp-ns1 "${1}" -w 20 -c 1 "${2}" rc=$? + maybe_pause rtr_single_iface_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh index 507a817..a7d4a03 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh @@ -20,9 +20,7 @@ fi function test_rtr_two_iface { rtr_two_iface_setup - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 rc=0 @@ -37,21 +35,9 @@ function test_rtr_two_iface { echo "Unrecognized IP format '$1'" fi - #ip netns exec vpp1-ns ping -w 15 -c 1 "${1}" - #rc=$? - - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause rtr_two_iface_clean - - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh index 5a3dc83..2dd2a12 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh @@ -24,35 +24,17 @@ function test_rtr_two_iface_two_customers { test_result=0 rc=0 - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vpp1-cus1-ns "${1}" -w 20 -c 1 "${2}" - rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 1 did not receive any response!" - test_result=1 - fi + assert_rc_ok $? rtr_two_iface_two_customers_clean "No response received!" ip netns exec vpp1-cus2-ns "${1}" -w 20 -c 1 "${2}" rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 2 did not receive any response!" - test_result=1 - fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause rtr_two_iface_two_customers_clean - - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh b/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh index f03c199..cec65a1 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh @@ -35,54 +35,29 @@ function test_smr_rtr_disjoint { # CONFIGURE smr_rtr_disjoint_setup - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 rc=0 # TEST IP6 over IP4 test_ns_ping $1 vpp1-ns + assert_rc_ok $? smr_rtr_disjoint_clean "No icmp received!" - rc=$? - - if [ $rc -ne 0 ] ; then - echo "IPv6 over IPv4 test failed: No ICMP response received within specified timeout limit!" - else - echo "IPv6 over IPv4 test passed." - test_result=0 - fi - - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause # RECONFIGURE smr_rtr_disjoint_reconfigure - if [ "$2" == "wait" ] ; then - read -p "Forwarding reconfigured press any key to continue .." -n1 - fi + maybe_pause # TEST IP6 over disjoint IP4 and IP6 underlay test_ns_ping $1 vpp1-ns - rc=$? - if [ $rc -ne 0 ] ; then - echo "SMR + disjoint locators test failed: No ICMP response received within specified timeout limit!" - else - echo "SMR + disjoint locators test passed." - test_result=0 - fi - - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause # CLEANUP smr_rtr_disjoint_clean - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh b/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh index 9a5755f..84c8d96 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh @@ -23,36 +23,19 @@ function test_eid_virtualization { # init to test failed test_result=1 - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vpp1-cus1-ns "${1}" -w 20 -c 1 "${2}" - rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 1 did not receive any response!" - fi + assert_rc_ok $? two_customers_topo_clean "No response!" - #read -p "press any key to continue .." -n1 + maybe_pause ip netns exec vpp1-cus2-ns "${1}" -w 20 -c 1 "${2}" rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 2 did not receive any response!" - fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause two_customers_topo_clean - - if [ $rc -ne 0 ] ; then - echo "Test failed!"; - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/topologies/basic_topo.sh b/tests/data_plane/vpp_lite_topo/topologies/basic_topo.sh index 09b8e24..15aaa51 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/basic_topo.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/basic_topo.sh @@ -82,26 +82,29 @@ function basic_topo_setup ip addr add 6:0:3::100/64 dev odl ethtool --offload odl rx off tx off - # start vpp1 and vpp2 in separate chroot - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi if [ "$1" != "no_odl" ] ; then post_curl "add-mapping" ${ODL_CONFIG_FILE1} post_curl "add-mapping" ${ODL_CONFIG_FILE2} fi } - diff --git a/tests/data_plane/vpp_lite_topo/topologies/basic_topo_l2.sh b/tests/data_plane/vpp_lite_topo/topologies/basic_topo_l2.sh index 9066a74..630651f 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/basic_topo_l2.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/basic_topo_l2.sh @@ -89,22 +89,26 @@ function basic_topo_setup ip addr add 6:0:3::100/64 dev odl ethtool --offload odl rx off tx off - # start vpp1 and vpp2 in separate chroot - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi if [ "$1" != "no_odl" ] ; then post_curl "add-mapping" ${ODL_CONFIG_FILE1} diff --git a/tests/data_plane/vpp_lite_topo/topologies/basic_two_odls.sh b/tests/data_plane/vpp_lite_topo/topologies/basic_two_odls.sh index 73c0a1d..7e6eda6 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/basic_two_odls.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/basic_two_odls.sh @@ -79,19 +79,24 @@ function basic_two_odls_setup ip addr add 6.0.3.100/24 dev odl1 ethtool --offload odl1 rx off tx off - #ip addr add 6.0.3.100/24 dev odl2 - #ethtool --offload odl2 rx off tx off + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} - # start vpp1 and vpp2 in separate chroot - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi } diff --git a/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo.sh b/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo.sh index 85f2f90..9f06d82 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo.sh @@ -103,22 +103,26 @@ function multihoming_topo_setup ip addr add 6:0:3::100/64 dev odl ethtool --offload odl rx off tx off - # start vpp1 and vpp2 in separate chroot - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi if [ "$1" != "no_odl" ] ; then post_curl "add-mapping" ${ODL_CONFIG_FILE1} diff --git a/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo_l2.sh b/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo_l2.sh index 308f375..b28c6d5 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo_l2.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/multihoming_topo_l2.sh @@ -110,22 +110,26 @@ function multihoming_topo_setup ip addr add 6:0:3::100/64 dev odl ethtool --offload odl rx off tx off - # start vpp1 and vpp2 in separate chroot - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi if [ "$1" != "no_odl" ] ; then post_curl "add-mapping" ${ODL_CONFIG_FILE1} diff --git a/tests/data_plane/vpp_lite_topo/topologies/rtr_single_iface.sh b/tests/data_plane/vpp_lite_topo/topologies/rtr_single_iface.sh index c740a17..4c3e9ca 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/rtr_single_iface.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/rtr_single_iface.sh @@ -79,28 +79,29 @@ function rtr_single_iface_setup { ip addr add 6:0:3::100/64 dev odl ethtool --offload odl rx off tx off - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - ${VPP_LITE_BIN} \ - unix { log /tmp/rtr.log cli-listen \ - localhost:5004 full-coredump \ - exec ${VPP_LITE_CONF}/rtr.config } \ - api-trace { on } api-segment {prefix rtr} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat - ${VPP_API_TEST} chroot prefix rtr script in ${VPP_LITE_CONF}/vpp3.vat + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + start_vpp 5004 vpp3 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + echo "exec ${VPP_LITE_CONF}/vpp3.cli" | nc 0 5004 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + ${VPP_API_TEST} chroot prefix vpp3 script in ${VPP_LITE_CONF}/vpp3.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi post_curl "add-mapping" ${ODL_CONFIG_FILE1} post_curl "add-mapping" ${ODL_CONFIG_FILE2} diff --git a/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface.sh b/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface.sh index 69306bb..f4210fe 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface.sh @@ -111,29 +111,29 @@ function rtr_two_iface_setup { ip addr add 6:0:5::100/64 dev odl_vpp2 ethtool --offload odl_vpp2 rx off tx off - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - ${VPP_LITE_BIN} \ - unix { log /tmp/rtr.log cli-listen \ - localhost:5004 full-coredump \ - exec ${VPP_LITE_CONF}/rtr.config } \ - api-trace { on } api-segment {prefix rtr} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat - ${VPP_API_TEST} chroot prefix rtr script in ${VPP_LITE_CONF}/vpp3.vat - + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + start_vpp 5004 vpp3 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + echo "exec ${VPP_LITE_CONF}/vpp3.cli" | nc 0 5004 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + ${VPP_API_TEST} chroot prefix vpp3 script in ${VPP_LITE_CONF}/vpp3.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi post_curl "add-mapping" ${ODL_CONFIG_FILE1} post_curl "add-mapping" ${ODL_CONFIG_FILE2} } diff --git a/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface_two_customers.sh b/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface_two_customers.sh index 12ab299..b181775 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface_two_customers.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/rtr_two_iface_two_customers.sh @@ -142,29 +142,29 @@ function rtr_two_iface_two_customers_setup { ip addr add 6:0:5::100/64 dev odl_vpp2 ethtool --offload odl_vpp2 rx off tx off - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - ${VPP_LITE_BIN} \ - unix { log /tmp/rtr.log cli-listen \ - localhost:5004 full-coredump \ - exec ${VPP_LITE_CONF}/rtr.config } \ - api-trace { on } api-segment {prefix rtr} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat - ${VPP_API_TEST} chroot prefix rtr script in ${VPP_LITE_CONF}/vpp3.vat - + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + start_vpp 5004 vpp3 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + echo "exec ${VPP_LITE_CONF}/vpp3.cli" | nc 0 5004 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + ${VPP_API_TEST} chroot prefix vpp3 script in ${VPP_LITE_CONF}/vpp3.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi post_curl "add-mapping" ${ODL_CONFIG_FILE1} post_curl "add-mapping" ${ODL_CONFIG_FILE2} post_curl "add-mapping" ${ODL_CONFIG_FILE3} diff --git a/tests/data_plane/vpp_lite_topo/topologies/smr_rtr_disjoint.sh b/tests/data_plane/vpp_lite_topo/topologies/smr_rtr_disjoint.sh index 2b50cc9..e18d229 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/smr_rtr_disjoint.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/smr_rtr_disjoint.sh @@ -115,29 +115,29 @@ function smr_rtr_disjoint_setup { ip addr add 6:0:5::100/64 dev odl_vpp2 ethtool --offload odl_vpp2 rx off tx off - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment {prefix xtr1} - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment {prefix xtr2} - - ${VPP_LITE_BIN} \ - unix { log /tmp/rtr.log cli-listen \ - localhost:5004 full-coredump \ - exec ${VPP_LITE_CONF}/rtr.config } \ - api-trace { on } api-segment {prefix rtr} - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat - ${VPP_API_TEST} chroot prefix rtr script in ${VPP_LITE_CONF}/vpp3.vat - + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + start_vpp 5004 vpp3 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + echo "exec ${VPP_LITE_CONF}/vpp3.cli" | nc 0 5004 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + ${VPP_API_TEST} chroot prefix vpp3 script in ${VPP_LITE_CONF}/vpp3.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi post_curl "add-mapping" ${ODL_CONFIG_FILE1} post_curl "add-mapping" ${ODL_CONFIG_FILE2} } diff --git a/tests/data_plane/vpp_lite_topo/topologies/two_customers_topo.sh b/tests/data_plane/vpp_lite_topo/topologies/two_customers_topo.sh index 2570087..645077d 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/two_customers_topo.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/two_customers_topo.sh @@ -109,21 +109,26 @@ function two_customers_topo_setup { ip addr add 6:0:3::100/64 dev odl ethtool --offload odl rx off tx off - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec ${VPP_LITE_CONF}/vpp1.config } \ - api-trace { on } api-segment { prefix xtr1 } - - ${VPP_LITE_BIN} \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec ${VPP_LITE_CONF}/vpp2.config } \ - api-trace { on } api-segment { prefix xtr2 } - - sleep 2 - ${VPP_API_TEST} chroot prefix xtr1 script in ${VPP_LITE_CONF}/vpp1.vat - ${VPP_API_TEST} chroot prefix xtr2 script in ${VPP_LITE_CONF}/vpp2.vat + # generate config files + ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD} + + start_vpp 5002 vpp1 + start_vpp 5003 vpp2 + + echo "* Selected configuration method: $CFG_METHOD" + if [ "$CFG_METHOD" == "cli" ] ; then + echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 + echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 + elif [ "$CFG_METHOD" == "vat" ] ; then + sleep 2 + ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat + ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat + else + echo "=== WARNING:" + echo "=== Invalid configuration method selected!" + echo "=== To resolve this set env variable CFG_METHOD to vat or cli." + echo "===" + fi post_curl "add-mapping" ${ODL_CONFIG_FILE1} post_curl "add-mapping" ${ODL_CONFIG_FILE2} |