aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--resources/libraries/python/InterfaceUtil.py28
-rw-r--r--resources/libraries/robot/honeycomb/tap.robot145
-rw-r--r--resources/libraries/robot/honeycomb/vxlan.robot3
-rw-r--r--resources/templates/vat/tap_dump.vat1
-rw-r--r--tests/suites/honeycomb/1 - interface_management.robot5
-rw-r--r--tests/suites/honeycomb/2 - vxlan.robot6
-rw-r--r--tests/suites/honeycomb/3 - bridge_domain.robot6
-rw-r--r--tests/suites/honeycomb/4 - tap.robot74
-rw-r--r--tests/suites/honeycomb/__init__.robot22
9 files changed, 277 insertions, 13 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index 1c1ada8f6c..838ba3bb69 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -490,7 +490,7 @@ class InterfaceUtil(object):
if output["retval"] == 0:
return output["sw_if_index"]
else:
- raise RuntimeError('Unable to create VXLAN interface on node {}'
+ raise RuntimeError('Unable to create VXLAN interface on node {0}'
.format(node))
@staticmethod
@@ -504,7 +504,7 @@ class InterfaceUtil(object):
:type interface: int or str
:return: Dictionary containing data for the given VxLAN interface or if
interface=None, the list of dictionaries with all VxLAN interfaces.
- :rtype dict or list
+ :rtype: dict or list
"""
param = "sw_if_index"
if interface is None:
@@ -544,6 +544,30 @@ class InterfaceUtil(object):
return response[0]
@staticmethod
+ def tap_dump(node, name=None):
+ """Get all TAP interface data from the given node, or data about
+ a specific TAP interface.
+
+ :param node: VPP node to get data from.
+ :param name: Optional name of a specific TAP interface.
+ :type node: dict
+ :type name: str
+ :return: Dictionary of information about a specific TAP interface, or
+ a List of dictionaries containing all TAP data for the given node.
+ :rtype: dict or list
+ """
+ with VatTerminal(node) as vat:
+ response = vat.vat_terminal_exec_cmd_from_template(
+ "tap_dump.vat")
+ if name is None:
+ return response[0]
+ else:
+ for item in response[0]:
+ if name == item['dev_name']:
+ return item
+ return {}
+
+ @staticmethod
def create_subinterface(node, interface, sub_id, outer_vlan_id,
inner_vlan_id, type_subif):
"""Create sub-interface on node.
diff --git a/resources/libraries/robot/honeycomb/tap.robot b/resources/libraries/robot/honeycomb/tap.robot
new file mode 100644
index 0000000000..f503b60090
--- /dev/null
+++ b/resources/libraries/robot/honeycomb/tap.robot
@@ -0,0 +1,145 @@
+# Copyright (c) 2016 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Library | resources.libraries.python.InterfaceUtil
+| ... | WITH NAME | interfaceCLI
+| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
+| ... | WITH NAME | InterfaceAPI
+| Documentation | Keywords used to manipulate TAP interfaces.
+
+*** Keywords ***
+| Honeycomb creates TAP interface
+| | [Documentation] | Uses Honeycomb API to configure a new TAP interface.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ... | - settings - Configuration data for TAP. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb creates TAP interface \
+| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\
+| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
+| | ...
+| | [Arguments] | ${node} | ${interface} | ${settings}
+| | interfaceAPI.Create TAP interface | ${node} | ${interface}
+| | ... | &{settings}
+
+| Honeycomb configures TAP interface
+| | [Documentation] | Uses Honeycomb API to configure an existing TAP interface.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ... | - settings - Configuration data for TAP. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb configures TAP interface \
+| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\
+| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
+| | ...
+| | [Arguments] | ${node} | ${interface} | ${settings}
+| | interfaceAPI.Configure interface TAP | ${node} | ${interface}
+| | ... | &{settings}
+
+| Honeycomb removes TAP interface
+| | [Documentation] | Uses Honeycomb API to remove a TAP interface.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Honeycomb removes TAP interface \
+| | ... | \| ${nodes['DUT1']} \| tap_int1 \|
+| | [Arguments] | ${node} | ${interface}
+| | interfaceAPI.Delete interface | ${node} | ${interface}
+
+| TAP configuration from Honeycomb should be
+| | [Documentation] | Retrieves interface TAP configuration through Honeycomb\
+| | ... | and compares with settings supplied in argument.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ... | - settings - Configuration data for TAP. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| TAP configuration from Honeycomb should be \
+| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\
+| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
+| | ...
+| | [Arguments] | ${node} | ${interface} | ${settings}
+| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
+| | ${api_tap}= | Set Variable | ${api_data['v3po:tap']}
+| | Should be equal | ${api_tap['tap-name']} | ${settings['tap-name']}
+| | ${api_mac}= | Set Variable | ${api_data['phys-address']}
+| | Should be equal | ${api_mac} | ${settings['mac']}
+
+| TAP configuration from VAT should be
+| | [Documentation] | Retrieves interface TAP configuration through VAT and\
+| | ... | compares with settings supplied in argument.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - settings - Configuration data for TAP. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| TAP configuration from Honeycomb should be \
+| | ... | \| ${nodes['DUT1']} \| ${{'tap-name':'tap1',\
+| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
+| | ...
+| | [Arguments] | ${node} | ${interface} | ${settings}
+| | ${vat_data}= | TAP Dump | ${node} | ${interface}
+| | Should be equal | ${vat_data['dev_name']} | ${settings['tap-name']}
+| | ${vat_data}= | VPP Get interface data | ${node}
+# other settings not accessible through VAT commands
+
+| TAP configuration from Honeycomb should be empty
+| | [Documentation] | Attempts to retrieve interface TAP configuration\
+| | ... | through Honeycomb and expects to recieve an empty dictionary.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| TAP configuration from Honeycomb should be empty\
+| | ... | \| ${nodes['DUT1']} \| tap_int1 \|
+| | ...
+| | [Arguments] | ${node} | ${interface}
+| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
+| | Run keyword and expect error | *KeyError: 'v3po:tap' | Set Variable
+| | ... | ${api_data['v3po:tap']}
+
+| TAP configuration from VAT should be empty
+| | [Documentation] | Attempts to retrieve interface TAP configuration\
+| | ... | through VAT and expects a "no data" error.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - information about a DUT node. Type: dictionary
+| | ... | - interface - name of an interface on the specified node. Type: string
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| TAP configuration from VAT should be empty\
+| | ... | \| ${nodes['DUT1']} \| tap_int1 \|
+| | ...
+| | [Arguments] | ${node} | ${interface}
+| | Run Keyword And Expect Error | ValueError: No JSON object could be decoded
+| | ... | TAP Dump | ${node} | ${interface}
diff --git a/resources/libraries/robot/honeycomb/vxlan.robot b/resources/libraries/robot/honeycomb/vxlan.robot
index 83a6e120b7..a57c965fa3 100644
--- a/resources/libraries/robot/honeycomb/vxlan.robot
+++ b/resources/libraries/robot/honeycomb/vxlan.robot
@@ -112,7 +112,8 @@
| | ...
| | [Arguments] | ${node} | ${interface}
| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
-| | Should be empty | ${api_data}
+| | Run keyword and expect error | *KeyError: 'v3po:vxlan' | Set Variable
+| | ... | ${api_data['v3po:vxlan']}
| VxLAN configuration from VAT should be empty
| | [Documentation] | Attempts to retrieve interface VxLAN configuration\
diff --git a/resources/templates/vat/tap_dump.vat b/resources/templates/vat/tap_dump.vat
new file mode 100644
index 0000000000..8f51f6e23c
--- /dev/null
+++ b/resources/templates/vat/tap_dump.vat
@@ -0,0 +1 @@
+sw_interface_tap_dump \ No newline at end of file
diff --git a/tests/suites/honeycomb/1 - interface_management.robot b/tests/suites/honeycomb/1 - interface_management.robot
index e320c46f60..ce5fa0492f 100644
--- a/tests/suites/honeycomb/1 - interface_management.robot
+++ b/tests/suites/honeycomb/1 - interface_management.robot
@@ -14,7 +14,7 @@
*** Variables ***
# Node and interface to run tests on.
| ${node}= | ${nodes['DUT1']}
-| ${interface}= | ${node['interfaces'].values()[0]['name']}
+| ${interface}= | ${node['interfaces']['port1']['name']}
# Configuration which will be set and verified during tests.
| @{ipv4_address_mask}= | 192.168.0.2 | 255.255.255.0
| @{ipv4_address_prefix}= | 192.168.0.3 | ${16}
@@ -31,10 +31,7 @@
*** Settings ***
| Resource | resources/libraries/robot/default.robot
-| Resource | resources/libraries/robot/honeycomb/honeycomb.robot
| Resource | resources/libraries/robot/honeycomb/interfaces.robot
-| Suite Setup | Run keywords | Setup all DUTs before test | AND
-| ... | Setup Honeycomb service on DUTs | ${node}
| Documentation | *Honeycomb interface management test suite.*
| ...
| ... | Test suite uses the first interface of the first DUT node.
diff --git a/tests/suites/honeycomb/2 - vxlan.robot b/tests/suites/honeycomb/2 - vxlan.robot
index c1dee35102..678717c74f 100644
--- a/tests/suites/honeycomb/2 - vxlan.robot
+++ b/tests/suites/honeycomb/2 - vxlan.robot
@@ -14,7 +14,7 @@
*** Variables ***
# Node and interfaces to run tests on.
| ${node}= | ${nodes['DUT1']}
-| ${interface}= | ${node['interfaces'].values()[0]['name']}
+| ${interface}= | ${node['interfaces']['port1']['name']}
| ${vx_interface}= | vx_tunnel_test
# Configuration which will be set and verified during tests.
| &{vxlan_settings}= | src=192.168.0.2 | dst=192.168.0.3 | vni=${88}
@@ -26,7 +26,6 @@
*** Settings ***
| Resource | resources/libraries/robot/default.robot
-| Resource | resources/libraries/robot/honeycomb/honeycomb.robot
| Resource | resources/libraries/robot/honeycomb/interfaces.robot
| Resource | resources/libraries/robot/honeycomb/vxlan.robot
# import additional VxLAN settings from resource file
@@ -41,6 +40,7 @@
| | [Tags] | honeycomb_sanity
| | Given VxLAN configuration from Honeycomb should be empty
| | ... | ${node} | ${vx_interface}
+| | And VxLAN configuration from VAT should be empty | ${node}
| | When Honeycomb sets interface VxLAN configuration
| | ... | ${node} | ${vx_interface} | ${vxlan_settings}
| | Then VxLAN configuration from Honeycomb should be
@@ -53,6 +53,8 @@
| | [Tags] | honeycomb_sanity
| | Given VxLAN configuration from Honeycomb should be
| | ... | ${node} | ${vx_interface} | ${vxlan_settings}
+| | And VxLAN configuration from VAT should be
+| | ... | ${node} | ${vxlan_settings}
| | When Honeycomb removes VxLAN tunnel settings | ${node} | ${vx_interface}
| | Then VxLAN configuration from Honeycomb should be empty
| | ... | ${node} | ${vx_interface}
diff --git a/tests/suites/honeycomb/3 - bridge_domain.robot b/tests/suites/honeycomb/3 - bridge_domain.robot
index 71774fed46..e99b659b3f 100644
--- a/tests/suites/honeycomb/3 - bridge_domain.robot
+++ b/tests/suites/honeycomb/3 - bridge_domain.robot
@@ -14,8 +14,8 @@
*** Variables ***
# Node and interfaces to run tests on.
| ${node}= | ${nodes['DUT1']}
-| @{interfaces}= | ${node['interfaces'].values()[0]['name']}
-| ... | ${node['interfaces'].values()[1]['name']}
+| @{interfaces}= | ${node['interfaces']['port1']['name']}
+| ... | ${node['interfaces']['port3']['name']}
# Configuration which will be set and verified during tests.
| ${bd1_name}= | bd-01
| ${bd2_name}= | bd-02
@@ -25,10 +25,8 @@
*** Settings ***
| Resource | resources/libraries/robot/default.robot
-| Resource | resources/libraries/robot/honeycomb/honeycomb.robot
| Resource | resources/libraries/robot/honeycomb/interfaces.robot
| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
-| Suite Teardown | Stop Honeycomb service on DUTs | ${node}
| Documentation | *Honeycomb bridge domain management test suite.*
| ...
| ... | Test suite uses the first two interfaces on the first DUT node.
diff --git a/tests/suites/honeycomb/4 - tap.robot b/tests/suites/honeycomb/4 - tap.robot
new file mode 100644
index 0000000000..e3613c0e48
--- /dev/null
+++ b/tests/suites/honeycomb/4 - tap.robot
@@ -0,0 +1,74 @@
+# Copyright (c) 2016 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Variables ***
+# Node and interfaces to run tests on.
+| ${node}= | ${nodes['DUT1']}
+| ${interface}= | ${node['interfaces']['port1']['name']}
+| ${tap_interface}= | tap_test
+# Configuration which will be set and verified during tests.
+| &{tap_settings}= | tap-name=tap_test | mac=08:00:27:c0:5d:37
+| ... | device-instance=${1}
+| &{tap_settings2}= | tap-name=tap_test | mac=08:00:27:60:26:ab
+| ... | device-instance=${2}
+
+*** Settings ***
+| Resource | resources/libraries/robot/default.robot
+| Resource | resources/libraries/robot/honeycomb/interfaces.robot
+| Resource | resources/libraries/robot/honeycomb/tap.robot
+| Documentation | *Honeycomb TAP management test suite.*
+| ...
+| ... | Test suite uses the first interface of the first DUT node.
+
+*** Test Cases ***
+| Honeycomb configures TAP interface
+| | [Documentation] | Check if Honeycomb API can configure a TAP interface.
+| | [Tags] | honeycomb_sanity
+| | Given TAP configuration from Honeycomb should be empty
+| | ... | ${node} | ${tap_interface}
+| | And TAP configuration from VAT should be empty
+| | ... | ${node} | ${tap_interface}
+| | When Honeycomb creates TAP interface
+| | ... | ${node} | ${tap_interface} | ${tap_settings}
+| | Then TAP configuration from Honeycomb should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings}
+| | And TAP configuration from VAT should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings}
+
+| Honeycomb modifies existing TAP interface configuration
+| | [Documentation] | Check if Honeycomb API can re-configure and existing TAP\
+| | ... | interface with new settings.
+| | [Tags] | honeycomb_sanity
+| | Given TAP configuration from Honeycomb should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings}
+| | And TAP configuration from VAT should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings}
+| | When Honeycomb configures TAP interface
+| | ... | ${node} | ${tap_interface} | ${tap_settings2}
+| | Then TAP configuration from Honeycomb should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings2}
+| | And TAP configuration from VAT should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings2}
+
+| Honeycomb removes TAP interface
+| | [Documentation] | Check if Honeycomb API can remove TAP interface.
+| | [Tags] | honeycomb_sanity
+| | Given TAP configuration from Honeycomb should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings2}
+| | And TAP configuration from VAT should be
+| | ... | ${node} | ${tap_interface} | ${tap_settings2}
+| | When Honeycomb removes TAP interface | ${node} | ${tap_interface}
+| | Then TAP configuration from Honeycomb should be empty
+| | ... | ${node} | ${tap_interface}
+| | And TAP configuration from VAT should be empty
+| | ... | ${node} | ${tap_interface}
diff --git a/tests/suites/honeycomb/__init__.robot b/tests/suites/honeycomb/__init__.robot
new file mode 100644
index 0000000000..a61f2160f2
--- /dev/null
+++ b/tests/suites/honeycomb/__init__.robot
@@ -0,0 +1,22 @@
+# Copyright (c) 2016 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Variables***
+| ${node}= | ${nodes['DUT1']}
+
+*** Settings ***
+| Resource | resources/libraries/robot/default.robot
+| Resource | resources/libraries/robot/honeycomb/honeycomb.robot
+| Suite Setup | Run keywords | Setup all DUTs before test | AND
+| ... | Setup Honeycomb service on DUTs | ${node}
+| Suite Teardown | Stop Honeycomb service on DUTs | ${node}