From: selias Date: Tue, 1 Mar 2016 09:56:40 +0000 (+0100) Subject: change interface up calls to explicit keywords X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=commitdiff_plain;h=8120dcdc84da7ff1dee097240bc1ecf18914397c change interface up calls to explicit keywords Remove implicit "set interface state" calls from ipv4 and ipv6 test keywords. Use robot keyword instead. Change-Id: I535a7a967910e77dded39eb167fb9c164187566e Signed-off-by: selias --- diff --git a/resources/libraries/python/IPv4Setup.py b/resources/libraries/python/IPv4Setup.py index ed65518254..a9d9caa51c 100644 --- a/resources/libraries/python/IPv4Setup.py +++ b/resources/libraries/python/IPv4Setup.py @@ -231,14 +231,18 @@ class IPv4Setup(object): """IPv4 setup in topology.""" @staticmethod - def vpp_nodes_setup_ipv4_addresses(nodes, nodes_addr): - """Setup IPv4 addresses on all VPP nodes in topology. + def vpp_nodes_set_ipv4_addresses(nodes, nodes_addr): + """Set IPv4 addresses on all VPP nodes in topology. :param nodes: Nodes of the test topology. :param nodes_addr: Available nodes IPv4 adresses. :type nodes: dict :type nodes_addr: dict + :return: affected interfaces as list of (node, interface) tuples + :rtype: list """ + + interfaces = [] for net in nodes_addr.values(): for port in net['ports'].values(): host = port.get('node') @@ -251,7 +255,9 @@ class IPv4Setup(object): if node['type'] != NodeType.DUT: continue get_node(node).set_ip(port['if'], port['addr'], net['prefix']) - InterfaceUtil.set_interface_state(node, port['if'], 'up') + interfaces.append((node, port['if'])) + + return interfaces @staticmethod @keyword('Get IPv4 address of node "${node}" interface "${port}" ' diff --git a/resources/libraries/python/IPv6Setup.py b/resources/libraries/python/IPv6Setup.py index e04668f953..598905735a 100644 --- a/resources/libraries/python/IPv6Setup.py +++ b/resources/libraries/python/IPv6Setup.py @@ -55,14 +55,19 @@ class IPv6Setup(object): def __init__(self): pass - def nodes_setup_ipv6_addresses(self, nodes, nodes_addr): - """Setup IPv6 addresses on all VPP nodes in topology. + def nodes_set_ipv6_addresses(self, nodes, nodes_addr): + """Set IPv6 addresses on all VPP nodes in topology. :param nodes: Nodes of the test topology. :param nodes_addr: Available nodes IPv6 adresses. :type nodes: dict :type nodes_addr: dict + :return: affected interfaces as list of (node, interface) tuples + :rtype: list """ + + interfaces = [] + for net in nodes_addr.values(): for port in net['ports'].values(): host = port.get('node') @@ -76,6 +81,9 @@ class IPv6Setup(object): self.vpp_set_if_ipv6_addr(node, port['if'], port['addr'], net['prefix']) + interfaces.append((node, port['if'])) + + return interfaces def nodes_clear_ipv6_addresses(self, nodes, nodes_addr): """Remove IPv6 addresses from all VPP nodes in topology. diff --git a/resources/libraries/robot/bridge_domain.robot b/resources/libraries/robot/bridge_domain.robot index 819331f1a7..fe7553a394 100644 --- a/resources/libraries/robot/bridge_domain.robot +++ b/resources/libraries/robot/bridge_domain.robot @@ -20,6 +20,8 @@ | | [Documentation] | Setup BD between 2 interfaces on VPP node and if learning | | ... | is off set static L2FIB entry on second interface | | [Arguments] | ${node} | ${if1} | ${if2} | ${learn}=${TRUE} | ${mac}=${EMPTY} +| | Set Interface State | ${node} | ${if1} | up +| | Set Interface State | ${node} | ${if2} | up | | Vpp Add L2 Bridge Domain | ${node} | ${1} | ${if1} | ${if2} | ${learn} | | Run Keyword If | ${learn} == ${FALSE} | | ... | Vpp Add L2fib Entry | ${node} | ${mac} | ${if2} | ${1} diff --git a/resources/libraries/robot/ipv4.robot b/resources/libraries/robot/ipv4.robot index d122932c89..4c76644c54 100644 --- a/resources/libraries/robot/ipv4.robot +++ b/resources/libraries/robot/ipv4.robot @@ -26,7 +26,9 @@ | Setup IPv4 adresses on all DUT nodes in topology | | [Documentation] | Setup IPv4 address on all DUTs in topology | | [Arguments] | ${nodes} | ${nodes_addr} -| | VPP nodes setup ipv4 addresses | ${nodes} | ${nodes_addr} +| | ${interfaces}= | VPP nodes set ipv4 addresses | ${nodes} | ${nodes_addr} +| | :FOR | ${interface} | IN | @{interfaces} +| | | Set Interface State | @{interface} | up | Routes are set up for IPv4 testing | | [Documentation] | Setup routing on all VPP nodes required for IPv4 tests diff --git a/resources/libraries/robot/ipv6.robot b/resources/libraries/robot/ipv6.robot index 4783b070ab..78a8eda45a 100644 --- a/resources/libraries/robot/ipv6.robot +++ b/resources/libraries/robot/ipv6.robot @@ -152,7 +152,9 @@ | | [Documentation] | Setup IPv6 address on all DUTs | | [Arguments] | ${nodes} | ${nodes_addr} | | Setup all DUTs before test -| | Nodes Setup Ipv6 Addresses | ${nodes} | ${nodes_addr} +| | ${interfaces}= | Nodes Set Ipv6 Addresses | ${nodes} | ${nodes_addr} +| | :FOR | ${interface} | IN | @{interfaces} +| | | Set Interface State | @{interface} | up | | All Vpp Interfaces Ready Wait | ${nodes} | Clear ipv6 on all dut in topology diff --git a/resources/libraries/robot/l2_xconnect.robot b/resources/libraries/robot/l2_xconnect.robot index 0983181010..4266234e10 100644 --- a/resources/libraries/robot/l2_xconnect.robot +++ b/resources/libraries/robot/l2_xconnect.robot @@ -13,9 +13,12 @@ *** Settings *** | Library | resources.libraries.python.L2Util +| Library | resources.libraries.python.InterfaceUtil *** Keywords *** | L2 setup xconnect on DUT | | [Documentation] | Setup Bidirectional Cross Connect on DUTs | | [Arguments] | ${node} | ${if1} | ${if2} | +| | Set Interface State | ${node} | ${if1} | up +| | Set Interface State | ${node} | ${if2} | up | | Vpp Setup Bidirectional Cross Connect | ${node} | ${if1} | ${if2} diff --git a/resources/templates/vat/l2_bridge_domain.vat b/resources/templates/vat/l2_bridge_domain.vat index d35dd59b85..20bc28f96d 100644 --- a/resources/templates/vat/l2_bridge_domain.vat +++ b/resources/templates/vat/l2_bridge_domain.vat @@ -1,5 +1,3 @@ -sw_interface_set_flags sw_if_index {sw_if_id1} admin-up -sw_interface_set_flags sw_if_index {sw_if_id2} admin-up bridge_domain_add_del bd_id {bd_id} flood 1 uu-flood 1 forward 1 learn {learn} arp-term 0 sw_interface_set_l2_bridge sw_if_index {sw_if_id1} bd_id {bd_id} shg 0 enable sw_interface_set_l2_bridge sw_if_index {sw_if_id2} bd_id {bd_id} shg 0 enable diff --git a/resources/templates/vat/l2_xconnect.vat b/resources/templates/vat/l2_xconnect.vat index d004336c7b..77cb9d6240 100644 --- a/resources/templates/vat/l2_xconnect.vat +++ b/resources/templates/vat/l2_xconnect.vat @@ -1,3 +1 @@ -sw_interface_set_flags sw_if_index {interface1} admin-up -sw_interface_set_flags sw_if_index {interface2} admin-up sw_interface_set_l2_xconnect rx_sw_if_index {interface1} tx_sw_if_index {interface2}