diff options
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 12 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HcAPIKwInterfaces.py | 118 | ||||
-rw-r--r-- | resources/libraries/python/honeycomb/HoneycombUtil.py | 2 | ||||
-rw-r--r-- | resources/libraries/robot/honeycomb/sub_interface.robot | 412 | ||||
-rw-r--r-- | resources/libraries/robot/honeycomb/vhost_user.robot | 2 | ||||
-rw-r--r-- | tests/suites/honeycomb/6 - sub_interface.robot | 386 | ||||
-rw-r--r-- | tests/suites/honeycomb/resources/sub_interfaces.py | 100 |
7 files changed, 1024 insertions, 8 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 838ba3bb69..35077d8268 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -190,15 +190,15 @@ class InterfaceUtil(object): if interface is not None: if isinstance(interface, basestring): - sw_if_index = Topology.get_interface_sw_index(node, interface) + param = "interface_name" + elif isinstance(interface, int): + param = "sw_if_index" else: - sw_if_index = interface - + raise TypeError for data_if in data: - if data_if["sw_if_index"] == sw_if_index: - + if data_if[param] == interface: return data_if - + return dict() return data @staticmethod diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index 3f9e9d16a5..c143b069db 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -26,6 +26,7 @@ from resources.libraries.python.honeycomb.HoneycombUtil \ # pylint: disable=too-many-public-methods +# pylint: disable=too-many-lines class InterfaceKeywords(object): """Keywords for Interface manipulation. @@ -34,7 +35,7 @@ class InterfaceKeywords(object): """ INTF_PARAMS = ("name", "description", "type", "enabled", - "link-up-down-trap-enable") + "link-up-down-trap-enable", "v3po:l2") IPV4_PARAMS = ("enabled", "forwarding", "mtu") IPV6_PARAMS = ("enabled", "forwarding", "mtu", "dup-addr-detect-transmits") IPV6_AUTOCONF_PARAMS = ("create-global-addresses", @@ -46,8 +47,22 @@ class InterfaceKeywords(object): VXLAN_PARAMS = ("src", "dst", "vni", "encap-vrf-id") L2_PARAMS = ("bridge-domain", "split-horizon-group", "bridged-virtual-interface") + L2_REWRITE_TAG_PARAMS = ("rewrite-operation", + "first-pushed", + "tag1", + "tag2") TAP_PARAMS = ("tap-name", "mac", "device-instance") VHOST_USER_PARAMS = ("socket", "role") + SUB_INTF_PARAMS = ("super-interface", + "identifier", + "vlan-type", + "number-of-tags", + "outer-id", + "inner-id", + "match-any-outer-id", + "match-any-inner-id", + "exact-match", + "default-subif") def __init__(self): pass @@ -931,3 +946,104 @@ class InterfaceKeywords(object): new_vhost_structure = [new_vhost, ] return InterfaceKeywords._set_interface_properties( node, interface, path, new_vhost_structure) + + @staticmethod + def create_sub_interface(node, super_interface, identifier, **kwargs): + """Create a new sub-interface. + + :param node: Honeycomb node. + :param super_interface: The name of super interface. + :param identifier: sub-interface identifier. + :param kwargs: Parameters and their values. The accepted parameters are + defined in InterfaceKeywords.SUB_INTF_PARAMS. + :type node: dict + :type super_interface: str + :type identifier: int + :type kwargs: dict + :return: Content of response. + :rtype: bytearray + :raises HoneycombError: If the parameter is not valid. + """ + + # These parameters are empty types (in JSON represented as empty + # dictionary) but ODL internally represents them as Booleans. If the + # value is an empty dictionary, it is True, if the parameter is + # missing, it is False. + empty_types = ("match-any-outer-id", + "match-any-inner-id", + "exact-match", + "default-subif") + + sub_interface_name = "{0}.{1}".format(super_interface, str(identifier)) + new_sub_interface = { + "name": sub_interface_name, + "type": "v3po:sub-interface", + "enabled": "false", + "sub-interface": { + "super-interface": super_interface, + "identifier": identifier + } + } + for param, value in kwargs.items(): + if param in InterfaceKeywords.INTF_PARAMS: + new_sub_interface[param] = value + elif param in InterfaceKeywords.SUB_INTF_PARAMS: + if param in empty_types: + if value: + new_sub_interface["sub-interface"][param] = dict() + else: + new_sub_interface["sub-interface"][param] = value + else: + raise HoneycombError("The parameter {0} is invalid.". + format(param)) + + path = ("interfaces", "interface") + new_sub_interface_structure = [new_sub_interface, ] + return InterfaceKeywords._set_interface_properties( + node, sub_interface_name, path, new_sub_interface_structure) + + @staticmethod + def add_vlan_tag_rewrite_to_sub_interface(node, sub_interface, **kwargs): + """Add vlan tag rewrite to a sub-interface. + + :param node: Honeycomb node. + :param sub_interface: The name of sub-interface. + :param kwargs: Parameters and their values. The accepted parameters are + defined in InterfaceKeywords.L2_REWRITE_TAG_PARAMS. + :type node: dict + :type sub_interface: str + :type kwargs: dict + :return: Content of response. + :rtype: bytearray + :raises HoneycombError: If the parameter is not valid. + """ + + new_rewrite = dict() + for param, value in kwargs.items(): + if param in InterfaceKeywords.L2_REWRITE_TAG_PARAMS: + new_rewrite[param] = value + else: + raise HoneycombError("The parameter {0} is invalid.". + format(param)) + + path = ("interfaces", ("interface", "name", sub_interface), "v3po:l2", + "vlan-tag-rewrite") + return InterfaceKeywords._set_interface_properties( + node, sub_interface, path, new_rewrite) + + @staticmethod + def remove_vlan_tag_rewrite_from_sub_interface(node, sub_interface): + """Remove vlan tag rewrite from a sub-interface. + + :param node: Honeycomb node. + :param sub_interface: The name of sub-interface. + :type node: dict + :type sub_interface: str + :rtype: bytearray + :raises HoneycombError: If the parameter is not valid. + """ + + path = ("interfaces", ("interface", "name", sub_interface), "v3po:l2", + "vlan-tag-rewrite") + return InterfaceKeywords._set_interface_properties( + node, sub_interface, path, None) diff --git a/resources/libraries/python/honeycomb/HoneycombUtil.py b/resources/libraries/python/honeycomb/HoneycombUtil.py index 644cf62c43..2f8392ecb5 100644 --- a/resources/libraries/python/honeycomb/HoneycombUtil.py +++ b/resources/libraries/python/honeycomb/HoneycombUtil.py @@ -330,6 +330,8 @@ class HoneycombUtil(object): if data_representation == DataRepresentation.JSON: data = dumps(data) + logger.trace(data) + path = HoneycombUtil.read_path_from_url_file(url_file) return HTTPRequest.put(node=node, path=path, headers=header, payload=data) diff --git a/resources/libraries/robot/honeycomb/sub_interface.robot b/resources/libraries/robot/honeycomb/sub_interface.robot new file mode 100644 index 0000000000..dd68e3f22e --- /dev/null +++ b/resources/libraries/robot/honeycomb/sub_interface.robot @@ -0,0 +1,412 @@ +# 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 +| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot +| Documentation | Keywords used to manipulate sub-interfaces. + +*** Variables *** +# Translation table used to convert values received from Honeycomb to values +# received from VAT. +| &{rewrite_operations}= +| ... | disabled=0 +| ... | push-1=1 +| ... | push-2=2 +| ... | pop-1=3 +| ... | pop-2=4 +| ... | translate-1-to-1=5 +| ... | translate-1-to-2=6 +| ... | translate-2-to-1=7 +| ... | translate-2-to-2=8 + +*** Keywords *** +| Honeycomb creates sub-interface +| | [Documentation] | Create a sub-interface using Honeycomb API. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... | - identifier - ID of sub-interface to be created. Type: integer +| | ... | - sub_interface_base_settings - Configuration data for sub-interface.\ +| | ... | Type: dictionary +| | ... | - sub_interface_settings - Configuration data specific for a\ +| | ... | sub-interface. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb creates sub-interface\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| 10 \| ${sub_interface_settings} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${identifier} +| | ... | ${sub_interface_base_settings} | ${sub_interface_settings} +| | interfaceAPI.Create sub interface | ${node} | ${interface} +| | ... | &{sub_interface_base_settings} | &{sub_interface_settings} + +| Honeycomb fails to remove sub-interface +| | [Documentation] | Honeycomb tries to remove sub-interface using Honeycomb\ +| | ... | API. This operation must fail. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of a sub-interface on the specified node. +| | ... | Type: string +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb fails to remove sub-interface\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| +| | ... +| | [Arguments] | ${node} | ${interface} +| | Run keyword and expect error | *HoneycombError: Not possible to remove* 500. +| | ... | interfaceAPI.Delete interface | ${node} | ${interface} + +| Sub-interface configuration from Honeycomb should be +| | [Documentation] | Retrieves sub-interface configuration through Honeycomb\ +| | ... | and compares it 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 +| | ... | - base_settings - Configuration data for sub-interface.\ +| | ... | Type: dictionary +| | ... | - sub_settings - Configuration data specific for a sub-interface.\ +| | ... | Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Sub-interface configuration from Honeycomb should be\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_interface_base_settings}\ +| | ... | \| ${sub_interface_settings} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${base_settings} | ${sub_settings} +| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | ${api_sub}= | Set Variable | ${api_data['v3po:sub-interface']} +| | :FOR | ${key} | IN | @{base_settings.keys()} +| | | Should be equal | ${api_data['${key}']} | ${base_settings['${key}']} +| | Should be equal as strings +| | ... | ${api_sub['super-interface']} | ${sub_settings['super-interface']} +| | Should be equal as strings +| | ... | ${api_sub['identifier']} | ${sub_settings['identifier']} +| | Should be equal as strings +| | ... | ${api_sub['vlan-type']} | ${sub_settings['vlan-type']} +| | Should be equal as strings +| | ... | ${api_sub['number-of-tags']} | ${sub_settings['number-of-tags']} +| | Run keyword if | ${sub_settings['match-any-outer-id']} == ${TRUE} +| | ... | Should be equal | ${api_sub['match-any-outer-id'][0]} | ${None} +| | Run keyword if | ${sub_settings['match-any-inner-id']} == ${TRUE} +| | ... | Should be equal | ${api_sub['match-any-inner-id'][0]} | ${None} +| | Run keyword if | ${sub_settings['exact-match']} == ${TRUE} +| | ... | Should be equal | ${api_sub['exact-match'][0]} | ${None} +| | Run keyword if | ${sub_settings['default-subif']} == ${TRUE} +| | ... | Should be equal | ${api_sub['default-subif'][0]} | ${None} + +| Sub-interface configuration from VAT should be +| | [Documentation] | Retrieves sub-interface configuration through VAT and\ +| | ... | compares it 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 +| | ... | - sub_settings - Configuration data specific for a sub-interface.\ +| | ... | Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Sub-interface configuration from VAT should be\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_interface_base_settings}\ +| | ... | \| ${sub_interface_settings} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${sub_settings} +| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} +| | Should be equal as strings | ${vat_data['sub_id']} +| | ... | ${sub_settings['identifier']} +| | Should be equal as strings | ${vat_data['sub_number_of_tags']} +| | ... | ${sub_settings['number-of-tags']} +| | Run keyword if | ${sub_settings['match-any-outer-id']} == ${TRUE} +| | ... | Should be equal as integers | ${vat_data['sub_outer_vlan_id_any']} +| | ... | ${sub_settings['match-any-outer-id']} +| | Run keyword if | ${sub_settings['match-any-inner-id']} == ${TRUE} +| | ... | Should be equal as integers | ${vat_data['sub_inner_vlan_id_any']} +| | ... | ${sub_settings['match-any-inner-id']} +| | Run keyword if | ${sub_settings['exact-match']} == ${TRUE} +| | ... | Should be equal as integers | ${vat_data['sub_exact_match']} +| | ... | ${sub_settings['exact-match']} +| | Run keyword if | ${sub_settings['default-subif']} == ${TRUE} +| | ... | Should be equal as integers | ${vat_data['sub_default']} +| | ... | ${sub_settings['default-subif']} + +| Sub-interface configuration from Honeycomb should be empty +| | [Documentation] | Attempts to retrieve sub-interface configuration through\ +| | ... | Honeycomb and expects to get empty dictionary. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of a sub-interface on the specified node. Type:\ +| | ... | string +| | ... +| | ... | *Example:* +| | ... | \| Sub-interface configuration from Honeycomb should be empty\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| +| | ... +| | [Arguments] | ${node} | ${interface} +| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | Should be empty | ${api_data} + +| Sub-interface configuration from VAT should be empty +| | [Documentation] | Attempts to retrieve sub-interface configuration through\ +| | ... | VAT and expects to get empty dictionary. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of a sub-interface on the specified node. Type:\ +| | ... | string +| | ... +| | ... | *Example:* +| | ... | \| Sub-interface configuration from VAT should be empty\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| +| | ... +| | [Arguments] | ${node} | ${interface} | +| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} +| | Should be empty | ${vat_data} + +| Honeycomb adds sub-interface to bridge domain +| | [Documentation] | Honeycomb adds the given sub-interface to bridge domain. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an sub-interface on the specified node. Type:\ +| | ... | string +| | ... | - bd_name - The name of bridge domain where the sub-interface will be\ +| | ... | added. Type: string +| | ... | - sub_bd_setings - Parameters to be set while adding the\ +| | ... | sub-interface to the bridge domain. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb adds sub-interface to bridge domain\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| test_bd \| ${sub_bd_setings} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${bd_name} | ${sub_bd_setings} +| | interfaceAPI.Add bridge domain to interface +| | ... | ${node} | ${interface} | ${bd_name} +| | ... | split_horizon_group=${sub_bd_setings['split-horizon-group']} +| | ... | bvi=${sub_bd_setings['bridged-virtual-interface']} + +| Sub-interface bridge domain configuration from Honeycomb should be +| | [Documentation] | Uses Honeycomb API to verify sub-interface assignment to\ +| | ... | a bridge domain. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of a sub-interface on the specified node. Type:\ +| | ... | string +| | ... | - setings - Parameters to be checked. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Sub-interface bridge domain configuration from Honeycomb should be\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_bd_setings} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | ${if_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | Should be equal | ${if_data['v3po:l2']['bridge-domain']} +| | ... | ${settings['bridge-domain']} +| | Should be equal | disabled +| | ... | ${if_data['v3po:l2']['vlan-tag-rewrite']['rewrite-operation']} + +| Sub-interface bridge domain configuration from VAT should be +| | [Documentation] | Uses VAT to verify sub-interface assignment to a bridge\ +| | ... | domain. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of a sub-interface on the specified node. Type:\ +| | ... | string +| | ... | - setings - Parameters to be checked. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Sub-interface bridge domain configuration from VAT should be\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_bd_setings} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | ${bd_data}= | VPP get bridge domain data | ${node} +| | ${bd_intf}= | Set Variable | ${bd_data[0]} +| | ${sw_if_data}= | Set Variable | ${bd_intf['sw_if'][0]} +| | Should be equal as integers | ${bd_intf['flood']} | ${bd_settings['flood']} +| | Should be equal as integers | ${bd_intf['forward']} +| | ... | ${bd_settings['forward']} +| | Should be equal as integers | ${bd_intf['learn']} | ${bd_settings['learn']} +| | Should be equal as strings | ${sw_if_data['shg']} +| | ... | ${settings['split-horizon-group']} + +| Sub-interface configuration with bd and rw from Honeycomb should be +| | [Documentation] | Retrieves sub-interface configuration through Honeycomb\ +| | ... | and compares it 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 +| | ... | - base_settings - Configuration data for sub-interface.\ +| | ... | Type: dictionary +| | ... | - sub_settings - Configuration data specific for a sub-interface.\ +| | ... | Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Sub-interface configuration with bd and rw from Honeycomb should be\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_interface_base_settings}\ +| | ... | \| ${sub_interface_settings} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${base_settings} | ${sub_settings} +| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | ${api_sub}= | Set Variable | ${api_data['v3po:sub-interface']} +| | Should be equal as strings | ${api_data['name']} | ${base_settings['name']} +| | Should be equal as strings | ${api_data['type']} | ${base_settings['type']} +| | Should be equal as strings +| | ... | ${api_sub['super-interface']} | ${sub_settings['super-interface']} +| | Should be equal as strings +| | ... | ${api_sub['identifier']} | ${sub_settings['identifier']} +| | Should be equal as strings +| | ... | ${api_sub['vlan-type']} | ${sub_settings['vlan-type']} +| | Should be equal as strings +| | ... | ${api_sub['number-of-tags']} | ${sub_settings['number-of-tags']} +| | Run keyword if | ${sub_settings['match-any-outer-id']} == ${TRUE} +| | ... | Should be equal | ${api_sub['match-any-outer-id'][0]} | ${None} +| | Run keyword if | ${sub_settings['match-any-inner-id']} == ${TRUE} +| | ... | Should be equal | ${api_sub['match-any-inner-id'][0]} | ${None} +| | Run keyword if | ${sub_settings['exact-match']} == ${TRUE} +| | ... | Should be equal | ${api_sub['exact-match'][0]} | ${None} +| | Run keyword if | ${sub_settings['default-subif']} == ${TRUE} +| | ... | Should be equal | ${api_sub['default-subif'][0]} | ${None} +| | Should be equal | ${api_data['v3po:l2']['bridge-domain']} +| | ... | ${base_settings['v3po:l2']['bridge-domain']} +| | ${rw_data}= | Set Variable | ${api_data['v3po:l2']['vlan-tag-rewrite']} +| | ${rw_params}= | Set Variable +| | ... | ${base_settings['v3po:l2']['vlan-tag-rewrite']} +| | Should be equal as strings | ${rw_data['rewrite-operation']} +| | ... | ${rw_params['rewrite-operation']} +| | Should be equal as strings | ${rw_data['first-pushed']} +| | ... | ${rw_params['first-pushed']} + +| Rewrite tag configuration from VAT should be +| | [Documentation] | Retrieves sub-interface configuration through VAT and\ +| | ... | compares values of rewrite tag parameters 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 +| | ... | - rw_settings - Parameters to be set while setting the rewrite tag.\ +| | ... | Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Rewrite tag configuration from VAT should be\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${rw_settings} +| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} +| | Should be equal as strings | ${vat_data['vtr_op']} +| | ... | ${rewrite_operations['${rw_settings['rewrite-operation']}']} +| | Run keyword if | '${rw_settings['rewrite-operation']}' == 'push-1' +| | ... | Should be equal as strings +| | ... | ${vat_data['vtr_tag1']} | ${rw_settings['tag1']} + +| Honeycomb sets rewrite tag +| | [Documentation] | Set the rewrite tag for sub-interface using Honeycomb API. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - sub_interface - name of an sub-interface on the specified node.\ +| | ... | Type: string +| | ... | - rw_params - Parameters to be set while setting the rewrite tag.\ +| | ... | Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb sets rewrite tag\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \| +| | ... +| | [Arguments] | ${node} | ${sub_interface} | ${rw_params} +| | interfaceAPI.Add vlan tag rewrite to sub interface +| | ... | ${node} | ${sub_interface} | &{rw_params} + +| Honeycomb removes rewrite tag +| | [Documentation] | Remove the rewrite tag from sub-interface using Honeycomb\ +| | ... | API. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - sub_interface - name of an sub-interface on the specified node.\ +| | ... | Type: string +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb removes rewrite tag \| ${nodes['DUT1']} \| sub_test \| +| | ... +| | [Arguments] | ${node} | ${sub_interface} +| | interfaceAPI.Remove vlan tag rewrite from sub interface +| | ... | ${node} | ${sub_interface} + +| Rewrite tag from Honeycomb should be +| | [Documentation] | Uses Honeycomb API to verify if the rewrite tag is set\ +| | ... | with correct parameters. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - sub_interface - name of an sub-interface on the specified node.\ +| | ... | Type: string +| | ... | - rw_params - Parameters to be checked. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Rewrite tag from Honeycomb should be\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \| +| | ... +| | [Arguments] | ${node} | ${sub_interface} | ${rw_params} +| | ${if_data}= | interfaceAPI.Get interface oper data | ${node} +| | ... | ${sub_interface} +| | ${rw_data}= | Set Variable | ${if_data['v3po:l2']["vlan-tag-rewrite"]} +| | Should be equal as strings | ${rw_data['rewrite-operation']} +| | ... | ${rw_params['rewrite-operation']} +| | Should be equal as strings | ${rw_data['first-pushed']} +| | ... | ${rw_params['first-pushed']} + +| Honeycomb fails to set wrong rewrite tag +| | [Documentation] | Honeycomb tries to set wrong rewrite tag and expects\ +| | ... | error. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - sub_interface - name of an sub-interface on the specified node.\ +| | ... | Type: string +| | ... | - rw_params - Parameters to be set while setting the rewrite tag.\ +| | ... | Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb fails to set wrong rewrite tag\ +| | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \| +| | ... +| | [Arguments] | ${node} | ${sub_interface} | ${rw_params} +| | Run keyword and expect error | *HoneycombError: * was not successful. * 400. +| | ... | interfaceAPI.Add vlan tag rewrite to sub interface | ${node} +| | ... | ${sub_interface} | &{rw_params} + +| Honeycomb fails to set sub-interface up +| | [Documentation] | Honeycomb tries to set sub-interface up and expects error. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - sub_interface - name of an sub-interface on the specified node.\ +| | ... | Type: string +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb fails to set sub-interface up\ +| | ... | \| ${node} \| sub_test \| +| | ... +| | [Arguments] | ${node} | ${sub_interface} +| | Run keyword and expect error | *HoneycombError: * was not successful. * 500. +| | ... | interfaceAPI.Set interface up | ${node} | ${sub_interface} diff --git a/resources/libraries/robot/honeycomb/vhost_user.robot b/resources/libraries/robot/honeycomb/vhost_user.robot index 1d585041a4..89f6ddf09f 100644 --- a/resources/libraries/robot/honeycomb/vhost_user.robot +++ b/resources/libraries/robot/honeycomb/vhost_user.robot @@ -178,5 +178,5 @@ | | ... | | [Arguments] | ${node} | ${interface} | ${settings} | | Run Keyword And Expect Error | HoneycombError: * Status code: 400. -| | ... | interfaceAPI.Configure interface vhost user | ${node} | ${interface} | +| | ... | interfaceAPI.Configure interface vhost user | ${node} | ${interface} | | ... | &{settings} diff --git a/tests/suites/honeycomb/6 - sub_interface.robot b/tests/suites/honeycomb/6 - sub_interface.robot new file mode 100644 index 0000000000..50becace60 --- /dev/null +++ b/tests/suites/honeycomb/6 - sub_interface.robot @@ -0,0 +1,386 @@ +# 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 *** +| Resource | resources/libraries/robot/default.robot +| Resource | resources/libraries/robot/honeycomb/sub_interface.robot +| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot +| Resource | resources/libraries/robot/honeycomb/interfaces.robot +| Variables | tests/suites/honeycomb/resources/sub_interfaces.py +| Documentation | *Honeycomb sub-interface management test suite.* +| ... +| ... | This test suite tests if it is posible to create, modify and\ +| ... | delete a sub-interface. + +*** Variables *** +| ${node}= | ${nodes['DUT1']} + +# Test interface 1 and its sub-interface parameters: +| ${interface}= | ${node['interfaces']['port1']['name']} +| ${sub_interface_id}= | 10 +| ${sub_interface_name}= | ${interface}.${sub_interface_id} +| &{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} +| &{sub_interface_settings_wrong}= +| ... | super-interface=${interface} +| ... | identifier=${sub_interface_id} +| ... | vlan-type=WRONG_TYPE +| ... | number-of-tags=2 +| ... | outer-id=22 +| ... | inner-id=33 +| ... | match-any-outer-id=${TRUE} +| ... | match-any-inner-id=${TRUE} +| ... | exact-match=${TRUE} +| ... | default-subif=${TRUE} + +# Test interface 2 and its sub-interface parameters: +| ${interface2}= | ${node['interfaces']['port3']['name']} +| ${sub_interface2_name}= | ${interface2}.${sub_interface_id} +| &{sub_interface2_base_settings}= +| ... | name=${sub_interface2_name} +| ... | type=v3po:sub-interface +| ... | v3po:l2=&{bd_rw_settings} +| &{sub_interface2_settings}= +| ... | super-interface=${interface2} +| ... | identifier=${sub_interface_id} +| ... | vlan-type=802dot1ad +| ... | number-of-tags=2 +| ... | outer-id=44 +| ... | inner-id=55 +| ... | match-any-outer-id=${FALSE} +| ... | match-any-inner-id=${FALSE} +| ... | exact-match=${TRUE} +| ... | default-subif=${FALSE} + +*** Test Cases *** +| Honycomb creates sub-interface +| | [Documentation] | Check if Honeycomb creates a sub-interface. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be empty +| | ... | ${node} | ${sub_interface_name} +| | And sub-interface configuration from VAT should be empty +| | ... | ${node} | ${sub_interface_name} +| | When Honeycomb creates sub-interface +| | ... | ${node} | ${interface} | ${sub_interface_id} +| | ... | ${sub_interface_base_settings} | ${sub_interface_settings} +| | Then sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} + +| Honeycomb adds sub-interface to bridge domain +| | [Documentation] | Check if Honeycomb adds a sub-interface to bridge domain. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | When Honeycomb creates L2 bridge domain +| | ... | ${node} | ${bd_name} | ${bd_settings} +| | Then Bridge domain configuration from Honeycomb should be +| | ... | ${node} | ${bd_name} | ${bd_settings} +| | When Honeycomb adds sub-interface to bridge domain +| | ... | ${node} | ${sub_interface_name} | ${bd_name} | ${sub_bd_settings} +| | Then sub-interface bridge domain configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_bd_settings} +| | And sub-interface bridge domain configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_bd_settings} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} + +| Honeycomb sets vlan tag rewrite on sub-interface in bridge domain +| | [Documentation] | Check if Honeycomb adds vlan tag rewrite on sub-interface\ +| | ... | in bridge domain. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | And sub-interface bridge domain configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_bd_settings} +| | &{init_rw_params}= | Create dictionary | first-pushed=802dot1ad +| | ... | rewrite-operation=disabled +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${init_rw_params} +| | When Honeycomb sets rewrite tag +| | ... | ${node} | ${sub_interface_name} | ${rw_params} +| | Then rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params} +| | And rewrite tag configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} + +| Honeycomb edits vlan tag rewrite on sub-interface in bridge domain +| | [Documentation] | Check if Honeycomb updates vlan tag rewrite on\ +| | ... | sub-interface in bridge domain. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params} +| | When Honeycomb sets rewrite tag +| | ... | ${node} | ${sub_interface_name} | ${rw_params_edited} +| | Then rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_edited} +| | And rewrite tag configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_edited} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} + +| Honeycomb removes vlan tag rewrite from sub-interface +| | [Documentation] | Check if Honeycomb removes vlan tag rewrite from\ +| | ... | sub-interface. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_edited} +| | When Honeycomb removes rewrite tag +| | ... | ${node} | ${sub_interface_name} +| | Then rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} +| | And rewrite tag configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} + +| Honeycomb sets again vlan tag rewrite on sub-interface in bridge domain +| | [Documentation] | Check if Honeycomb adds vlan tag rewrite on sub-interface\ +| | ... | in bridge domain if it was disabled before. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} +| | When Honeycomb sets rewrite tag +| | ... | ${node} | ${sub_interface_name} | ${rw_params} +| | Then rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params} +| | And rewrite tag configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} + +| Honycomb deletes sub-interface +| | [Documentation] | Check if Honeycomb can delete an existing sub-interface. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | When Honeycomb fails to remove sub-interface +| | ... | ${node} | ${sub_interface_name} +| | Then sub-interface configuration from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_base_settings} +| | ... | ${sub_interface_settings} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${sub_interface_settings} + +| Honycomb creates sub-interface with bridge domain +| | [Documentation] | Check if Honeycomb creates a sub-interface with bridge\ +| | ... | domain and rewrite tag configured. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration from Honeycomb should be empty +| | ... | ${node} | ${sub_interface2_name} +| | And sub-interface configuration from VAT should be empty +| | ... | ${node} | ${sub_interface2_name} +| | When Honeycomb creates L2 bridge domain +| | ... | ${node} | ${bd2_name} | ${bd2_settings} +| | And Honeycomb creates sub-interface +| | ... | ${node} | ${interface2} | ${sub_interface_id} +| | ... | ${sub_interface2_base_settings} | ${sub_interface2_settings} +| | Then sub-interface configuration with bd and rw from Honeycomb should be +| | ... | ${node} | ${sub_interface2_name} | ${sub_interface2_base_settings} +| | ... | ${sub_interface2_settings} +| | And sub-interface configuration from VAT should be +| | ... | ${node} | ${sub_interface2_name} | ${sub_interface2_settings} +| | And rewrite tag configuration from VAT should be +| | ... | ${node} | ${sub_interface2_name} | ${rw_params} + +| Honeycomb sets wrong operation in vlan tag rewrite +| | [Documentation] | Negative test: Honeycomb tries to set a wrong value of\ +| | ... | "rewrite-operation" parameter in "vlan-tag-rewrite". The operation\ +| | ... | must fail. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration with bd and rw from Honeycomb should be +| | ... | ${node} | ${sub_interface2_name} | ${sub_interface2_base_settings} +| | ... | ${sub_interface2_settings} +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} +| | When Honeycomb fails to set wrong rewrite tag +| | ... | ${node} | ${sub_interface_name} | ${rw_params_wrong_op} +| | Then sub-interface configuration with bd and rw from Honeycomb should be +| | ... | ${node} | ${sub_interface2_name} | ${sub_interface2_base_settings} +| | ... | ${sub_interface2_settings} +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} +| | And rewrite tag configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} + +| Honeycomb sets wrong first-pushed in vlan tag rewrite +| | [Documentation] | Negative test: Honeycomb tries to set a wrong value of\ +| | ... | "first-pushed" parameter in "vlan-tag-rewrite". The operation must\ +| | ... | fail. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given sub-interface configuration with bd and rw from Honeycomb should be +| | ... | ${node} | ${sub_interface2_name} | ${sub_interface2_base_settings} +| | ... | ${sub_interface2_settings} +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} +| | When Honeycomb fails to set wrong rewrite tag +| | ... | ${node} | ${sub_interface_name} | ${rw_params_wrong_pushed} +| | Then sub-interface configuration with bd and rw from Honeycomb should be +| | ... | ${node} | ${sub_interface2_name} | ${sub_interface2_base_settings} +| | ... | ${sub_interface2_settings} +| | And rewrite tag from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} +| | And rewrite tag configuration from VAT should be +| | ... | ${node} | ${sub_interface_name} | ${rw_params_disabled} + +| Honeycomb sets interface and sub-interface up +| | [Documentation] | Honeycomb changes the state of interface up and then\ +| | ... | changes the state of its sub-interface up, in this order. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given interface state from Honeycomb should be +| | ... | ${node} | ${interface} | down +| | And interface state from VAT should be +| | ... | ${node} | ${interface} | down +| | When Honeycomb sets interface state +| | ... | ${node} | ${interface} | up +| | Then interface state from Honeycomb should be +| | ... | ${node} | ${interface} | up +| | And interface state from VAT should be +| | ... | ${node} | ${interface} | up +| | Given interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | down +| | And interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | down +| | When Honeycomb sets interface state +| | ... | ${node} | ${sub_interface_name} | up +| | Then interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | up +| | And Interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | up + +| Honeycomb sets sub-interface down while its super-interface is up +| | [Documentation] | Honeycomb sets the sub-interface down while its\ +| | ... | super-interface is up. It must be possible. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | up +| | And Interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | up +| | And interface state from Honeycomb should be +| | ... | ${node} | ${interface} | up +| | And interface state from VAT should be +| | ... | ${node} | ${interface} | up +| | When Honeycomb sets interface state +| | ... | ${node} | ${sub_interface_name} | down +| | Then Interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | down +| | And Interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | down +| | And interface state from Honeycomb should be +| | ... | ${node} | ${interface} | up +| | And interface state from VAT should be +| | ... | ${node} | ${interface} | up + +| Honeycomb sets interface and sub-interface down +| | [Documentation] | Honeycomb changes the state of interface down and then\ +| | ... | changes the state of its sub-interface down, in this order. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given interface state from Honeycomb should be +| | ... | ${node} | ${interface} | up +| | And interface state from VAT should be +| | ... | ${node} | ${interface} | up +| | When Honeycomb sets interface state +| | ... | ${node} | ${interface} | down +| | Then interface state from Honeycomb should be +| | ... | ${node} | ${interface} | down +| | And Interface state from VAT should be +| | ... | ${node} | ${interface} | down +| | Given interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | up +| | And interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | up +| | When Honeycomb sets interface state +| | ... | ${node} | ${sub_interface_name} | down +| | Then Interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | down +| | And Interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | down + +| Honeycomb fails to set sub-interface up while its super-interface is down +| | [Documentation] | Honeycomb tries to set the sub-interface up while its\ +| | ... | super-interface is down. It must not be possible. +| | ... +| | [Tags] | honeycomb_sanity +| | ... +| | Given interface state from Honeycomb should be +| | ... | ${node} | ${interface} | down +| | And interface state from VAT should be +| | ... | ${node} | ${interface} | down +| | And interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | down +| | And interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | down +| | When Honeycomb fails to set sub-interface up +| | ... | ${node} | ${sub_interface_name} +| | Then interface state from Honeycomb should be +| | ... | ${node} | ${interface} | down +| | And interface state from VAT should be +| | ... | ${node} | ${interface} | down +| | And interface state from Honeycomb should be +| | ... | ${node} | ${sub_interface_name} | down +| | And interface state from VAT should be +| | ... | ${node} | ${sub_interface_name} | down diff --git a/tests/suites/honeycomb/resources/sub_interfaces.py b/tests/suites/honeycomb/resources/sub_interfaces.py new file mode 100644 index 0000000000..9c18984930 --- /dev/null +++ b/tests/suites/honeycomb/resources/sub_interfaces.py @@ -0,0 +1,100 @@ +# 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 sub-interface test suite.""" + +# Bridge domain name. +bd_name = 'test-sub-bd' + +# Bridge domain settings used while creating a test bridge domain. +bd_settings = { + 'flood': True, + 'forward': True, + 'learn': True, + 'unknown-unicast-flood': True, + 'arp-termination': True +} + +# Bridge domain configuration used while adding the bridge domain to a +# sub-interface. +sub_bd_settings = { + 'bridge-domain': bd_name, + 'split-horizon-group': '0', + 'bridged-virtual-interface': 'False' +} + +# Rewrite tag parameters used while setting the rewrite tag. +rw_params = { + 'rewrite-operation': 'pop-1', + 'first-pushed': '802dot1ad', + 'tag1': '1', + 'tag2': '2' +} + +# Rewrite tag parameters used while editing the rewrite tag. +rw_params_edited = { + 'rewrite-operation': 'push-1', + 'first-pushed': '802dot1q', + 'tag1': '12', + 'tag2': '22' +} + +# Rewrite tag parameters when it is disabled. +rw_params_disabled = { + 'rewrite-operation': 'disabled', + 'first-pushed': '802dot1ad' +} + +# Rewrite tag parameters - wrong value of 'rewrite-operation' parameter. +# Used in negative test. +rw_params_wrong_op = { + 'rewrite-operation': 'WRONG_OP', + 'first-pushed': '802dot1q', + 'tag1': '1', + 'tag2': '2' +} + +# Rewrite tag parameters - wrong value of 'first-pushed' parameter. +# Used in negative test. +rw_params_wrong_pushed = { + 'rewrite-operation': 'pop-1', + 'first-pushed': 'WRONG_PUSHED', + 'tag1': '1', + 'tag2': '2' +} + +# Second bridge domain name. +bd2_name = 'test-sub-bd2' +sub2_bd_settings = { + 'bridge-domain': bd2_name, + 'split-horizon-group': '0', + 'bridged-virtual-interface': 'False' +} + +# Second bridge domain configuration used while adding the bridge domain to a +# sub-interface. +bd2_settings = { + 'flood': True, + 'forward': True, + 'learn': True, + 'unknown-unicast-flood': True, + 'arp-termination': True +} + +# Parameters of a bridge domain with rewrite tag. +bd_rw_settings = { + 'bridge-domain': bd2_name, + 'split-horizon-group': '0', + 'bridged-virtual-interface': 'False', + 'vlan-tag-rewrite': rw_params +} |