From ce469c1a7d56c2be639e5cecde961c4ef6354fb5 Mon Sep 17 00:00:00 2001 From: selias Date: Wed, 25 May 2016 17:16:11 +0200 Subject: [PATCH 1/1] Add Honeycomb persistence tests JIRA: CSIT-121 - add honeycomb persistence test suite - add keywords used by persistence tests - add methods for working with Honeycomb persistence files - make suite setup clear persisted data before Honeycomb startup Change-Id: Ief61c12b730d58a456566c4683c0091e08a09b56 Signed-off-by: selias --- resources/libraries/python/constants.py | 2 +- .../python/honeycomb/HcAPIKwInterfaces.py | 26 +++ .../libraries/python/honeycomb/HcPersistence.py | 87 ++++++++ .../libraries/python/honeycomb/HoneycombSetup.py | 8 +- .../libraries/robot/honeycomb/honeycomb.robot | 12 ++ .../libraries/robot/honeycomb/persistence.robot | 226 +++++++++++++++++++++ tests/suites/honeycomb/7 - persistence.robot | 64 ++++++ tests/suites/honeycomb/__init__.robot | 2 + tests/suites/honeycomb/resources/persistence.py | 74 +++++++ 9 files changed, 496 insertions(+), 5 deletions(-) create mode 100644 resources/libraries/python/honeycomb/HcPersistence.py create mode 100644 resources/libraries/robot/honeycomb/persistence.robot create mode 100644 tests/suites/honeycomb/7 - persistence.robot create mode 100644 tests/suites/honeycomb/resources/persistence.py diff --git a/resources/libraries/python/constants.py b/resources/libraries/python/constants.py index b3a61da16a..a119bdbf01 100644 --- a/resources/libraries/python/constants.py +++ b/resources/libraries/python/constants.py @@ -26,7 +26,7 @@ class Constants(object): VAT_BIN_NAME = 'vpp_api_test' # Honeycomb directory location at topology nodes: - REMOTE_HC_DIR = '/opt/honeycomb/v3po-karaf-1.0.0-SNAPSHOT/bin' + REMOTE_HC_DIR = '/opt/honeycomb/v3po-karaf-1.0.0-SNAPSHOT' # Honeycomb templates location RESOURCES_TPL_HC = 'resources/templates/honeycomb' diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index c143b069db..e8cbc78bea 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -1047,3 +1047,29 @@ class InterfaceKeywords(object): "vlan-tag-rewrite") return InterfaceKeywords._set_interface_properties( node, sub_interface, path, None) + + @staticmethod + def compare_interface_lists(list1, list2): + """Compare provided lists of interfaces by name. + + :param list1: List of interfaces. + :param list2: List of interfaces. + :type list1: list + :type list2: list + :raises HoneycombError: If an interface exists in only one of the lists. + """ + + ignore = ["vx_tunnel0", "vxlan_gpe_tunnel0"] + # these have no equivalent in config data and no effect on VPP + + names1 = [x['name'] for x in list1] + names2 = [x['name'] for x in list2] + + for name in names1: + if name not in names2 and name not in ignore: + raise HoneycombError("Interface {0} not present in list {1}" + .format(name, list2)) + for name in names2: + if name not in names1 and name not in ignore: + raise HoneycombError("Interface {0} not present in list {1}" + .format(name, list1)) diff --git a/resources/libraries/python/honeycomb/HcPersistence.py b/resources/libraries/python/honeycomb/HcPersistence.py new file mode 100644 index 0000000000..adb55f5477 --- /dev/null +++ b/resources/libraries/python/honeycomb/HcPersistence.py @@ -0,0 +1,87 @@ +# 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. + +"""Implementation of keywords for managing Honeycomb persistence files.""" + +from robot.api import logger + +from resources.libraries.python.constants import Constants as Const +from resources.libraries.python.honeycomb.HoneycombUtil import HoneycombError +from resources.libraries.python.ssh import SSH +from resources.libraries.python.topology import NodeType + + +class HcPersistence(object): + """Implements keywords for managing Honeycomb persistence files. + + The keywords implemented in this class make possible to: + - find and replace strings in config.json persistence file + """ + + def __init__(self): + pass + + @staticmethod + def clear_persisted_honeycomb_config(*nodes): + """Remove configuration data persisted from last Honeycomb session. + Default configuration will be used instead. + + :param nodes: List of DUTs to execute on. + :type nodes: list + :raises HoneycombError: If persisted configuration could not be removed. + """ + cmd = "rm {0}/etc/opendaylight/honeycomb/*".format( + Const.REMOTE_HC_DIR) + for node in nodes: + if node['type'] == NodeType.DUT: + ssh = SSH() + ssh.connect(node) + (ret_code, _, stderr) = ssh.exec_command_sudo(cmd) + if ret_code != 0: + if "No such file or directory" not in stderr: + raise HoneycombError('Could not clear persisted ' + 'configuration on node {0}, {1}' + .format(node['host'], stderr)) + else: + logger.info("Persistence data was not present on node" + " {0}".format(node['host'])) + else: + logger.info("Persistence files removed on node {0}" + .format(node['host'])) + + @staticmethod + def modify_persistence_files(node, find, replace): + """Searches contents of persistence file config.json for the provided + string, and replaces all occurrences with another string. + + :param node: Honeycomb node. + :param find: Text to find in file. + :param replace: String to replace anything found with. + :type node: dict + :type find: string + :type replace: string + :raises HoneycombError: If persistent configuration couldn't be + modified. + """ + + argument = "\"s/{0}/{1}/g\"".format(find, replace) + path = "{0}/etc/opendaylight/honeycomb/config.json".format( + Const.REMOTE_HC_DIR) + command = "sed -i {0} {1}".format(argument, path) + + ssh = SSH() + ssh.connect(node) + (ret_code, _, stderr) = ssh.exec_command_sudo(command) + if ret_code != 0: + raise HoneycombError("Failed to modify persistence file on node" + " {0}, {1}".format(node, stderr)) diff --git a/resources/libraries/python/honeycomb/HoneycombSetup.py b/resources/libraries/python/honeycomb/HoneycombSetup.py index e9c1295260..1c232f08a5 100644 --- a/resources/libraries/python/honeycomb/HoneycombSetup.py +++ b/resources/libraries/python/honeycomb/HoneycombSetup.py @@ -53,9 +53,9 @@ class HoneycombSetup(object): :type nodes: list :raises HoneycombError: If Honeycomb fails to start. """ - logger.console("Starting Honeycomb service ...") + logger.console("\nStarting Honeycomb service ...") - cmd = "{0}/start".format(Const.REMOTE_HC_DIR) + cmd = "{0}/bin/start".format(Const.REMOTE_HC_DIR) for node in nodes: if node['type'] == NodeType.DUT: @@ -81,9 +81,9 @@ class HoneycombSetup(object): :type nodes: list :raises HoneycombError: If Honeycomb failed to stop. """ - logger.console("Shutting down Honeycomb service ...") + logger.console("\nShutting down Honeycomb service ...") - cmd = "{0}/stop".format(Const.REMOTE_HC_DIR) + cmd = "{0}/bin/stop".format(Const.REMOTE_HC_DIR) errors = [] for node in nodes: diff --git a/resources/libraries/robot/honeycomb/honeycomb.robot b/resources/libraries/robot/honeycomb/honeycomb.robot index ee8cfbc408..c04bd23a57 100644 --- a/resources/libraries/robot/honeycomb/honeycomb.robot +++ b/resources/libraries/robot/honeycomb/honeycomb.robot @@ -60,3 +60,15 @@ | | Stop honeycomb on DUTs | @{duts} | | Wait until keyword succeeds | 2m | 10s | | ... | Check honeycomb shutdown state | @{duts} + +| Clear persisted Honeycomb configuration +| | [Documentation] | *Delete saved configuration.* +| | ... +| | ... | *Arguments:* +| | ... | - duts - one or more nodes to clear persistence on. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \| +| | [Arguments] | @{duts} +| | Clear persisted Honeycomb config | @{duts} \ No newline at end of file diff --git a/resources/libraries/robot/honeycomb/persistence.robot b/resources/libraries/robot/honeycomb/persistence.robot new file mode 100644 index 0000000000..1c23915aca --- /dev/null +++ b/resources/libraries/robot/honeycomb/persistence.robot @@ -0,0 +1,226 @@ +# 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.honeycomb.HcAPIKwInterfaces.InterfaceKeywords +| ... | WITH NAME | InterfaceAPI +| Library | resources.libraries.python.honeycomb.HcPersistence +| Resource | resources/libraries/robot/honeycomb/honeycomb.robot +| Resource | resources/libraries/robot/honeycomb/interfaces.robot +| Resource | resources/libraries/robot/honeycomb/vxlan.robot +| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot +| Resource | resources/libraries/robot/honeycomb/tap.robot +| Resource | resources/libraries/robot/honeycomb/vhost_user.robot +| Resource | resources/libraries/robot/honeycomb/sub_interface.robot +| Variables | tests/suites/honeycomb/resources/persistence.py | ${interface} +| Documentation | Keywords used to test Honeycomb persistence. + +*** Keywords *** +| Honeycomb is restarted +| | [Documentation] | Restarts Honeycomb without clearing persistence data. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb is restarted \| ${nodes['DUT1']} \| +| | [Arguments] | ${node} +| | Stop Honeycomb service on DUTs | ${node} +| | Setup Honeycomb service on DUTs | ${node} + +| VPP is restarted +| | [Documentation] | Restarts VPP and waits until it reconnects with Honeycomb. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| VPP is restarted \| ${nodes['DUT1']} \| +| | [Arguments] | ${node} +| | Setup DUT | ${node} +| | Check VPP connection | ${node} + +| Check VPP connection +| | [Documentation] | Checks if Honeycomb is connected to VPP by reading VPP\ +| | ... | version number from Honeycomb operational data. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Check VPP connection \| ${nodes['DUT1']} \| +| | [Arguments] | ${node} +| | Wait until keyword succeeds | 2min | 20sec +| | ... | Check Honeycomb startup state | ${node} + +| Honeycomb and VPP are restarted +| | [Documentation] | Stops Honeycomb, restarts VPP and then starts Honeycomb\ +| | ... | again. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb and VPP are restarted \| ${nodes['DUT1']} \| +| | [Arguments] | ${node} +| | Stop Honeycomb service on DUTs | ${node} +| | Setup DUT | ${node} +| | Setup Honeycomb service on DUTs | ${node} + +| Honeycomb configures every setting +| | [Documentation] | Uses Honeycomb to set basic settings for VxLAN,\ +| | ... | bridge domains, TAP, vhost-user and VLAN. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb configures every setting \| ${nodes['DUT1']} \ +| | ... | \| GigabitEthernet0/8/0 \| +| | [Arguments] | ${node} | ${interface} +| | Honeycomb sets interface VxLAN configuration +| | ... | ${node} | ${vx_interface} | ${vxlan_settings} +| | Honeycomb creates first l2 bridge domain +| | ... | ${node} | ${bd_name} | ${bd_settings} +| | Honeycomb creates TAP interface +| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | Honeycomb creates vhost-user interface +| | ... | ${node} | ${vhost_interface} | ${vhost_user_server} +| | Honeycomb creates sub-interface +| | ... | ${node} | ${interface} | ${sub_interface_id} +| | ... | ${sub_interface_base_settings} | ${sub_interface_settings} +| | Honeycomb sets interface state | ${node} | ${interface} | up +| | VxLAN configuration from Honeycomb should be +| | ... | ${node} | ${vx_interface} | ${vxlan_settings} +| | VxLAN configuration from VAT should be +| | ... | ${node} | ${vxlan_settings} +| | Bridge domain configuration from Honeycomb should be +| | ... | ${node} | ${bd_name} | ${bd_settings} +| | Bridge domain configuration from VAT should be +| | ... | ${node} | ${0} | ${bd_settings} +| | TAP configuration from Honeycomb should be +| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | TAP configuration from VAT should be +| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | Sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | Sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} +| | Interface state from Honeycomb should be | ${node} | ${interface} | up +| | Interface state from VAT should be | ${node} | ${interface} | up + +| Honeycomb and VPP should verify every setting +| | [Documentation] | Uses Honeycomb and VAT to verify settings for VxLAN,\ +| | ... | bridge domains, TAP, vhost-user and VLAN. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb and VPP should verify every setting \| ${nodes['DUT1']} \ +| | ... | \| GigabitEthernet0/8/0 \| +| | [Arguments] | ${node} | ${interface} +| | VxLAN configuration from Honeycomb should be +| | ... | ${node} | ${vx_interface} | ${vxlan_settings} +| | VxLAN configuration from VAT should be +| | ... | ${node} | ${vxlan_settings} +| | Bridge domain configuration from Honeycomb should be +| | ... | ${node} | ${bd_name} | ${bd_settings} +| | Bridge domain configuration from VAT should be +| | ... | ${node} | ${0} | ${bd_settings} +| | TAP configuration from Honeycomb should be +| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | TAP configuration from VAT should be +| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | Vhost-user configuration from Honeycomb should be +| | ... | ${node} | ${vhost_interface} | ${vhost_user_server} +| | Vhost-user configuration from VAT should be +| | ... | ${node} | ${vhost_user_server} +| | Sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | Sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} +| | Interface state from Honeycomb should be | ${node} | ${interface} | up +| | Interface state from VAT should be | ${node} | ${interface} | up + +| Honeycomb and VPP should have default configuration +| | [Documentation] | Uses Honeycomb and VAT to verify settings for VxLAN,\ +| | ... | bridge domains, TAP, vhost-user and VLAN. Expects default\ +| | ... | configuration. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb and VPP should have default configuration \| +| | ... | ${nodes['DUT1']} \| +| | [Arguments] | ${node} +| | VxLAN configuration from Honeycomb should be empty +| | ... | ${node} | ${vx_interface} +| | VxLAN configuration from VAT should be empty | ${node} +| | Honeycomb should show no bridge domains | ${node} +| | VAT should show no bridge domains | ${node} +| | TAP configuration from Honeycomb should be empty +| | ... | ${node} | ${tap_interface} +| | TAP configuration from VAT should be empty +| | ... | ${node} | ${tap_interface} +| | Vhost-user configuration from Honeycomb should be empty +| | ... | ${node} | ${vhost_interface} +| | Vhost-user configuration from VAT should be empty +| | ... | ${node} +| | Sub-interface configuration from Honeycomb should be empty +| | ... | ${node} | ${sub_interface_name} +| | Sub-interface configuration from VAT should be empty +| | ... | ${node} | ${sub_interface_name} + +| Honeycomb should show no rogue interfaces +| | [Documentation] | Checks if operational data contains interfaces not\ +| | ... | present in configuration and vice versa. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb should show no rogue interfaces \| ${nodes['DUT1']} \| +| | [Arguments] | ${node} +| | ${data_conf}= | InterfaceAPI.Get all interfaces cfg data | ${node} +| | ${data_oper}= | InterfaceAPI.Get all interfaces oper data | ${node} +| | Compare interface lists | ${data_conf} | ${data_oper} + +| Persistence file is damaged during restart +| | [Documentation] | Shuts down Honeycomb, modifies persistence files to\ +| | ... | simulate damage, then restarts VPP and starts up Honeycomb again. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Persistence file is damaged during restart \| ${nodes['DUT1']} \| +| | [Arguments] | ${node} +| | Stop Honeycomb service on DUTs | ${node} +| | Modify persistence files | ${node} | { | abc +| | Setup DUT | ${node} +| | Setup Honeycomb service on DUTs | ${node} \ No newline at end of file diff --git a/tests/suites/honeycomb/7 - persistence.robot b/tests/suites/honeycomb/7 - persistence.robot new file mode 100644 index 0000000000..24043c343c --- /dev/null +++ b/tests/suites/honeycomb/7 - persistence.robot @@ -0,0 +1,64 @@ +# 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 interface to run tests on. +| ${node}= | ${nodes['DUT1']} +| ${interface}= | ${node['interfaces']['port1']['name']} + +*** Settings *** +| Resource | resources/libraries/robot/default.robot +| Resource | resources/libraries/robot/honeycomb/persistence.robot +# Restart Honeycomb and VPP to clear configuration before tests. +| Suite Setup | Run keywords +| ... | Stop Honeycomb service on DUTs | ${node} | AND +| ... | Clear persisted Honeycomb configuration | ${node} | AND +| ... | Setup DUT | ${node} | AND +| ... | Setup Honeycomb service on DUTs | ${node} +| Documentation | *Honeycomb configuration persistence test suite.* + +*** Test Cases *** +| Honeycomb persists configuration through restart of both systems +| | [Documentation] | Checks if Honeycomb maintains configuration after both\ +| | ... | Honeycomb and VPP are restarted. +| | [Tags] | honeycomb_sanity +| | When Honeycomb configures every setting | ${node} | ${interface} +| | And Honeycomb and VPP are restarted | ${node} +| | Then Honeycomb and VPP should verify every setting | ${node} | ${interface} +| | And Honeycomb should show no rogue interfaces | ${node} + +| Honeycomb persists configuration through restart of Honeycomb +| | [Documentation] | Checks if Honeycomb maintains configuration after it\ +| | ... | is restarted. +| | [Tags] | honeycomb_sanity +| | Given Honeycomb and VPP should verify every setting | ${node} | ${interface} +| | When Honeycomb is restarted | ${node} +| | Then Honeycomb and VPP should verify every setting | ${node} | ${interface} +| | And Honeycomb should show no rogue interfaces | ${node} + +| Honeycomb persists configuration through restart of VPP +| | [Documentation] | Checks if Honeycomb updates VPP settings after VPP is\ +| | ... | restarted. +| | [Tags] | honeycomb_sanity +| | Given Honeycomb and VPP should verify every setting | ${node} | ${interface} +| | When VPP is restarted | ${node} +| | Then Honeycomb and VPP should verify every setting | ${node} | ${interface} +| | And Honeycomb should show no rogue interfaces | ${node} + +| Honeycomb reverts to defaults if persistence files are invalid +| | [Documentation] | Checks if Honeycomb reverts to default configuration when\ +| | ... | persistence files are damaged or invalid. +| | [Tags] | honeycomb_sanity +| | Given Honeycomb and VPP should verify every setting | ${node} | ${interface} +| | When Persistence file is damaged during restart | ${node} +| | Then Honeycomb and VPP should have default configuration | ${node} diff --git a/tests/suites/honeycomb/__init__.robot b/tests/suites/honeycomb/__init__.robot index a61f2160f2..264f604599 100644 --- a/tests/suites/honeycomb/__init__.robot +++ b/tests/suites/honeycomb/__init__.robot @@ -15,8 +15,10 @@ | ${node}= | ${nodes['DUT1']} *** Settings *** +| Library | resources.libraries.python.honeycomb.HcPersistence | Resource | resources/libraries/robot/default.robot | Resource | resources/libraries/robot/honeycomb/honeycomb.robot | Suite Setup | Run keywords | Setup all DUTs before test | AND +| ... | Clear persisted Honeycomb configuration | ${node} | AND | ... | Setup Honeycomb service on DUTs | ${node} | Suite Teardown | Stop Honeycomb service on DUTs | ${node} diff --git a/tests/suites/honeycomb/resources/persistence.py b/tests/suites/honeycomb/resources/persistence.py new file mode 100644 index 0000000000..d47ea662f9 --- /dev/null +++ b/tests/suites/honeycomb/resources/persistence.py @@ -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. + +"""Test variables for Honeycomb persistence test suite.""" + + +def get_variables(interface): + """Creates and returns dictionary of test variables. + + :param interface: name of super-interface for the tested sub-interface + :type interface: str + :return: dictionary of test variables + :rtype: dict + """ + # Vlan subinterface basic settings + sub_interface_id = 10 + sub_interface_name = interface + '.' + str(sub_interface_id) + + variables = { + # VxLan settings + 'vx_interface': 'vx_tunnel_test', + 'vxlan_settings': {'src': '192.168.0.2', + 'dst': '192.168.0.3', + "vni": 88, + 'encap-vrf-id': 0}, + # bridge domain settings + 'bd_name': 'bd_persist', + 'bd_settings': {'flood': True, + 'forward': True, + 'learn': True, + 'unknown-unicast-flood': True, + 'arp-termination': True + }, + # tap interface settings + 'tap_interface': 'tap_test', + 'tap_settings': {'tap-name': 'tap_test', + 'mac': '08:00:27:c0:5d:37', + 'device-instance': 1 + }, + # vhost-user interface settings + 'vhost_interface': 'test_vhost', + 'vhost_user_server': {'socket': 'soc1', + 'role': 'server' + }, + # Vlan subinterface settings + 'sub_interface_id': sub_interface_id, + 'sub_interface_name': sub_interface_name, + 'sub_interface_base_settings': {'name': sub_interface_name, + 'type': 'v3po:sub-interface' + }, + 'sub_interface_settings': { + 'super-interface': interface, + 'identifier': sub_interface_id, + 'vlan-type': '802dot1ad', + 'number-of-tags': 2, + 'outer-id': 22, + 'inner-id': 33, + 'match-any-outer-id': False, + 'match-any-inner-id': False, + 'exact-match': True, + 'default-subif': True + } + } + return variables -- 2.16.6