diff options
Diffstat (limited to 'resources')
4 files changed, 490 insertions, 316 deletions
diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index 92b5830847..e2be81e877 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -35,7 +35,8 @@ class InterfaceKeywords(object): """ INTF_PARAMS = ("name", "description", "type", "enabled", - "link-up-down-trap-enable", "v3po:l2", "v3po:vxlan-gpe") + "link-up-down-trap-enable", "v3po:l2", "v3po:vxlan-gpe", + "vpp-vlan:sub-interfaces") IPV4_PARAMS = ("enabled", "forwarding", "mtu") IPV6_PARAMS = ("enabled", "forwarding", "mtu", "dup-addr-detect-transmits") IPV6_AUTOCONF_PARAMS = ("create-global-addresses", @@ -47,22 +48,18 @@ 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") + SUB_IF_PARAMS = ("identifier", + "vlan-type", + "enabled") + SUB_IF_MATCH = ("default", + "untagged", + "vlan-tagged", + "vlan-tagged-exact-match") + BD_PARAMS = ("bridge-domain", + "split-horizon-group", + "bridged-virtual-interface") VXLAN_GPE_PARAMS = ("local", "remote", "vni", @@ -954,105 +951,258 @@ class InterfaceKeywords(object): node, interface, path, new_vhost_structure) @staticmethod - def create_sub_interface(node, super_interface, identifier, **kwargs): + def create_sub_interface(node, super_interface, match, tags=None, **kwargs): """Create a new sub-interface. :param node: Honeycomb node. - :param super_interface: The name of super interface. - :param identifier: sub-interface identifier. + :param super_interface: Super interface. + :param match: Match type. The valid values are defined in + InterfaceKeywords.SUB_IF_MATCH. + :param tags: List of tags. :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.SUB_INTF_PARAMS. + defined in InterfaceKeywords.SUB_IF_PARAMS. :type node: dict :type super_interface: str - :type identifier: int + :type match: str + :type tags: list :type kwargs: dict :return: Content of response. :rtype: bytearray :raises HoneycombError: If the parameter is not valid. + :raises KeyError: If the parameter 'match' is invalid. """ - # 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") + match_type = { + "default": + {"default": {}}, + "untagged": + {"untagged": {}}, + "vlan-tagged": + {"vlan-tagged": {"match-exact-tags": "false"}}, + "vlan-tagged-exact-match": + {"vlan-tagged": {"match-exact-tags": "true"}} + } - 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 - } + "tags": { + "tag": [] + }, } + for param, value in kwargs.items(): - if param in InterfaceKeywords.INTF_PARAMS: + if param in InterfaceKeywords.SUB_IF_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") + try: + new_sub_interface["match"] = match_type[match] + except KeyError: + raise HoneycombError("The value '{0}' of parameter 'match' is " + "invalid.".format(match)) + + if tags: + new_sub_interface["tags"]["tag"].extend(tags) + + path = ("interfaces", + ("interface", "name", super_interface), + "vpp-vlan:sub-interfaces", + "sub-interface") new_sub_interface_structure = [new_sub_interface, ] return InterfaceKeywords._set_interface_properties( - node, sub_interface_name, path, new_sub_interface_structure) + node, super_interface, 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. + def get_sub_interface_oper_data(node, super_interface, identifier): + """Retrieves sub-interface operational data using Honeycomb API. :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. + :param super_interface: Super interface. + :param identifier: The ID of sub-interface. :type node: dict - :type sub_interface: str - :type kwargs: dict + :type super_interface: str + :type identifier: int + :return: Sub-interface operational data. + :rtype: dict + :raises HoneycombError: If there is no sub-interface with the given ID. + """ + + if_data = InterfaceKeywords.get_interface_oper_data(node, + super_interface) + for sub_if in if_data["vpp-vlan:sub-interfaces"]["sub-interface"]: + if str(sub_if["identifier"]) == str(identifier): + return sub_if + + raise HoneycombError("The interface {0} does not have sub-interface " + "with ID {1}".format(super_interface, identifier)) + + @staticmethod + def remove_all_sub_interfaces(node, super_interface): + """Remove all sub-interfaces from the given interface. + + :param node: Honeycomb node. + :param super_interface: Super interface. + :type node: dict + :type super_interface: str :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", super_interface), + "vpp-vlan:sub-interfaces") - path = ("interfaces", ("interface", "name", sub_interface), "v3po:l2", - "vlan-tag-rewrite") return InterfaceKeywords._set_interface_properties( - node, sub_interface, path, new_rewrite) + node, super_interface, path, {}) @staticmethod - def remove_vlan_tag_rewrite_from_sub_interface(node, sub_interface): - """Remove vlan tag rewrite from a sub-interface. + def set_sub_interface_state(node, super_interface, identifier, state): + """Set the administrative state of sub-interface. :param node: Honeycomb node. - :param sub_interface: The name of sub-interface. + :param super_interface: Super interface. + :param identifier: The ID of sub-interface. + :param state: Required sub-interface state - up or down. :type node: dict - :type sub_interface: str + :type super_interface: str + :type identifier: int + :type state: str + :return: Content of response. + :rtype: bytearray + """ + + intf_state = {"up": "true", + "down": "false"} + + path = ("interfaces", + ("interface", "name", super_interface), + "vpp-vlan:sub-interfaces", + ("sub-interface", "identifier", identifier), + "enabled") + + return InterfaceKeywords._set_interface_properties( + node, super_interface, path, intf_state[state]) + + @staticmethod + def add_bridge_domain_to_sub_interface(node, super_interface, identifier, + config): + """Add a sub-interface to a bridge domain and set its parameters. + + :param node: Honeycomb node. + :param super_interface: Super interface. + :param identifier: The ID of sub-interface. + :param config: Bridge domain configuration. + :type node: dict + :type super_interface: str + :type identifier: int + :type config: dict + :return: Content of response. :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. """ - path = ("interfaces", ("interface", "name", sub_interface), "v3po:l2", - "vlan-tag-rewrite") + path = ("interfaces", + ("interface", "name", super_interface), + "vpp-vlan:sub-interfaces", + ("sub-interface", "identifier", int(identifier)), + "l2") + return InterfaceKeywords._set_interface_properties( - node, sub_interface, path, None) + node, super_interface, path, config) + + @staticmethod + def get_bd_data_from_sub_interface(node, super_interface, identifier): + """Get the operational data about the bridge domain from sub-interface. + + :param node: Honeycomb node. + :param super_interface: Super interface. + :param identifier: The ID of sub-interface. + :type node: dict + :type super_interface: str + :type identifier: int + :return: Operational data about the bridge domain. + :rtype: dict + :raises HoneycombError: If there is no sub-interface with the given ID. + """ + + try: + bd_data = InterfaceKeywords.get_sub_interface_oper_data( + node, super_interface, identifier)["l2"] + return bd_data + except KeyError: + raise HoneycombError("The operational data does not contain " + "information about a bridge domain.") + + @staticmethod + def configure_tag_rewrite(node, super_interface, identifier, config): + """Add / change / disable vlan tag rewrite on a sub-interface. + + :param node: Honeycomb node. + :param super_interface: Super interface. + :param identifier: The ID of sub-interface. + :param config: Rewrite tag configuration. + :type node: dict + :type super_interface: str + :type identifier: int + :type config: dict + :return: Content of response. + :rtype: bytearray + """ + + path = ("interfaces", + ("interface", "name", super_interface), + "vpp-vlan:sub-interfaces", + ("sub-interface", "identifier", int(identifier)), + "l2", + "rewrite") + + return InterfaceKeywords._set_interface_properties( + node, super_interface, path, config) + + @staticmethod + def get_tag_rewrite_oper_data(node, super_interface, identifier): + """Get the operational data about tag rewrite. + + :param node: Honeycomb node. + :param super_interface: Super interface. + :param identifier: The ID of sub-interface. + :type node: dict + :type super_interface: str + :type identifier: int + :return: Operational data about tag rewrite. + :rtype: dict + :raises HoneycombError: If there is no sub-interface with the given ID. + """ + + try: + tag_rewrite = InterfaceKeywords.get_sub_interface_oper_data( + node, super_interface, identifier)["l2"]["rewrite"] + return tag_rewrite + except KeyError: + raise HoneycombError("The operational data does not contain " + "information about the tag-rewrite.") + + @staticmethod + def compare_data_structures(data, ref): + """Checks if data obtained from UUT is as expected. + + :param data: Data to be checked. + :param ref: Referential data used for comparison. + :type data: dict + :type ref: dict + :raises HoneycombError: If a parameter from referential data is not + present in operational data or if it has different value. + """ + + for key, item in ref.items(): + try: + if data[key] != item: + raise HoneycombError("The value of parameter '{0}' is " + "incorrect. It should be " + "'{1}' but it is '{2}'". + format(key, item, data[key])) + except KeyError: + raise HoneycombError("The parameter '{0}' is not present in " + "operational data".format(key)) @staticmethod def compare_interface_lists(list1, list2): diff --git a/resources/libraries/robot/honeycomb/interfaces.robot b/resources/libraries/robot/honeycomb/interfaces.robot index 19f4ddac71..02d0a49cb8 100644 --- a/resources/libraries/robot/honeycomb/interfaces.robot +++ b/resources/libraries/robot/honeycomb/interfaces.robot @@ -368,3 +368,25 @@ | | [Arguments] | ${node} | ${interface} | | | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} | | Should be empty | ${vat_data} + +| Interface indices from Honeycomb and VAT should correspond +| | [Documentation] | Uses VAT and Honeycomb to get operational data about the\ +| | ... | given interface and compares the interface indexes. The interface +| | ... | index from Honeycomb should be greater than index from VAT by one. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of the interface to be checked. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Interface indices from Honeycomb and VAT should correspond \ +| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| +| | ... +| | [Arguments] | ${node} | ${interface} +| | ... +| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} +| | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1 +| | Should be equal as strings +| | ... | ${api_data['if-index']} | ${sw_if_index} diff --git a/resources/libraries/robot/honeycomb/sub_interface.robot b/resources/libraries/robot/honeycomb/sub_interface.robot index e7f9c8a66b..c21b860f64 100644 --- a/resources/libraries/robot/honeycomb/sub_interface.robot +++ b/resources/libraries/robot/honeycomb/sub_interface.robot @@ -14,195 +14,225 @@ *** Settings *** | Library | resources.libraries.python.InterfaceUtil | ... | WITH NAME | interfaceCLI +| Library | resources.libraries.python.L2Util | 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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_interface - Super-interface where a sub-interface will be\ +| | ... | created. Type: string +| | ... | - match - Match type. Type: string +| | ... | - tags - List of tags to be set while creating the sub-interface.\ +| | ... | Type: list +| | ... | - sub_interface_settings - Sub-inteface parameters to be set while\ +| | ... | creating the 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 +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0\ +| | ... | \| vlan-tagged-exact-match \| ${sub_if_1_tags}\ +| | ... | \| ${sub_if_1_settings} \| | | ... -| | ... | *Example:* -| | ... | \| Honeycomb fails to remove sub-interface\ -| | ... | \| ${nodes['DUT1']} \| sub_test \| +| | [Arguments] | ${node} | ${super_interface} +| | ... | ${match} | ${tags} | ${sub_interface_settings} | | ... -| | [Arguments] | ${node} | ${interface} -| | Run keyword and expect error | *HoneycombError: Not possible to remove* 500. -| | ... | interfaceAPI.Delete interface | ${node} | ${interface} +| | interfaceAPI.Create sub interface | ${node} | ${super_interface} +| | ... | ${match} | ${tags} | &{sub_interface_settings} | 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.\ +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_interface - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... | - sub_if_settings - Operational data for sub-interface to be checked.\ | | ... | 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} +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\ +| | ... | \| ${sub_if_1_params} \| +| | ... +| | [Arguments] | ${node} | ${super_interface} | ${identifier} +| | ... | ${sub_if_settings} +| | ... +| | ${api_data}= | interfaceAPI.Get sub interface oper data +| | ... | ${node} | ${super_interface} | ${identifier} +| | interfaceAPI.Compare Data Structures | ${api_data} | ${sub_if_settings} | 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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - sub_interface - Name of an sub-interface on the specified node.\ +| | ... | Type: string +| | ... | - sub_interface_settings - Operational data specific for a\ +| | ... | sub-interface to be checked. Type: dictionary | | ... | | ... | *Example:* | | ... | \| Sub-interface configuration from VAT should be\ -| | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_interface_base_settings}\ -| | ... | \| ${sub_interface_settings} \| +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_if_1_params} \| | | ... -| | [Arguments] | ${node} | ${interface} | ${sub_settings} -| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} +| | [Arguments] | ${node} | ${sub_interface} | ${sub_interface_settings} +| | ... +| | ${vat_data}= | InterfaceCLI.VPP get interface data +| | ... | ${node} | ${sub_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_settings['identifier']} +| | Should be equal as strings +| | ... | ${vat_data['interface_name']} | ${sub_interface} +| | Run keyword if | ${vat_data['link_up_down']} == 0 +| | ... | Should be equal as strings +| | ... | ${sub_interface_settings['oper-status']} | down +| | Run keyword if | ${vat_data['link_up_down']} == 1 +| | ... | Should be equal as strings +| | ... | ${sub_interface_settings['oper-status']} | up + +| Sub-interface indices from Honeycomb and VAT should correspond +| | [Documentation] | Uses VAT and Honeycomb to get operational data about the\ +| | ... | given sub-interface and compares the interface indexes. The +| | ... | sub-interface index from Honeycomb should be greater than index from +| | ... | VAT by one. +| | ... +| | ... | *Arguments:* +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_interface - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Sub-interface indices from Honeycomb and VAT should correspond \ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| +| | ... +| | [Arguments] | ${node} | ${super_interface} | ${identifier} +| | ... +| | ${api_data}= | interfaceAPI.Get sub interface oper data +| | ... | ${node} | ${super_interface} | ${identifier} +| | ${vat_data}= | InterfaceCLI.VPP get interface data +| | ... | ${node} | ${super_interface}.${identifier} +| | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1 +| | Should be equal as strings +| | ... | ${api_data['if-index']} | ${sw_if_index} + +| Honeycomb sets the sub-interface up +| | [Documentation] | Honeycomb sets the sub-interface up. +| | ... +| | ... | *Arguments:* +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_interface - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... +| | ... | *Example:* +| | ... | Honeycomb sets the sub-interface up\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| +| | ... +| | [Arguments] | ${node} | ${super_interface} | ${identifier} +| | ... +| | interfaceAPI.Set sub interface state +| | ... | ${node} | ${super_interface} | ${identifier} | up + +| Honeycomb sets the sub-interface down +| | [Documentation] | Honeycomb sets the sub-interface down. +| | ... +| | ... | *Arguments:* +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_interface - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... +| | ... | *Example:* +| | ... | Honeycomb sets the sub-interface down\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| +| | ... +| | [Arguments] | ${node} | ${super_interface} | ${identifier} +| | ... +| | interfaceAPI.Set sub interface state +| | ... | ${node} | ${super_interface} | ${identifier} | down + +| 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 +| | ... | - super_interface - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb fails to set sub-interface up\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| +| | ... +| | [Arguments] | ${node} | ${super_interface} | ${identifier} +| | ... +| | Run keyword and expect error | *HoneycombError: * was not successful. * 500. +| | ... | interfaceAPI.Set sub interface state +| | ... | ${node} | ${super_interface} | ${identifier} | up | 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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_if - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... | - sub_bd_setings - Bridge domain 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} \| +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \| | | ... -| | [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']} +| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings} +| | ... +| | interfaceAPI.Add bridge domain to sub interface +| | ... | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings} | 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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_if - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... | - settings - Bridge domain parameters to be checked. Type: dictionary | | ... | | ... | *Example:* | | ... | \| Sub-interface bridge domain configuration from Honeycomb should be\ -| | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_bd_setings} \| +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \| | | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | ${if_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} -| | Should be equal | ${if_data['v3po:l2']['bridge-domain']} +| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} +| | ... +| | ${if_data}= | interfaceAPI.Get BD data from sub interface +| | ... | ${node} | ${super_if} | ${identifier} +| | Should be equal | ${if_data['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:\ +| | ... | - 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} \| +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${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]} @@ -213,166 +243,135 @@ | | 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. +| Honeycomb fails to remove all sub-interfaces +| | [Documentation] | Honeycomb tries to remove all sub-interfaces using\ +| | ... | Honeycomb API. This operation must fail. | | ... | | ... | *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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_if - Super-interface. Type: string | | ... | | ... | *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']} +| | ... | \| Honeycomb fails to remove all sub-interfaces\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| +| | ... +| | [Arguments] | ${node} | ${super_if} +| | ... +| | Run keyword and expect error | *HoneycombError:*not successful. * code: 500. +| | ... | interfaceAPI.Remove all sub interfaces +| | ... | ${node} | ${super_if} -| 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. +| Honeycomb configures tag rewrite +| | [Documentation] | Honeycomb configures tag-rewrite | | ... | | ... | *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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_if - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... | - settings - tag-rewrite parameters. Type: dictionary. | | ... | | ... | *Example:* -| | ... | \| Rewrite tag configuration from VAT should be\ -| | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \| +| | ... | \| Honeycomb configures tag rewrite\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\ +| | ... | \| ${tag_rewrite_push} \| | | ... -| | [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']} +| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} +| | ... +| | interfaceAPI.Configure tag rewrite +| | ... | ${node} | ${super_if} | ${identifier} | ${settings} -| Honeycomb sets rewrite tag -| | [Documentation] | Set the rewrite tag for sub-interface using Honeycomb API. +| Rewrite tag from Honeycomb should be empty +| | [Documentation] | Checks if the tag-rewrite is empty or does not exist. | | ... | | ... | *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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_if - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string | | ... | | ... | *Example:* -| | ... | \| Honeycomb sets rewrite tag\ -| | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \| +| | ... | \| Rewrite tag from Honeycomb should be empty\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| | | ... -| | [Arguments] | ${node} | ${sub_interface} | ${rw_params} -| | interfaceAPI.Add vlan tag rewrite to sub interface -| | ... | ${node} | ${sub_interface} | &{rw_params} +| | [Arguments] | ${node} | ${super_if} | ${identifier} +| | ... +| | Run keyword and expect error | *Hon*Error*oper*does not contain*tag-rewrite* +| | ... | interfaceAPI.Get tag rewrite oper data +| | ... | ${node} | ${super_if} | ${identifier} -| Honeycomb removes rewrite tag -| | [Documentation] | Remove the rewrite tag from sub-interface using Honeycomb\ -| | ... | API. +| Rewrite tag from Honeycomb should be +| | [Documentation] | Checks if the operational data retrieved from Honeycomb\ +| | ... | are as expected. | | ... | | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - sub_interface - name of an sub-interface on the specified node.\ -| | ... | Type: string +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_if - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... | - settings - tag-rewrite operational parameters to be checked.\ +| | ... | Type: dictionary. | | ... | | ... | *Example:* -| | ... | \| Honeycomb removes rewrite tag \| ${nodes['DUT1']} \| sub_test \| +| | ... | \| Rewrite tag from Honeycomb should be\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\ +| | ... | \| ${tag_rewrite_push_oper} \| | | ... -| | [Arguments] | ${node} | ${sub_interface} -| | interfaceAPI.Remove vlan tag rewrite from sub interface -| | ... | ${node} | ${sub_interface} +| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} +| | ${api_data}= | interfaceAPI.Get tag rewrite oper data +| | ... | ${node} | ${super_if} | ${identifier} +| | interfaceAPI.Compare Data Structures | ${api_data} | ${settings} -| Rewrite tag from Honeycomb should be -| | [Documentation] | Uses Honeycomb API to verify if the rewrite tag is set\ -| | ... | with correct parameters. +| Rewrite tag 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 -| | ... | - sub_interface - name of an sub-interface on the specified node.\ +| | ... | - interface - name of a sub-interface on the specified node.\ | | ... | Type: string -| | ... | - rw_params - Parameters to be checked. Type: dictionary +| | ... | - rw_settings - Parameters to be set while setting the rewrite tag.\ +| | ... | 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']} +| | ... | \| Rewrite tag from VAT should be\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${rw_params} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${rw_settings} +| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} +| | interfaceAPI.Compare Data Structures | ${vat_data} | ${rw_settings} | Honeycomb fails to set wrong rewrite tag | | [Documentation] | Honeycomb tries to set wrong rewrite tag and expects\ -| | ... | error. +| | ... | an 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 +| | ... | - node - Information about a DUT node. Type: dictionary +| | ... | - super_if - Super-interface. Type: string +| | ... | - identifier - Sub-interface ID. Type: integer or string +| | ... | - settings - tag-rewrite parameters. Type: dictionary. | | ... | | ... | *Example:* | | ... | \| Honeycomb fails to set wrong rewrite tag\ -| | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \| +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\ +| | ... | \| ${tag_rewrite_push_WRONG} \| | | ... -| | [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} +| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} +| | Run keyword and expect error | *HoneycombError: * was not successful. *00. +| | ... | interfaceAPI.Configure tag rewrite +| | ... | ${node} | ${super_if} | ${identifier} | ${settings} -| Honeycomb fails to set sub-interface up -| | [Documentation] | Honeycomb tries to set sub-interface up and expects error. +| VAT disables tag-rewrite +| | [Documentation] | The keyword disables the tag-rewrite using VAT. | | ... | | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - sub_interface - name of an sub-interface on the specified node.\ +| | ... | - 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 \| +| | ... | \| VAT disables tag-rewrite\ +| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| | | ... | | [Arguments] | ${node} | ${sub_interface} -| | Run keyword and expect error | *HoneycombError: * was not successful. * 500. -| | ... | interfaceAPI.Set interface up | ${node} | ${sub_interface} +| | ... +| | ${sw_if_index}= | interfaceCLI.Get sw if index | ${node} | ${sub_interface} +| | L2 tag rewrite | ${node} | ${sw_if_index} | disable diff --git a/resources/libraries/robot/honeycomb/vxlan_gpe.robot b/resources/libraries/robot/honeycomb/vxlan_gpe.robot index 3850eb83fa..364a23228c 100644 --- a/resources/libraries/robot/honeycomb/vxlan_gpe.robot +++ b/resources/libraries/robot/honeycomb/vxlan_gpe.robot @@ -90,7 +90,7 @@ | | ... | ${api_data['name']} | ${base_settings['name']} | | Should be equal as strings | | ... | ${api_data['type']} | v3po:vxlan-gpe-tunnel -| | Run keyword if | '${base_settings['enabled']}' == 'true' +| | Run keyword if | $base_settings['enabled'] == True | | ... | Run keywords | | ... | Should be equal as strings | ${api_data['admin-status']} | up | | ... | AND @@ -130,9 +130,11 @@ | | Should be equal as strings | ${vat_data['protocol']} | | ... | ${protocols['${vxlan_gpe_params['next-protocol']}']} -| Interface indices should be the same from Honeycomb and VAT -| | [Documentation] | Uses VAT and Honeycomb to get operational data about the\ -| | ... | given interface and compares the interface indexes. +| VxLAN GPE Interface indices from Honeycomb and VAT should correspond +| | [Documentation] | Uses VAT and Honeycomb to get operational data about the \ +| | ... | given VxLAN GPE interface and compares the interface indexes. The \ +| | ... | VxLAN GPE interface index from Honeycomb should be greater than \ +| | ... | index from VAT by one. | | ... | | ... | *Arguments:* | | ... | - node - information about a DUT node. Type: dictionary @@ -140,15 +142,16 @@ | | ... | | ... | *Example:* | | ... -| | ... | \| Interface indices should be the same from Honeycomb and VAT \ -| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| +| | ... | \| VxLAN GPE Interface indices from Honeycomb and VAT should \ +| | ... | correspond \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| | | ... | | [Arguments] | ${node} | ${interface} | | ... | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} | | ${vat_data}= | VxLAN GPE Dump | ${node} | ${interface} +| | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1 | | Should be equal as strings -| | ... | ${api_data['if-index']} | ${vat_data['sw_if_index']} +| | ... | ${api_data['if-index']} | ${sw_if_index} | VxLAN GPE configuration from VAT should be empty | | [Documentation] | Uses VAT to get operational data about the given\ |