diff options
Diffstat (limited to 'resources/libraries')
5 files changed, 52 insertions, 53 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 558e99b4e7..793f908a7a 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -260,7 +260,9 @@ class InterfaceUtil(object): Note: A single interface may have multiple IP addresses assigned. :rtype: list """ - sw_if_index = InterfaceUtil.get_sw_if_index(node, interface) + + sw_if_index = Topology.convert_interface_reference( + node, interface, "sw_if_index") with VatTerminal(node) as vat: response = vat.vat_terminal_exec_cmd_from_template( diff --git a/resources/libraries/python/honeycomb/HcAPIKwACL.py b/resources/libraries/python/honeycomb/HcAPIKwACL.py index 565ed486d8..556c39644f 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwACL.py +++ b/resources/libraries/python/honeycomb/HcAPIKwACL.py @@ -47,7 +47,7 @@ class ACLKeywords(object): :type node: dict :type path: str :type data: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the status code in response to PUT is not 200 = OK. @@ -79,7 +79,7 @@ class ACLKeywords(object): :param table: Classify table to be added. :type node: dict :type table: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -93,7 +93,7 @@ class ACLKeywords(object): :param node: Honeycomb node. :type node: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -107,7 +107,7 @@ class ACLKeywords(object): :param table_name: Name of the classify table to be removed. :type node: dict :type table_name: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -120,7 +120,7 @@ class ACLKeywords(object): :param node: Honeycomb node. :type node: dict - :return: List of classify tables. + :returns: List of classify tables. :rtype: list """ @@ -131,10 +131,8 @@ class ACLKeywords(object): raise HoneycombError( "Not possible to get operational information about the " "classify tables. Status code: {0}.".format(status_code)) - try: - return resp["vpp-classifier"]["classify-table"] - except (KeyError, TypeError): - return [] + + return resp["vpp-classifier-state"]["classify-table"] @staticmethod def get_classify_table_oper_data(node, table_name): @@ -144,22 +142,16 @@ class ACLKeywords(object): :param table_name: Name of the classify table. :type node: dict :type table_name: str - :return: Operational data about the given classify table. + :returns: Operational data about the given classify table. :rtype: dict """ - path = "/classify-table/" + table_name - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "oper_classify_table", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "classify tables. Status code: {0}.".format(status_code)) - try: - return resp["classify-table"][0] - except (KeyError, TypeError): - return [] + tables = ACLKeywords.get_all_classify_tables_oper_data(node) + for table in tables: + if table["name"] == table_name: + return table + raise HoneycombError("Table {0} not found in ACL table list.".format( + table_name)) @staticmethod def get_all_classify_tables_cfg_data(node): @@ -167,7 +159,7 @@ class ACLKeywords(object): :param node: Honeycomb node. :type node: dict - :return: List of classify tables. + :returns: List of classify tables. :rtype: list """ @@ -193,7 +185,7 @@ class ACLKeywords(object): :type node: dict :type table_name: str :type session: dict - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -212,7 +204,7 @@ class ACLKeywords(object): :type node: dict :type table_name: str :type session_match: str - :return: Content of response. + :returns: Content of response. :rtype: bytearray """ @@ -229,15 +221,13 @@ class ACLKeywords(object): :param table_name: Name of the classify table. :type node: dict :type table_name: str - :return: List of classify sessions present in the classify table. + :returns: List of classify sessions present in the classify table. :rtype: list """ table_data = ACLKeywords.get_classify_table_oper_data(node, table_name) - try: - return table_data["classify-table"][0]["classify-session"] - except (KeyError, TypeError): - return [] + + return table_data["classify-session"] @staticmethod def get_classify_session_oper_data(node, table_name, session_match): @@ -250,23 +240,19 @@ class ACLKeywords(object): :type node: dict :type table_name: str :type session_match: str - :return: Classify session operational data. + :returns: Classify session operational data. :rtype: dict + :raises HoneycombError: If no session the specified match Id is found. """ - path = "/classify-table/" + table_name + \ - "/classify-session/" + session_match - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "oper_classify_table", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "classify tables. Status code: {0}.".format(status_code)) - try: - return resp["classify-session"][0] - except (KeyError, TypeError): - return {} + sessions = ACLKeywords.get_all_classify_sessions_oper_data( + node, table_name) + for session in sessions: + if session["match"] == session_match: + return session + raise HoneycombError( + "Session with match value \"{0}\" not found" + " under ACL table {1}.".format(session_match, table_name)) @staticmethod def create_acl_plugin_classify_chain(node, list_name, data, macip=False): @@ -281,7 +267,7 @@ class ACLKeywords(object): :type data: dict :type macip: bool - :return: Content of response. + :returns: Content of response. :rtype: bytearray :raises HoneycombError: If the operation fails. """ @@ -318,8 +304,9 @@ class ACLKeywords(object): :type direction: str :type macip: bool - :return: Content of response. + :returns: Content of response. :rtype: bytearray + :raises ValueError: If the direction argument is incorrect. :raises HoneycombError: If the operation fails. """ diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index b4746e2118..f317d06a69 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -201,6 +201,16 @@ class InterfaceKeywords(object): :rtype: dict """ + try: + interface = Topology.convert_interface_reference( + node, interface, "name") + except RuntimeError: + if isinstance(interface, basestring): + # Probably name of a custom interface (TAP, VxLAN, Vhost, ...) + pass + else: + raise + intfs = InterfaceKeywords.get_all_interfaces_oper_data(node) for intf in intfs: if intf["name"] == interface: @@ -653,6 +663,9 @@ class InterfaceKeywords(object): :rtype: bytearray """ + interface = Topology.convert_interface_reference( + node, interface, "name") + path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6", "address") address = [{"ip": ip_addr, "prefix-length": prefix_len}, ] diff --git a/resources/libraries/robot/honeycomb/access_control_lists.robot b/resources/libraries/robot/honeycomb/access_control_lists.robot index a62ea0f2e8..e35cc92952 100644 --- a/resources/libraries/robot/honeycomb/access_control_lists.robot +++ b/resources/libraries/robot/honeycomb/access_control_lists.robot @@ -225,7 +225,7 @@ | | ... | \| ACL session from Honeycomb should not exist \| ${nodes['DUT1']} \ | | ... | \| table0 \| 00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00 \| | | [Arguments] | ${node} | ${table_name} | ${session_match} -| | Run keyword and expect error | *HoneycombError: *Status code: 404. +| | Run keyword and expect error | *KeyError:* | | ... | Get classify session oper data | | ... | ${node} | ${table_name} | ${session_match} diff --git a/resources/libraries/robot/honeycomb/lisp.robot b/resources/libraries/robot/honeycomb/lisp.robot index f490769c6f..e1d69ed316 100644 --- a/resources/libraries/robot/honeycomb/lisp.robot +++ b/resources/libraries/robot/honeycomb/lisp.robot @@ -77,11 +77,8 @@ | | ... | \| Lisp should not be configured \| ${nodes['DUT1']} \| | | [Arguments] | ${node} | | ... -| | ${data}= | Get Lisp operational data | ${node} -| | Should be equal as strings | ${data['lisp-state']['enable']} | False -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | Should match | ${data['pitr-cfg']['locator-set']} | N/A -| | Variable should not exist | ${data['eid-table']['vni-table'][0]} +| | Run keyword and Expect Error | KeyError: 'lisp-feature-data' +| | ... | Get Lisp operational data | ${node} | Lisp state From Honeycomb Should Be | | [Documentation] | Retrieves Lisp state from Honeycomb operational\ |