From: Patrik Hrnciar Date: Thu, 18 Feb 2016 09:05:05 +0000 (+0100) Subject: Update l2_xconnect test to use NodePath X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=commitdiff_plain;h=71b27a0864f4e02f8750de23fb6498369696734c Update l2_xconnect test to use NodePath Change-Id: I9951a7e9a36dbc78c44f6bd868b4f6531ecb3349 Signed-off-by: Patrik Hrnciar --- diff --git a/resources/libraries/robot/l2_xconnect.robot b/resources/libraries/robot/l2_xconnect.robot index f42c748970..e4dcddd54f 100644 --- a/resources/libraries/robot/l2_xconnect.robot +++ b/resources/libraries/robot/l2_xconnect.robot @@ -17,42 +17,22 @@ | Library | resources.libraries.python.CrossConnectSetup | Library | resources.libraries.python.topology.Topology | Library | resources.libraries.python.TrafficScriptExecutor -| Library | resources.libraries.python.InterfaceUtil.InterfaceUtil | Variables | resources/libraries/python/constants.py *** Keywords *** -| L2 setup xconnect on DUTs +| L2 setup xconnect on DUT | | [Documentation] | Setup Bidirectional Cross Connect on DUTs -# TODO: rewrite with dynamic path selection -| | Vpp Setup Bidirectional Cross Connect | ${nodes['DUT1']} -| | ... | ${nodes['DUT1']['interfaces']['port1']['name']} -| | ... | ${nodes['DUT1']['interfaces']['port3']['name']} -| | Vpp Setup Bidirectional Cross Connect | ${nodes['DUT2']} -| | ... | ${nodes['DUT2']['interfaces']['port1']['name']} -| | ... | ${nodes['DUT2']['interfaces']['port3']['name']} - - -| Get traffic links between TG "${tg}" and DUT1 "${dut1}" and DUT2 "${dut2}" -| | ${DUT1_TG_link}= | Get first active connecting link between node "${dut1}" and "${tg}" -| | ${DUT2_TG_link}= | Get first active connecting link between node "${dut2}" and "${tg}" -| | ${tg_traffic_links}= | Create List | ${DUT1_TG_link} | ${DUT2_TG_link} -| | [Return] | ${tg_traffic_links} - - -| Send traffic on node "${node}" from link "${link1}" to link "${link2}" -| | ${src_port}= | Get Interface By Link Name | ${node} | ${link1} -| | ${dst_port}= | Get Interface By Link Name | ${node} | ${link2} +| | [Arguments] | ${node} | ${if1} | ${if2} | +| | Vpp Setup Bidirectional Cross Connect | ${node} | ${if1} | ${if2} + +| Send and receive traffic +| | [Documentation] | Send traffic from source interface to destination interface +| | [Arguments] | ${tg_node} | ${src_int} | ${dst_int} +| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int} +| | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int} | | ${src_ip}= | Set Variable | 192.168.100.1 | | ${dst_ip}= | Set Variable | 192.168.100.2 -| | ${src_mac}= | Get Node Link Mac | ${node} | ${link1} -| | ${dst_mac}= | Get Node Link Mac | ${node} | ${link2} -| | ${args}= | Traffic Script Gen Arg | ${dst_port} | ${src_port} | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} -| | Run Traffic Script On Node | send_ip_icmp.py | ${node} | ${args} - - -| Interfaces on all DUTs are in "${state}" state -| | Set interface state | ${nodes['DUT1']} | ${nodes['DUT1']['interfaces']['port1']['name']} | ${state} -| | Set interface state | ${nodes['DUT1']} | ${nodes['DUT1']['interfaces']['port3']['name']} | ${state} -| | Set interface state | ${nodes['DUT2']} | ${nodes['DUT2']['interfaces']['port1']['name']} | ${state} -| | Set interface state | ${nodes['DUT2']} | ${nodes['DUT2']['interfaces']['port3']['name']} | ${state} +| | ${args}= | Traffic Script Gen Arg | ${dst_int} | ${src_int} | ${src_mac} +| | | ... | ${dst_mac} | ${src_ip} | ${dst_ip} +| | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args} diff --git a/resources/templates/vat/l2_xconnect.vat b/resources/templates/vat/l2_xconnect.vat index 77cb9d6240..da1040e963 100644 --- a/resources/templates/vat/l2_xconnect.vat +++ b/resources/templates/vat/l2_xconnect.vat @@ -1 +1,3 @@ +sw_interface_set_flags sw_if_index {interface1} admin-up link-up +sw_interface_set_flags sw_if_index {interface2} admin-up link-up sw_interface_set_l2_xconnect rx_sw_if_index {interface1} tx_sw_if_index {interface2} diff --git a/tests/suites/l2_xconnect/l2_xconnect_untagged.robot b/tests/suites/l2_xconnect/l2_xconnect_untagged.robot index 286a63e9f4..f6c1cbdd72 100644 --- a/tests/suites/l2_xconnect/l2_xconnect_untagged.robot +++ b/tests/suites/l2_xconnect/l2_xconnect_untagged.robot @@ -15,19 +15,25 @@ | Resource | resources/libraries/robot/default.robot | Resource | resources/libraries/robot/l2_xconnect.robot +| Library | resources.libraries.python.NodePath | Force Tags | 3_NODE_SINGLE_LINK_TOPO -| Suite Setup | Run Keywords | Setup all DUTs before test -| ... | AND | Setup all TGs before traffic script -| ... | AND | Interfaces on all DUTs are in "up" state +| Test Setup | Setup all DUTs before test +| Suite Setup | Setup all TGs before traffic script + *** Test Cases *** -| VPP forwards packets through xconnect in circular topology -| | Given L2 setup xconnect on DUTs -| | ${tg}= | Set Variable | ${nodes['TG']} -| | ${dut1}= | Set Variable | ${nodes['DUT1']} -| | ${dut2}= | Set Variable | ${nodes['DUT2']} -| | ${tg_links}= | Get traffic links between TG "${tg}" and DUT1 "${dut1}" and DUT2 "${dut2}" +| Vpp forwards packets via L2 xconnect in circular topology +| | [Tags] | 3_NODE_SINGLE_LINK_TOPO +| | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']} +| | Compute Path +| | ${src_if} | ${tg}= | Next Interface +| | ${dut1_if1} | ${dut1}= | Next Interface +| | ${dut1_if2} | ${dut1}= | Next Interface +| | ${dut2_if1} | ${dut2}= | Next Interface +| | ${dut2_if2} | ${dut2}= | Next Interface +| | ${dst_if} | ${tg}= | Next Interface +| | L2 setup xconnect on DUT | ${dut1} | ${dut1_if1} | ${dut1_if2} +| | L2 setup xconnect on DUT | ${dut2} | ${dut2_if1} | ${dut2_if2} | | Sleep | 10 | Work around VPP interface up taking too long. -| | Send traffic on node "${nodes['TG']}" from link "${tg_links[0]}" to link "${tg_links[1]}" - +| | Send and receive traffic | ${tg} | ${src_if} | ${dst_if}