Interface VxLAN test 57/957/8
authorTibor Frank <tifrank@cisco.com>
Mon, 2 May 2016 16:19:04 +0000 (18:19 +0200)
committerTibor Frank <tifrank@cisco.com>
Mon, 9 May 2016 08:04:17 +0000 (10:04 +0200)
JIRA: CSIT-45

- add test: Honeycomb modifies interface configuration - VxLAN
- add keywords used in these tests to set and verify configuration
- add method and vat template for dumping an interface's configured VxLAN
- fixed requirements.txt

Change-Id: I6d6c360a4d478a0e40eecf7c0235969e7c06f7a9
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Signed-off-by: C.J. Collier <cjcollier@linuxfoundation.org>
resources/libraries/python/InterfaceUtil.py
resources/libraries/robot/honeycomb/interfaces.robot
resources/templates/vat/vxlan_dump.vat [new file with mode: 0644]
tests/suites/honeycomb/interface_management.robot

index ec2ef69..35194f2 100644 (file)
@@ -493,6 +493,32 @@ class InterfaceUtil(object):
             raise RuntimeError('Unable to create VXLAN interface on node {}'
                                .format(node))
 
+    @staticmethod
+    def vxlan_dump(node, interface):
+        """Get VxLAN data for the given interface.
+
+        :param node: VPP node to get interface data from.
+        :param interface: Numeric index or name string of a specific interface.
+        :type node: dict
+        :type interface: int or str
+        :return: Dictionary containing data for the given VxLAN.
+        :rtype dict
+        """
+
+        if isinstance(interface, basestring):
+            sw_if_index = Topology.get_interface_sw_index(node, interface)
+        else:
+            sw_if_index = interface
+
+        with VatTerminal(node) as vat:
+            response = vat.vat_terminal_exec_cmd_from_template(
+                "vxlan_dump.vat", sw_if_index=sw_if_index)
+
+        for vxlan in response[0]:
+            if vxlan["sw_if_index"] == sw_if_index:
+                return vxlan
+        return {}
+
     @staticmethod
     def create_subinterface(node, interface, sub_id, outer_vlan_id,
                             inner_vlan_id, type_subif):
index 0768fd3..f98cca0 100644 (file)
 | | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
 | | Should be equal | ${vat_data['mtu']} | ${mtu}
 | | Should be equal | ${vat_data['sub_inner_vlan_id']} | ${vrf-id}
+
+| Honeycomb sets interface VxLAN configuration
+| | [Documentation] | Uses Honeycomb API to change VxLAN configuration \
+| | ... | of the specified interface.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ... | - vxlan_settings - Configuration data for VxLAN. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb sets interface VxLAN configuration \
+| | ... | \|${node} \| ${interface} \| &{vxlan_settings} \|
+| | ...
+| | [Arguments] | ${node} | ${interface} | &{vxlan_settings}
+| | :FOR | ${items} | IN | @{vxlan_settings.items()}
+| | | interfaceAPI.Configure interface vxlan | ${node} | ${interface} | @{items}
+
+| VxLAN configuration from Honeycomb should be
+| | [Documentation] | Retrieves interface VxLAN configuration through Honeycomb\
+| | ... | and compares with state supplied in argument.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ... | - vxlan_settings - Configuration data for VxLAN. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| VxLAN configuration from Honeycomb should be \
+| | ... | \| ${node} \| ${interface} \| &{vxlan_settings} \|
+| | ...
+| | [Arguments] | ${node} | ${interface} | &{vxlan_settings}
+| | ${api_data}= | interfaceAPI.Get interface cfg data | ${node} | ${interface}
+| | :FOR | ${items} | IN | @{vxlan_settings.items()}
+| | | Should be equal as strings
+| | ... | ${api_data['v3po:vxlan']['@{items}[0]']} | ${items[1]}
+| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
+| | :FOR | ${items} | IN | @{vxlan_settings.items()}
+| | | Should be equal as strings
+| | ... | ${api_data['v3po:vxlan']['@{items}[0]']} | ${items[1]}
+
+| VxLAN configuration from VAT should be
+| | [Documentation] | Retrieves interface VxLAN configuration through VAT and\
+| | ... | compares with state supplied in argument.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ... | - vxlan_settings - Configuration data for VxLAN. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| VxLAN configuration from Honeycomb should be \
+| | ... | \| ${node} \| ${interface} \| &{vxlan_settings} \|
+| | ...
+| | [Arguments] | ${node} | ${interface} | &{vxlan_settings}
+| | ${vat_data}= | VxLAN Dump | ${node} | ${interface}
+| | Should be equal as strings
+| | ... | ${vat_data['dst_address']} | ${vxlan_settings['dst']}
+| | Should be equal as strings
+| | ... | ${vat_data['src_address']} | ${vxlan_settings['src']}
+| | Should be equal as strings | ${vat_data['vni']} | ${vxlan_settings['vni']}
+| | Should be equal as strings
+| | ... | ${vat_data['encap-vrf-id']} | ${vxlan_settings['encap_vrf_id']}
diff --git a/resources/templates/vat/vxlan_dump.vat b/resources/templates/vat/vxlan_dump.vat
new file mode 100644 (file)
index 0000000..0be6d9f
--- /dev/null
@@ -0,0 +1 @@
+vxlan_tunnel_dump sw_if_index {sw_if_index}
\ No newline at end of file
index f741f95..3408b52 100644 (file)
@@ -25,6 +25,8 @@
 | ... | dup-addr-detect-transmits=5
 | &{ethernet}= | mtu=9000
 | &{routing}= | vrf-id=27
+| &{vxlan_settings}= | src=10.0.1.20 | dst=10.0.3.20 | vni=1000
+| ... | encap-vrf-id=1000
 
 *** Settings ***
 | Resource | resources/libraries/robot/default.robot
 | | ... | ${node} | ${interface} | ${ethernet} | ${routing}
 | | And Interface ethernet and routing configuration from VAT should be
 | | ... | ${node} | ${interface} | ${ethernet['mtu']} | ${routing['vrf-id']}
+
+| Honeycomb modifies interface configuration - VxLAN
+| | [Documentation] | Check if Honeycomb API can configure interface VxLAN \
+| | ... | settings.
+| | [Tags] | honeycomb_sanity
+| | When Honeycomb sets interface VxLAN configuration
+| | ... | ${node} | ${interface} | &{vxlan_settings}
+| | Then VxLAN configuration from Honeycomb should be
+| | ... | ${node} | ${interface} | &{vxlan_settings}
+| | And VxLAN configuration from VAT should be
+| | ... | ${node} | ${interface} | &{vxlan_settings}