diff options
Diffstat (limited to 'resources/libraries')
50 files changed, 0 insertions, 13949 deletions
diff --git a/resources/libraries/bash/function/artifacts_hc.sh b/resources/libraries/bash/function/artifacts_hc.sh deleted file mode 100644 index 7a866f6596..0000000000 --- a/resources/libraries/bash/function/artifacts_hc.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2019 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. - -set -exuo pipefail - -function download_artifacts_hc () { - - # Download or install HC artifacts from packagecloud.io. - # - # Variables read: - # - CSIT_DIR - Path to existing root of local CSIT git repository. - # Variables set: - # - REPO_URL - FD.io Packagecloud repository. - # Functions conditionally called (see their documentation for side effects): - # - download_ubuntu_artifacts_hc - # - download_centos_artifacts_hc - - set -exuo pipefail - - os_id=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') || { - die "Get OS release failed." - } - - repo_url_path="${CSIT_DIR}/VPP_REPO_URL" - if [ -e "${repo_url_path}" ]; then - REPO_URL="$(<${repo_url_path})" || { - die "Read repo URL from ${repo_url_path} failed." - } - else - REPO_URL="https://packagecloud.io/install/repositories/fdio/master" - fi - - if [ "${os_id}" == "ubuntu" ]; then - download_ubuntu_artifacts_hc || die - elif [ "${os_id}" == "centos" ]; then - download_centos_artifacts_hc || die - else - die "${os_id} is not yet supported." - fi -} - -function download_ubuntu_artifacts_hc () { - - # Download or install Ubuntu HC artifacts from packagecloud.io. - # - # Variables read: - # - REPO_URL - FD.io Packagecloud repository. - # - HC_VERSION - HC version. - # - INSTALL - Whether install packages (if set to "true") or download only. - # Default: "false". - - set -exuo pipefail - - curl -s "${REPO_URL}"/script.deb.sh | sudo bash || { - die "Packagecloud FD.io repo fetch failed." - } - # If version is set we will add suffix. - artifacts=() - hc=(honeycomb) - if [ -z "${HC_VERSION-}" ]; then - artifacts+=(${hc[@]}) - else - artifacts+=(${hc[@]/%/=${HC_VERSION-}}) - fi - - if [[ "${INSTALL:-false}" == "true" ]]; then - sudo apt-get -y install "${artifacts[@]}" || { - die "Install HC artifacts failed." - } - else - apt-get -y download "${artifacts[@]}" || { - die "Download HC artifacts failed." - } - fi -} - -function download_centos_artifacts_hc () { - - # Download or install CentOS HC artifacts from packagecloud.io. - # - # Variables read: - # - REPO_URL - FD.io Packagecloud repository. - # - HC_VERSION - HC version. - # - INSTALL - Whether install packages (if set to "true") or download only. - # Default: "false". - - set -exuo pipefail - - curl -s "${REPO_URL}"/script.rpm.sh | sudo bash || { - die "Packagecloud FD.io repo fetch failed." - } - # If version is set we will add suffix. - artifacts=() - hc=(honeycomb) - if [ -z "${HC_VERSION-}" ]; then - artifacts+=(${hc[@]}) - else - artifacts+=(${hc[@]/%/-${HC_VERSION-}}) - fi - - if [[ "${INSTALL:-false}" == "true" ]]; then - sudo yum -y install "${artifacts[@]}" || { - die "Install HC artifact failed." - } - else - sudo yum -y install --downloadonly --downloaddir=. "${artifacts[@]}" || { - die "Download HC artifacts failed." - } - fi -} diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py index 0b0d6f866e..3fa9ae28dc 100644 --- a/resources/libraries/python/Constants.py +++ b/resources/libraries/python/Constants.py @@ -187,21 +187,6 @@ class Constants(object): # TRex install directory TREX_INSTALL_DIR = '/opt/trex-core-2.61' - # Honeycomb directory location at topology nodes: - REMOTE_HC_DIR = '/opt/honeycomb' - - # Honeycomb persistence files location - REMOTE_HC_PERSIST = '/var/lib/honeycomb/persist' - - # Honeycomb log file location - REMOTE_HC_LOG = '/var/log/honeycomb/honeycomb.log' - - # Honeycomb templates location - RESOURCES_TPL_HC = 'resources/templates/honeycomb' - - # ODL Client Restconf listener port - ODL_PORT = 8181 - # Sysctl kernel.core_pattern KERNEL_CORE_PATTERN = '/tmp/%p-%u-%g-%s-%t-%h-%e.core' diff --git a/resources/libraries/python/honeycomb/BGP.py b/resources/libraries/python/honeycomb/BGP.py deleted file mode 100644 index 976e41d379..0000000000 --- a/resources/libraries/python/honeycomb/BGP.py +++ /dev/null @@ -1,396 +0,0 @@ -# Copyright (c) 2018 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. - -"""Keywords to manipulate BGP configuration using Honeycomb REST API.""" - -from resources.libraries.python.Constants import Constants as Const -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil - - -class BGPKeywords(object): - """Keywords to manipulate BGP configuration. - - Implements keywords which read configuration and operational data for - the BGP feature, and configure BGP parameters using Honeycomb REST API. - """ - - def __init__(self): - """Initializer.""" - pass - - @staticmethod - def _configure_bgp_peer(node, path, data=None): - """Send BGP peer configuration data and check the response. - - :param node: Honeycomb node. - :param path: Additional path to append to the base BGP config path. - :param data: Configuration data to be sent in PUT request. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. - """ - - if data is None: - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_bgp_peer", path) - else: - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_bgp_peer", data, path) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of BGP peer was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def _configure_bgp_route(node, path, data=None): - """Send BGP route configuration data and check the response. - - :param node: Honeycomb node. - :param path: Additional path to append to the base BGP config path. - :param data: Configuration data to be sent in PUT request. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. - """ - - if data is None: - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_bgp_route", path) - else: - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_bgp_route", data, path) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of BGP route was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def get_full_bgp_configuration(node): - """Get BGP configuration from the node. - - :param node: Honeycomb node. - :type node: dict - :returns: BGP configuration data. - :rtype: dict - :raises HoneycombError: If the status code in response is not 200 = OK. - """ - - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "config_bgp_peer") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about BGP." - " Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def get_bgp_peer(node, address, datastore='config'): - """Get BGP configuration of the specified peer from the node. - - :param node: Honeycomb node. - :param address: IP address of the peer. - :param datastore: Get data from config or operational datastore. - :type node: dict - :type address: str - :type datastore: str - :returns: BGP peer configuration data. - :rtype: dict - :raises HoneycombError: If the status code in response is not 200 = OK. - """ - - path = "bgp-openconfig-extensions:neighbors/" \ - "neighbor/{0}".format(address) - if datastore != "operational": - url = "config_bgp_peer" - else: - url = "oper_bgp" - path = "peer/bgp:%2F%2F{0}".format(address) - status_code, resp = HcUtil. \ - get_honeycomb_data(node, url, path) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the BGP" - " peer. Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def add_bgp_peer(node, address, data): - """Configure a BGP peer on the node. - - :param node: Honeycomb node. - :param address: IP address of the peer. - :param data: Peer configuration data. - :type node: dict - :type address: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = "bgp-openconfig-extensions:neighbors/neighbor/{address}".format( - address=address) - return BGPKeywords._configure_bgp_peer(node, path, data) - - @staticmethod - def remove_bgp_peer(node, address): - """Remove a BGP peer from the configuration. - - :param node: Honeycomb node. - :param address: IP address of the peer. - :type node: dict - :type address: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "bgp-openconfig-extensions:neighbors/neighbor/{address}".format( - address=address) - return BGPKeywords._configure_bgp_peer(node, path) - - @staticmethod - def configure_bgp_route(node, peer_address, data, route_address, - index, ip_version): - """Configure a route for the BGP peer specified by peer IP address. - - :param node: Honeycomb node. - :param peer_address: IP address of the BGP peer. - :param data: Route configuration data. - :param route_address: IP address of the route. - :param index: Index number of the route within specified peer. - :param ip_version: IP protocol version. ipv4 or ipv6 - :type node: dict - :type peer_address: str - :type data: dict - :type route_address: str - :type index: int - :type ip_version: str - :returns: Content of response. - :rtype: bytearray - """ - - route_address = route_address.replace("/", "%2F") - - if ip_version.lower() == "ipv4": - path = "{0}/tables/bgp-types:ipv4-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv4-routes/ipv4-route/{1}/{2}" \ - .format(peer_address, route_address, index) - else: - path = "{0}/tables/bgp-types:ipv6-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv6-routes/ipv6-route/{1}/{2}" \ - .format(peer_address, route_address, index) - - return BGPKeywords._configure_bgp_route(node, path, data) - - @staticmethod - def get_bgp_route(node, peer_address, route_address, index, ip_version): - """Get all BGP peers from operational data. - - :param node: Honeycomb node. - :param peer_address: IP address of the BGP peer. - :param route_address: IP address of the route. - :param index: Index number of the route within specified peer. - :param ip_version: IP protocol version. ipv4 or ipv6 - :type node: dict - :type peer_address: str - :type route_address: str - :type index: int - :type ip_version: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response is not 200 = OK. - """ - - route_address = route_address.replace("/", "%2F") - - if ip_version.lower() == "ipv4": - path = "{0}/tables/bgp-types:ipv4-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv4-routes/ipv4-route/{1}/{2}" \ - .format(peer_address, route_address, index) - else: - path = "{0}/tables/bgp-types:ipv6-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv6-routes/ipv6-route/{1}/{2}" \ - .format(peer_address, route_address, index) - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "config_bgp_route", path) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the BGP" - " route. Status code: {0}.".format(status_code)) - - return resp - - @staticmethod - def get_all_peer_routes(node, peer_address, ip_version): - """Get all configured routes for the given BGP peer. - - :param node: Honeycomb node. - :param peer_address: IP address of the peer. - :param ip_version: IP protocol version. ipv4 or ipv6 - :type node: dict - :type peer_address: str - :type ip_version: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response is not 200 = OK. - """ - - if ip_version.lower() == "ipv4": - path = "{0}/tables/bgp-types:ipv4-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv4-routes".format(peer_address) - else: - path = "{0}/tables/bgp-types:ipv6-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv6-routes".format(peer_address) - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "config_bgp_route", path) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about BGP" - " routes. Status code: {0}.".format(status_code)) - - return resp - - @staticmethod - def remove_bgp_route(node, peer_address, route_address, index, ip_version): - """Remove the specified BGP route from configuration. - - :param node: Honeycomb node. - :param peer_address: IP address of the BGP peer. - :param route_address: IP address of the route. - :param index: Index number of the route within specified peer. - :param ip_version: IP protocol version. ipv4 or ipv6 - :type node: dict - :type peer_address: str - :type route_address: str - :type index: int - :type ip_version: str - :returns: Content of response. - :rtype: bytearray - """ - - route_address = route_address.replace("/", "%2F") - - if ip_version.lower() == "ipv4": - path = "{0}/tables/bgp-types:ipv4-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv4-routes/ipv4-route/{1}/{2}" \ - .format(peer_address, route_address, index) - else: - path = "{0}/tables/bgp-types:ipv6-address-family/" \ - "bgp-types:unicast-subsequent-address-family/" \ - "bgp-inet:ipv6-routes/ipv6-route/{1}/{2}" \ - .format(peer_address, route_address, index) - - return BGPKeywords._configure_bgp_route(node, path) - - @staticmethod - def get_bgp_local_rib(node): - """Get local RIB table from the Honeycomb node. - - :param node: Honeycomb node. - :type node: dict - :returns: RIB operational data. - :rtype: dict - :raises HoneycombError: If the status code in response is not 200 = OK. - """ - - path = "loc-rib" - - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "oper_bgp", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational data from BGP local RIB." - " Status code: {0}.".format(status_code)) - - return resp - - @staticmethod - def configure_bgp_base(node, ip_address, port, as_number): - """Modify BGP config file. Requires a restart of Honeycomb to take - effect. - - :param node: Honeycomb node. - :param ip_address: BGP peer identifier/binding address. - :param port: BGP binding port. - :param as_number: Autonomous System ID number. - :type node: dict - :type ip_address: str - :type port: int - :type as_number: int - :raises HoneycombError: If modifying the configuration fails. - """ - - from resources.libraries.python.ssh import SSH - - config = { - '\\"bgp-binding-address\\"': '\\"{0}\\"'.format(ip_address), - '\\"bgp-port\\"': port, - '\\"bgp-as-number\\"': as_number} - - path = "{0}/config/bgp.json".format(Const.REMOTE_HC_DIR) - - for key, value in config.items(): - find = key - replace = '"{0}": "{1}",'.format(key, value) - - argument = '"/{0}/c\\ {1}"'.format(find, replace) - command = "sed -i {0} {1}".format(argument, path) - - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify configuration on " - "node {0}, {1}".format(node, stderr)) - - @staticmethod - def compare_rib_tables(data, ref): - """Compare provided RIB table with reference. All reference entries must - be present in data. Data entries not present in reference are ignored. - - :param data: Data from Honeycomb node. - :param ref: Reference data to compare against. - :type data: dict - :type ref: dict - :raises HoneycombError: If the tables do not match. - """ - - # Remove runtime attributes from data - for item in data: - item.pop("attributes", "") - - for item in ref: - if item not in data: - raise HoneycombError( - "RIB entry {0} not found in operational data {1}." - .format(item, data)) diff --git a/resources/libraries/python/honeycomb/DHCP.py b/resources/libraries/python/honeycomb/DHCP.py deleted file mode 100644 index 56cfdb2a78..0000000000 --- a/resources/libraries/python/honeycomb/DHCP.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright (c) 2018 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. - -"""Keywords to manipulate NAT configuration using Honeycomb REST API.""" - -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil - - -class DHCPRelayKeywords(object): - """Keywords for NAT configuration.""" - - def __init__(self): - pass - - @staticmethod - def _set_dhcp_relay_properties(node, path, data=None): - """Set DHCP relay properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response is not - 200 = OK or 201 = ACCEPTED. - """ - - if data: - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_dhcp_relay", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_dhcp_relay", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of DHCP relay was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def add_dhcp_relay(node, data, ip_version, entry_id): - """Add a DHCP relay entry to the list on entries. - - :param node: Honeycomb node. - :param data: Configuration for the relay entry. - :param ip_version: IP protocol version, ipv4 or ipv6. - :param entry_id: Numeric ID. - :type node: dict - :type data: dict - :type ip_version: str - :type entry_id: int - :returns: Content of response. - :rtype: bytearray - """ - - path = "/relay/vpp-fib-table-management:{0}/{1}".format(ip_version, - entry_id) - - return DHCPRelayKeywords._set_dhcp_relay_properties(node, path, data) - - @staticmethod - def clear_dhcp_relay_configuration(node): - """Remove all DHCP relay configuration from the node. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - """ - return DHCPRelayKeywords._set_dhcp_relay_properties(node, "") - - @staticmethod - def get_dhcp_relay_oper_data(node): - """Get operational data about the DHCP relay feature. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response is not 200 = OK. - """ - - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "config_dhcp_relay") - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Could not retrieve DHCP relay configuration. " - "Status code: {0}.".format(status_code)) - return resp diff --git a/resources/libraries/python/honeycomb/FIB.py b/resources/libraries/python/honeycomb/FIB.py deleted file mode 100644 index bfccf5a029..0000000000 --- a/resources/libraries/python/honeycomb/FIB.py +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (c) 2018 Bell Canada, Pantheon Technologies 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. - -"""This module implements keywords to manipulate FIB tables using -Honeycomb REST API.""" - -from robot.api import logger - -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil - - -class FibKeywords(object): - """Implementation of keywords which make it possible to: - - add/remove FIB tables, - - add/remove FIB table entries - - get operational data about FIB tables, - """ - - def __init__(self): - pass - - @staticmethod - def _set_fib_table_properties(node, path, data=None): - """Set FIB table properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response is not - 200 = OK. - """ - - if data: - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_fib_table", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_fib_table", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - if data is None and '"error-tag":"data-missing"' in resp: - logger.debug("data does not exist in path.") - else: - raise HoneycombError( - "The configuration of FIB table was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def configure_fib_table(node, ip_version, vrf=1): - """Configure a FIB table according to the data provided. - - :param node: Honeycomb node. - :param ip_version: IP protocol version, ipv4 or ipv6. - :param vrf: vrf-id to attach configuration to. - :type node: dict - :type ip_version: str - :type vrf: int - :returns: Content of response. - :rtype: bytearray - """ - full_data = { - "vpp-fib-table-management:table": [ - { - "table-id": vrf, - "address-family": "vpp-fib-table-management:{0}" - .format(ip_version), - "name": "{0}-VRF:{1}".format(ip_version, vrf) - } - ] - } - path = "/table/{0}/vpp-fib-table-management:{1}".format(vrf, ip_version) - return FibKeywords._set_fib_table_properties(node, path, full_data) - - @staticmethod - def delete_fib_table(node, ip_version, vrf=1): - """Delete the specified FIB table from configuration data. - - :param node: Honeycomb node. - :param ip_version: IP protocol version, ipv4 or ipv6. - :param vrf: vrf-id to attach configuration to. - :type node: dict - :type ip_version: str - :type vrf: int - :returns: Content of response. - :rtype: bytearray - """ - - path = "/table/{0}/vpp-fib-table-management:{1}".format(vrf, ip_version) - return FibKeywords._set_fib_table_properties(node, path) - - @staticmethod - def get_fib_table_oper(node, ip_version, vrf=1): - """Retrieve operational data about the specified FIB table. - - :param node: Honeycomb node. - :param ip_version: IP protocol version, ipv4 or ipv6. - :param vrf: vrf-id to attach configuration to. - :type node: dict - :type ip_version: str - :type vrf: int - :returns: FIB table operational data. - :rtype: list - :raises HoneycombError: If the operation fails. - """ - - path = "/table/{0}/vpp-fib-table-management:{1}".format(vrf, ip_version) - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "oper_fib_table", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "FIB tables. Status code: {0}.".format(status_code)) - - data = resp['vpp-fib-table-management:table'][0] - - return data diff --git a/resources/libraries/python/honeycomb/HcAPIKwACL.py b/resources/libraries/python/honeycomb/HcAPIKwACL.py deleted file mode 100644 index b2848411a1..0000000000 --- a/resources/libraries/python/honeycomb/HcAPIKwACL.py +++ /dev/null @@ -1,374 +0,0 @@ -# Copyright (c) 2019 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. - -"""This module implements keywords to manipulate ACL data structures using -Honeycomb REST API.""" - - -from robot.api import logger - -from resources.libraries.python.topology import Topology -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation - - -class ACLKeywords(object): - """Implementation of keywords which make it possible to: - - add classify table(s), - - remove classify table(s), - - get operational data about classify table(s), - - add classify session(s), - - remove classify session(s), - - get operational data about classify sessions(s). - """ - - def __init__(self): - pass - - @staticmethod - def _set_classify_table_properties(node, path, data=None): - """Set classify table properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - 200 = OK. - """ - - if data: - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_classify_table", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil.\ - delete_honeycomb_data(node, "config_classify_table", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - if data is None and '"error-tag":"data-missing"' in resp: - logger.debug("data does not exist in path.") - else: - raise HoneycombError( - "The configuration of classify table was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def add_classify_table(node, table): - """Add a classify table to the list of classify tables. The keyword does - not validate given data. - - :param node: Honeycomb node. - :param table: Classify table to be added. - :type node: dict - :type table: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = "/classify-table/" + table["name"] - data = {"classify-table": [table, ]} - return ACLKeywords._set_classify_table_properties(node, path, data) - - @staticmethod - def remove_all_classify_tables(node): - """Remove all classify tables defined on the node. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - """ - - return ACLKeywords._set_classify_table_properties(node, path="") - - @staticmethod - def remove_classify_table(node, table_name): - """Remove the given classify table. - - :param node: Honeycomb node. - :param table_name: Name of the classify table to be removed. - :type node: dict - :type table_name: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/classify-table/" + table_name - return ACLKeywords._set_classify_table_properties(node, path) - - @staticmethod - def get_all_classify_tables_oper_data(node): - """Get operational data about all classify tables present on the node. - - :param node: Honeycomb node. - :type node: dict - :returns: List of classify tables. - :rtype: list - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "oper_classify_table") - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "classify tables. Status code: {0}.".format(status_code)) - - return resp["vpp-classifier-state"]["classify-table"] - - @staticmethod - def get_classify_table_oper_data(node, table_name): - """Get operational data about the given classify table. - - :param node: Honeycomb node. - :param table_name: Name of the classify table. - :type node: dict - :type table_name: str - :returns: Operational data about the given classify table. - :rtype: dict - """ - - 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): - """Get configuration data about all classify tables present on the node. - - :param node: Honeycomb node. - :type node: dict - :returns: List of classify tables. - :rtype: list - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_classify_table") - - 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["vpp-classifier"]["classify-table"] - except (KeyError, TypeError): - return [] - - @staticmethod - def add_classify_session(node, table_name, session): - """Add a classify session to the classify table. - - :param node: Honeycomb node. - :param table_name: Name of the classify table. - :param session: Classify session to be added to the classify table. - :type node: dict - :type table_name: str - :type session: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = "/classify-table/" + table_name + \ - "/classify-session/" + session["match"] - data = {"classify-session": [session, ]} - return ACLKeywords._set_classify_table_properties(node, path, data) - - @staticmethod - def remove_classify_session(node, table_name, session_match): - """Remove the given classify session from the classify table. - - :param node: Honeycomb node. - :param table_name: Name of the classify table. - :param session_match: Classify session match. - :type node: dict - :type table_name: str - :type session_match: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/classify-table/" + table_name + \ - "/classify-session/" + session_match - return ACLKeywords._set_classify_table_properties(node, path) - - @staticmethod - def get_all_classify_sessions_oper_data(node, table_name): - """Get operational data about all classify sessions in the classify - table. - - :param node: Honeycomb node. - :param table_name: Name of the classify table. - :type node: dict - :type table_name: str - :returns: List of classify sessions present in the classify table. - :rtype: list - """ - - table_data = ACLKeywords.get_classify_table_oper_data(node, table_name) - - return table_data["classify-session"] - - @staticmethod - def get_classify_session_oper_data(node, table_name, session_match): - """Get operational data about the given classify session in the classify - table. - - :param node: Honeycomb node. - :param table_name: Name of the classify table. - :param session_match: Classify session match. - :type node: dict - :type table_name: str - :type session_match: str - :returns: Classify session operational data. - :rtype: dict - :raises HoneycombError: If no session the specified match Id is found. - """ - - 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): - """Create classify chain using the ietf-acl node. - - :param node: Honeycomb node. - :param list_name: Name for the classify list. - :param data: Dictionary of settings to send to Honeycomb. - :type node: dict - :type list_name: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the operation fails. - """ - - path = "/acl/{0}".format(list_name) - - status_code, resp = HcUtil.put_honeycomb_data( - node, "config_plugin_acl", data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Could not create classify chain." - "Status code: {0}.".format(status_code)) - - return resp - - @staticmethod - def set_acl_plugin_interface(node, interface, acl_name, direction): - """Assign an interface to an ietf-acl classify chain. - - :param node: Honeycomb node. - :param interface: Name of an interface on the node. - :param acl_name: Name of an ACL chain configured through ACL-plugin. - :param direction: Classify incoming or outgoing packets. - Valid options are: ingress, egress - :type node: dict - :type interface: str or int - :type acl_name: str - :type direction: str - :returns: Content of response. - :rtype: bytearray - :raises ValueError: If the direction argument is incorrect. - :raises HoneycombError: If the operation fails. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - interface = interface.replace("/", "%2F") - - if direction not in ("ingress", "egress"): - raise ValueError("Unknown traffic direction {0}. " - "Valid options are: ingress, egress." - .format(direction)) - - path = "/attachment-points/interface/{0}/{1}/acl-sets/".format( - interface, direction) - - data = { - "acl-sets": { - "acl-set": { - "name": acl_name - } - } - } - - status_code, resp = HcUtil.put_honeycomb_data( - node, "config_plugin_acl", data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Could not configure ACL on interface. " - "Status code: {0}.".format(status_code)) - - return resp - - @staticmethod - def delete_interface_plugin_acls(node, interface): - """Remove all plugin-acl assignments from an interface. - - :param node: Honeycomb node. - :param interface: Name of an interface on the node. - :type node: dict - :type interface: str or int - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - interface = interface.replace("/", "%2F") - - path = "/attachment-points/interface/{0}/".format(interface) - status_code, _ = HcUtil.delete_honeycomb_data( - node, "config_plugin_acl", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Could not remove ACL assignment from interface. " - "Status code: {0}.".format(status_code)) - - @staticmethod - def delete_acl_plugin_classify_chains(node): - """Remove all plugin-ACL classify chains. - - :param node: Honeycomb node. - :type node: dict - """ - - status_code, _ = HcUtil.delete_honeycomb_data( - node, "config_plugin_acl") - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Could not remove plugin-acl chain. " - "Status code: {0}.".format(status_code)) diff --git a/resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py b/resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py deleted file mode 100644 index 576124794c..0000000000 --- a/resources/libraries/python/honeycomb/HcAPIKwBridgeDomain.py +++ /dev/null @@ -1,482 +0,0 @@ -# Copyright (c) 2018 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. - -"""Keywords to manipulate bridge domain configuration using Honeycomb REST API. - -The keywords make possible to put and get configuration data and to get -operational data. -""" - -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil - - -class BridgeDomainKeywords(object): - """Keywords to manipulate bridge domain configuration. - - Implements keywords which get configuration and operational data about - bridge domains and put the bridge domains' parameters using Honeycomb REST - API. - """ - - PARAMS = ("flood", "forward", "learn", "unknown-unicast-flood", - "arp-termination") - - def __init__(self): - pass - - @staticmethod - def _configure_bd(node, bd_name, data, - data_representation=DataRepresentation.JSON): - """Send bridge domain configuration data and check the response. - - :param node: Honeycomb node. - :param bd_name: The name of bridge domain. - :param data: Configuration data to be sent in PUT request. - :param data_representation: How the data is represented. - :type node: dict - :type bd_name: str - :type data: dict - :type data_representation: DataRepresentation - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response on PUT is not - 200 = OK. - """ - - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_bridge_domain", data, - data_representation=data_representation) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of bridge domain '{0}' was not successful. " - "Status code: {1}.".format(bd_name, status_code)) - return resp - - @staticmethod - def _set_bd_properties(node, bd_name, path, new_value=None): - """Set bridge domain properties. - - This method reads bridge domain configuration data, creates, changes or - removes the requested data and puts it back to Honeycomb. - - :param node: Honeycomb node. - :param bd_name: The name of bridge domain. - :param path: Path to data we want to change, create or remove. - :param new_value: The new value to be set. If None, the item will be - removed. - :type node: dict - :type bd_name: str - :type path: tuple - :type new_value: str, dict or list - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If it is not possible to get or set the data. - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_bridge_domain") - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Not possible to get configuration information about the " - "bridge domains. Status code: {0}.".format(status_code)) - - if new_value: - new_data = HcUtil.set_item_value(resp, path, new_value) - else: - new_data = HcUtil.remove_item(resp, path) - - return BridgeDomainKeywords._configure_bd(node, bd_name, new_data) - - @staticmethod - def _create_bd_structure(bd_name, **kwargs): - """Create the bridge domain data structure as it is expected by - Honeycomb REST API. - - :param bd_name: Bridge domain name. - :param kwargs: Parameters and their values. The accepted parameters are - defined in BridgeDomainKeywords.PARAMS. - :type bd_name: str - :type kwargs: dict - :returns: Bridge domain data structure. - :rtype: dict - """ - - bd_structure = {"name": bd_name} - - for param, value in kwargs.items(): - if param not in BridgeDomainKeywords.PARAMS: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - bd_structure[param] = str(value) - - return bd_structure - - @staticmethod - def get_all_bds_cfg_data(node): - """Get configuration data about all bridge domains from Honeycomb. - - :param node: Honeycomb node. - :type node: dict - :returns: Configuration data about all bridge domains from Honeycomb. - :rtype: list - :raises HoneycombError: If it is not possible to get configuration data. - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_bridge_domain") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the " - "bridge domains. Status code: {0}.".format(status_code)) - try: - return resp["bridge-domains"]["bridge-domain"] - - except (KeyError, TypeError): - return [] - - @staticmethod - def get_bd_cfg_data(node, bd_name): - """Get configuration data about the given bridge domain from Honeycomb. - - :param node: Honeycomb node. - :param bd_name: The name of bridge domain. - :type node: dict - :type bd_name: str - :returns: Configuration data about the given bridge domain from - Honeycomb. - :rtype: dict - """ - - intfs = BridgeDomainKeywords.get_all_bds_cfg_data(node) - for intf in intfs: - if intf["name"] == bd_name: - return intf - return {} - - @staticmethod - def get_all_bds_oper_data(node): - """Get operational data about all bridge domains from Honeycomb. - - :param node: Honeycomb node. - :type node: dict - :returns: Operational data about all bridge domains from Honeycomb. - :rtype: list - :raises HoneycombError: If it is not possible to get operational data. - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "oper_bridge_domains") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "bridge domains. Status code: {0}.".format(status_code)) - try: - return resp["bridge-domains-state"]["bridge-domain"] - - except (KeyError, TypeError): - return [] - - @staticmethod - def get_bd_oper_data(node, bd_name): - """Get operational data about the given bridge domain from Honeycomb. - - :param node: Honeycomb node. - :param bd_name: The name of bridge domain. - :type node: dict - :type bd_name: str - :returns: Operational data about the given bridge domain from Honeycomb. - :rtype: dict - """ - - intfs = BridgeDomainKeywords.get_all_bds_oper_data(node) - for intf in intfs: - if intf["name"] == bd_name: - return intf - return {} - - @staticmethod - def add_first_bd(node, bd_name, **kwargs): - """Add the first bridge domain. - - If there are any other bridge domains configured, they will be removed. - - :param node: Honeycomb node. - :param bd_name: Bridge domain name. - :param kwargs: Parameters and their values. The accepted parameters are - defined in BridgeDomainKeywords.PARAMS - :type node: dict - :type bd_name: str - :type kwargs: dict - :returns: Bridge domain data structure. - :rtype: dict - """ - - new_bd = BridgeDomainKeywords._create_bd_structure(bd_name, **kwargs) - bridge_domain = {"bridge-domains": {"bridge-domain": [new_bd, ]}} - return BridgeDomainKeywords._configure_bd(node, bd_name, bridge_domain) - - @staticmethod - def add_bd(node, bd_name, **kwargs): - """Add a bridge domain. - - :param node: Honeycomb node. - :param bd_name: Bridge domain name. - :param kwargs: Parameters and their values. The accepted parameters are - defined in BridgeDomainKeywords.PARAMS - :type node: dict - :type bd_name: str - :type kwargs: dict - :returns: Bridge domain data structure. - :rtype: dict - """ - - path = ("bridge-domains", "bridge-domain") - new_bd = BridgeDomainKeywords._create_bd_structure(bd_name, **kwargs) - bridge_domain = [new_bd, ] - return BridgeDomainKeywords._set_bd_properties(node, bd_name, path, - bridge_domain) - - @staticmethod - def remove_all_bridge_domains(node): - """Remove all bridge domains. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If it is not possible to remove all bridge - domains. - """ - - data = {"bridge-domains": {"bridge-domain": []}} - - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_bridge_domain", data) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError("Not possible to remove all bridge domains. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def remove_bridge_domain(node, bd_name): - """Remove a bridge domain. - - :param node: Honeycomb node. - :param bd_name: The name of bridge domain to be removed. - :type node: dict - :type bd_name: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If it is not possible to remove the bridge - domain. - """ - - path = ("bridge-domains", ("bridge-domain", "name", bd_name)) - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_bridge_domain") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the " - "bridge domains. Status code: {0}.".format(status_code)) - - new_data = HcUtil.remove_item(resp, path) - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_bridge_domain", new_data) - if status_code != HTTPCodes.OK: - raise HoneycombError("Not possible to remove bridge domain {0}. " - "Status code: {1}.". - format(bd_name, status_code)) - return resp - - @staticmethod - def configure_bridge_domain(node, bd_name, param, value): - """Configure a bridge domain. - - :param node: Honeycomb node. - :param bd_name: Bridge domain name. - :param param: Parameter to set, change or remove. The accepted - parameters are defined in BridgeDomainKeywords.PARAMS - :param value: The new value to be set, change or remove. If None, the - item will be removed. - :type node: dict - :type bd_name: str - :type param: str - :type value: str - :returns: Content of response. - :rtype: bytearray - """ - - if param not in BridgeDomainKeywords.PARAMS: - raise HoneycombError("The parameter {0} is invalid.".format(param)) - - path = ("bridge-domains", ("bridge-domain", "name", bd_name), param) - return BridgeDomainKeywords.\ - _set_bd_properties(node, bd_name, path, value) - - @staticmethod - def add_l2_fib_entry(node, bd_name, l2_fib_entry): - """Add an L2 FIB entry to the bridge domain's list of L2 FIB entries. - - :param node: Honeycomb node. - :param bd_name: Bridge domain's name. - :param l2_fib_entry: L2 FIB entry to be added to the L2 FIB table. - :type node: dict - :type bd_name: str - :type l2_fib_entry: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = ("bridge-domains", - ("bridge-domain", "name", bd_name), - "l2-fib-table", - "l2-fib-entry") - - new_l2_fib_entry = [l2_fib_entry, ] - return BridgeDomainKeywords._set_bd_properties( - node, bd_name, path, new_l2_fib_entry) - - @staticmethod - def modify_l2_fib_entry(node, bd_name, mac, param, value): - """Modify an existing L2 FIB entry in the bridge domain's L2 FIB table. - The L2 FIB entry is specified by MAC address. - - :param node: Honeycomb node. - :param bd_name: Bridge domain's name. - :param mac: MAC address used as the key in L2 FIB data structure. - :param param: The parameter to be modified. - :param value: The new value of the parameter. - :type node: dict - :type bd_name: str - :type mac: str - :type param: str - :type value: str or int - :returns: Content of response. - :rtype: bytearray - """ - - path = ("bridge-domains", - ("bridge-domain", "name", bd_name), - "l2-fib-table", - ("l2-fib-entry", "phys-address", mac), - param) - - return BridgeDomainKeywords._set_bd_properties( - node, bd_name, path, value) - - @staticmethod - def remove_l2_fib_entry(node, bd_name, mac): - """Remove an L2 FIB entry from bridge domain's L2 FIB table. The - entry is specified by MAC address. - - :param node: Honeycomb node. - :param bd_name: Bridge domain's name. - :param mac: MAC address used as the key in L2 FIB data structure. - :type node: dict - :type bd_name: str - :type mac: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If it is not possible to remove the specified - entry. - """ - - path = ("bridge-domains", - ("bridge-domain", "name", bd_name), - "l2-fib-table", - ("l2-fib-entry", "phys-address", str(mac))) - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_bridge_domain") - if status_code != HTTPCodes.OK: - raise HoneycombError("Not possible to get configuration information" - " about the L2 FIB entry {0} from bridge " - "domain {1}. Status code: {2}.". - format(mac, bd_name, status_code)) - - new_data = HcUtil.remove_item(resp, path) - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_bridge_domain", new_data) - if status_code != HTTPCodes.OK: - raise HoneycombError("Not possible to remove L2 FIB entry {0} from " - "bridge domain {1}. Status code: {2}.". - format(mac, bd_name, status_code)) - return resp - - - @staticmethod - def remove_all_l2_fib_entries(node, bd_name): - """Remove all entries from the bridge domain's L2 FIB table. - - :param node: Honeycomb node. - :param bd_name: Bridge domain's name. - :type node: dict - :type bd_name: str - :returns: Content of response. - :rtype: bytearray - """ - - path = ("bridge-domains", - ("bridge-domain", "name", bd_name), - "l2-fib-table") - - return BridgeDomainKeywords._set_bd_properties( - node, bd_name, path, None) - - @staticmethod - def get_all_l2_fib_entries(node, bd_name): - """Retrieves all entries from the bridge domain's L2 FIB table. - - :param node: Honeycomb node. - :param bd_name: Bridge domain's name. - :type node: dict - :type bd_name: str - :returns: Bridge domain's L2 FIB table or empty list if the table does - not exist or it is empty. - :rtype: list - """ - - bd_data = BridgeDomainKeywords.get_bd_oper_data(node, bd_name) - try: - return bd_data["l2-fib-table"]["l2-fib-entry"] - except KeyError: - return [] - - @staticmethod - def get_l2_fib_entry(node, bd_name, mac): - """Retrieves an entry from bridge domain's L2 FIB table. The entry is - specified by MAC address. - - :param node: Honeycomb node. - :param bd_name: Bridge domain's name. - :param mac: MAC address used as the key in L2 FIB data structure. - :type node: dict - :type bd_name: str - :type mac: str - :returns: The requested entry from bridge domain's L2 FIB table or empty - dictionary if it does not exist in the L2 FIB table. - :rtype: dict - """ - - l2_fib = BridgeDomainKeywords.get_all_l2_fib_entries(node, bd_name) - for entry in l2_fib: - if entry["phys-address"] == mac: - return entry - return {} diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py deleted file mode 100644 index 662fedca10..0000000000 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ /dev/null @@ -1,1908 +0,0 @@ -# Copyright (c) 2018 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. - -"""Keywords to manipulate interface configuration using Honeycomb REST API. - -The keywords make possible to put and get configuration data and to get -operational data. -""" -from robot.api import logger - -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil -from resources.libraries.python.topology import Topology - - -class InterfaceKeywords(object): - """Keywords for Interface manipulation. - - Implements keywords which get configuration and operational data about - vpp interfaces and set the interface's parameters using Honeycomb REST API. - """ - - INTF_PARAMS = ("name", "description", "type", "enabled", - "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", - "create-temporary-addresses", - "temporary-valid-lifetime", - "temporary-preferred-lifetime") - ETH_PARAMS = ("mtu", ) - ROUTING_PARAMS = ("ipv4-vrf-id", "ipv6-vrf-id") - VXLAN_PARAMS = ("src", "dst", "vni", "encap-vrf-id") - L2_PARAMS = ("bridge-domain", "split-horizon-group", - "bridged-virtual-interface") - TAP_PARAMS = ("id", "tx-ring-size", "rx-ring-size", "host-mac", - "host-interface-name", "host-namespace", "host-bridge", - "host-ipv4-address", "host-ipv6-address", "tag", - "host-ipv4-gateway", "host-ipv6-gateway", "mac") - VHOST_USER_PARAMS = ("socket", "role") - 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", - "next-protocol", - "encap-vrf-id", - "decap-vrf-id") - - def __init__(self): - pass - - @staticmethod - def _configure_interface(node, interface, data, - data_representation=DataRepresentation.JSON): - """Send interface configuration data and check the response. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param data: Configuration data to be sent in PUT request. - :param data_representation: How the data is represented. - :type node: dict - :type interface: str - :type data: dict - :type data_representation: DataRepresentation - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response on PUT is not - 200 = OK. - """ - - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_vpp_interfaces", data, - data_representation=data_representation) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of interface '{0}' was not successful. " - "Status code: {1}.".format(interface, status_code)) - return resp - - @staticmethod - def get_all_interfaces_cfg_data(node): - """Get configuration data about all interfaces from Honeycomb. - - :param node: Honeycomb node. - :type node: dict - :returns: Configuration data about all interfaces from Honeycomb. - :rtype: list - :raises HoneycombError: If it is not possible to get configuration data. - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_vpp_interfaces") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the " - "interfaces. Status code: {0}.".format(status_code)) - try: - return resp["interfaces"]["interface"] - - except (KeyError, TypeError): - return [] - - @staticmethod - def get_interface_cfg_data(node, interface): - """Get configuration data about the given interface from Honeycomb. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Configuration data about the given interface from Honeycomb. - :rtype: dict - """ - - intfs = InterfaceKeywords.get_all_interfaces_cfg_data(node) - for intf in intfs: - if intf["name"] == interface: - return intf - return {} - - @staticmethod - def get_all_interfaces_oper_data(node): - """Get operational data about all interfaces from Honeycomb. - - :param node: Honeycomb node. - :type node: dict - :returns: Operational data about all interfaces from Honeycomb. - :rtype: list - :raises HoneycombError: If it is not possible to get operational data. - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "oper_vpp_interfaces") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "interfaces. Status code: {0}.".format(status_code)) - try: - return resp["interfaces"]["interface"] - - except (KeyError, TypeError): - return [] - - @staticmethod - def get_disabled_interfaces_oper_data(node): - """Get operational data about all disabled interfaces from Honeycomb. - - :param node: Honeycomb node. - :type node: dict - :returns: Operational data about disabled interfaces. - :rtype: list - :raises HoneycombError: If it is not possible to get operational data. - """ - - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "oper_disabled_interfaces") - if status_code == HTTPCodes.NOT_FOUND: - raise HoneycombError( - "No disabled interfaces present on node." - ) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "interfaces. Status code: {0}.".format(status_code)) - try: - return resp["disabled-interfaces"]["disabled-interface-index"] - - except (KeyError, TypeError): - return [] - - @staticmethod - def get_interface_oper_data(node, interface): - """Get operational data about the given interface from Honeycomb. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Operational data about the given interface from Honeycomb. - :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: - return intf - return {} - - @staticmethod - def _set_interface_properties(node, interface, path, new_value=None): - """Set interface properties. - - This method reads interface configuration data, creates, changes or - removes the requested data and puts it back to Honeycomb. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param path: Path to data we want to change / create / remove. - :param new_value: The new value to be set. If None, the item will be - removed. - :type node: dict - :type interface: str - :type path: tuple - :type new_value: str, dict or list - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If it is not possible to get or set the data. - """ - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_vpp_interfaces") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the " - "interfaces. Status code: {0}.".format(status_code)) - - if new_value: - new_data = HcUtil.set_item_value(resp, path, new_value) - else: - new_data = HcUtil.remove_item(resp, path) - return InterfaceKeywords._configure_interface(node, interface, new_data) - - @staticmethod - def honeycomb_set_interface_state(node, interface, state="up"): - """Set VPP interface state. - - The keyword changes the administration state of interface to up or down - depending on the parameter "state". - - :param node: Honeycomb node. - :param interface: Interface name, key, link name or sw_if_index. - :param state: The requested state, only "up" and "down" are valid - values. - :type node: dict - :type interface: str - :type state: str - :returns: Content of response. - :rtype: bytearray - :raises KeyError: If the argument "state" is nor "up" or "down". - :raises HoneycombError: If the interface is not present on the node. - """ - - intf_state = {"up": "true", - "down": "false"} - - interface = Topology.convert_interface_reference( - node, interface, "name") - - intf = interface.replace("/", "%2F") - path = "/interface/{0}".format(intf) - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_vpp_interfaces", path) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the " - "interfaces. Status code: {0}.".format(status_code)) - - resp["interface"][0]["enabled"] = intf_state[state.lower()] - - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_vpp_interfaces", resp, path, - data_representation=DataRepresentation.JSON) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of interface '{0}' was not successful. " - "Status code: {1}.".format(interface, status_code)) - return resp - - @staticmethod - def set_interface_up(node, interface): - """Set the administration state of VPP interface to up. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Content of response - :rtype: bytearray - """ - - return InterfaceKeywords.honeycomb_set_interface_state( - node, interface, "up") - - @staticmethod - def set_interface_down(node, interface): - """Set the administration state of VPP interface to down. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - """ - - return InterfaceKeywords.honeycomb_set_interface_state( - node, interface, "down") - - @staticmethod - def add_bridge_domain_to_interface(node, interface, bd_name, - split_horizon_group=None, bvi=None): - """Add a new bridge domain to an interface and set its parameters. - - :param node: Honeycomb node. - :param interface: Interface name, key, link name or sw_if_index. - :param bd_name: Bridge domain name. - :param split_horizon_group: Split-horizon group name. - :param bvi: The bridged virtual interface. - :type node: dict - :type interface: str - :type bd_name: str - :type split_horizon_group: str - :type bvi: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the interface is not present on the node. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - v3po_l2 = {"bridge-domain": str(bd_name)} - if split_horizon_group: - v3po_l2["split-horizon-group"] = str(split_horizon_group) - if bvi: - v3po_l2["bridged-virtual-interface"] = str(bvi) - - path = ("interfaces", ("interface", "name", str(interface)), "v3po:l2") - - return InterfaceKeywords._set_interface_properties( - node, interface, path, v3po_l2) - - @staticmethod - def remove_bridge_domain_from_interface(node, interface): - """Remove bridge domain assignment from interface. - - :param node: Honeycomb node. - :param interface: Interface name, key, link name or sw_if_index. - :type node: dict - :type interface: str or int - :raises HoneycombError: If the operation fails. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - intf = interface.replace("/", "%2F") - - path = "/interface/{0}/v3po:l2".format(intf) - - status_code, response = HcUtil.delete_honeycomb_data( - node, "config_vpp_interfaces", path) - - if status_code != HTTPCodes.OK: - if '"error-tag":"data-missing"' in response: - logger.debug("Data does not exist in path.") - else: - raise HoneycombError( - "Could not remove bridge domain assignment from interface " - "'{0}'. Status code: {1}.".format(interface, status_code)) - - @staticmethod - def get_bd_oper_data_from_interface(node, interface): - """Returns operational data about bridge domain settings in the - interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Operational data about bridge domain settings in the - interface. - :rtype: dict - """ - - if_data = InterfaceKeywords.get_interface_oper_data(node, interface) - - if if_data: - try: - return if_data["v3po:l2"] - except KeyError: - return {} - return {} - - @staticmethod - def configure_interface_base(node, interface, param, value): - """Configure the base parameters of interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param param: Parameter to configure (set, change, remove) - :param value: The value of parameter. If None, the parameter will be - removed. - :type node: dict - :type interface: str - :type param: str - :type value: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - if param not in InterfaceKeywords.INTF_PARAMS: - raise HoneycombError("The parameter {0} is invalid.".format(param)) - - path = ("interfaces", ("interface", "name", interface), param) - return InterfaceKeywords._set_interface_properties( - node, interface, path, value) - - @staticmethod - def configure_interface_ipv4(node, interface, param, value): - """Configure IPv4 parameters of interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param param: Parameter to configure (set, change, remove) - :param value: The value of parameter. If None, the parameter will be - removed. - :type node: dict - :type interface: str - :type param: str - :type value: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - if param not in InterfaceKeywords.IPV4_PARAMS: - raise HoneycombError("The parameter {0} is invalid.".format(param)) - - path = ("interfaces", ("interface", "name", interface), - "ietf-ip:ipv4", param) - return InterfaceKeywords._set_interface_properties( - node, interface, path, value) - - @staticmethod - def add_first_ipv4_address(node, interface, ip_addr, network): - """Add the first IPv4 address. - - If there are any other addresses configured, they will be removed. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param ip_addr: IPv4 address to be set. - :param network: Netmask or length of network prefix. - :type node: dict - :type interface: str - :type ip_addr: str - :type network: str or int - :returns: Content of response. - :rtype: bytearray - :raises ValueError: If the provided netmask or prefix is not valid. - :raises HoneycombError: If the operation fails. - """ - - interface = InterfaceKeywords.handle_interface_reference( - node, interface) - - path = "/interface/{0}/ietf-ip:ipv4".format(interface) - if isinstance(network, basestring): - data = { - "ietf-ip:ipv4": { - "address": [{"ip": ip_addr, "netmask": network}, ]}} - elif isinstance(network, int) and (0 < network < 33): - data = { - "ietf-ip:ipv4": { - "address": [{"ip": ip_addr, "prefix-length": network}, ]}} - else: - raise ValueError("Value {0} is not a valid netmask or network " - "prefix length.".format(network)) - status_code, _ = HcUtil.put_honeycomb_data( - node, "config_vpp_interfaces", data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Configuring IPv4 address failed. " - "Status code:{0}".format(status_code)) - - @staticmethod - def add_ipv4_address(node, interface, ip_addr, network): - """Add IPv4 address. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param ip_addr: IPv4 address to be set. - :param network: Netmask or length of network prefix. - :type node: dict - :type interface: str - :type ip_addr: str - :type network: str or int - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the provided netmask or prefix is not valid. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4", - "address") - if isinstance(network, basestring): - address = [{"ip": ip_addr, "netmask": network}] - elif isinstance(network, int) and (0 < network < 33): - address = [{"ip": ip_addr, "prefix-length": network}] - else: - raise HoneycombError("Value {0} is not a valid netmask or network " - "prefix length.".format(network)) - return InterfaceKeywords._set_interface_properties( - node, interface, path, address) - - @staticmethod - def remove_all_ipv4_addresses(node, interface): - """Remove all IPv4 addresses from interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4", - "address") - return InterfaceKeywords._set_interface_properties( - node, interface, path, None) - - @staticmethod - def add_ipv4_neighbor(node, interface, ip_addr, link_layer_address): - """Add the IPv4 neighbour. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param ip_addr: IPv4 address of neighbour to be set. - :param link_layer_address: Link layer address. - :type node: dict - :type interface: str - :type ip_addr: str - :type link_layer_address: str - :returns: Content of response. - :rtype: bytearray - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4", - "neighbor") - neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ] - return InterfaceKeywords._set_interface_properties( - node, interface, path, neighbor) - - @staticmethod - def remove_all_ipv4_neighbors(node, interface): - """Remove all IPv4 neighbours. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4", - "neighbor") - return InterfaceKeywords._set_interface_properties( - node, interface, path, None) - - @staticmethod - def configure_interface_ipv6(node, interface, param, value): - """Configure IPv6 parameters of interface - - :param node: Honeycomb node. - :param interface: The name of interface. - :param param: Parameter to configure (set, change, remove) - :param value: The value of parameter. If None, the parameter will be - removed. - :type node: dict - :type interface: str - :type param: str - :type value: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - if param in InterfaceKeywords.IPV6_PARAMS: - path = ("interfaces", ("interface", "name", interface), - "ietf-ip:ipv6", param) - elif param in InterfaceKeywords.IPV6_AUTOCONF_PARAMS: - path = ("interfaces", ("interface", "name", interface), - "ietf-ip:ipv6", "autoconf", param) - else: - raise HoneycombError("The parameter {0} is invalid.".format(param)) - - return InterfaceKeywords._set_interface_properties( - node, interface, path, value) - - @staticmethod - def add_first_ipv6_address(node, interface, ip_addr, prefix_len): - """Add the first IPv6 address. - - If there are any other addresses configured, they will be removed. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param ip_addr: IPv6 address to be set. - :param prefix_len: Prefix length. - :type node: dict - :type interface: str - :type ip_addr: str - :type prefix_len: str - :returns: Content of response. - :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}, ]} - return InterfaceKeywords._set_interface_properties( - node, interface, path, address) - - @staticmethod - def add_ipv6_address(node, interface, ip_addr, prefix_len): - """Add IPv6 address. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param ip_addr: IPv6 address to be set. - :param prefix_len: Prefix length. - :type node: dict - :type interface: str - :type ip_addr: str - :type prefix_len: str - :returns: Content of response. - :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}, ] - return InterfaceKeywords._set_interface_properties( - node, interface, path, address) - - @staticmethod - def remove_all_ipv6_addresses(node, interface): - """Remove all IPv6 addresses from interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6", - "address") - return InterfaceKeywords._set_interface_properties( - node, interface, path, None) - - @staticmethod - def add_ipv6_neighbor(node, interface, ip_addr, link_layer_address): - """Add the IPv6 neighbour. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param ip_addr: IPv6 address of neighbour to be set. - :param link_layer_address: Link layer address. - :type node: dict - :type interface: str - :type ip_addr: str - :type link_layer_address: str - :returns: Content of response. - :rtype: bytearray - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6", - "neighbor") - neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ] - return InterfaceKeywords._set_interface_properties( - node, interface, path, neighbor) - - @staticmethod - def remove_all_ipv6_neighbors(node, interface): - """Remove all IPv6 neighbours. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6", - "neighbor") - return InterfaceKeywords._set_interface_properties( - node, interface, path, None) - - @staticmethod - def configure_interface_ethernet(node, interface, param, value): - """Configure the ethernet parameters of interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param param: Parameter to configure (set, change, remove) - :param value: The value of parameter. If None, the parameter will be - removed. - :type node: dict - :type interface: str - :type param: str - :type value: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - if param not in InterfaceKeywords.ETH_PARAMS: - raise HoneycombError("The parameter {0} is invalid.".format(param)) - path = ("interfaces", ("interface", "name", interface), "v3po:ethernet", - param) - return InterfaceKeywords._set_interface_properties( - node, interface, path, value) - - @staticmethod - def configure_interface_routing(node, interface, param, value): - """Configure the routing parameters of interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param param: Parameter to configure (set, change, remove) - :param value: The value of parameter. If None, the parameter will be - removed. - :type node: dict - :type interface: str - :type param: str - :type value: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - if param not in InterfaceKeywords.ROUTING_PARAMS: - raise HoneycombError("The parameter {0} is invalid.".format(param)) - - path = ("interfaces", ("interface", "name", interface), "v3po:routing", - param) - return InterfaceKeywords._set_interface_properties( - node, interface, path, value) - - @staticmethod - def honeycomb_create_vxlan_interface(node, interface, **kwargs): - """Create a new VxLAN interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VXLAN_PARAMS. - :type node: dict - :type interface: str - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - new_vx_lan = { - "name": interface, - "type": "v3po:vxlan-tunnel", - "v3po:vxlan": {} - } - for param, value in kwargs.items(): - if param not in InterfaceKeywords.VXLAN_PARAMS: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - new_vx_lan["v3po:vxlan"][param] = value - - path = ("interfaces", "interface") - vx_lan_structure = [new_vx_lan, ] - return InterfaceKeywords._set_interface_properties( - node, interface, path, vx_lan_structure) - - @staticmethod - def delete_interface(node, interface): - """Delete an interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If it is not possible to get information about - interfaces or it is not possible to delete the interface. - """ - - path = ("interfaces", ("interface", "name", interface)) - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_vpp_interfaces") - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get configuration information about the " - "interfaces. Status code: {0}.".format(status_code)) - - new_data = HcUtil.remove_item(resp, path) - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_vpp_interfaces", new_data) - if status_code != HTTPCodes.OK: - raise HoneycombError("Not possible to remove interface {0}. " - "Status code: {1}.". - format(interface, status_code)) - return resp - - @staticmethod - def honeycomb_configure_interface_vxlan(node, interface, **kwargs): - """Configure VxLAN on the interface. - - The keyword configures VxLAN parameters on the given interface. The type - of interface must be set to "v3po:vxlan-tunnel". - The new VxLAN parameters overwrite the current configuration. If a - parameter in new configuration is missing, it is removed from VxLAN - configuration. - If the dictionary kwargs is empty, VxLAN configuration is removed. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VXLAN_PARAMS. - :type node: dict - :type interface: str - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - vx_lan_structure = dict() - for param, value in kwargs.items(): - if param not in InterfaceKeywords.VXLAN_PARAMS: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - vx_lan_structure[param] = value - - path = ("interfaces", ("interface", "name", interface), "v3po:vxlan") - return InterfaceKeywords._set_interface_properties( - node, interface, path, vx_lan_structure) - - @staticmethod - def configure_interface_l2(node, interface, param, value): - """Configure the L2 parameters of interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param param: Parameter to configure (set, change, remove) - :param value: The value of parameter. If None, the parameter will be - removed. - :type node: dict - :type interface: str - :type param: str - :type value: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - if param not in InterfaceKeywords.L2_PARAMS: - raise HoneycombError("The parameter {0} is invalid.".format(param)) - path = ("interfaces", ("interface", "name", interface), "v3po:l2", - param) - return InterfaceKeywords._set_interface_properties( - node, interface, path, value) - - @staticmethod - def create_tap_interface(node, interface, **kwargs): - """Create a new TAP interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.TAP_PARAMS. - :type node: dict - :type interface: str - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - new_tap = { - "name": interface, - "type": "v3po:tap-v2", - "v3po:tap-v2": {} - } - for param, value in kwargs.items(): - if param not in InterfaceKeywords.TAP_PARAMS: - raise HoneycombError( - "The parameter {0} is invalid.".format(param)) - new_tap["v3po:tap-v2"][param] = value - - path = ("interfaces", "interface") - new_tap_structure = [new_tap, ] - return InterfaceKeywords._set_interface_properties( - node, interface, path, new_tap_structure) - - @staticmethod - def configure_interface_tap(node, interface, **kwargs): - """Configure TAP on the interface. - - The keyword configures TAP parameters on the given interface. The type - of interface must be set to "v3po:tap-v2". - The new TAP parameters overwrite the current configuration. If a - parameter in new configuration is missing, it is removed from TAP - configuration. - If the dictionary kwargs is empty, TAP configuration is removed. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.TAP_PARAMS. - :type node: dict - :type interface: str - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - tap_structure = dict() - for param, value in kwargs.items(): - if param not in InterfaceKeywords.TAP_PARAMS: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - tap_structure[param] = value - - path = ("interfaces", ("interface", "name", interface), "v3po:tap-v2") - return InterfaceKeywords._set_interface_properties( - node, interface, path, tap_structure) - - @staticmethod - def configure_interface_vhost_user(node, interface, **kwargs): - """Configure vhost-user on the interface. - - The keyword configures vhost-user parameters on the given interface. - The type of interface must be set to "v3po:vhost-user". - The new vhost-user parameters overwrite the current configuration. If a - parameter in new configuration is missing, it is removed from vhost-user - configuration. - If the dictionary kwargs is empty, vhost-user configuration is removed. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VHOST_USER_PARAMS. - :type node: dict - :type interface: str - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - vhost_structure = dict() - for param, value in kwargs.items(): - if param not in InterfaceKeywords.VHOST_USER_PARAMS: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - vhost_structure[param] = value - - path = ("interfaces", ("interface", "name", interface), - "v3po:vhost-user") - return InterfaceKeywords._set_interface_properties( - node, interface, path, vhost_structure) - - @staticmethod - def create_vhost_user_interface(node, interface, **kwargs): - """Create a new vhost-user interface. - - :param node: Honeycomb node. - :param interface: The name of interface. - :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VHOST_USER_PARAMS. - :type node: dict - :type interface: str - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - """ - - new_vhost = { - "name": interface, - "type": "v3po:vhost-user", - "v3po:vhost-user": {} - } - for param, value in kwargs.items(): - if param not in InterfaceKeywords.VHOST_USER_PARAMS: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - new_vhost["v3po:vhost-user"][param] = value - - path = ("interfaces", "interface") - new_vhost_structure = [new_vhost, ] - return InterfaceKeywords._set_interface_properties( - node, interface, path, new_vhost_structure) - - @staticmethod - def honeycomb_create_sub_interface(node, super_interface, match, tags=None, - **kwargs): - """Create a new sub-interface. - - :param node: Honeycomb node. - :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_IF_PARAMS. - :type node: dict - :type super_interface: str - :type match: str - :type tags: list - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the parameter is not valid. - :raises KeyError: If the parameter 'match' is invalid. - """ - - super_interface = Topology.convert_interface_reference( - node, super_interface, "name") - - match_type = { - "default": - {"default": {}}, - "untagged": - {"untagged": {}}, - "vlan-tagged": - {"vlan-tagged": {"match-exact-tags": "false"}}, - "vlan-tagged-exact-match": - {"vlan-tagged": {"match-exact-tags": "true"}} - } - - new_sub_interface = { - "tags": { - "tag": [] - }, - } - - for param, value in kwargs.items(): - if param in InterfaceKeywords.SUB_IF_PARAMS: - new_sub_interface[param] = value - else: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - 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, super_interface, path, new_sub_interface_structure) - - @staticmethod - def get_sub_interface_oper_data(node, super_interface, identifier): - """Retrieves sub-interface operational data using Honeycomb API. - - :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 - :returns: 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 - :returns: Content of response. - :rtype: bytearray - """ - - path = ("interfaces", - ("interface", "name", super_interface), - "vpp-vlan:sub-interfaces") - - return InterfaceKeywords._set_interface_properties( - node, super_interface, path, {}) - - @staticmethod - def set_sub_interface_state(node, super_interface, identifier, state): - """Set the administrative state of sub-interface. - - :param node: Honeycomb node. - :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 super_interface: str - :type identifier: int - :type state: str - :returns: Content of response. - :rtype: bytearray - """ - - super_interface = Topology.convert_interface_reference( - node, super_interface, "name") - - intf_state = {"up": "true", - "down": "false"} - - path = ("interfaces", - ("interface", "name", super_interface), - "vpp-vlan:sub-interfaces", - ("sub-interface", "identifier", int(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 - :returns: Content of response. - :rtype: bytearray - """ - - path = ("interfaces", - ("interface", "name", super_interface), - "vpp-vlan:sub-interfaces", - ("sub-interface", "identifier", int(identifier)), - "l2") - - return InterfaceKeywords._set_interface_properties( - 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 - :returns: 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 - :returns: 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 - :returns: 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 add_ip_address_to_sub_interface(node, super_interface, identifier, - ip_addr, network, ip_version): - """Add an ipv4 address to the specified sub-interface, with the provided - netmask or network prefix length. Any existing ipv4 addresses on the - sub-interface will be replaced. - - :param node: Honeycomb node. - :param super_interface: Super interface. - :param identifier: The ID of sub-interface. - :param ip_addr: IPv4 address to be set. - :param network: Network mask or network prefix length. - :param ip_version: ipv4 or ipv6 - :type node: dict - :type super_interface: str - :type identifier: int - :type ip_addr: str - :type network: str or int - :type ip_version: string - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the provided netmask or prefix is not valid. - """ - - path = ("interfaces", - ("interface", "name", super_interface), - "vpp-vlan:sub-interfaces", - ("sub-interface", "identifier", int(identifier)), - ip_version.lower()) - - if isinstance(network, basestring) and ip_version.lower() == "ipv4": - address = {"address": [{"ip": ip_addr, "netmask": network}, ]} - - elif isinstance(network, int) and 0 < network < 33: - address = {"address": [{"ip": ip_addr, "prefix-length": network}, ]} - - else: - raise HoneycombError("{0} is not a valid netmask or prefix length." - .format(network)) - - return InterfaceKeywords._set_interface_properties( - node, super_interface, path, address) - - @staticmethod - def remove_all_ip_addresses_from_sub_interface(node, super_interface, - identifier, ip_version): - """Remove all ipv4 addresses from the specified sub-interface. - - :param node: Honeycomb node. - :param super_interface: Super interface. - :param identifier: The ID of sub-interface. - :param ip_version: ipv4 or ipv6 - :type node: dict - :type super_interface: str - :type identifier: int - :type ip_version: string - :returns: Content of response. - :rtype: bytearray - """ - - path = ("interfaces", - ("interface", "name", super_interface), - "vpp-vlan:sub-interfaces", - ("sub-interface", "identifier", int(identifier)), - str(ip_version), "address") - - return InterfaceKeywords._set_interface_properties( - node, super_interface, path, None) - - @staticmethod - def compare_data_structures(data, ref, _path=''): - """Checks if data obtained from UUT is as expected. If it is not, - proceeds down the list/dictionary tree and finds the point of mismatch. - - :param data: Data to be checked. - :param ref: Referential data used for comparison. - :param _path: Used in recursive calls, stores the path taken down - the JSON tree. - :type data: dict - :type ref: dict - :type _path: str - - :raises HoneycombError: If the data structures do not match in some way, - or if they are not in deserialized JSON format. - """ - - if data == ref: - return True - - elif isinstance(data, dict) and isinstance(ref, dict): - for key in ref: - if key not in data: - raise HoneycombError( - "Key {key} is not present in path {path}. Keys in path:" - "{data_keys}".format( - key=key, - path=_path, - data_keys=data.keys())) - - if data[key] != ref[key]: - if isinstance(data[key], list) \ - or isinstance(data[key], dict): - InterfaceKeywords.compare_data_structures( - data[key], ref[key], - _path + '[{0}]'.format(key)) - else: - raise HoneycombError( - "Data mismatch, key {key} in path {path} has value" - " {data}, but should be {ref}".format( - key=key, - path=_path, - data=data[key], - ref=ref[key])) - - elif isinstance(data, list) and isinstance(ref, list): - for item in ref: - if item not in data: - if isinstance(item, dict): - InterfaceKeywords.compare_data_structures( - data[0], item, - _path + '[{0}]'.format(ref.index(item))) - else: - raise HoneycombError( - "Data mismatch, list item {index} in path {path}" - " has value {data}, but should be {ref}".format( - index=ref.index(item), - path=_path, - data=data[0], - ref=item)) - - else: - raise HoneycombError( - "Unexpected data type {data_type} in path {path}, reference" - " type is {ref_type}. Must be list or dictionary.".format( - data_type=type(data), - ref_type=type(ref), - path=_path)) - - @staticmethod - def compare_interface_lists(list1, list2): - """Compare provided lists of interfaces by name. - - :param list1: List of interfaces. - :param list2: List of interfaces. - :type list1: list - :type list2: list - :raises HoneycombError: If an interface exists in only one of the lists. - """ - - ignore = ["vx_tunnel0", "vxlan_gpe_tunnel0"] - # these have no equivalent in config data and no effect on VPP - - names1 = [x['name'] for x in list1] - names2 = [x['name'] for x in list2] - - for name in names1: - if name not in names2 and name not in ignore: - raise HoneycombError("Interface {0} not present in list {1}" - .format(name, list2)) - for name in names2: - if name not in names1 and name not in ignore: - raise HoneycombError("Interface {0} not present in list {1}" - .format(name, list1)) - - @staticmethod - def create_vxlan_gpe_interface(node, interface, **kwargs): - """Create a new VxLAN GPE interface. - - :param node: Honeycomb node. - :param interface: The name of interface to be created. - :param kwargs: Parameters and their values. The accepted parameters are - defined in InterfaceKeywords.VXLAN_GPE_PARAMS. - :type node: dict - :type interface: str - :type kwargs: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If a parameter in kwargs is not valid. - """ - - new_vxlan_gpe = { - "name": interface, - "type": "v3po:vxlan-gpe-tunnel", - "v3po:vxlan-gpe": {} - } - for param, value in kwargs.items(): - if param in InterfaceKeywords.INTF_PARAMS: - new_vxlan_gpe[param] = value - elif param in InterfaceKeywords.VXLAN_GPE_PARAMS: - new_vxlan_gpe["v3po:vxlan-gpe"][param] = value - else: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - path = ("interfaces", "interface") - vxlan_gpe_structure = [new_vxlan_gpe, ] - return InterfaceKeywords._set_interface_properties( - node, interface, path, vxlan_gpe_structure) - - @staticmethod - def enable_acl_on_interface(node, interface, table_name): - """Enable ACL on the given interface. - - :param node: Honeycomb node. - :param interface: The interface where the ACL will be enabled. - :param table_name: Name of the classify table. - :type node: dict - :type interface: str - :type table_name: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the configuration of interface is not - successful. - """ - - interface = interface.replace("/", "%2F") - - data = { - "vpp-interface-acl:acl": { - "ingress": { - "ip4-acl": { - "classify-table": table_name - }, - "l2-acl": { - "classify-table": table_name - } - } - } - } - - path = "/interface/" + interface + "/vpp-interface-acl:acl" - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_vpp_interfaces", data, path, - data_representation=DataRepresentation.JSON) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of interface '{0}' was not successful. " - "Status code: {1}.".format(interface, status_code)) - return resp - - @staticmethod - def enable_policer_on_interface(node, interface, table_name): - """Enable Policer on the given interface. - - :param node: Honeycomb node. - :param interface: The interface where policer will be enabled. - :param table_name: Name of the classify table. - :type node: dict - :type interface: str - :type table_name: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the configuration of interface is not - successful. - """ - interface = Topology.convert_interface_reference( - node, interface, "name") - interface = interface.replace("/", "%2F") - - data = { - "interface-policer:policer": { - "ip4-table": table_name - } - } - - path = "/interface/" + interface + "/interface-policer:policer" - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_vpp_interfaces", data, path, - data_representation=DataRepresentation.JSON) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of interface '{0}' was not successful. " - "Status code: {1}.".format(interface, status_code)) - return resp - - @staticmethod - def disable_policer_on_interface(node, interface): - """Disable Policer on the given interface. - - :param node: Honeycomb node. - :param interface: The interface where policer will be disabled. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the configuration of interface is not - successful. - """ - interface = Topology.convert_interface_reference( - node, interface, "name") - interface = interface.replace("/", "%2F") - - path = "/interface/" + interface + "/interface-policer:policer" - status_code, resp = HcUtil.\ - delete_honeycomb_data(node, "config_vpp_interfaces", path) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "The configuration of interface '{0}' was not successful. " - "Status code: {1}.".format(interface, status_code)) - return resp - - @staticmethod - def disable_acl_on_interface(node, interface): - """Disable ACL on the given interface. - - :param node: Honeycomb node. - :param interface: The interface where the ACL will be disabled. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the configuration of interface is not - successful. - """ - - interface = interface.replace("/", "%2F") - - path = "/interface/" + interface + "/vpp-interface-acl:acl" - - status_code, resp = HcUtil.\ - delete_honeycomb_data(node, "config_vpp_interfaces", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "The configuration of interface '{0}' was not successful. " - "Status code: {1}.".format(interface, status_code)) - return resp - - @staticmethod - def create_pbb_sub_interface(node, intf, params): - """Creates a PBB sub-interface on the given interface and sets its - parameters. - - :param node: Honeycomb node. - :param intf: The interface where PBB sub-interface will be configured. - :param params: Configuration parameters of the sub-interface to be - created. - :type node: dict - :type intf: str - :type params: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the configuration of sub-interface is not - successful. - """ - - interface = intf.replace("/", "%2F") - path = "/interface/{0}/pbb-rewrite".format(interface) - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_vpp_interfaces", params, path, - data_representation=DataRepresentation.JSON) - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of PBB sub-interface '{0}' was not " - "successful. Status code: {1}.".format(intf, status_code)) - return resp - - @staticmethod - def delete_pbb_sub_interface(node, intf): - """Deletes the given PBB sub-interface. - - :param node: Honeycomb node. - :param intf: The interface where PBB sub-interface will be deleted. - :type node: dict - :type intf: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the removal of sub-interface is not - successful. - """ - - interface = intf.replace("/", "%2F") - path = "/interface/{0}/pbb-rewrite".format(interface) - - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_vpp_interfaces", path) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "The removal of pbb sub-interface '{0}' was not successful. " - "Status code: {1}.".format(intf, status_code)) - return resp - - @staticmethod - def get_pbb_sub_interface_oper_data(node, intf, sub_if_id): - """Retrieves PBB sub-interface operational data from Honeycomb. - - :param node: Honeycomb node. - :param intf: The interface where PBB sub-interface is located. - :param sub_if_id: ID of the PBB sub-interface. - :type node: dict - :type intf: str - :type sub_if_id: str or int - :returns: PBB sub-interface operational data. - :rtype: dict - :raises HoneycombError: If the removal of sub-interface is not - successful. - """ - - raise NotImplementedError - - @staticmethod - def check_disabled_interface(node, interface): - """Retrieves list of disabled interface indices from Honeycomb, - and matches with the provided interface by index. - - :param node: Honeycomb node. - :param interface: Index number of an interface on the node. - :type node: dict - :type interface: int - :returns: True if the interface exists in disabled interfaces. - :rtype: bool - :raises HoneycombError: If the interface is not present - in retrieved list of disabled interfaces. - """ - data = InterfaceKeywords.get_disabled_interfaces_oper_data(node) - # decrement by one = conversion from HC if-index to VPP sw_if_index - interface -= 1 - - for item in data: - if item["index"] == interface: - return True - raise HoneycombError("Interface index {0} not present in list" - " of disabled interfaces.".format(interface)) - - @staticmethod - def configure_interface_span(node, dst_interface, src_interfaces=None): - """Configure SPAN port mirroring on the specified interfaces. If no - source interface is provided, SPAN will be disabled. - - :param node: Honeycomb node. - :param dst_interface: Interface to mirror packets to. - :param src_interfaces: List of interfaces to mirror packets from. - :type node: dict - :type dst_interface: str or int - :type src_interfaces: list of dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If SPAN could not be configured. - """ - - interface = Topology.convert_interface_reference( - node, dst_interface, "name") - interface = interface.replace("/", "%2F") - path = "/interface/" + interface + "/span" - - if not src_interfaces: - status_code, _ = HcUtil.delete_honeycomb_data( - node, "config_vpp_interfaces", path) - else: - for src_interface in src_interfaces: - src_interface["iface-ref"] = Topology.\ - convert_interface_reference( - node, src_interface["iface-ref"], "name") - data = { - "span": { - "mirrored-interfaces": { - "mirrored-interface": src_interfaces - } - } - } - - status_code, _ = HcUtil.put_honeycomb_data( - node, "config_vpp_interfaces", data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Configuring SPAN failed. Status code:{0}".format(status_code)) - - @staticmethod - def configure_sub_interface_span(node, super_interface, dst_interface_index, - src_interfaces=None): - """Configure SPAN port mirroring on the specified sub-interface. If no - source interface is provided, SPAN will be disabled. - - Note: Does not support source sub-interfaces, only destination. - - :param node: Honeycomb node. - :param super_interface: Name, link name or sw_if_index - of the destination interface's super-interface. - :param dst_interface_index: Index of sub-interface to mirror packets to. - :param src_interfaces: List of interfaces to mirror packets from. - :type node: dict - :type super_interface: str or int - :type dst_interface_index: int - :type src_interfaces: list of dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If SPAN could not be configured. - """ - - super_interface = Topology.convert_interface_reference( - node, super_interface, "name") - super_interface = super_interface.replace("/", "%2F") - - path = "/interface/{0}/vpp-vlan:sub-interfaces/sub-interface/{1}/span"\ - .format(super_interface, dst_interface_index) - - if not src_interfaces: - status_code, _ = HcUtil.delete_honeycomb_data( - node, "config_vpp_interfaces", path) - else: - for src_interface in src_interfaces: - src_interface["iface-ref"] = Topology. \ - convert_interface_reference( - node, src_interface["iface-ref"], "name") - data = { - "span": { - "mirrored-interfaces": { - "mirrored-interface": src_interfaces - } - } - } - - status_code, _ = HcUtil.put_honeycomb_data( - node, "config_vpp_interfaces", data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Configuring SPAN failed. Status code:{0}".format(status_code)) - - @staticmethod - def add_interface_local0_to_topology(node): - """Use Topology methods to add interface "local0" to working topology, - if not already present. - - :param node: DUT node. - :type node: dict - """ - - if Topology.get_interface_by_sw_index(node, 0) is None: - local0_key = Topology.add_new_port(node, "localzero") - Topology.update_interface_sw_if_index(node, local0_key, 0) - Topology.update_interface_name(node, local0_key, "local0") - - @staticmethod - def configure_interface_unnumbered(node, interface, interface_src=None): - """Configure the specified interface as unnumbered. The interface - borrows IP address from the specified source interface. If not source - interface is provided, unnumbered configuration will be removed. - - :param node: Honeycomb node. - :param interface: Name, link name or sw_if_index of an interface. - :param interface_src: Name of source interface. - :type node: dict - :type interface: str or int - :type interface_src: str - :raises HoneycombError: If the configuration fails. - """ - - interface = InterfaceKeywords.handle_interface_reference( - node, interface) - - path = "/interface/{0}/unnumbered-interfaces:unnumbered"\ - .format(interface) - - if interface_src: - data = { - "unnumbered": { - "use": interface_src - } - } - status_code, _ = HcUtil.put_honeycomb_data( - node, "config_vpp_interfaces", data, path) - else: - status_code, _ = HcUtil.delete_honeycomb_data( - node, "config_vpp_interfaces", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Configuring unnumbered interface failed. " - "Status code:{0}".format(status_code)) - - @staticmethod - def handle_interface_reference(node, interface): - """Convert any interface reference to interface name used by Honeycomb. - - :param node: Honeycomb node. - :param interface: Name, link name or sw_if_index of an interface, - name of a custom interface or name of a sub-interface. - :type node: Honeycomb node. - :type interface: str or int - :returns: Name of interface that can be used in Honeycomb requests. - :rtype: str - """ - - try: - interface = Topology.convert_interface_reference( - node, interface, "name") - interface = interface.replace("/", "%2F") - except RuntimeError: - # interface is not in topology - if "." in interface: - # Assume it's the name of a sub-interface - interface, index = interface.split(".") - interface = interface.replace("/", "%2F") - interface = "{0}/vpp-vlan:sub-interfaces/sub-interface/{1}".\ - format(interface, index) - else: - # Assume it's the name of a custom interface (pbb, vxlan, etc.) - interface = interface.replace("/", "%2F") - - return interface diff --git a/resources/libraries/python/honeycomb/HcAPIKwNSH.py b/resources/libraries/python/honeycomb/HcAPIKwNSH.py deleted file mode 100644 index e042fdd423..0000000000 --- a/resources/libraries/python/honeycomb/HcAPIKwNSH.py +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright (c) 2018 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. - -"""This module implements keywords to manipulate NSH-SFC data structures using -Honeycomb REST API.""" - -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation - - -class NSHKeywords(object): - """Implementation of keywords which make it possible to: - - add and remove NSH entries, - - get operational data about NSH entries, - - add and remove NSH maps, - - get operational data about NSH maps. - """ - - def __init__(self): - pass - - @staticmethod - def _set_nsh_properties(node, path, data=None): - """Set NSH properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - OK or ACCEPTED. - """ - - if data: - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_nsh", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_nsh", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of NSH-SFC was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def add_nsh_entry(node, name, data): - """Add an NSH entry to the list of entries. The keyword does - not validate given data. - - :param node: Honeycomb node. - :param name: Name for the NSH entry. - :param data: Settings for the new entry. - :type node: dict - :type name: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = "/nsh-entries/nsh-entry/{0}".format(name) - - return NSHKeywords._set_nsh_properties(node, path, data) - - @staticmethod - def add_nsh_map(node, name, data): - """Add an NSH map to the list of maps. The keyword does - not validate given data. - - :param node: Honeycomb node. - :param name: Name for the NSH map. - :param data: Settings for the new map. - :type node: dict - :type name: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - """ - path = "/nsh-maps/nsh-map/{0}".format(name) - - return NSHKeywords._set_nsh_properties(node, path, data) - - @staticmethod - def remove_nsh_entry(node, name): - """Remove an NSH entry from the list of entries. - :param node: Honeycomb node. - :param name: Name of the NSH entry. - :type node: dict - :type name: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/nsh-entries/nsh-entry/{0}".format(name) - return NSHKeywords._set_nsh_properties(node, path) - - @staticmethod - def remove_nsh_map(node, name): - """Remove an NSH map from the list of maps. - :param node: Honeycomb node. - :param name: Name of the NSH map. - :type node: dict - :type name: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/nsh-maps/nsh-map/{0}".format(name) - return NSHKeywords._set_nsh_properties(node, path) - - @staticmethod - def get_nsh_oper_data(node, entry_name=None, map_name=None): - """Get all NSH operational data present on the node. Optionally - filter out data for a specific entry or map. - - :param node: Honeycomb node. - :param entry_name: Name of a specific NSH entry. Optional. - :param map_name: Name of a specific NSH map. Optional. Do not use - together with entry_name. - :type node: dict - :type entry_name: str - :type map_name: str - :returns: List of classify tables. - :rtype: list - """ - if entry_name: - path = "/nsh-entries/nsh-entry/{0}".format(entry_name) - elif map_name: - path = "/nsh-maps/nsh-map/{0}".format(map_name) - else: - path = '' - - status_code, resp = HcUtil. \ - get_honeycomb_data(node, "oper_nsh", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "classify tables. Status code: {0}.".format(status_code)) - - return resp - - @staticmethod - def clear_nsh_settings(node): - """Remove the entire NSH container with all of its entries and maps. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - """ - - return NSHKeywords._set_nsh_properties(node, '') diff --git a/resources/libraries/python/honeycomb/HcPersistence.py b/resources/libraries/python/honeycomb/HcPersistence.py deleted file mode 100644 index 1627375f72..0000000000 --- a/resources/libraries/python/honeycomb/HcPersistence.py +++ /dev/null @@ -1,142 +0,0 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Implementation of keywords for managing Honeycomb persistence files.""" - -from robot.api import logger - -from resources.libraries.python.Constants import Constants as Const -from resources.libraries.python.honeycomb.HoneycombUtil import HoneycombError -from resources.libraries.python.ssh import SSH -from resources.libraries.python.topology import NodeType - - -class HcPersistence(object): - """Implements keywords for managing Honeycomb persistence files. - - The keywords implemented in this class make possible to: - - find and replace strings in config.json persistence file - """ - - def __init__(self): - pass - - @staticmethod - def clear_persisted_honeycomb_config(*nodes): - """Remove configuration data persisted from last Honeycomb session. - Default configuration will be used instead. - - :param nodes: List of DUTs to execute on. - :type nodes: list - :raises HoneycombError: If persisted configuration could not be removed. - """ - cmd = "rm -rf {}/*".format(Const.REMOTE_HC_PERSIST) - for node in nodes: - if node['type'] == NodeType.DUT: - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(cmd) - if ret_code != 0: - if "No such file or directory" not in stderr: - raise HoneycombError('Could not clear persisted ' - 'configuration on node {0}, {1}' - .format(node['host'], stderr)) - else: - logger.info("Persistence data was not present on node" - " {0}".format(node['host'])) - else: - logger.info("Persistence files removed on node {0}" - .format(node['host'])) - - @staticmethod - def modify_persistence_files(node, find, replace): - """Searches contents of persistence file data.json for the provided - string, and replaces all occurrences with another string. - - :param node: Honeycomb node. - :param find: Text to find in file. - :param replace: String to replace anything found with. - :type node: dict - :type find: string - :type replace: string - :raises HoneycombError: If persistent configuration couldn't be - modified. - """ - - argument = "\"s/{0}/{1}/g\"".format(find, replace) - path = "{0}/config/data.json".format(Const.REMOTE_HC_PERSIST) - command = "sed -i {0} {1}".format(argument, path) - - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify persistence file on node" - " {0}, {1}".format(node, stderr)) - - @staticmethod - def log_persisted_configuration(node): - """Read contents of Honeycomb persistence files and print them to log. - - :param node: Honeycomb node. - :type node: dict - """ - - commands = [ - "cat {0}/config/data.json".format(Const.REMOTE_HC_PERSIST), - "cat {0}/context/data.json".format(Const.REMOTE_HC_PERSIST), - ] - - ssh = SSH() - ssh.connect(node) - for command in commands: - (_, _, _) = ssh.exec_command_sudo(command) - - @staticmethod - def configure_persistence(node, state): - """Enable or disable Honeycomb configuration data persistence. - - :param node: Honeycomb node. - :param state: Enable or Disable. - :type node: dict - :type state: str - :raises ValueError: If the state argument is incorrect. - :raises HoneycombError: If the operation fails. - """ - - state = state.lower() - if state == "enable": - state = "true" - elif state == "disable": - state = "false" - else: - raise ValueError("Unexpected value of state argument:" - " {0} provided. Must be enable or disable." - .format(state)) - - for setting in ("persist-config", "persist-context"): - # find the setting, replace entire line with 'setting: state' - find = '\\"{setting}\\":'.format(setting=setting) - replace = '\\"{setting}\\": \\"{state}\\",'.format( - setting=setting, state=state) - - argument = '"/{0}/c\\ {1}"'.format(find, replace) - path = "{0}/config/honeycomb.json".format(Const.REMOTE_HC_DIR) - command = "sed -i {0} {1}".format(argument, path) - - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify configuration on " - "node {0}, {1}".format(node, stderr)) diff --git a/resources/libraries/python/honeycomb/HoneycombSetup.py b/resources/libraries/python/honeycomb/HoneycombSetup.py deleted file mode 100644 index 796639e879..0000000000 --- a/resources/libraries/python/honeycomb/HoneycombSetup.py +++ /dev/null @@ -1,821 +0,0 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Implementation of keywords for Honeycomb setup.""" - -from json import loads -from time import time, sleep - -from ipaddress import IPv6Address, AddressValueError - -from robot.api import logger - -from resources.libraries.python.HTTPRequest import HTTPRequest, HTTPCodes, \ - HTTPRequestError -from resources.libraries.python.Constants import Constants as Const -from resources.libraries.python.honeycomb.HoneycombUtil import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil -from resources.libraries.python.ssh import SSH -from resources.libraries.python.topology import NodeType - - -class HoneycombSetup(object): - """Implements keywords for Honeycomb setup. - - The keywords implemented in this class make possible to: - - start Honeycomb, - - stop Honeycomb, - - check the Honeycomb start-up state, - - check the Honeycomb shutdown state, - - add VPP to the topology. - """ - - def __init__(self): - pass - - @staticmethod - def start_honeycomb_on_duts(*nodes): - """Start Honeycomb on specified DUT nodes. - - This keyword starts the Honeycomb service on specified DUTs. - The keyword just starts the Honeycomb and does not check its startup - state. Use the keyword "Check Honeycomb Startup State" to check if the - Honeycomb is up and running. - Honeycomb must be installed in "/opt" directory, otherwise the start - will fail. - - :param nodes: List of nodes to start Honeycomb on. - :type nodes: list - :raises HoneycombError: If Honeycomb fails to start. - """ - - HoneycombSetup.print_environment(nodes) - - cmd = "sudo service honeycomb start" - - for node in nodes: - if node['type'] == NodeType.DUT: - logger.console( - "\n(re)Starting Honeycomb service on node {0}".format( - node["host"])) - ssh = SSH() - ssh.connect(node) - (ret_code, _, _) = ssh.exec_command_sudo(cmd) - if int(ret_code) != 0: - raise HoneycombError('Node {0} failed to start Honeycomb.'. - format(node['host'])) - else: - logger.info("Starting the Honeycomb service on node {0} is " - "in progress ...".format(node['host'])) - - @staticmethod - def stop_honeycomb_on_duts(*nodes): - """Stop the Honeycomb service on specified DUT nodes. - - This keyword stops the Honeycomb service on specified nodes. It just - stops the Honeycomb and does not check its shutdown state. Use the - keyword "Check Honeycomb Shutdown State" to check if Honeycomb has - stopped. - - :param nodes: List of nodes to stop Honeycomb on. - :type nodes: list - :raises HoneycombError: If Honeycomb failed to stop. - """ - - cmd = "sudo service honeycomb stop" - errors = [] - - for node in nodes: - if node['type'] == NodeType.DUT: - logger.console( - "\nShutting down Honeycomb service on node {0}".format( - node["host"])) - ssh = SSH() - ssh.connect(node) - (ret_code, _, _) = ssh.exec_command_sudo(cmd) - if int(ret_code) != 0: - errors.append(node['host']) - else: - logger.info("Stopping the Honeycomb service on node {0} is " - "in progress ...".format(node['host'])) - if errors: - raise HoneycombError('Node(s) {0} failed to stop Honeycomb.'. - format(errors)) - - @staticmethod - def restart_honeycomb_on_dut(node): - """Restart Honeycomb on specified DUT nodes. - - This keyword restarts the Honeycomb service on specified DUTs. Use the - keyword "Check Honeycomb Startup State" to check if the Honeycomb is up - and running. - - :param node: Node to restart Honeycomb on. - :type node: dict - :raises HoneycombError: If Honeycomb fails to start. - """ - - logger.console( - "\n(re)Starting Honeycomb service on node {0}".format(node["host"])) - - cmd = "sudo service honeycomb restart" - - ssh = SSH() - ssh.connect(node) - (ret_code, _, _) = ssh.exec_command_sudo(cmd) - if int(ret_code) != 0: - raise HoneycombError('Node {0} failed to restart Honeycomb.'. - format(node['host'])) - else: - logger.info( - "Honeycomb service restart is in progress on node {0}".format( - node['host'])) - - @staticmethod - def check_honeycomb_startup_state(node, timeout=360, retries=20, - interval=15): - """Repeatedly check the status of Honeycomb startup until it is fully - started or until timeout or max retries is reached. - - :param node: Honeycomb node. - :param timeout: Timeout value in seconds. - :param retries: Max number of retries. - :param interval: Interval between checks, in seconds. - :type node: dict - :type timeout: int - :type retries: int - :type interval: int - :raises HoneycombError: If the Honeycomb process IP cannot be found, - or if timeout or number of retries is exceeded. - """ - - ssh = SSH() - ssh.connect(node) - - count = 0 - start = time() - while time() - start < timeout and count < retries: - count += 1 - - try: - status_code_version, _ = HcUtil.get_honeycomb_data( - node, "oper_vpp_version") - status_code_if_cfg, _ = HcUtil.get_honeycomb_data( - node, "config_vpp_interfaces") - status_code_if_oper, _ = HcUtil.get_honeycomb_data( - node, "oper_vpp_interfaces") - except HTTPRequestError: - sleep(interval) - continue - if status_code_if_cfg == HTTPCodes.OK\ - and status_code_if_cfg == HTTPCodes.OK\ - and status_code_if_oper == HTTPCodes.OK: - logger.info("Check successful, Honeycomb is up and running.") - break - else: - logger.debug( - "Attempt ${count} failed on Restconf check. Status codes:\n" - "Version: {version}\n" - "Interface config: {if_cfg}\n" - "Interface operational: {if_oper}".format( - count=count, - version=status_code_version, - if_cfg=status_code_if_cfg, - if_oper=status_code_if_oper)) - sleep(interval) - continue - else: - _, vpp_status, _ = ssh.exec_command("sudo service vpp status") - raise HoneycombError( - "Timeout or max retries exceeded. Status of VPP:\n" - "{vpp_status}".format(vpp_status=vpp_status)) - - @staticmethod - def check_honeycomb_shutdown_state(node): - """Check state of Honeycomb service during shutdown on specified nodes. - - Honeycomb nodes reply with connection refused or the following status - codes depending on shutdown progress: codes 200, 404. - - :param node: List of DUT nodes stopping Honeycomb. - :type node: dict - :returns: True if all GETs fail to connect. - :rtype: bool - """ - cmd = "pgrep honeycomb" - - ssh = SSH() - ssh.connect(node) - (ret_code, _, _) = ssh.exec_command_sudo(cmd) - if ret_code == 0: - raise HoneycombError('Honeycomb on node {0} is still ' - 'running.'.format(node['host']), - enable_logging=False) - else: - logger.info("Honeycomb on node {0} has stopped". - format(node['host'])) - return True - - @staticmethod - def configure_restconf_binding_address(node): - """Configure Honeycomb to accept restconf requests from all IP - addresses. IP version is determined by node data. - - :param node: Information about a DUT node. - :type node: dict - :raises HoneycombError: If the configuration could not be changed. - """ - - find = "restconf-binding-address" - try: - IPv6Address(unicode(node["host"])) - # if management IP of the node is in IPv6 format - replace = '\\"restconf-binding-address\\": \\"0::0\\",' - except (AttributeError, AddressValueError): - replace = '\\"restconf-binding-address\\": \\"0.0.0.0\\",' - - argument = '"/{0}/c\\ {1}"'.format(find, replace) - path = "{0}/config/restconf.json".format(Const.REMOTE_HC_DIR) - command = "sed -i {0} {1}".format(argument, path) - - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify configuration on " - "node {0}, {1}".format(node, stderr)) - - @staticmethod - def configure_jvpp_timeout(node, timeout=10): - """Configure timeout value for Java API commands Honeycomb sends to VPP. - - :param node: Information about a DUT node. - :param timeout: Timeout value in seconds. - :type node: dict - :type timeout: int - :raises HoneycombError: If the configuration could not be changed. - """ - - find = "jvpp-request-timeout" - replace = '\\"jvpp-request-timeout\\": {0}'.format(timeout) - - argument = '"/{0}/c\\ {1}"'.format(find, replace) - path = "{0}/config/jvpp.json".format(Const.REMOTE_HC_DIR) - command = "sed -i {0} {1}".format(argument, path) - - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify configuration on " - "node {0}, {1}".format(node, stderr)) - - @staticmethod - def print_environment(nodes): - """Print information about the nodes to log. The information is defined - by commands in cmds tuple at the beginning of this method. - - :param nodes: List of DUT nodes to get information about. - :type nodes: list - """ - - # TODO: When everything is set and running in VIRL env, transform this - # method to a keyword checking the environment. - - cmds = ("uname -a", - "df -lh", - "echo $JAVA_HOME", - "echo $PATH", - "which java", - "java -version", - "dpkg --list | grep openjdk", - "ls -la /opt/honeycomb", - "cat /opt/honeycomb/modules/*module-config") - - for node in nodes: - if node['type'] == NodeType.DUT: - logger.info("Checking node {} ...".format(node['host'])) - for cmd in cmds: - logger.info("Command: {}".format(cmd)) - ssh = SSH() - ssh.connect(node) - ssh.exec_command_sudo(cmd) - - @staticmethod - def print_ports(node): - """Uses "sudo netstat -anp | grep java" to print port where a java - application listens. - - :param node: Honeycomb node where we want to print the ports. - :type node: dict - """ - - cmds = ("netstat -anp | grep java", - "ps -ef | grep [h]oneycomb") - - logger.info("Checking node {} ...".format(node['host'])) - for cmd in cmds: - logger.info("Command: {}".format(cmd)) - ssh = SSH() - ssh.connect(node) - ssh.exec_command_sudo(cmd) - - @staticmethod - def configure_log_level(node, level): - """Set Honeycomb logging to the specified level. - - :param node: Honeycomb node. - :param level: Log level (INFO, DEBUG, TRACE). - :type node: dict - :type level: str - """ - - find = 'logger name=\\"io.fd\\"' - replace = '<logger name=\\"io.fd\\" level=\\"{0}\\"/>'.format(level) - - argument = '"/{0}/c\\ {1}"'.format(find, replace) - path = "{0}/config/logback.xml".format(Const.REMOTE_HC_DIR) - command = "sed -i {0} {1}".format(argument, path) - - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify configuration on " - "node {0}, {1}".format(node, stderr)) - - @staticmethod - def manage_honeycomb_features(node, feature, disable=False): - """Configure Honeycomb to use features that are disabled by default, or - disable previously enabled features. - - ..Note:: If the module is not enabled in VPP, Honeycomb will - be unable to establish VPP connection. - - :param node: Honeycomb node. - :param feature: Feature to enable. - :param disable: Disable the specified feature instead of enabling it. - :type node: dict - :type feature: string - :type disable: bool - :raises HoneycombError: If the configuration could not be changed. - """ - - disabled_features = { - "NSH": ["io.fd.hc2vpp.vppnsh.impl.VppNshModule"], - "BGP": ["io.fd.hc2vpp.bgp.inet.BgpInetModule", - "io.fd.honeycomb.infra.bgp.BgpModule", - "io.fd.honeycomb.infra.bgp.BgpReadersModule", - "io.fd.honeycomb.infra.bgp.BgpWritersModule", - "io.fd.honeycomb.northbound.bgp.extension.InetModule", - "io.fd.honeycomb.northbound.bgp.extension.EvpnModule", - "io.fd.honeycomb.northbound.bgp.extension.L3VpnV4Module", - "io.fd.honeycomb.northbound.bgp.extension.L3VpnV6Module", - "io.fd.honeycomb.northbound.bgp.extension." - "LabeledUnicastModule", - "io.fd.honeycomb.northbound.bgp.extension.LinkstateModule"] - } - - ssh = SSH() - ssh.connect(node) - - if feature in disabled_features.keys(): - # for every module, uncomment by replacing the entire line - for item in disabled_features[feature]: - find = replace = "{0}".format(item) - if disable: - replace = "// {0}".format(find) - - argument = '"/{0}/c\\ {1}"'.format(find, replace) - path = "{0}/modules/*module-config"\ - .format(Const.REMOTE_HC_DIR) - command = "sed -i {0} {1}".format(argument, path) - - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify configuration on " - "node {0}, {1}".format(node, stderr)) - else: - raise HoneycombError( - "Unrecognized feature {0}.".format(feature)) - - @staticmethod - def copy_java_libraries(node): - """Copy Java libraries installed by vpp-api-java package to honeycomb - lib folder. - - This is a (temporary?) workaround for jvpp version mismatches. - - :param node: Honeycomb node - :type node: dict - """ - - ssh = SSH() - ssh.connect(node) - (_, stdout, _) = ssh.exec_command_sudo( - "ls /usr/share/java | grep ^jvpp-*") - - files = stdout.split("\n")[:-1] - for item in files: - # example filenames: - # jvpp-registry-17.04.jar - # jvpp-core-17.04.jar - - parts = item.split("-") - version = "{0}-SNAPSHOT".format(parts[2][:5]) - artifact_id = "{0}-{1}".format(parts[0], parts[1]) - - directory = "{0}/lib/io/fd/vpp/{1}/{2}".format( - Const.REMOTE_HC_DIR, artifact_id, version) - cmd = "sudo mkdir -p {0}; " \ - "sudo cp /usr/share/java/{1} {0}/{2}-{3}.jar".format( - directory, item, artifact_id, version) - - (ret_code, _, stderr) = ssh.exec_command(cmd) - if ret_code != 0: - raise HoneycombError("Failed to copy JVPP libraries on " - "node {0}, {1}".format(node, stderr)) - - @staticmethod - def copy_odl_client(node, odl_name, src_path, dst_path): - """Copy ODL Client from source path to destination path. - - :param node: Honeycomb node. - :param odl_name: Name of ODL client version to use. - :param src_path: Source Path where to find ODl client. - :param dst_path: Destination path. - :type node: dict - :type odl_name: str - :type src_path: str - :type dst_path: str - :raises HoneycombError: If the operation fails. - """ - - ssh = SSH() - ssh.connect(node) - - cmd = "sudo rm -rf {dst}/*karaf_{odl_name} && " \ - "cp -r {src}/*karaf_{odl_name}* {dst}".format( - src=src_path, odl_name=odl_name, dst=dst_path) - - ret_code, _, _ = ssh.exec_command_sudo(cmd, timeout=180) - if int(ret_code) != 0: - raise HoneycombError( - "Failed to copy ODL client on node {0}".format(node["host"])) - - @staticmethod - def setup_odl_client(node, path): - """Start ODL client on the specified node. - - Karaf should be located in the provided path, and VPP and Honeycomb - should already be running, otherwise the start will fail. - - :param node: Node to start ODL client on. - :param path: Path to ODL client on node. - :type node: dict - :type path: str - :raises HoneycombError: If Honeycomb fails to start. - """ - - logger.console("\nStarting ODL client ...") - ssh = SSH() - ssh.connect(node) - - cmd = "{path}/*karaf*/bin/start clean".format(path=path) - ret_code, _, _ = ssh.exec_command_sudo(cmd) - - if int(ret_code) != 0: - raise HoneycombError('Node {0} failed to start ODL.'. - format(node['host'])) - else: - logger.info("Starting the ODL client on node {0} is " - "in progress ...".format(node['host'])) - - @staticmethod - def install_odl_features(node, path, *features): - """Install required features on a running ODL client. - - :param node: Honeycomb node. - :param path: Path to ODL client on node. - :param features: Optional, list of additional features to install. - :type node: dict - :type path: str - :type features: list - """ - - ssh = SSH() - ssh.connect(node) - - auth = "-u karaf -p karaf" - - cmd = "{path}/*karaf*/bin/client {auth} feature:install " \ - "odl-restconf-all " \ - "odl-netconf-connector-all " \ - "odl-netconf-topology".format(path=path, auth=auth) - for feature in features: - cmd += " {0}".format(feature) - - ret_code, _, _ = ssh.exec_command_sudo(cmd, timeout=250) - - if int(ret_code) != 0: - raise HoneycombError("Feature install did not succeed.") - - @staticmethod - def check_odl_startup_state(node): - """Check the status of ODL client startup. - - :param node: Honeycomb node. - :param node: dict - :returns: True when ODL is started. - :rtype: bool - :raises HoneycombError: When the response is not code 200: OK. - """ - - path = HcUtil.read_path_from_url_file( - "odl_client/odl_netconf_connector") - expected_status_codes = (HTTPCodes.UNAUTHORIZED, - HTTPCodes.FORBIDDEN, - HTTPCodes.NOT_FOUND, - HTTPCodes.SERVICE_UNAVAILABLE, - HTTPCodes.INTERNAL_SERVER_ERROR) - - status_code, _ = HTTPRequest.get(node, path, timeout=10, - enable_logging=False) - if status_code == HTTPCodes.OK: - logger.info("ODL client on node {0} is up and running". - format(node['host'])) - elif status_code in expected_status_codes: - if status_code == HTTPCodes.UNAUTHORIZED: - logger.info('Unauthorized. If this triggers keyword ' - 'timeout, verify username and password.') - raise HoneycombError('ODL client on node {0} running but ' - 'not yet ready.'.format(node['host']), - enable_logging=False) - else: - raise HoneycombError('Unexpected return code: {0}.'. - format(status_code)) - return True - - @staticmethod - def check_odl_shutdown_state(node): - """Check the status of ODL client shutdown. - - :param node: Honeycomb node. - :type node: dict - :returns: True when ODL is stopped. - :rtype: bool - :raises HoneycombError: When the response is not code 200: OK. - """ - - cmd = "pgrep -f karaf" - path = HcUtil.read_path_from_url_file( - "odl_client/odl_netconf_connector") - - try: - HTTPRequest.get(node, path, timeout=10, enable_logging=False) - raise HoneycombError("ODL client is still running.") - except HTTPRequestError: - logger.debug("Connection refused, checking process state....") - ssh = SSH() - ssh.connect(node) - ret_code, _, _ = ssh.exec_command(cmd) - if ret_code == 0: - raise HoneycombError("ODL client is still running.") - - return True - - @staticmethod - def mount_honeycomb_on_odl(node): - """Tell ODL client to mount Honeycomb instance over netconf. - - :param node: Honeycomb node. - :type node: dict - :raises HoneycombError: When the response is not code 200: OK. - """ - - path = HcUtil.read_path_from_url_file( - "odl_client/odl_netconf_connector") - - url_file = "{0}/{1}".format(Const.RESOURCES_TPL_HC, - "odl_client/mount_honeycomb.json") - - with open(url_file) as template: - data = template.read() - - data = loads(data) - - status_code, _ = HTTPRequest.post( - node, - path, - headers={"Content-Type": "application/json", - "Accept": "text/plain"}, - json=data, - timeout=10, - enable_logging=False) - - if status_code == HTTPCodes.OK: - logger.info("ODL mount point configured successfully.") - elif status_code == HTTPCodes.CONFLICT: - logger.info("ODL mount point was already configured.") - else: - raise HoneycombError('Mount point configuration not successful') - - @staticmethod - def stop_odl_client(node, path): - """Stop ODL client service on the specified node. - - :param node: Node to start ODL client on. - :param path: Path to ODL client. - :type node: dict - :type path: str - :raises HoneycombError: If ODL client fails to stop. - """ - - ssh = SSH() - ssh.connect(node) - - cmd = "{0}/*karaf*/bin/stop".format(path) - - ssh = SSH() - ssh.connect(node) - ret_code, _, _ = ssh.exec_command_sudo(cmd) - if int(ret_code) != 0: - logger.debug("ODL Client refused to shut down.") - cmd = "pkill -f 'karaf'" - (ret_code, _, _) = ssh.exec_command_sudo(cmd) - if int(ret_code) != 0: - raise HoneycombError('Node {0} failed to stop ODL.'. - format(node['host'])) - - logger.info("ODL client service stopped.") - - @staticmethod - def set_static_arp(node, ip_address, mac_address): - """Configure a static ARP entry using arp. - - :param node: Node in topology. - :param ip_address: IP address for the entry. - :param mac_address: MAC adddress for the entry. - :type node: dict - :type ip_address: str - :type mac_address: str - :raises RuntimeError: If the operation fails. - """ - - ssh = SSH() - ssh.connect(node) - ret_code, _, _ = ssh.exec_command_sudo("arp -s {0} {1}".format( - ip_address, mac_address)) - - if ret_code != 0: - raise RuntimeError("Failed to configure static ARP adddress.") - - -class HoneycombStartupConfig(object): - """Generator for Honeycomb startup configuration. - """ - def __init__(self): - """Initializer.""" - - self.template = """#!/bin/sh - - STATUS=100 - - while [ $STATUS -eq 100 ] - do - {java_call} -jar $(dirname $0)/{jar_filename} - STATUS=$? - echo "Honeycomb exited with status: $STATUS" - if [ $STATUS -eq 100 ] - then - echo "Restarting..." - fi - done - """ - - self.java_call = "{scheduler} {affinity} java{jit_mode}{params}" - - self.scheduler = "" - self.core_affinity = "" - self.jit_mode = "" - self.params = "" - self.numa = "" - - self.config = "" - self.ssh = SSH() - - def apply_config(self, node): - """Generate configuration file /opt/honeycomb/honeycomb on the specified - node. - - :param node: Honeycomb node. - :type node: dict - """ - - self.ssh.connect(node) - _, filename, _ = self.ssh.exec_command("ls /opt/honeycomb | grep .jar") - - java_call = self.java_call.format(scheduler=self.scheduler, - affinity=self.core_affinity, - jit_mode=self.jit_mode, - params=self.params) - self.config = self.template.format(java_call=java_call, - jar_filename=filename) - - self.ssh.connect(node) - cmd = "echo '{config}' > /tmp/honeycomb " \ - "&& chmod +x /tmp/honeycomb " \ - "&& sudo mv -f /tmp/honeycomb /opt/honeycomb".\ - format(config=self.config) - self.ssh.exec_command(cmd) - - def set_cpu_scheduler(self, scheduler="FIFO"): - """Use alternate CPU scheduler. - - Note: OTHER scheduler doesn't load-balance over isolcpus. - - :param scheduler: CPU scheduler to use. - :type scheduler: str - """ - - schedulers = {"FIFO": "-f 99", # First In, First Out - "RR": "-r 99", # Round Robin - "OTHER": "-o", # Ubuntu default - } - self.scheduler = "chrt {0}".format(schedulers[scheduler]) - - def set_cpu_core_affinity(self, low, high=None): - """Set core affinity for the honeycomb process and subprocesses. - - :param low: Lowest core ID number. - :param high: Highest core ID number. Leave empty to use a single core. - :type low: int - :type high: int - """ - - self.core_affinity = "taskset -c {low}-{high}".format( - low=low, high=high if high else low) - - def set_jit_compiler_mode(self, jit_mode): - """Set running mode for Java's JIT compiler. - - :param jit_mode: Desiret JIT mode. - :type jit_mode: str - """ - - modes = {"client": " -client", # Default - "server": " -server", # Higher performance but longer warmup - "classic": " -classic" # Disables JIT compiler - } - - self.jit_mode = modes[jit_mode] - - def set_memory_size(self, mem_min, mem_max=None): - """Set minimum and maximum memory use for the JVM. - - :param mem_min: Minimum amount of memory (MB). - :param mem_max: Maximum amount of memory (MB). Default is 4 times - minimum value. - :type mem_min: int - :type mem_max: int - """ - - self.params += " -Xms{min}m -Xmx{max}m".format( - min=mem_min, max=mem_max if mem_max else mem_min*4) - - def set_metaspace_size(self, mem_min, mem_max=None): - """Set minimum and maximum memory used for class metadata in the JVM. - - :param mem_min: Minimum metaspace size (MB). - :param mem_max: Maximum metaspace size (MB). Defailt is 4 times - minimum value. - :type mem_min: int - :type mem_max: int - """ - - self.params += " -XX:MetaspaceSize={min}m " \ - "-XX:MaxMetaspaceSize={max}m".format( - min=mem_min, max=mem_max if mem_max else mem_min*4) - - def set_numa_optimization(self): - """Use optimization of memory use and garbage collection for NUMA - architectures.""" - - self.params += " -XX:+UseNUMA -XX:+UseParallelGC" - - def set_ssh_security_provider(self): - """Disables BouncyCastle for SSHD.""" - # Workaround for issue described in: - # https://wiki.fd.io/view/Honeycomb/Releases/1609/Honeycomb_and_ODL - - self.params += " -Dorg.apache.sshd.registerBouncyCastle=false" diff --git a/resources/libraries/python/honeycomb/HoneycombUtil.py b/resources/libraries/python/honeycomb/HoneycombUtil.py deleted file mode 100644 index 59483f4672..0000000000 --- a/resources/libraries/python/honeycomb/HoneycombUtil.py +++ /dev/null @@ -1,512 +0,0 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Implementation of low level functionality used in communication with -Honeycomb. - -Exception HoneycombError is used in all methods and in all modules with -Honeycomb keywords. - -Class HoneycombUtil implements methods used by Honeycomb keywords. They must not -be used directly in tests. Use keywords implemented in the module -HoneycombAPIKeywords instead. -""" - -from json import loads, dumps -from enum import Enum, unique - -from robot.api import logger - -from resources.libraries.python.ssh import SSH -from resources.libraries.python.HTTPRequest import HTTPRequest -from resources.libraries.python.Constants import Constants as Const - - -@unique -class DataRepresentation(Enum): - """Representation of data sent by PUT and POST requests.""" - NO_DATA = 0 - JSON = 1 - XML = 2 - TXT = 3 - - -# Headers used in requests. Key - content representation, value - header. -HEADERS = {DataRepresentation.NO_DATA: - {}, # It must be empty dictionary. - DataRepresentation.JSON: - {"Content-Type": "application/json", - "Accept": "text/plain"}, - DataRepresentation.XML: - {"Content-Type": "application/xml", - "Accept": "text/plain"}, - DataRepresentation.TXT: - {"Content-Type": "text/plain", - "Accept": "text/plain"} - } - - -class HoneycombError(Exception): - - """Exception(s) raised by methods working with Honeycomb. - - When raising this exception, put this information to the message in this - order: - - - short description of the encountered problem (parameter msg), - - relevant messages if there are any collected, e.g., from caught - exception (optional parameter details), - - relevant data if there are any collected (optional parameter details). - - The logging is performed on two levels: 1. error - short description of the - problem; 2. debug - detailed information. - """ - - def __init__(self, msg, details='', enable_logging=True): - """Sets the exception message and enables / disables logging. - - It is not wanted to log errors when using these keywords together - with keywords like "Wait until keyword succeeds". So you can disable - logging by setting enable_logging to False. - - :param msg: Message to be displayed and logged. - :param enable_logging: When True, logging is enabled, otherwise - logging is disabled. - :type msg: str - :type enable_logging: bool - """ - super(HoneycombError, self).__init__() - self._msg = "{0}: {1}".format(self.__class__.__name__, msg) - self._details = details - if enable_logging: - logger.debug(self._details) - - def __repr__(self): - return repr(self._msg) - - def __str__(self): - return str(self._msg) - - -class HoneycombUtil(object): - """Implements low level functionality used in communication with Honeycomb. - - There are implemented methods to get, put and delete data to/from Honeycomb. - They are based on functionality implemented in the module HTTPRequests which - uses HTTP requests GET, PUT, POST and DELETE to communicate with Honeycomb. - - It is possible to PUT the data represented as XML or JSON structures or as - plain text. - Data received in the response of GET are always represented as a JSON - structure. - - There are also two supportive methods implemented: - - - read_path_from_url_file which reads URL file and returns a path (see - docs/honeycomb_url_files.rst). - - parse_json_response which parses data from response in JSON - representation according to given path. - """ - - def __init__(self): - pass - - @staticmethod - def read_path_from_url_file(url_file): - """Read path from .url file. - - For more information about .url file see docs/honeycomb_url_files.rst - - :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. - :type url_file: str - :returns: Requested path. - :rtype: str - """ - - url_file = "{0}/{1}.url".format(Const.RESOURCES_TPL_HC, url_file) - with open(url_file) as template: - path = template.readline() - return path - - @staticmethod - def find_item(data, path): - """Find a data item (single leaf or sub-tree) in data received from - Honeycomb REST API. - - Path format: - The path is a tuple with items navigating to requested data. The items - can be strings or tuples: - - - string item represents a dictionary key in data, - - tuple item represents list item in data. - - Example:: - - data = \ - { - "interfaces": { - "interface": [ - { - "name": "GigabitEthernet0/8/0", - "enabled": "true", - "type": "iana-if-type:ethernetCsmacd", - }, - { - "name": "local0", - "enabled": "false", - "type": "iana-if-type:ethernetCsmacd", - } - ] - } - } - - path = ("interfaces", ("interface", "name", "local0"), "enabled") - This path points to "false". - - The tuple ("interface", "name", "local0") consists of:: - - index 0 - dictionary key pointing to a list, - index 1 - key which identifies an item in the list, it is also marked - as the key in corresponding yang file. - index 2 - key value. - - :param data: Data received from Honeycomb REST API. - :param path: Path to data we want to find. - :type data: dict - :type path: tuple - :returns: Data represented by path. - :rtype: str, dict, or list - :raises HoneycombError: If the data has not been found. - """ - - for path_item in path: - try: - if isinstance(path_item, str): - data = data[path_item] - elif isinstance(path_item, tuple): - for data_item in data[path_item[0]]: - if data_item[path_item[1]] == path_item[2]: - data = data_item - except KeyError as err: - raise HoneycombError("Data not found: {0}".format(err)) - - return data - - @staticmethod - def remove_item(data, path): - """Remove a data item (single leaf or sub-tree) in data received from - Honeycomb REST API. - - :param data: Data received from Honeycomb REST API. - :param path: Path to data we want to remove. - :type data: dict - :type path: tuple - :returns: Original data without removed part. - :rtype: dict - """ - - origin_data = previous_data = data - try: - for path_item in path: - previous_data = data - if isinstance(path_item, str): - data = data[path_item] - elif isinstance(path_item, tuple): - for data_item in data[path_item[0]]: - if data_item[path_item[1]] == path_item[2]: - data = data_item - except KeyError as err: - logger.debug("Data not found: {0}".format(err)) - return origin_data - - if isinstance(path[-1], str): - previous_data.pop(path[-1]) - elif isinstance(path[-1], tuple): - previous_data[path[-1][0]].remove(data) - if not previous_data[path[-1][0]]: - previous_data.pop(path[-1][0]) - - return origin_data - - @staticmethod - def set_item_value(data, path, new_value): - """Set or change the value (single leaf or sub-tree) in data received - from Honeycomb REST API. - - If the item is not present in the data structure, it is created. - - :param data: Data received from Honeycomb REST API. - :param path: Path to data we want to change or create. - :param new_value: The value to be set. - :type data: dict - :type path: tuple - :type new_value: str, dict or list - :returns: Original data with the new value. - :rtype: dict - """ - - origin_data = data - for path_item in path[:-1]: - if isinstance(path_item, str): - try: - data = data[path_item] - except KeyError: - data[path_item] = {} - data = data[path_item] - elif isinstance(path_item, tuple): - try: - flag = False - index = 0 - for data_item in data[path_item[0]]: - if data_item[path_item[1]] == path_item[2]: - data = data[path_item[0]][index] - flag = True - break - index += 1 - if not flag: - data[path_item[0]].append({path_item[1]: path_item[2]}) - data = data[path_item[0]][-1] - except KeyError: - data[path_item] = [] - - if not path[-1] in data.keys(): - data[path[-1]] = {} - - if isinstance(new_value, list) and isinstance(data[path[-1]], list): - for value in new_value: - data[path[-1]].append(value) - else: - data[path[-1]] = new_value - - return origin_data - - @staticmethod - def get_honeycomb_data(node, url_file, path=""): - """Retrieve data from Honeycomb according to given URL. - - :param node: Honeycomb node. - :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. - :param path: Path which is added to the base path to identify the data. - :type node: dict - :type url_file: str - :type path: str - :returns: Status code and content of response. - :rtype: tuple - """ - - base_path = HoneycombUtil.read_path_from_url_file(url_file) - path = base_path + path - status_code, resp = HTTPRequest.get(node, path) - - try: - data = loads(resp) - except ValueError: - logger.debug("Failed to deserialize JSON data.") - data = None - - return status_code, data - - @staticmethod - def put_honeycomb_data(node, url_file, data, path="", - data_representation=DataRepresentation.JSON): - """Send configuration data using PUT request and return the status code - and response content. - - :param node: Honeycomb node. - :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. - :param data: Configuration data to be sent to Honeycomb. - :param path: Path which is added to the base path to identify the data. - :param data_representation: How the data is represented. - :type node: dict - :type url_file: str - :type data: dict, str - :type path: str - :type data_representation: DataRepresentation - :returns: Status code and content of response. - :rtype: tuple - :raises HoneycombError: If the given data representation is not defined - in HEADERS. - """ - - try: - header = HEADERS[data_representation] - except AttributeError as err: - raise HoneycombError("Wrong data representation: {0}.". - format(data_representation), repr(err)) - if data_representation == DataRepresentation.JSON: - data = dumps(data) - - logger.trace(data) - - base_path = HoneycombUtil.read_path_from_url_file(url_file) - path = base_path + path - logger.trace(path) - return HTTPRequest.put( - node=node, path=path, headers=header, payload=data) - - @staticmethod - def post_honeycomb_data(node, url_file, data=None, - data_representation=DataRepresentation.JSON, - timeout=10): - """Send a POST request and return the status code and response content. - - :param node: Honeycomb node. - :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. - :param data: Configuration data to be sent to Honeycomb. - :param data_representation: How the data is represented. - :param timeout: How long to wait for the server to send data before - giving up. - :type node: dict - :type url_file: str - :type data: dict, str - :type data_representation: DataRepresentation - :type timeout: int - :returns: Status code and content of response. - :rtype: tuple - :raises HoneycombError: If the given data representation is not defined - in HEADERS. - """ - - try: - header = HEADERS[data_representation] - except AttributeError as err: - raise HoneycombError("Wrong data representation: {0}.". - format(data_representation), repr(err)) - if data_representation == DataRepresentation.JSON: - data = dumps(data) - - path = HoneycombUtil.read_path_from_url_file(url_file) - return HTTPRequest.post( - node=node, path=path, headers=header, payload=data, timeout=timeout) - - @staticmethod - def delete_honeycomb_data(node, url_file, path=""): - """Delete data from Honeycomb according to given URL. - - :param node: Honeycomb node. - :param url_file: URL file. The argument contains only the name of file - without extension, not the full path. - :param path: Path which is added to the base path to identify the data. - :type node: dict - :type url_file: str - :type path: str - :returns: Status code and content of response. - :rtype: tuple - """ - - base_path = HoneycombUtil.read_path_from_url_file(url_file) - path = base_path + path - return HTTPRequest.delete(node, path) - - @staticmethod - def append_honeycomb_log(node, suite_name): - """Append Honeycomb log for the current test suite to the full log. - - :param node: Honeycomb node. - :param suite_name: Name of the current test suite. ${SUITE_NAME} - variable in robotframework. - :type node: dict - :type suite_name: str - """ - - ssh = SSH() - ssh.connect(node) - - ssh.exec_command( - "echo '{separator}' >> /tmp/honeycomb.log".format(separator="="*80)) - ssh.exec_command( - "echo 'Log for suite: {suite}' >> /tmp/honeycomb.log".format( - suite=suite_name)) - ssh.exec_command( - "cat {hc_log} >> /tmp/honeycomb.log".format( - hc_log=Const.REMOTE_HC_LOG)) - - @staticmethod - def append_odl_log(node, odl_name, suite_name): - """Append ODL karaf log for the current test suite to the full log. - - :param node: Honeycomb node. - :param odl_name: Name of ODL client version to use. - :param suite_name: Name of the current test suite. ${SUITE_NAME} - variable in robotframework. - :type node: dict - :type odl_name: str - :type suite_name: str - """ - - ssh = SSH() - ssh.connect(node) - - ssh.exec_command( - "echo '{separator}' >> /tmp/karaf.log".format(separator="="*80)) - ssh.exec_command( - "echo 'Log for suite: {suite}' >> /tmp/karaf.log".format( - suite=suite_name)) - ssh.exec_command( - "cat /tmp/karaf_{odl_name}/data/log/karaf.log >> /tmp/karaf.log" - .format(odl_name=odl_name)) - - @staticmethod - def clear_honeycomb_log(node): - """Delete the Honeycomb log file for the current test suite. - - :param node: Honeycomb node. - :type node: dict - """ - - ssh = SSH() - ssh.connect(node) - - ssh.exec_command("sudo rm {hc_log}".format(hc_log=Const.REMOTE_HC_LOG)) - - @staticmethod - def archive_honeycomb_log(node, perf=False): - """Copy honeycomb log file from DUT node to VIRL for archiving. - - :param node: Honeycomb node. - :param perf: Alternate handling, for use with performance test topology. - :type node: dict - :type perf: bool - """ - - ssh = SSH() - ssh.connect(node) - - if not perf: - cmd = "cp /tmp/honeycomb.log /scratch/" - ssh.exec_command_sudo(cmd, timeout=60) - else: - ssh.scp( - ".", - "/tmp/honeycomb.log", - get=True, - timeout=60) - ssh.exec_command("rm /tmp/honeycomb.log") - - @staticmethod - def archive_odl_log(node): - """Copy ODL karaf log file from DUT node to VIRL for archiving. - - :param node: Honeycomb node. - :type node: dict - """ - - ssh = SSH() - ssh.connect(node) - - cmd = "cp /tmp/karaf.log /scratch/" - ssh.exec_command_sudo(cmd, timeout=60) diff --git a/resources/libraries/python/honeycomb/IPv6Management.py b/resources/libraries/python/honeycomb/IPv6Management.py deleted file mode 100644 index deec041103..0000000000 --- a/resources/libraries/python/honeycomb/IPv6Management.py +++ /dev/null @@ -1,147 +0,0 @@ -# Copyright (c) 2017 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. - -"""Keywords used for setup and testing of Honeycomb's control-plane interface -using IPv6. -""" - -from resources.libraries.python.ssh import SSH - - -class IPv6Management(object): - """Utilities for managing IPv6 contol-plane interfaces.""" - - def __init__(self): - pass - - @staticmethod - def get_interface_name_by_mac(node, mac): - """Get the name of an interface using its MAC address. - - :param node: Node in topology. - :param mac: MAC address. - :type node: dict - :type mac: str - :returns: Name of the interface. - :rtype: str - :raises RuntimeError: If no interface is found. - """ - - cmd = " | ".join([ - "fgrep -ls '{0}' /sys/class/net/*/address".format(mac), - "awk -F '/' '{print $5}'" - ]) - - ssh = SSH() - ssh.connect(node) - ret_code, stdout, _ = ssh.exec_command(cmd) - - if ret_code == 0: - return stdout.strip() - else: - raise RuntimeError("No interface found using the specified MAC " - "address.") - - @staticmethod - def clear_interface_configuration(node, interface): - """Remove all configured IP addresses from the specified interface - and set it into down state. - - :param node: Node in topology. - :param interface: Name of an interface on the node. - :type node: dict - :type interface: str - :raises RuntimeError: If the configuration could not be cleared. - """ - - cmd = " && ".join([ - "sudo ip addr flush dev {interface}".format(interface=interface), - "sudo ip link set dev {interface} down".format(interface=interface) - ]) - - ssh = SSH() - ssh.connect(node) - ret_code, _, _ = ssh.exec_command(cmd) - if ret_code != 0: - raise RuntimeError("Could not clear interface configuration.") - - @staticmethod - def set_management_interface_address(node, interface, address, prefix): - """Configure an IP address on the specified interface. - - :param node: Node in topology. - :param interface: Name of an interface on the node. - :param address: IP address to configure. - :param prefix: IP network prefix. - :type node: dict - :type interface: str - :type address: str - :type prefix: int - :raises RuntimeError: If the configuration fails. - """ - - ssh = SSH() - ssh.connect(node) - - # Enable IPv6 for only the specified interface - cmd = "sudo sysctl net.ipv6.conf.{0}.disable_ipv6=0".format(interface) - - ret_code, _, _ = ssh.exec_command(cmd) - if ret_code != 0: - raise RuntimeError("Could not enable IPv6 on interface.") - - # Configure IPv6 address on the interface - cmd = "sudo ip address add {address}/{prefix} dev {interface}".format( - interface=interface, - address=address, - prefix=prefix) - - ret_code, _, _ = ssh.exec_command(cmd) - if ret_code != 0: - raise RuntimeError("Could not configure IP address on interface.") - - # Set the interface up - cmd = "sudo ip link set {interface} up".format(interface=interface) - - ret_code, _, _ = ssh.exec_command(cmd) - if ret_code != 0: - raise RuntimeError("Could not change the interface to 'up' state.") - - @staticmethod - def configure_control_interface_tunnel(node, src_port, dst_ip, dst_port): - """Configure a tunnel on the specified node, tunelling any IPv4 traffic - from one port to the specified address. - - :param node: Node in topology. - :param src_port: Port to tunnel traffic from. - :param dst_ip: IP address to tunnel traffic to. - :param dst_port: Port to tunnel traffic to. - :type node: dict - :type src_port: int - :type dst_ip: str - :type dst_port: int - :raises RuntimeError: If tunnel creation is not successful. - """ - - cmd = "nohup socat TCP4-LISTEN:{src_port},fork,su=nobody " \ - "TCP6:[{dst_ip}]:{dst_port} $@ > " \ - "/tmp/socat.log 2>&1 &".format( - src_port=src_port, - dst_ip=dst_ip, - dst_port=dst_port) - - ssh = SSH() - ssh.connect(node) - ret_code, _, _ = ssh.exec_command_sudo(cmd) - if ret_code != 0: - raise RuntimeError("Could not configure tunnel.") diff --git a/resources/libraries/python/honeycomb/Lisp.py b/resources/libraries/python/honeycomb/Lisp.py deleted file mode 100644 index 6ff6f834cc..0000000000 --- a/resources/libraries/python/honeycomb/Lisp.py +++ /dev/null @@ -1,671 +0,0 @@ -# Copyright (c) 2018 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. - -"""This module implements keywords to manipulate LISP data structures using -Honeycomb REST API.""" - -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.topology import Topology - - -class LispKeywords(object): - """Implementation of keywords which make it possible to: - - enable/disable LISP feature - - configure LISP mappings - - configure locator sets - - configure map resolver - - configure LISP PITR feature - - read operational data for all of the above - """ - - def __init__(self): - """Initializer.""" - pass - - @staticmethod - def _set_lisp_properties(node, path, data=None): - """Set LISP properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. - """ - - if data: - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_lisp", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil.\ - delete_honeycomb_data(node, "config_lisp", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Lisp configuration unsuccessful. " - "Status code: {0}.".format(status_code)) - else: - return resp - - @staticmethod - def get_lisp_operational_data(node): - """Retrieve Lisp properties from Honeycomb operational data. - - :param node: Honeycomb node. - :type node: dict - :returns: List operational data. - :rtype: bytearray - """ - - status_code, resp = HcUtil.get_honeycomb_data(node, "oper_lisp") - - if status_code != HTTPCodes.OK: - raise HoneycombError("Could not retrieve LISP operational data." - "Status code: {0}.".format(status_code)) - else: - # get rid of empty vni-table entry - resp["lisp-state"]["lisp-feature-data"]["eid-table"][ - "vni-table"].remove( - { - "virtual-network-identifier": 0, - "vrf-subtable": {"table-id": 0} - } - ) - return resp - - @staticmethod - def verify_map_server_data_from_honeycomb(data, ip_addresses): - """Verify whether MAP server data from Honeycomb is correct. - - :param data: LISP operational data containing map server IP addresses. - :param ip_addresses: IP addresses to verify map server data against. - :type data: dict - :type ip_addresses: list - :returns: Boolean Value indicating equality of IP Lists. - :rtype: bool - """ - - data =\ - data['lisp-state']['lisp-feature-data']['map-servers']['map-server'] - - data = sorted([entry['ip-address'] for entry in data]) - ip_addresses.sort() - - return data == ip_addresses - - @staticmethod - def verify_map_server_data_from_vat(data, ip_addresses): - """Verify whether MAP server data from VAT is correct. - - :param data: LISP operational data containing map server IP addresses. - :param ip_addresses: IP addresses to verify map server data against. - :type data: dict - :type ip_addresses: list - :returns: Boolean Value indicating equality of IP Lists. - :rtype: bool - """ - - data = sorted([entry['map-server'] for entry in data]) - ip_addresses.sort() - - return data == ip_addresses - - @staticmethod - def set_lisp_state(node, state=True): - """Enable or disable the LISP feature. - - :param node: Honeycomb node. - :param state: Enable or disable LISP. - :type node: dict - :type state: bool - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the return code is not 200:OK - or 404:NOT FOUND. - """ - - ret_code, data = HcUtil.get_honeycomb_data(node, "config_lisp") - if ret_code == HTTPCodes.OK: - data["lisp"]["enable"] = bool(state) - elif ret_code == HTTPCodes.NOT_FOUND: - data = {"lisp": {"enable": bool(state)}} - else: - raise HoneycombError("Unexpected return code when getting existing" - " LISP configuration.") - - return LispKeywords._set_lisp_properties(node, '', data) - - @staticmethod - def set_rloc_probe_state(node, state=False): - """Enable or disable the Routing Locator probe. - - :param node: Honeycomb node. - :param state: Enable or Disable the Rloc probe. - :type node: dict - :type state: bool - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/rloc-probe" - - data = { - "rloc-probe": { - "enabled": bool(state) - } - } - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def add_locator(node, interface, locator_set, priority=1, weight=1): - """Configure a new LISP locator set. - - :param node: Honeycomb node. - :param interface: An interface on the node. - :param locator_set: Name for the new locator set. - :param priority: Priority parameter for the locator. - :param weight: Weight parameter for the locator. - :type node: dict - :type interface: str - :type locator_set: str - :type priority: int - :type weight: int - :returns: Content of response. - :rtype: bytearray - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - path = "/lisp-feature-data/locator-sets/locator-set" \ - "/{0}".format(locator_set) - - data = { - "locator-set": { - "name": locator_set, - "interface": { - "interface-ref": interface, - "priority": priority, - "weight": weight - } - } - } - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def configure_lisp_mapping(node, data): - """Modify eid-table configuration to the data provided. - - :param node: Honeycomb node. - :param data: Settings for the LISP mappings. - :type node: dict - :type data: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/eid-table" - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def configure_lisp_map_request_mode(node, option): - """Modify LISP Map Request Mode configuration to the data provided. - - :param node: Honeycomb node. - :param option: Settings for the LISP map request mode. - :type node: dict - :type option: str - :returns: Content of response. - :rtype: bytearray - """ - - data = { - "map-request-mode": { - "mode": option - } - } - - path = "/lisp-feature-data/map-request-mode" - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def add_lisp_adjacency(node, vni_id, map_name, adjacency_name, data): - """Add an adjacency to an existing LISP mapping. - - :param node: Honeycomb node. - :param vni_id: vni_id of the mapping. - :param map_name: Name of the mapping. - :param adjacency_name: Name for the new adjacency. - :param data: Adjacency settings. - :type node: dict - :type vni_id: int - :type map_name: str - :type adjacency_name: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = ( - "/lisp-feature-data/eid-table/vni-table/{vni_id}/" - "vrf-subtable/remote-mappings/remote-mapping/{map_name}/" - "adjacencies/adjacency/{adjacency_name}" - ) - path = path.format( - vni_id=vni_id, - map_name=map_name, - adjacency_name=adjacency_name - ) - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def add_map_resolver(node, ip_address): - """Configure map resolver with the specified IP address. - - :param node: Honeycomb node. - :param ip_address: IP address to configure map resolver with. - :type node: dict - :type ip_address: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/map-resolvers/map-resolver/{0}".format( - ip_address) - - data = { - "map-resolver": { - "ip-address": ip_address - } - } - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def set_map_register(node, map_register=False): - """Configure Map Register. - - :param node: Honeycomb node. - :param map_register: Enable or disable Map Register. - :type node: dict - :type map_register: bool - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/map-register" - - data = { - "map-register": { - "enabled": bool(map_register) - } - } - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def set_map_request_mode(node, src_dst=False): - """Configure Map Request Mode. - - :param node: Honeycomb node. - :param src_dst: Configure Map Request Mode with source destination. - :type node: dict - :type src_dst: bool - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/map-request-mode" - - data = { - "map-request-mode": { - "mode": "source-destination" if src_dst - else "target-destination" - } - } - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def delete_map_resolver(node): - """Delete an existing map resolver. - - :param node: Honeycomb node - :type node: dict - :returns: Content of response - :rtype: bytearray - """ - - path = "/lisp-feature-data/map-resolvers" - - return LispKeywords._set_lisp_properties(node, path) - - @staticmethod - def add_map_server(node, *ip_addresses): - """Configure map server with the specified IP addresses. - - :param node: Honeycomb node. - :param ip_addresses: IP addresses to configure map server with. - :type node: dict - :type ip_addresses: list - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/map-servers" - - data = { - "map-servers": { - "map-server": [ - {"ip-address": ip_address} for ip_address in ip_addresses - ] - } - } - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def delete_map_server(node): - """Delete all map servers. - - :param node: Honeycomb node - :type node: dict - :returns: Content of response - :rtype: bytearray - """ - - path = "/lisp-feature-data/map-servers" - - return LispKeywords._set_lisp_properties(node, path) - - @staticmethod - def configure_pitr(node, locator_set=None): - """Configure PITR feature with the specified locator set. If not locator - set is specified, disable PITR instead. - - :param node: Honeycomb node. - :param locator_set: Name of a locator set. Optional. - :type node: dict - :type locator_set: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/pitr-cfg" - - if locator_set: - data = { - "pitr-cfg": { - "locator-set": locator_set - } - } - else: - data = None - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def configure_petr(node, ip_address): - """Configure PETR feature with the specified IP. If no IP - specified, disable PETR instead. - - :param node: Honeycomb node. - :param ip_address: IPv6 address. - :type node: dict - :type ip_address: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/lisp-feature-data/petr-cfg" - - if ip_address: - data = { - "petr-cfg": { - "petr-address": ip_address - } - } - else: - data = None - - return LispKeywords._set_lisp_properties(node, path, data) - - @staticmethod - def disable_lisp(node): - """Remove all LISP settings on the node. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - """ - - return LispKeywords._set_lisp_properties(node, "") - - -class LispGPEKeywords(object): - """Implementation of keywords which make it possible to: - - enable/disable LISP GPE feature - - configure LISP GPE forwarding entries - - read operational data for all of the above - """ - - def __init__(self): - """Initializer.""" - pass - - @staticmethod - def _set_lispgpe_properties(node, path, data=None): - """Set LISP GPE properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. - """ - - if data: - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_lisp_gpe", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil.\ - delete_honeycomb_data(node, "config_lisp_gpe", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Lisp GPE configuration unsuccessful. " - "Status code: {0}.".format(status_code)) - else: - return resp - - @staticmethod - def get_lispgpe_operational_data(node): - """Retrieve LISP GPE properties from Honeycomb operational data. - - :param node: Honeycomb node. - :type node: dict - :returns: LISP GPE operational data. - :rtype: bytearray - :raises HoneycombError: If the status code in response to GET is not - 200 = OK. - """ - - status_code, resp = HcUtil.get_honeycomb_data(node, "oper_lisp_gpe") - - if status_code != HTTPCodes.OK: - raise HoneycombError("Could not retrieve Lisp GPE operational data." - "Status code: {0}.".format(status_code)) - else: - return resp - - @staticmethod - def get_lispgpe_mapping(node, name): - """Retrieve LISP GPE operational data and parse for a specific mapping. - - :param node: Honeycomb node. - :param name: Name of the mapping to look for. - :type node: dict - :type name: str - :returns: LISP GPE mapping. - :rtype: dict - :raises HoneycombError: If the mapping is not present in operational - data. - """ - - data = LispGPEKeywords.get_lispgpe_operational_data(node) - try: - data = data["gpe-state"]["gpe-feature-data"]["gpe-entry-table"] \ - ["gpe-entry"] - except KeyError: - raise HoneycombError("No mappings present in operational data.") - for item in data: - if item["id"] == name: - mapping = item - break - else: - raise HoneycombError("Mapping with name {name} not found in " - "operational data.".format(name=name)) - - return mapping - - @staticmethod - def get_lispgpe_config_data(node): - """Retrieve LISP GPE properties from Honeycomb config data. - - :param node: Honeycomb node. - :type node: dict - :returns: LISP GPE config data. - :rtype: bytearray - :raises HoneycombError: If the status code in response to GET is not - 200 = OK. - """ - - status_code, resp = HcUtil.get_honeycomb_data(node, "config_lisp_gpe") - - if status_code != HTTPCodes.OK: - raise HoneycombError("Could not retrieve Lisp GPE config data." - "Status code: {0}.".format(status_code)) - else: - return resp - - @staticmethod - def set_lispgpe_state(node, state=True): - """Enable or disable the LISP GPE feature. - - :param node: Honeycomb node. - :param state: Enable or disable LISP. - :type node: dict - :type state: bool - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the return code is not 200:OK - or 404:NOT FOUND. - """ - - ret_code, data = HcUtil.get_honeycomb_data(node, "config_lisp_gpe") - if ret_code == HTTPCodes.OK: - data["gpe"]["gpe-feature-data"]["enable"] = bool(state) - elif ret_code == HTTPCodes.NOT_FOUND: - data = {"gpe": {"gpe-feature-data": {"enable": bool(state)}}} - else: - raise HoneycombError("Unexpected return code when getting existing" - " Lisp GPE configuration.") - - return LispGPEKeywords._set_lispgpe_properties(node, '', data) - - @staticmethod - def configure_lispgpe_mapping(node, data=None): - """Modify LISP GPE mapping configuration to the data provided. - - :param node: Honeycomb node. - :param data: Settings for the LISP GPE mappings. - :type node: dict - :type data: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = "/gpe-feature-data/gpe-entry-table" - if data: - data = {"gpe-entry-table": {"gpe-entry": data}} - return LispGPEKeywords._set_lispgpe_properties(node, path, data) - else: - return LispGPEKeywords._set_lispgpe_properties(node, path) - - @staticmethod - def add_lispgpe_mapping(node, name, data): - """Add the specified LISP GPE mapping. - - :param node: Honeycomb node. - :param name: Name for the mapping. - :param data: Mapping details. - :type node: dict - :type name: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - """ - - path = "/gpe-feature-data/gpe-entry-table/gpe-entry/{name}".format( - name=name) - - data = {"gpe-entry": data} - return LispGPEKeywords._set_lispgpe_properties(node, path, data) - - @staticmethod - def delete_lispgpe_mapping(node, mapping): - """Delete the specified LISP GPE mapping from configuration. - - :param node: Honeycomb node. - :param mapping: Name of the mapping to remove. - :type node: dict - :type mapping: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/gpe-feature-data/gpe-entry-table/gpe-entry/{0}".format(mapping) - return LispGPEKeywords._set_lispgpe_properties(node, path) - - @staticmethod - def disable_lispgpe(node): - """Remove all LISP GPE settings on the node. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - """ - - return LispGPEKeywords._set_lispgpe_properties(node, "") diff --git a/resources/libraries/python/honeycomb/NAT.py b/resources/libraries/python/honeycomb/NAT.py deleted file mode 100644 index 759b801026..0000000000 --- a/resources/libraries/python/honeycomb/NAT.py +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (c) 2018 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. - -"""Keywords to manipulate NAT configuration using Honeycomb REST API.""" - -from resources.libraries.python.topology import Topology -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil - - -class NATKeywords(object): - """Keywords for NAT configuration.""" - - def __init__(self): - pass - - @staticmethod - def _set_nat_properties(node, path, data=None): - """Set NAT properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - OK or ACCEPTED. - """ - - if data: - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_nat", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_nat", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "The configuration of NAT was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def get_nat_oper_data(node): - """Read NAT operational data. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the operation fails or the response - is not as expected. - """ - - status_code, resp = HcUtil.get_honeycomb_data(node, "oper_nat") - - if status_code != HTTPCodes.OK: - raise HoneycombError("Could not retrieve NAT operational data.") - - if "nat" not in resp.keys(): - raise HoneycombError( - "Unexpected format, response does not contain nat container.") - return resp['nat'] - - @staticmethod - def configure_nat_entries(node, data, instance=0, entry=1): - """Configure NAT entries on node. - - :param node: Honeycomb node. - :param data: Data to be configured on node. - :param instance: NAT instance ID. - :param entry: NAT entry index. - :type node: dict - :type data: dict - :type instance: int - :type entry: int - :returns: Content of response. - :rtype: bytearray - """ - - return NATKeywords._set_nat_properties( - node, - '/instances/instance/{0}/' - 'mapping-table/mapping-entry/{1}/'.format(instance, entry), - data) - - @staticmethod - def configure_nat_on_interface(node, interface, direction, delete=False): - """Configure NAT on the specified interface. - - :param node: Honeycomb node. - :param interface: Name of an interface on the node. - :param direction: NAT direction, outbound or inbound. - :param delete: Delete an existing interface NAT configuration. - :type node: dict - :type interface: str - :type direction: str - :type delete: bool - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the operation fails. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - - interface = interface.replace("/", "%2F") - path = "/interface/{0}/interface-nat:nat/{1}".format( - interface, direction) - - data = {direction: {}} - - if delete: - status_code, resp = HcUtil.delete_honeycomb_data( - node, "config_vpp_interfaces", path) - else: - status_code, resp = HcUtil.put_honeycomb_data( - node, "config_vpp_interfaces", data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Could not configure NAT on interface. " - "Status code: {0}.".format(status_code)) - - return resp diff --git a/resources/libraries/python/honeycomb/Netconf.py b/resources/libraries/python/honeycomb/Netconf.py deleted file mode 100644 index caca14ed1a..0000000000 --- a/resources/libraries/python/honeycomb/Netconf.py +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) 2019 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. - -"""Keywords used to connect to Honeycomb through Netconf, send messages - and receive replies.""" - -import socket -from time import time - -import paramiko -from robot.api import logger - -from resources.libraries.python.honeycomb.HoneycombUtil import HoneycombError - - -class Netconf(object): - """Implements methods for creating and managing Netconf sessions.""" - - def __init__(self, delimiter=']]>]]>'): - """Initializer. - - Note: Passing the channel object as a robotframework argument closes - the channel. Class variables are used instead, - to persist the connection channel throughout test cases. - """ - - self.client = None - self.channel = None - self.delimiter = delimiter - - def create_session(self, node, hello, time_out=10): - """Create an SSH session, connect to Honeycomb on the specified node, - open a communication channel to the Netconf subsystem and exchange hello - messages. - - :param node: Honeycomb node. - :param hello: Hello message and capability list to be sent to Honeycomb. - :param time_out: Timeout value for the connection in seconds. - :type node: dict - :type hello: str - :type time_out: int - """ - - start = time() - client = paramiko.SSHClient() - client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - - client.connect(node['host'], - username=node['honeycomb']['user'], - password=node['honeycomb']['passwd'], - pkey=None, - port=node['honeycomb']['netconf_port'], - timeout=time_out) - - logger.trace('Connect took {0} seconds'.format(time() - start)) - logger.debug('New ssh: {0}'.format(client)) - logger.debug('Connect peer: {0}'. - format(client.get_transport().getpeername())) - logger.debug(client) - - channel = client.get_transport().open_session() - channel.settimeout(time_out) - channel.set_combine_stderr(True) - channel.get_pty() - channel.invoke_subsystem("netconf") - logger.debug(channel) - - self.client = client - self.channel = channel - - # read OpenDaylight's hello message and capability list - self.get_response( - size=131072, - err="Timeout on getting hello message." - ) - - self.channel.send(hello) - if not self.channel.active: - raise HoneycombError("Channel closed on capabilities exchange.") - - def get_response(self, size=4096, err="Unspecified Error."): - """Iteratively read data from the receive buffer and catenate together - until message ends with the message delimiter, or - until timeout is reached. - - :param size: Maximum number of bytes to read in one iteration. - :param err: Error message to provide when timeout is reached. - :type size: int - :type err: str - :returns: Content of response. - :rtype: str - :raises HoneycombError: If the read process times out. - """ - - reply = '' - - try: - while not reply.endswith(self.delimiter) or \ - self.channel.recv_ready(): - try: - chunk = self.channel.recv(size) - if not chunk: - break - reply += chunk - if self.channel.exit_status_ready(): - logger.debug('Channel exit status ready.') - break - except socket.timeout: - raise HoneycombError("Socket timeout.", - enable_logging=False) - - except RuntimeError: - raise HoneycombError(err + " Content of buffer: {0}".format(reply), - enable_logging=False) - - logger.trace(reply) - return reply.replace(self.delimiter, "") - - def get_all_responses(self, size=4096): - """Read responses from the receive buffer and catenate together - until a read operation times out. - - :param size: Maximum number of bytes to read in one iteration. - :type size: int - :returns: Content of response. - :rtype: str - """ - - response = "" - err = "Expected timeout occurred." - - while True: - try: - response += self.get_response(size, err) - except HoneycombError: - break - - return response - - def send(self, message, **params): - """Sends provided message through the channel. - - :param message: Message to be sent to Honeycomb. - :param params: Format the message string with these parameters. - :type message: str - :type params: dict - """ - - message = message.format(**params) - - if not message.endswith(self.delimiter): - message += self.delimiter - - logger.debug(message) - - self.channel.send(message) diff --git a/resources/libraries/python/honeycomb/Notifications.py b/resources/libraries/python/honeycomb/Notifications.py deleted file mode 100644 index 38f1fd3093..0000000000 --- a/resources/libraries/python/honeycomb/Notifications.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Implementation of keywords for managing Honeycomb notifications.""" - -from robot.api import logger - -from resources.libraries.python.honeycomb.HoneycombUtil import HoneycombError -from resources.libraries.python.honeycomb.Netconf import Netconf - - -class Notifications(Netconf): - """Implements keywords for receiving Honeycomb notifications. - - The keywords implemented in this class make it possible to: - - receive notifications from Honeycomb - - read received notifications - """ - - def add_notification_listener(self, subscription): - """Open a new channel on the SSH session, connect to Netconf subsystem - and subscribe to receive Honeycomb notifications. - - :param subscription: RPC for subscription to notifications. - :type subscription: str - :raises HoneycombError: If subscription to notifications fails. - """ - - logger.debug(subscription) - self.send(subscription) - - reply = self.get_response( - err="Timeout on notifications subscription." - ) - - if "<ok/>" not in reply: - raise HoneycombError("Notifications subscription failed with" - " message: {0}".format(reply)) - - logger.debug("Notifications subscription successful.") - - def get_notification(self, time_out=10): - """Read and return the next notification message. - - :param time_out: Timeout value for the read operation in seconds. - :type time_out: int - :returns: Data received from buffer. - :rtype: str - """ - - logger.debug("Getting notification. Timeout set to {0} seconds." - .format(time_out)) - - reply = self.get_response( - err="Timeout on getting notification." - ) - - return reply diff --git a/resources/libraries/python/honeycomb/Performance.py b/resources/libraries/python/honeycomb/Performance.py deleted file mode 100644 index b81b9fd3db..0000000000 --- a/resources/libraries/python/honeycomb/Performance.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Implementation of keywords for testing Honeycomb performance.""" - -from resources.libraries.python.ssh import SSH -from resources.libraries.python.Constants import Constants as Const -from resources.libraries.python.honeycomb.HoneycombUtil import HoneycombError - - -class Performance(object): - """Keywords used in Honeycomb performance testing.""" - - def __init__(self): - """Initializer.""" - pass - - @staticmethod - def configure_netconf_threads(node, threads): - """Set Honeycomb's Netconf thread count in configuration. - - :param node: Honeycomb node. - :param threads: Number of threads. - :type node: dict - :type threads: int - :raises HoneycombError: If the operation fails. - """ - - find = "netconf-netty-threads" - replace = '\\"netconf-netty-threads\\": {0},'.format(threads) - - argument = '"/{0}/c\\ {1}"'.format(find, replace) - path = "{0}/config/netconf.json".format(Const.REMOTE_HC_DIR) - command = "sed -i {0} {1}".format(argument, path) - - ssh = SSH() - ssh.connect(node) - (ret_code, _, stderr) = ssh.exec_command_sudo(command) - if ret_code != 0: - raise HoneycombError("Failed to modify configuration on " - "node {0}, {1}".format(node, stderr)) - - @staticmethod - def run_traffic_script_on_dut(node, script, cores, reserved=2, - *args, **kwargs): - """Copy traffic script over to the specified node and execute with - the provided arguments. - - :param node: Node in topology. - :param script: Name of the script to execute. - :param cores: Number of processor cores to use. - :param reserved: Number of cores reserved for other tasks. Default is 2, - one for system tasks and one for VPP main thread. - :param args: Sequential arguments for the script. - :param kwargs: Named arguments for the script. - :type node: dict - :type script: str - :type cores: int - :type reserved: int - :type args: list - :type kwargs: dict - """ - - path = "resources/traffic_scripts/honeycomb/{0}".format(script) - - # Assemble arguments for traffic script - arguments = "" - for arg in args: - arguments += "{0} ".format(arg) - - for key, value in kwargs.items(): - arguments += "--{0} {1} ".format(key, value) - - ssh = SSH() - ssh.connect(node) - ssh.scp(path, "/tmp") - - # Use alternate scheduler, Ubuntu's default can't load-balance - # over isolcpus - scheduler = "chrt -f 99" - core_afi = "taskset -c {first}-{last}".format( - first=reserved, last=cores-1) - - cmd = "{scheduler} {affinity} python /tmp/{script} {args}".format( - scheduler=scheduler, - affinity=core_afi, - script=script, - args=arguments) - - ret_code, stdout, _ = ssh.exec_command_sudo(cmd, timeout=600) - - ssh.exec_command("sudo pkill python ; rm /tmp/{0}".format(script)) - if ret_code != 0: - raise HoneycombError("Traffic script failed to execute.") - for line in stdout.splitlines(): - if "Avg. requests" in line: - return line - - @staticmethod - def log_core_schedule(node, process): - """Determine which cores the process' threads are running on. - - :param node: Honeycomb node. - :param process: Name of the process. - :type node: dict - :type process: str - """ - - # Get info on process and all of its children - cmd1 = """cat /proc/`pidof {0}`/task/*/stat""".format(process) - - # Parse process ID, name and core index - cmd2 = """awk '{print $1" "$2" "$39}'""" - - cmd = "{0} | {1}".format(cmd1, cmd2) - - ssh = SSH() - ssh.connect(node) - ssh.exec_command(cmd) diff --git a/resources/libraries/python/honeycomb/ProxyARP.py b/resources/libraries/python/honeycomb/ProxyARP.py deleted file mode 100644 index adc525d279..0000000000 --- a/resources/libraries/python/honeycomb/ProxyARP.py +++ /dev/null @@ -1,232 +0,0 @@ -# Copyright (c) 2018 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. - -"""This module implements keywords to configure proxyARP using Honeycomb -REST API.""" - -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.topology import Topology - - -class ProxyARPKeywords(object): - """Implementation of keywords which make it possible to: - - configure proxyARP behaviour - - enable/disable proxyARP on individual interfaces - """ - - def __init__(self): - """Initializer.""" - pass - - @staticmethod - def configure_proxyarp(node, data): - """Configure the proxyARP feature and check the return code. - - :param node: Honeycomb node. - :param data: Configuration to use. - :type node: dict - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response to PUT is not - 200 = OK or 201 = ACCEPTED. - """ - - data = { - "proxy-ranges": { - "proxy-range": [ - data, - ] - } - } - - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_proxyarp_ranges", data, - data_representation=DataRepresentation.JSON) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "proxyARP configuration unsuccessful. " - "Status code: {0}.".format(status_code)) - else: - return resp - - @staticmethod - def remove_proxyarp_configuration(node): - """Delete the proxyARP node, removing all of its configuration. - - :param node: Honeycomb node. - :type node: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response is not 200 = OK. - """ - - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_proxyarp_ranges") - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "proxyARP removal unsuccessful. " - "Status code: {0}.".format(status_code)) - else: - return resp - - @staticmethod - def get_proxyarp_operational_data(node): - """Retrieve proxyARP properties from Honeycomb operational data. - Note: The proxyARP feature has no operational data available. - - :param node: Honeycomb node. - :type node: dict - :returns: proxyARP operational data. - :rtype: bytearray - """ - - raise NotImplementedError("Not supported in VPP.") - - @staticmethod - def set_proxyarp_interface_config(node, interface, state): - """Enable or disable the proxyARP feature on the specified interface. - - :param node: Honeycomb node. - :param interface: Name or sw_if_index of an interface on the node. - :param state: Desired proxyARP state: enable, disable. - :type node: dict - :type interface: str - :type state: str - :raises ValueError: If the state argument is incorrect. - :raises HoneycombError: If the status code in response is not - 200 = OK or 201 = ACCEPTED. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - interface = interface.replace("/", "%2F") - - path = "/interface/{0}/proxy-arp".format(interface) - - if state == "disable": - status_code, _ = HcUtil.delete_honeycomb_data( - node, "config_vpp_interfaces", path) - elif state == "enable": - data = {"proxy-arp": {}} - status_code, _ = HcUtil.put_honeycomb_data( - node, "config_vpp_interfaces", data, path) - else: - raise ValueError("State argument has to be enable or disable.") - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "Interface proxyARP configuration on node {0} was not" - " successful.".format(node["host"])) - - @staticmethod - def get_proxyarp_interface_assignment(node, interface): - """Read the status of proxyARP feature on the specified interface. - Note: The proxyARP feature has no operational data available. - - :param node: Honeycomb node. - :param interface: Name or sw_if_index of an interface on the node. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - """ - - raise NotImplementedError("Not supported in VPP.") - - -class IPv6NDProxyKeywords(object): - """Keywords for IPv6 Neighbor Discovery proxy configuration.""" - - def __init__(self): - pass - - @staticmethod - def configure_ipv6nd(node, interface, addresses=None): - """Configure IPv6 Neighbor Discovery proxy on the specified interface, - or remove/replace an existing configuration. - - :param node: Honeycomb node. - :param interface: Name of an interface on the node. - :param addresses: IPv6 addresses to configure ND proxy with. If no - address is provided, ND proxy configuration will be removed. - :type node: dict - :type interface: str - :type addresses: list - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the operation fails. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - interface = interface.replace("/", "%2F") - - path = "/interface/{0}/ietf-ip:ipv6/nd-proxies".format(interface) - - if addresses is None: - status_code, resp = HcUtil. \ - delete_honeycomb_data(node, "config_vpp_interfaces", path) - else: - data = { - "nd-proxies": { - "nd-proxy": [{"address": x} for x in addresses] - } - } - - status_code, resp = HcUtil. \ - put_honeycomb_data(node, "config_vpp_interfaces", data, path, - data_representation=DataRepresentation.JSON) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - "IPv6 ND proxy configuration unsuccessful. " - "Status code: {0}.".format(status_code)) - else: - return resp - - @staticmethod - def get_ipv6nd_configuration(node, interface): - """Read IPv6 Neighbor Discovery proxy configuration on the specified - interface. - - :param node: Honeycomb node. - :param interface: Name of an interface on the node. - :type node: dict - :type interface: str - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the configuration could not be read. - """ - - interface = Topology.convert_interface_reference( - node, interface, "name") - interface = interface.replace("/", "%2F") - - path = "/interface/{0}/ietf-ip:ipv6/nd-proxies".format(interface) - - status_code, resp = HcUtil.get_honeycomb_data( - node, "config_vpp_interfaces", path) - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Could not read IPv6 ND proxy configuration. " - "Status code: {0}.".format(status_code)) - else: - return resp diff --git a/resources/libraries/python/honeycomb/Routing.py b/resources/libraries/python/honeycomb/Routing.py deleted file mode 100644 index 314c3fe64d..0000000000 --- a/resources/libraries/python/honeycomb/Routing.py +++ /dev/null @@ -1,328 +0,0 @@ -# Copyright (c) 2018 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. - -"""This module implements keywords to manipulate routing tables using -Honeycomb REST API.""" - -from robot.api import logger - -from resources.libraries.python.topology import Topology -from resources.libraries.python.HTTPRequest import HTTPCodes -from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError -from resources.libraries.python.honeycomb.HoneycombUtil \ - import HoneycombUtil as HcUtil -from resources.libraries.python.honeycomb.HoneycombUtil \ - import DataRepresentation -from resources.libraries.python.VatExecutor import VatTerminal - - -class RoutingKeywords(object): - """Implementation of keywords which make it possible to: - - add/remove routing tables, - - add/remove routing table entries - - get operational data about routing tables, - """ - - def __init__(self): - pass - - @staticmethod - def _set_routing_table_properties(node, path, data=None): - """Set routing table properties and check the return code. - - :param node: Honeycomb node. - :param path: Path which is added to the base path to identify the data. - :param data: The new data to be set. If None, the item will be removed. - :type node: dict - :type path: str - :type data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If the status code in response is not - 200 = OK. - """ - - if data: - status_code, resp = HcUtil.\ - put_honeycomb_data(node, "config_routing_table", data, path, - data_representation=DataRepresentation.JSON) - else: - status_code, resp = HcUtil.\ - delete_honeycomb_data(node, "config_routing_table", path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - if data is None and '"error-tag":"data-missing"' in resp: - logger.debug("data does not exist in path.") - else: - raise HoneycombError( - "The configuration of routing table was not successful. " - "Status code: {0}.".format(status_code)) - return resp - - @staticmethod - def configure_routing_table(node, name, ip_version, data, vrf=1, - special=False): - """Configure a routing table according to the data provided. - - :param node: Honeycomb node. - :param name: Name for the table. - :param ip_version: IP protocol version, ipv4 or ipv6. - :param data: Route configuration that should be set. - :param vrf: vrf-id to attach configuration to. - :param special: Must be True if the configuration is a special route. - :type node: dict - :type name: str - :type ip_version: str - :type data: dict - :type vrf: int - :type special: bool - :returns: Content of response. - :rtype: bytearray - """ - if special: - ip_version = "hc2vpp-ietf-{0}-unicast-routing:{0}".format( - ip_version) - protocol = "vpp-routing:vpp-protocol-attributes" - else: - ip_version = ip_version - protocol = "vpp-protocol-attributes" - - full_data = { - "control-plane-protocol": [ - { - "name": name, - "description": "hc2vpp-csit test route", - "type": "static", - protocol: { - "primary-vrf": vrf - }, - "static-routes": { - ip_version: { - "route": data - } - } - } - ] - } - - path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format( - name) - return RoutingKeywords._set_routing_table_properties( - node, path, full_data) - - @staticmethod - def delete_routing_table(node, name): - """Delete the specified routing table from configuration data. - - :param node: Honeycomb node. - :param name: Name of the table. - :type node: dict - :type name: str - :returns: Content of response. - :rtype: bytearray - """ - - path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format( - name) - return RoutingKeywords._set_routing_table_properties(node, path) - - @staticmethod - def get_routing_table_oper(node, name, ip_version): - """Retrieve operational data about the specified routing table. - - :param node: Honeycomb node. - :param name: Name of the routing table. - :param ip_version: IP protocol version, ipv4 or ipv6. - :type node: dict - :type name: str - :type ip_version: str - :returns: Routing table operational data. - :rtype: list - :raises HoneycombError: If the operation fails. - """ - - path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format( - name) - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "oper_routing_table", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about the " - "routing tables. Status code: {0}.".format(status_code)) - - data = RoutingKeywords.clean_routing_oper_data( - resp['control-plane-protocol'][0]['static-routes'] - ['hc2vpp-ietf-{0}-unicast-routing:{0}'.format(ip_version)]['route']) - - return data - - @staticmethod - def clean_routing_oper_data(data): - """Prepare received routing operational data to be verified against - expected data. - - :param data: Routing operational data. - :type data: list - :returns: Routing operational data without entry ID numbers. - :rtype: list - """ - - for item in data: - # ID values are auto-incremented based on existing routes in VPP - item.pop("id", None) - if "next-hop-list" in item.keys(): - for item2 in item["next-hop-list"]["next-hop"]: - item2.pop("id", None) - - if "next-hop-list" in item.keys(): - # List items come in random order - item["next-hop-list"]["next-hop"].sort() - - return data - - @staticmethod - def log_routing_configuration(node): - """Retrieve route configuration using VAT and print the response - to robot log. - - :param node: VPP node. - :type node: dict - """ - - with VatTerminal(node) as vat: - vat.vat_terminal_exec_cmd("ip_fib_dump") - - @staticmethod - def configure_interface_slaac(node, interface, slaac_data=None): - """Configure SLAAC on the specified interfaces. - - :param node: Honeycomb node. - :param interface: Interface to configure SLAAC. - :param slaac_data: Dictionary of configurations to apply. \ - If it is None then the existing configuration is removed. - :type node: dict - :type interface: str - :type slaac_data: dict of dicts - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If RA could not be configured. - """ - - interface = Topology.convert_interface_reference( - node, interface, 'name') - interface = interface.replace('/', '%2F') - path = 'interface/' + interface + '/ipv6/ipv6-router-advertisements' - - if not slaac_data: - status_code, _ = HcUtil.delete_honeycomb_data( - node, 'config_slaac', path) - else: - data = { - 'ipv6-router-advertisements': slaac_data - } - - status_code, _ = HcUtil.put_honeycomb_data( - node, 'config_slaac', data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - 'Configuring SLAAC failed. Status code:{0}'.format(status_code)) - - @staticmethod - def get_interface_slaac_oper_data(node, interface): - """Get operational data about SLAAC table present on the node. - - :param node: Honeycomb node. - :param interface: Interface SLAAC data are retrieved from. - :type node: dict - :type interface: str - :returns: dict of SLAAC operational data. - :rtype: dict - :raises HoneycombError: If status code differs from successful. - """ - interface = Topology.convert_interface_reference( - node, interface, 'name') - interface = interface.replace('/', '%2F') - path = 'interface/' + interface + '/ipv6/ipv6-router-advertisements' - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "config_slaac", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about SLAAC. " - "Status code: {0}.".format(status_code)) - try: - dict_of_str = resp[ - 'hc2vpp-ietf-ipv6-unicast-routing:ipv6-router-advertisements'] - return {k: str(v) for k, v in dict_of_str.items()} - except (KeyError, TypeError): - return {} - - @staticmethod - def configure_policer(node, policy_name, policer_data=None): - """Configure Policer on the specified node. - - :param node: Honeycomb node. - :param policer_data: Dictionary of configurations to apply. \ - If it is None then the existing configuration is removed. - :type node: dict - :type policer_data: dict - :returns: Content of response. - :rtype: bytearray - :raises HoneycombError: If policer could not be configured. - """ - - path = '/' + policy_name - - if not policer_data: - status_code, _ = HcUtil.delete_honeycomb_data( - node, 'config_policer', path) - else: - data = { - 'policer': policer_data - } - - status_code, _ = HcUtil.put_honeycomb_data( - node, 'config_policer', data, path) - - if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED): - raise HoneycombError( - 'Configuring policer failed. Status code:{0}'\ - .format(status_code)) - - @staticmethod - def get_policer_oper_data(node, policy_name): - """Get operational data about Policer on the node. - - :param node: Honeycomb node. - :type node: dict - :returns: dict of Policer operational data. - :rtype: dict - :raises HoneycombError: If status code differs from successful. - """ - - path = '/' + policy_name - - status_code, resp = HcUtil.\ - get_honeycomb_data(node, "oper_policer", path) - - if status_code != HTTPCodes.OK: - raise HoneycombError( - "Not possible to get operational information about Policer. " - "Status code: {0}.".format(status_code)) - try: - return resp['policer'] - except (KeyError, TypeError): - return {} diff --git a/resources/libraries/python/honeycomb/__init__.py b/resources/libraries/python/honeycomb/__init__.py deleted file mode 100644 index c35326d604..0000000000 --- a/resources/libraries/python/honeycomb/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - -""" -__init__ file for directory resources/libraries/python/honeycomb -""" diff --git a/resources/libraries/robot/honeycomb/access_control_lists.robot b/resources/libraries/robot/honeycomb/access_control_lists.robot deleted file mode 100644 index 57016f9a1a..0000000000 --- a/resources/libraries/robot/honeycomb/access_control_lists.robot +++ /dev/null @@ -1,447 +0,0 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Variables *** -#TODO: update based on resolution of bug https://jira.fd.io/browse/HONEYCOMB-119 - -*** Settings *** -| Library | resources.libraries.python.Classify -| Library | resources.libraries.python.InterfaceUtil -| Library | resources.libraries.python.honeycomb.HcAPIKwACL.ACLKeywords -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Documentation | Keywords used to manage ACLs. - -*** Keywords *** -| Honeycomb creates ACL table -| | [Documentation] | Uses Honeycomb API to create an ACL table. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - settings - ACL table settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb creates ACL table \| ${nodes['DUT1']} \ -| | ... | \| ${settings} \| -| | [Arguments] | ${node} | ${settings} -| | Add classify table | ${node} | ${settings} - -| Honeycomb removes ACL table -| | [Documentation] | Uses Honeycomb API to remove and existing ACL table. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_name - name of an ACL table. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes ACL table \| ${nodes['DUT1']} \| table0 \| -| | [Arguments] | ${node} | ${table_name} -| | Remove classify table | ${node} | ${table_name} - -| Honeycomb adds ACL session -| | [Documentation] | Uses Honeycomb API to create an ACL session. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_name - name of an ACL table. Type: string -| | ... | - settings - ACL session settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds ACL session \| ${nodes['DUT1']} \ -| | ... | \| table0 \| ${settings} \| -| | [Arguments] | ${node} | ${table_name} | ${settings} -| | Add classify session | ${node} | ${table_name} | ${settings} - -| Honeycomb removes ACL session -| | [Documentation] | Uses Honeycomb API to remove an ACL session. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_name - name of an ACL table. Type: string -| | ... | - match - ACL session match setting. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes ACL session \| ${nodes['DUT1']} \ -| | ... | \| table0 \| 00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00 \| -| | [Arguments] | ${node} | ${table_name} | ${match} -| | Remove classify session | ${node} | ${table_name} | ${match} - -| Honeycomb enables ACL on interface -| | [Documentation] | Uses Honeycomb API to enable ACL on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - table_name - name of an ACL table. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables ACL on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabithEthernet0/8/0 \| table0 \| -| | [Arguments] | ${node} | ${interface} | ${table_name} -| | Enable ACL on interface -| | ... | ${node} | ${interface} | ${table_name} - -| Honeycomb disables ACL on interface -| | [Documentation] | Uses Honeycomb API to disable ACL on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables ACL on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabithEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Disable ACL on interface | ${node} | ${interface} - -| ACL table from Honeycomb should be -| | [Documentation] | Retrieves ACL table information from Honeycomb\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - settings - expected ACL table settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ACL table from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| ${settings} \| -| | [Arguments] | ${node} | ${settings} -| | ${data}= | Get classify table oper data | ${node} | ${settings['name']} -| | Compare data structures | ${data} | ${settings} - -| ACL table from VAT should be -| | [Documentation] | Retrieves ACL table information from VAT\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_index - VPP internal index of an ACL table. Type: integer -| | ... | - settings - expected ACL table settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ACL session from PAPI should be \| ${nodes['DUT1']} \ -| | ... | \| ${0} \| ${settings} \| -| | [Arguments] | ${node} | ${table_index} | ${settings} -| | ${data}= | Get classify table data | ${node} | ${table_index} -| | Compare data structures | ${data} | ${settings} - -| ACL table from Honeycomb should not exist -| | [Documentation] | Retrieves ACL table information from Honeycomb\ -| | ... | and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_name - name of an ACL table. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ACL table from Honeycomb should not exist \| ${nodes['DUT1']} \ -| | ... | \| table0 \| -| | [Arguments] | ${node} | ${table_name} -| | Run keyword and expect error | * -| | ... | Get classify table oper data | ${node} | ${table_name} - -| ACL table from VAT should not exist -| | [Documentation] | Retrieves ACL table information from VAT\ -| | ... | and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_index - VPP internal index of an ACL table. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ACL table from VAT should not exist \| ${nodes['DUT1']} \ -| | ... | \| ${0} \| -| | [Arguments] | ${node} | ${table_index} -| | Run keyword and expect error | * -| | ... | Get classify table data | ${node} | ${table_index} - -| ACL session from Honeycomb should be -| | [Documentation] | Retrieves ACL session information from Honeycomb\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_name - name of an ACL table. Type: string -| | ... | - settings - expected ACL session settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ACL session from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| table0 \| ${settings} \| -| | [Arguments] | ${node} | ${table_name} | ${settings} -| | ${data}= | Get classify session oper data -| | ... | ${node} | ${table_name} | ${settings['match']} -| | Compare data structures | ${data} | ${settings} - -| ACL session from PAPI should be -| | [Documentation] | Retrieves ACL session information from PAPI\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_index - VPP internal index of an ACL table. Type: integer -| | ... | - settings - expected ACL session settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ACL session from PAPI should be \| ${nodes['DUT1']} \ -| | ... | \| ${0} \| ${settings} \| -| | [Arguments] | ${node} | ${table_index} | ${session_index} | ${settings} -| | ${data}= | Get classify session data | ${node} | ${table_index} -| | Compare data structures | ${data} | ${settings} - -| ACL session from Honeycomb should not exist -| | [Documentation] | Retrieves ACL session information from Honeycomb\ -| | ... | and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_name - name of an ACL table. Type: string -| | ... | - session_match - ACL session match setting. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| 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 | *KeyError:* -| | ... | Get classify session oper data -| | ... | ${node} | ${table_name} | ${session_match} - -| ACL session from PAPI should not exist -| | [Documentation] | Retrieves ACL session information from PAPI\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - table_index - VPP internal index of an ACL table. Type: integer -| | ... | - session_index - VPP internal index of an ACL session. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ACL session from PAPI should not exist \| ${nodes['DUT1']} \ -| | ... | \| ${0} \| -| | [Arguments] | ${node} | ${table_index} -| | Run keyword if | ${session_index} == 0 -| | ... | Run keyword and expect error -| | ... | ValueError: No JSON object could be decoded -| | ... | Get classify session data | ${node} | ${table_index} -| | Run keyword if | ${session_index} > 0 -| | ... | Run keyword and expect error -| | ... | IndexError: list index out of range -| | ... | Get classify session data | ${node} | ${table_index} - -| Interface ACL configuration from Honeycomb should be -| | [Documentation] | Retrieves ACL interface settings from Honeycomb\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - table_name - expected ACL table name. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface ACL configuration from Honeycomb should be \ -| | ... | \| ${nodes['DUT1']} \| GigabithEthernet0/8/0 \| table0 \| -| | [Arguments] | ${node} | ${interface} | ${table_name} -| | ${data}= | Get interface oper data | ${node} | ${interface} -| | Should be equal -| | ... | ${table_name} -| | ... | ${data['vpp-interface-acl:acl']['ingress']['l2-acl']['classify-table']} -| | ... | ${data['vpp-interface-acl:acl']['ingress']['ip4-acl']['classify-table']} - -| Interface ACL configuration from VAT should be -| | [Documentation] | Retrieves ACL interface settings from VAT\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - table_index - VPP internal index of an ACL table. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface ACL configuration from VAT should be \ -| | ... | \| ${nodes['DUT1']} \| GigabithEthernet0/8/0 \| ${0} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${table_index} -| | ${data}= | Get interface classify table | ${node} | ${interface} -| | Should be equal | ${table_index} | ${data['l2_table_id']} -| | Should be equal | ${table_index} | ${data['ip4_table_id']} - -| Interface ACL configuration from Honeycomb should be empty -| | [Documentation] | Retrieves ACL interface settings from Honeycomb\ -| | ... | and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface ACL configuration from Honeycomb should be empty \ -| | ... | \| ${nodes['DUT1']} \| GigabithEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError: 'vpp-interface-acl:acl' -| | ... | Set Variable -| | ... | ${data['vpp-interface-acl:acl']['l2-acl']['classify-table']} - -| Interface ACL configuration from VAT should be empty -| | [Documentation] | Retrieves ACL interface settings from VAT\ -| | ... | and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface ACL configuration from Honeycomb should be empty \ -| | ... | \| ${nodes['DUT1']} \| GigabithEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${data}= | Get interface classify table | ${node} | ${interface} -| | ${bitwise_non_zero}= | Convert To Integer | ${0xFFFFFFFF} -| | Should be equal | ${data['l2_table_id']} | ${bitwise_non_zero} -| | Should be equal | ${data['ip4_table_id']} | ${bitwise_non_zero} - -| Clear all ACL settings -| | [Documentation] | Removes all ACL sessions and tables from Honeycomb\ -| | ... | configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Clear all ACL settings \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Remove all classify tables | ${node} - -| Honeycomb creates ACL chain through ACL plugin -| | [Documentation] | Creates classify chain using the ACL plugin. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - acl_list_name - Name for the classify chain. Type: string -| | ... | - acl_list_settings - classify rules. Type: dictionary -| | ... | - macip - Use MAC+IP classifier. Optional. Type: boolean -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb creates ACL chain through ACL plugin \ -| | ... | \| ${nodes['DUT1']} \| acl_test \| ${settings} \| -| | [Arguments] | ${node} | ${acl_list_name} | ${acl_list_settings} -| | ... | ${macip}=${False} -| | Create ACL plugin classify chain -| | ... | ${node} | ${acl_list_name} | ${acl_list_settings} - -| Honeycomb assigns plugin-ACL chain to interface -| | [Documentation] | Applies classification through the high-level\ -| | ... | IETF-ACL node to an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - Interface to assign classifier to. Type: string -| | ... | - acl_list_name - Name of the clasify chain. Type: string -| | ... | - direction - Classifier direction, ingress or egress. Type: string -| | ... | - macip - Use MAC+IP classifier. Optional. Type: boolean -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb assigns plugin-ACL chain to interface \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| acl_test \| ingress \| -| | [Arguments] -| | ... | ${node} | ${interface} | ${acl_list_name} | ${direction} -| | ... | ${macip}=${False} -| | Set ACL plugin interface -| | ... | ${node} | ${interface} | ${acl_list_name} | ${direction} - -| Clear plugin-ACL configuration -| | [Documentation] | Removes ACl assignment from interface, then deletes\ -| | ... | IETF-ACL chain. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - Interface to clean classifiers from. | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Clear plugin-ACL configuration | ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Delete interface plugin ACLs | ${node} | ${interface} -| | Delete ACL plugin classify chains | ${node} - -| Read plugin-ACL configuration from VAT -| | [Documentation] | Obtains ACL-plugin configuration through VAT and logs\ -| | ... | the reply. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Read plugin-ACL configuration from VAT \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | VPP log plugin acl settings | ${node} -| | VPP log plugin acl interface assignment | ${node} - -| Send ICMP packet with type and code and verify received packet -| | [Documentation] | Sends an ICMP packet with specified code and type. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | _NOTE:_ Arguments are based on topology: -| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) -| | ... -| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary -| | ... | - src_ip - IP of source interface (TG-if1). Type: integer -| | ... | - dst_ip - IP of destination interface (TG-if2). Type: integer -| | ... | - tx_port - Source interface (TG-if1). Type: string -| | ... | - tx_mac - MAC address of source interface (TG-if1). Type: string -| | ... | - rx_port - Destionation interface (TG-if1). Type: string -| | ... | - rx_mac - MAC address of destination interface (TG-if1). Type: string -| | ... | - icmp_type - ICMP type to use. Type: int -| | ... | - icmp_code - ICMP code to use. Type: int -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send ICMP packet with type and code and verify received packet \| ${nodes['TG']} \ -| | ... | \| 16.0.0.1 \| 32.0.0.1 \| eth2 \| 08:00:27:cc:4f:54 \ -| | ... | \| eth4 \| 08:00:27:c9:6a:d5 \| ${1} \| ${1} \| -| | ... -| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_port} | -| | ... | ${tx_mac} | ${rx_port} | ${rx_mac} | ${icmp_type} | ${icmp_code} -| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_port} -| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} -| | ${args}= | Catenate | --src_mac | ${tx_mac} -| | ... | --dst_mac | ${rx_mac} -| | ... | --src_ip | ${src_ip} -| | ... | --dst_ip | ${dst_ip} -| | ... | --tx_if | ${tx_port_name} -| | ... | --rx_if | ${rx_port_name} -| | ... | --icmp_type | ${icmp_type} -| | ... | --icmp_code | ${icmp_code} -| | Run Traffic Script On Node | send_icmp_type_code.py -| | ... | ${tg_node} | ${args} diff --git a/resources/libraries/robot/honeycomb/bgp.robot b/resources/libraries/robot/honeycomb/bgp.robot deleted file mode 100644 index b39055196a..0000000000 --- a/resources/libraries/robot/honeycomb/bgp.robot +++ /dev/null @@ -1,277 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.BGP.BGPKeywords -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords - -*** Keywords *** -| Configure BGP module -| | [Documentation] | Edit Honeycomb's configuration file for the BGP feature.\ -| | ... | Honeycomb needs to be restarted for the changes to take effect. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - ip_address - IP address to bind BGP listener to. Type: string -| | ... | - port - Port number to bind BGP listener to. Type: integer -| | ... | - as_number - Autonomous System (AS) ID number. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure BGP module \| ${nodes['DUT1']} \| 192.168.0.1 \| ${179} \ -| | ... | \| ${65000} \| -| | ... -| | [Arguments] | ${node} | ${ip_address} | ${port} | ${as_number} -| | Configure BGP base | ${node} | ${ip_address} | ${port} | ${as_number} - -| No BGP peers should be configured -| | [Documentation] | Uses Honeycomb API to read BGP configuration and checks -| | ... | if there ary BGP peers conffigured. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| No BGP peers should be configured \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | ${oper_data}= | Get Full BGP Configuration | ${node} -| | Should be Empty | ${oper_data['bgp-openconfig-extensions:bgp']} - -| Honeycomb adds BGP peer -| | [Documentation] | Uses Honeycomb API to add a BGP peer. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - address - IP address of the peer. Type: string -| | ... | - data - Peer configuration data. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds BGP peer \| ${nodes['DUT1']} \| 192.168.0.1 \ -| | ... | \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${address} | ${data} -| | ... -| | Add BGP Peer | ${node} | ${address} | ${data} - -| BGP Peer From Honeycomb Should be -| | [Documentation] | Uses Honeycomb API to verify BGP peer config data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - address - IP address of the peer. Type: string -| | ... | - data - Peer configuration data. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| BGP Peer From Honeycomb Should be \ -| | ... | \| ${nodes['DUT1']} \| 192.168.0.1 \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${address} | ${data} -| | ... -| | ${oper_data}= | Get BGP Peer | ${node} | ${address} -| | Compare Data Structures | ${oper_data} | ${data} - -| Peer Operational Data From Honeycomb Should be -| | [Documentation] | Uses Honeycomb API to verify BGP peer operational data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - address - IP address of the peer. Type: string -| | ... | - data - Peer configuration data. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| BGP Peer From Honeycomb Should be \ -| | ... | \| ${nodes['DUT1']} \| 192.168.0.1 \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${address} -| | ... -| | ${oper_data}= | Get BGP Peer | ${node} | ${address} | operational -| | Should be Equal | ${oper_data['peer'][0]['peer-id']} | bgp://${address} - -| Honeycomb removes BGP peer -| | [Documentation] | Uses Honeycomb API to add a BGP peer. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - address - IP address of the peer. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds BGP peer \| ${nodes['DUT1']} \| 192.168.0.1 \| -| | ... -| | [Arguments] | ${node} | ${address} -| | ... -| | Remove BGP Peer | ${node} | ${address} - -| Honeycomb configures BGP route -| | [Documentation] | Uses Honeycomb API to add a BGP route\ -| | ... | to the specified peer. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - peer_address - IP address of the peer. Type: string -| | ... | - data - Peer configuration data. Type: dictionary -| | ... | - route_address - IP address of the route. Type: string -| | ... | - route_index - Numeric index of the route under the peer.\ -| | ... | Type: integer -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds BGP peer \| ${nodes['DUT1']} \| 192.168.0.1 \ -| | ... | \| ${data} \| 192.168.0.2 \| ${0} \| ipv4 \| -| | ... -| | [Arguments] | ${node} | ${peer_address} | ${data} -| | ... | ${route_address} | ${route_index} | ${ip_version} -| | ... -| | Configure BGP Route | ${node} | ${peer_address} | ${data} -| | ... | ${route_address} | ${route_index} | ${ip_version} - -| BGP Route From Honeycomb Should be -| | [Documentation] | Uses Honeycomb API to verify BGP route operational data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - peer_address - IP address of the peer. Type: string -| | ... | - data - Peer configuration data. Type: dictionary -| | ... | - route_address - IP address of the route. Type: string -| | ... | - route_index - Numeric index of the route under the peer.\ -| | ... | Type: integer -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| BGP Peers From Honeycomb Should Include \ -| | ... | \| ${nodes['DUT1']} \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${peer_address} | ${data} -| | ... | ${route_address} | ${route_index} | ${ip_version} -| | ... -| | ${oper_data}= | Get BGP Route | ${node} | ${peer_address} -| | ... | ${route_address} | ${route_index} | ${ip_version} -| | Compare Data Structures | ${oper_data} | ${data} - -| Honeycomb removes BGP route -| | [Documentation] | Uses Honeycomb API to remove a BGP route. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - peer_address - IP address of the peer. Type: string -| | ... | - route_address - IP address of the route. Type: string -| | ... | - route_index - Numeric index of the route under the peer.\ -| | ... | Type: integer -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes BGP route \| ${nodes['DUT1']} \| 192.168.0.1 \ -| | ... | \| 192.168.0.2 \| ${0} \| ipv4 \| -| | ... -| | [Arguments] | ${node} | ${peer_address} | ${route_address} -| | ... | ${route_index} | ${ip_version} -| | ... -| | Remove BGP Route | ${node} | ${peer_address} | ${route_address} -| | ... | ${route_index} | ${ip_version} - -| No BGP routes should be configured -| | [Documentation] | Uses Honeycomb API to verify that no BGP routes\ -| | ... | are configured under the specified peer. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - peer_address - IP address of the peer. Type: string -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| No BGP routes should be configured \| ${nodes['DUT1']} \ -| | ... | \| 192.168.0.1 \| ipv4 \| -| | ... -| | [Arguments] | ${node} | ${peer_address} | ${ip_version} -| | ... -| | ${oper_data}= | Get All Peer Routes -| | ... | ${node} | ${peer_address} | ${ip_version} -| | Should be Empty | ${oper_data['bgp-inet:${ip_version}-routes']} - -| No BGP routes should exist -| | [Documentation] | Uses Honeycomb API to verify that no BGP routes\ -| | ... | exist under the specified peer. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - peer_address - IP address of the peer. Type: string -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| No BGP routes should be configured \| ${nodes['DUT1']} \ -| | ... | \| 192.168.0.1 \| ipv4 \| -| | ... -| | [Arguments] | ${node} | ${peer_address} | ${ip_version} -| | ... -| | Run keyword and expect error | *Status code: 404* -| | ... | Get All Peer Routes -| | ... | ${node} | ${peer_address} | ${ip_version} - -| BGP Loc-RIB table should include -| | [Documentation] | Uses Honeycomb API to retrieve local BGP RIB table\ -| | ... | And verifies that it contains the specified entry. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - data - RIB that should be present in operational data.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| BGP Loc-RIB table should include \| ${nodes['DUT1']} \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${data} -| | ... -| | ${oper_data}= | Get BGP Local RIB | ${node} -| | ${oper_data}= | Set Variable | ${oper_data['loc-rib']['tables']} -| | ${data}= | Set Variable | ${data['loc-rib']['tables']} -| | Compare RIB Tables | ${oper_data} | ${data} - -| Receive BGP OPEN message -| | [Documentation] | Open a TCP listener on BGP port(179) and listen\ -| | ... | for BGP OPEN message. Verify ID and holdtime fields. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - Information about the TG node. Type: dictionary -| | ... | - rx_ip - IP address to listen on. Type: string -| | ... | - src_ip - IP address of the BGP speaker. Also acts as BGP peer ID.\ -| | ... | Type: string -| | ... | - holdtime - Expected value of HOLD_TIME field in received message.\ -| | ... | Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Receive BGP OPEN message \| ${node['TG']} \ -| | ... | \| 192.168.0.1 \| 192.168.0.2 \| ${0} -| | ... -| | [Arguments] | ${tg_node} | ${rx_ip} | ${src_ip} | ${port} | ${as_number} -| | ... | ${holdtime} -| | ... -| | ${args}= | Catenate | --rx_ip | ${rx_ip} -| | ... | --src_ip | ${src_ip} -| | ... | --rx_port | ${port} -| | ... | --as_number | ${as_number} -| | ... | --holdtime | ${holdtime} -| | Run Traffic Script On Node | honeycomb/bgp_open.py -| | ... | ${tg_node} | ${args} diff --git a/resources/libraries/robot/honeycomb/bridge_domain.robot b/resources/libraries/robot/honeycomb/bridge_domain.robot deleted file mode 100644 index 44dd450944..0000000000 --- a/resources/libraries/robot/honeycomb/bridge_domain.robot +++ /dev/null @@ -1,284 +0,0 @@ -# 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.L2Util -| Library | resources.libraries.python.honeycomb.HcAPIKwBridgeDomain.BridgeDomainKeywords -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Library | resources.libraries.python.InterfaceUtil - -*** Keywords *** -| Honeycomb creates first L2 bridge domain -| | [Documentation] | Uses Honeycomb API to create a bridge domain on the \ -| | ... | VPP node. Any other bridge domains will be removed in the process. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the created bridge domain. Type: string -| | ... | - settings - Settings for the created bridge domain. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb creates first L2 bridge domain \| ${nodes['DUT1']} \ -| | ... | \| bd-04 \| ${{flood:True, learn:False}} \| -| | [Arguments] | ${node} | ${bd_name} | ${settings} -| | Add first BD | ${node} | ${bd_name} | &{settings} - -| Honeycomb creates L2 bridge domain -| | [Documentation] | Uses Honeycomb API to create a bridge domain on the \ -| | ... | VPP node. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the created bridge domain. Type: string -| | ... | - settings - Settings for the created bridge domain. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb creates L2 bridge domain \| ${nodes['DUT1']} \ -| | ... | \| bd-04 \| ${{flood:True, learn:False}} \| -| | [Arguments] | ${node} | ${bd_name} | ${settings} -| | Add BD | ${node} | ${bd_name} | &{settings} - -| Bridge domain Operational Data From Honeycomb Should Be -| | [Documentation] | Uses Honeycomb API to verify bridge domain settings\ -| | ... | against provided values. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - settings - Expected settings for the bridge domain. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Bridge domain Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \| -| | [Arguments] | ${node} | ${bd_name} | ${settings} -| | ${api_data}= | Get bd oper data | ${node} | ${bd_name} -| | :FOR | ${key} | IN | @{settings.keys()} -| | | Should be equal | ${settings['${key}']} | ${api_data['${key}']} - -| Bridge domain Operational Data From VAT Should Be -| | [Documentation] | Uses VAT to verify bridge domain settings\ -| | ... | against provided values. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - settings - Expected settings for the bridge domain. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Bridge domain Operational Data From VAT Should Be \ -| | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \| -| | [Arguments] | ${node} | ${bd_index} | ${settings} -| | ${vat_data}= | VPP get bridge domain data | ${node} -| | ${vat_data}= | Set Variable | ${vat_data[${bd_index}]} -| | :FOR | ${key} | IN | @{settings.keys()} -| | | Run keyword if | $key in $vat_data.keys() -| | | ... | Should be equal | ${settings['${key}']} | ${vat_data['${key}']} - -| Honeycomb adds interfaces to bridge domain -| | [Documentation] | Uses Honeycomb API to assign interfaces to a bridge\ -| | ... | domain. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface1, interface2 - Names of interfaces to assign to bridge\ -| | ... | domain. Type: string -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - settings - Bridge domain specific interface settings.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds interfaces to bridge domain \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \| bd-04 \ -| | ... | \| ${{split_horizon_group:2, bvi:False}} \| -| | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name} -| | ... | ${settings} -| | Add bridge domain to interface -| | ... | ${node} | ${interface1} | ${bd_name} | &{settings} -| | Add bridge domain to interface -| | ... | ${node} | ${interface2} | ${bd_name} | &{settings} - -| Honeycomb should show interfaces assigned to bridge domain -| | [Documentation] | Uses Honeycomb API to verify interface assignment to\ -| | ... | bridge domain. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface1, interface2 - Names of interfaces to assign to bridge\ -| | ... | domain. Type: string -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - settings - Bridge domain specific interface settings.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb should show interfaces assigned to bridge domain \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \ -| | ... | \| bd-04 \| ${{split_horizon_group:2, bvi:False}} \| -| | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name} -| | ... | ${settings} -| | ${if1_data}= | Get interface oper data -| | ... | ${node} | ${interface1} -| | ${if2_data}= | Get interface oper data -| | ... | ${node} | ${interface2} -| | Should be equal | ${if1_data['v3po:l2']['bridge-domain']} -| | ... | ${if2_data['v3po:l2']['bridge-domain']} | ${bd_name} -| | Should be equal | ${if1_data['v3po:l2']['split-horizon-group']} -| | ... | ${if2_data['v3po:l2']['split-horizon-group']} -| | ... | ${settings['split_horizon_group']} -| | Should be equal | ${if1_data['v3po:l2']['bridged-virtual-interface']} -| | ... | ${if2_data['v3po:l2']['bridged-virtual-interface']} -| | ... | ${settings['bvi']} - -| PAPI should show interfaces assigned to bridge domain -| | [Documentation] | Uses VAT to verify interface assignment to\ -| | ... | bridge domain. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - index - Index of bridge domains on VPP node. Starts from 0,\ -| | ... | new BDs reuse numbers after a bridge domain is removed. Type: int -| | ... | - interface1, interface2 - names of interfaces to check bridge domain\ -| | ... | assignment on. Type: string -| | ... | - settings - bridge domain specific interface settings.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| PAPI should show interfaces assigned to bridge domain \ -| | ... | \| ${nodes['DUT1']} \| ${4} \| GigabitEthernet0/8/0 \ -| | ... | \| GigabitEthernet0/9/0 \| ${{split_horizon_group:2, bvi:False}} \| -| | [Arguments] | ${node} | ${index} | ${interface1} | ${interface2} -| | ... | ${settings} -| | ${if1_link}= | Get interface by name | ${node} | ${interface1} -| | ${if2_link}= | Get interface by name | ${node} | ${interface2} -| | ${if_indices}= | Create list -| | ... | ${node['interfaces']['${if1_link}']['vpp_sw_index']} -| | ... | ${node['interfaces']['${if2_link}']['vpp_sw_index']} -| | ${bd_data}= | VPP get bridge domain data | ${node} -| | ${bd_interfaces}= | Set Variable | ${bd_data[${index}]['sw_if_details']} -| | @{bd_interfaces}= | Create List | ${bd_interfaces[0]} | ${bd_interfaces[1]} -| | :FOR | ${interface} | IN | @{bd_interfaces} -# interface[1] = sw_if_index, interface[2] = shg -| | | Should contain | ${if_indices} | ${interface[1]} -| | | Should be equal | ${interface[2]} | ${settings['split_horizon_group']} - -| Honeycomb removes all bridge domains -| | [Documentation] | Uses Honeycomb API to remove all bridge domains from the \ -| | ... | VPP node. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes all bridge domains \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} | @{interfaces} -| | :FOR | ${interface} | IN | @{interfaces} -| | | Remove bridge domain from interface | ${node} | ${interface} -| | Remove all bridge domains | ${node} - -| Honeycomb should show no bridge domains -| | [Documentation] | Uses Honeycomb API to verify the removal of all\ -| | ... | bridge domains. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb should show no bridge domains \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Run keyword and expect error | *Not possible*Status code: 404* -| | ... | Get all BDs oper data | ${node} - -| PAPI should show no bridge domains -| | [Documentation] | Uses VAT to verify the removal of all bridge domains. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| PAPI should show no bridge domains \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | ${data}= | VPP get bridge domain data | ${node} -| | Should be empty | ${data} - -| Honeycomb adds interface to bridge domain -| | [Documentation] | Uses Honeycomb API to assign interface to a bridge\ -| | ... | domain. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - Name of interface to assign to bridge domain.\ -| | ... | Type: string -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - settings - Bridge domain specific interface settings.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds interfaces to bridge domain \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| bd-04 \ -| | ... | \| ${{split_horizon_group:2, bvi:False}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${bd_name} | ${settings} -| | ... -| | Add bridge domain to interface -| | ... | ${node} | ${interface} | ${bd_name} -| | ... | ${settings['split-horizon-group']} -| | ... | ${settings['bridged-virtual-interface']} - -| Bridge domain Operational Interface Assignment should be empty -| | [Documentation] | Get interface operational data and retrieve bridge -| | ... | domain configuration from it. It should be empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - Name of interface where the bridge domain parameters \ -| | ... | will be checked.Type: string -| | ... -| | ... | *Example:* -| | ... | \| Bridge domain Operational Interface Assignment should \ -| | ... | be empty \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ... -| | ${if_data}= | Get BD Oper Data From Interface -| | ... | ${node} | ${interface} -| | Should be empty | ${if_data} - -| Bridge domain Operational Interface Assignment should be -| | [Documentation] | Get interface operational data and retrieve bridge -| | ... | domain configuration from it. Compare the data to the expected one. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - Name of interface where the bridge domain parameters \ -| | ... | will be checked. Type: string -| | ... | - bd_settings - The referential bridge domain data. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Bridge domain Operational Interface Assignment should \ -| | ... | be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${if_bd_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${bd_settings} -| | ... -| | ${if_data}= | Get BD Oper Data From Interface -| | ... | ${node} | ${interface} -| | Compare Data Structures | ${if_data} | ${bd_settings} diff --git a/resources/libraries/robot/honeycomb/dhcp.robot b/resources/libraries/robot/honeycomb/dhcp.robot deleted file mode 100644 index 966c73f85c..0000000000 --- a/resources/libraries/robot/honeycomb/dhcp.robot +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.DHCP.DHCPRelayKeywords -| Library | resources.libraries.python.Dhcp.DhcpProxy -| Documentation | Keywords used to test Honeycomb DHCP features. - -*** Keywords *** -| DHCP relay Operational Data From Honeycomb Should Be empty -| | [Documentation] | Uses Honeycomb API to retrieve DHCP relay configuration\ -| | ... | and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| DHCP relay Operational Data From Honeycomb Should Be empty \ -| | ... | \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Run keyword and expect error | *Status code: 404* -| | ... | Get DHCP relay oper data | ${node} - -| Log DHCP relay configuration from VAT -| | [Documentation] | Uses VAT to retrieve DHCP relay configuration from VPP. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Log DHCP relay configuration from VAT \ -| | ... | \| ${nodes['DUT1']} \| ipv4 \| -| | [Arguments] | ${node} | ${ip_version} -| | VPP get DHCP proxy | ${node} | ${ip_version} - -| Honeycomb configures DHCP relay -| | [Documentation] | Uses Honeycomb API to configure DHCP relay. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - data - settings for the DHCP relay. Type: dictionary -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... | - vrf - vrf ID to configure DHCP on. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures DHCP relay \| ${nodes['DUT1']} \| ${data} \ -| | ... | \| ipv4 \| ${0} \| -| | [Arguments] | ${node} | ${data} | ${ip_version} | ${vrf} -| | Add DHCP relay | ${node} | ${data} | ${ip_version} | ${vrf} - -| Honeycomb clears DHCP relay configuration -| | [Documentation] | Uses Honeycomb API to delete all configured DHCP relays. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb clears DHCP relay configuration \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Clear DHCP relay configuration | ${node} - -| DHCP relay configuration from Honeycomb should contain -| | [Documentation] | Retrieves oper data for DHCP relay and compares\ -| | ... | with provided values. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - data - expected DHCP relay settings. Type dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| DHCP relay configuration from Honeycomb should contain \ -| | ... | \| ${nodes['DUT1']} \| ${data} \| -| | [Arguments] | ${node} | ${data} -| | ${oper_data}= | Get DHCP relay oper data | ${node} -| | ${oper_data}= | Set Variable | ${oper_data['relays']['relay'][0]} -| | Sort List | ${oper_data['server']} -| | Sort List | ${data['server']} -| | Should be equal | ${oper_data} | ${data} diff --git a/resources/libraries/robot/honeycomb/fib.robot b/resources/libraries/robot/honeycomb/fib.robot deleted file mode 100644 index 8209db7512..0000000000 --- a/resources/libraries/robot/honeycomb/fib.robot +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (c) 2018 Bell Canada, Pantheon Technologies and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.FIB.FibKeywords -| Documentation | Keywords used to test Honeycomb FIB tables. - -*** Keywords *** -| Honeycomb configures FIB table -| | [Documentation] | Uses Honeycomb API to configure a FIB table. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type:string -| | ... | - vrf - vrf-id the new table will belong to. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures FIB table \| ${nodes['DUT1']} \ -| | ... | \| ipv4 \| ${vrf} \| -| | [Arguments] | ${node} | ${ip_version} | ${vrf} -| | Configure FIB table | ${node} | ${ip_version} | ${vrf} - -| FIB table data from Honeycomb should contain -| | [Documentation] | Uses Honeycomb API to retrieve operational data about\ -| | ... | a FIB table, and compares with the data provided. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type:string -| | ... | - vrf - vrf-id the new table will belong to. Type: integer -| | ... | - expected_data - Data to compare against. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| FIB table data from Honeycomb should contain \| ${nodes['DUT1']} \ -| | ... | \| ipv4 \| ${data} \| -| | [Arguments] | ${node} | ${ip_version} | ${vrf} | ${expected_data} -| | ${data}= | Get FIB Table Oper | ${node} | ${ip_version} | ${vrf} -| | Should Contain | ${data} | ${expected_data} - -| Honeycomb removes FIB configuration -| | [Documentation] | Uses Honeycomb API to remove Honeycomb-created\ -| | ... | FIB configuration from the node. Entries configured automatically\ -| | ... | by VPP will not be removed. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type:string -| | ... | - vrf - vrf-id the new table will belong to. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes FIB configuration \| ${nodes['DUT1']} \ -| | ... | \| ${ip_version} \| ${vrf} \| -| | [Arguments] | ${node} | ${ip_version} | ${vrf} -| | Delete FIB table | ${node} | ${ip_version} | ${vrf} diff --git a/resources/libraries/robot/honeycomb/honeycomb.robot b/resources/libraries/robot/honeycomb/honeycomb.robot deleted file mode 100644 index cf89229dfd..0000000000 --- a/resources/libraries/robot/honeycomb/honeycomb.robot +++ /dev/null @@ -1,375 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.HoneycombSetup -| Library | resources.libraries.python.honeycomb.HoneycombUtil -| Library | resources.libraries.python.honeycomb.HcPersistence -| Library | resources.libraries.python.DUTSetup -| Library | resources.libraries.python.InterfaceUtil -| Resource | resources/libraries/robot/shared/default.robot - -*** Keywords *** -| Configure Honeycomb service on DUTs -| | [Documentation] | *Setup environment for honeycomb testing.* -| | ... -| | ... | _Setup steps:_ -| | ... | - 1. Login to each honeycomb node using ssh -| | ... | - 2. Startup honeycomb service -| | ... | - 3. Monitor service startup using HTTP GET request loop -| | ... | Expected sequence of HTTP replies: -| | ... | connection refused -> 404 -> 401 -> 503 or 500 -> 200 (pass) -| | ... | - 4. Configure honeycomb nodes using HTTP PUT request -| | ... -| | ... | _Arguments:_ -| | ... | - duts - list of nodes to setup Honeycomb on -| | ... -| | ... | _Used global constants and variables:_ -| | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory -| | ... | - HTTPCodes - HTTP protocol status codes -| | ... -| | [Arguments] | @{duts} -| | Start honeycomb on DUTs | @{duts} -| | :FOR | ${dut} | IN | @{duts} -| | | Check honeycomb startup state | @{duts} -| | | Sleep | 5s | Make sure all modules are loaded and ready. - -| Stop Honeycomb service on DUTs -| | [Documentation] | *Cleanup environment after honeycomb testing.* -| | ... -| | ... | _Teardown steps:_ -| | ... | - 1. Login to each honeycomb node using ssh -| | ... | - 2. Stop honeycomb service -| | ... | - 3. Monitor service shutdown using HTTP GET request loop -| | ... | Expected sequence of HTTP replies: -| | ... | 200 -> 404 -> connection refused (pass) -| | ... -| | ... | _Arguments:_ -| | ... | - duts - list of nodes to stop Honeycomb on -| | ... -| | ... | _Used global constants and variables:_ -| | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory -| | ... | - HTTPCodes - HTTP protocol status codes -| | ... -| | [Arguments] | @{duts} -| | Stop honeycomb on DUTs | @{duts} -| | :FOR | ${dut} | IN | @{duts} -| | | Wait until keyword succeeds | 60sec | 15sec -| | | ... | Check honeycomb shutdown state | @{duts} - -| Clear persisted Honeycomb configuration -| | [Documentation] | *Delete saved configuration.* -| | ... -| | ... | *Arguments:* -| | ... | - duts - one or more nodes to clear persistence on. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | @{duts} -| | Clear persisted Honeycomb config | @{duts} - -| Restart Honeycomb and VPP and clear persisted configuration -| | [Documentation] | Restarts Honeycomb and VPP with default configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Restart Honeycomb and VPP and clear persisted configuration \ -| | ... | \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Stop Honeycomb service on DUTs | ${node} -| | Clear persisted Honeycomb configuration | ${node} -| | Restart Vpp Service | ${node} -| | Verify Vpp | ${node} -| | VPP Enable Traces On DUT | ${node} -| | Configure Honeycomb service on DUTs | ${node} - -| Restart Honeycomb and VPP -| | [Documentation] | Stops the Honeycomb service and verifies it is stopped. -| | ... | Then restarts VPP, starts Honeycomb again and verifies it is running. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Stop Honeycomb service on DUTs | ${node} -| | Restart Vpp Service | ${node} -| | Verify Vpp | ${node} -| | VPP Enable Traces On DUT | ${node} -| | Configure Honeycomb service on DUTs | ${node} - -| Restart Honeycomb and VPP in performance test -| | [Documentation] | Stops Honeycomb and VPP and verifies HC is stopped. -| | ... | Then restarts VPP, starts Honeycomb again and verifies it is running. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Stop Honeycomb service on DUTs | ${node} -| | Restart Vpp Service | ${node} -| | Verify Vpp | ${node} -| | VPP Enable Traces On DUT | ${node} -| | Configure Honeycomb service on DUTs | ${node} -| | Check honeycomb startup state | ${node} | timeout=120 - -| Archive Honeycomb logs -| | [Documentation] | Copies log files from Honeycomb node\ -| | ... | to test executor. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - perf - Running on performance testbed? Yes/no Type: boolean -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Archive Honeycomb logs \| ${nudes['DUT1']} \| -| | ... -| | [Arguments] | ${node} | ${perf}=${False} -| | Archive Honeycomb log | ${node} | ${perf} -| | Archive ODL log | ${node} - -| Configure ODL Client Service On DUT -| | [Documentation] | Configure and start ODL client, then repeatedly check if -| | ... | it is running. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - odl_name - Name of ODL client version. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \ -| | ... | \| carbon-SR1 \| -| | ... -| | [Arguments] | ${node} | ${odl_name} -| | Copy ODL Client | ${node} | ${odl_name} | /mnt/common | /tmp -| | Setup ODL Client | ${node} | /tmp -| | Wait until keyword succeeds | 3min | 30sec -| | ... | Install ODL Features | ${node} | /tmp -| | Wait until keyword succeeds | 4min | 15sec -| | ... | Mount Honeycomb on ODL | ${node} -| | Wait until keyword succeeds | 2min | 15sec -| | ... | Check ODL startup state | ${node} -| | Check honeycomb startup state | ${node} | timeout=120 - -| Configure Honeycomb for functional testing -| | [Documentation] | Configure Honeycomb with parameters for functional -| | ... | testing, then start Honeycomb and repeatedly check startup status. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure Honeycomb for functional testing \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Configure Restconf binding address | ${node} -| | Configure Log Level | ${node} | TRACE -| | Configure Persistence | ${node} | disable -| | Configure jVPP timeout | ${node} | ${10} -| | Generate Honeycomb startup configuration for ODL test | ${node} -| | Clear Persisted Honeycomb Configuration | ${node} -| | Configure Honeycomb service on DUTs | ${node} - -| Configure ODL Client for functional testing -| | [Documentation] | Read external variable HC_ODL. Depending on its -| | ... | value either: do nothing, or setup ODL client for testing and -| | ... | create a global variable that modifies Restconf requests to use ODL. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ${use_odl_client}= | Get Variable Value | ${HC_ODL} -| | Run Keyword If | '${use_odl_client}' != '${NONE}' -| | ... | Run Keywords -| | ... | Set Global Variable | ${use_odl_client} | AND -| | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client} -| | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL. -| | ... | level=INFO - -| Set Up Honeycomb Functional Test Suite -| | [Documentation] | Generic test suite setup for Honeycomb functional tests. -| | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based -| | ... | on external variable. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Restart Vpp Service | ${node} -| | Verify Vpp | ${node} -| | VPP Enable Traces On DUT | ${node} -| | All TGs Set Interface Default Driver | ${nodes} -| | Configure Honeycomb for functional testing | ${node} -| | Configure ODL Client for functional testing | ${node} - -| Tear Down Honeycomb Functional Test Suite -| | [Documentation] | Generic test suite teardown for Honeycomb functional -| | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies -| | ... | that they are both stopped. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Append suite to Honeycomb log file | ${node} -| | ${use_odl_client}= | Get Variable Value | ${HC_ODL} -| | Run Keyword If | '${use_odl_client}' != '${NONE}' -| | ... | Run Keywords -| | ... | Append suite to ODL log file | ${node} | ${use_odl_client} | AND -| | ... | Stop ODL Client | ${node} | /tmp | AND -| | ... | Wait until keyword succeeds | 3min | 15sec -| | ... | Check ODL shutdown state | ${node} | AND -| | ... | Set Global Variable | ${use_odl_client} | ${NONE} -| | Stop Honeycomb service on DUTs | ${node} -| | Clear Honeycomb Log | ${node} -| | Stop VPP Service | ${node} - -| Enable Honeycomb Feature -| | [Documentation] | Enable the specified feature in Honeycomb configuration. -| | ... | Requires a restart of Honeycomb to take effect. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \| -| | ... -| | [arguments] | ${node} | ${feature} -| | Manage Honeycomb Features | ${node} | ${feature} - -| Disable Honeycomb Feature -| | [Documentation] | Disable the specified feature in Honeycomb configuration. -| | ... | Requires a restart of Honeycomb to take effect. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \| -| | ... -| | [arguments] | ${node} | ${feature} -| | Manage Honeycomb Features | ${node} | ${feature} | disable=${True} - -| Honeycomb Performance Suite Setup Generic -| | [Documentation] | Generic test suite setup for Honeycomb performance tests. -| | ... | Performs multiple attempts to start Honeycomb+VPP stack. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb Performance Suite Setup Generic \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Wait until keyword succeeds | 8min | 2min -| | ... | Restart Honeycomb and VPP in Performance test | ${node} - -| Honeycomb Performance Suite Teardown Generic -| | [Documentation] | Generic test suite teardown for Honeycomb performance -| | ... | tests. Logs CPU usage before stopping Honeycomb. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb Performance Suite Teardown Generic \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Log Honeycomb and VPP process distribution on cores | ${node} -| | Append suite to Honeycomb log file | ${node} -| | Stop Honeycomb service on DUTs | ${node} -| | Clear Honeycomb Log | ${node} -| | Stop VPP Service | ${node} - -| Append suite to Honeycomb log file -| | [Documentation] | Add the contents of honeycomb.log for the current suite\ -| | ... | to the full log which will be archived. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Append suite to Honeycomb log file \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Append Honeycomb log | ${node} | ${SUITE_NAME} - -| Append suite to ODL log file -| | [Documentation] | Add the contents of ODL karaf.log for the current suite\ -| | ... | to the full log which will be archived. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - odl_name - name of ODL client version. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Append suite to ODL karaf log file \| ${nodes['DUT1']} \ -| | ... | \| Oxygen \| -| | ... -| | [Arguments] | ${node} | ${odl_name} -| | Append ODL log | ${node} | ${odl_name} | ${SUITE_NAME} - -| Generate Honeycomb startup configuration for ODL test -| | [Documentation] | Create HC startup configuration and apply to config -| | ... | file on DUT. Requires Honeycomb restart to take effect. -| | ... -| | ... | *Arguments:* -| | ... | - node - Honeycomb node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Generate Honeycomb startup configuration for ODL test \ -| | ... | \| ${nodes[DUT1]} \| -| | ... -| | [Arguments] | ${node} -| | Import Library | resources.libraries.python.honeycomb.HoneycombSetup.HoneycombStartupConfig -| | ... | WITH NAME | HC_config -| | Run Keyword | HC_config.Set SSH Security provider -| | Run Keyword | HC_config.Set Memory Size | ${32} -| | Run Keyword | HC_config.Set Metaspace Size | ${32} -| | Run Keyword | HC_config.Apply config | ${node} diff --git a/resources/libraries/robot/honeycomb/interfaces.robot b/resources/libraries/robot/honeycomb/interfaces.robot deleted file mode 100644 index 06428c0c96..0000000000 --- a/resources/libraries/robot/honeycomb/interfaces.robot +++ /dev/null @@ -1,813 +0,0 @@ -# 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 -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Library | resources.libraries.python.IPUtil -| Library | resources.libraries.python.TrafficScriptExecutor - -*** Keywords *** -| Honeycomb configures interface state -| | [Documentation] | Uses Honeycomb API to change the admin state\ -| | ... | of the specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - state - state to set on interface. Type:string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures interface state \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| up \| -| | [Arguments] | ${node} | ${interface} | ${state} -| | Honeycomb Set Interface State | ${node} | ${interface} | ${state} - -| Interface state from Honeycomb should be -| | [Documentation] | Retrieves interface admin state through Honeycomb and\ -| | ... | compares with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - state - expected interface state. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface state from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| up \| -| | [Arguments] | ${node} | ${interface} | ${state} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${api_state}= | Set Variable | ${api_data['admin-status']} -| | Should be equal | ${api_state} | ${state} - -| Interface state from VAT should be -| | [Documentation] | Retrieves interface admin state through VAT and compares\ -| | ... | with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - state - expected interface state. Type: string -| | ... -| | ... | _NOTE:_ Vat returns state as int (1/0) instead of string (up/down). -| | ... | This keyword also handles translation. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface state from VAT should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| up \| -| | [Arguments] | ${node} | ${interface} | ${state} -| | ${vat_data}= | VPP get interface data | ${node} | ${interface} -| | ${vat_state}= | Set Variable if -| | ... | ${vat_data['admin_up_down']} == 1 | up | down -| | Should be equal | ${vat_state} | ${state} - -| Honeycomb sets interface IPv4 address -| | [Documentation] | Uses Honeycomb API to change ipv4 address\ -| | ... | of the specified interface. Any existing addresses will be removed. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to set. Type: string -| | ... | - netmask - subnet mask to set. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb sets interface IPv4 address \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 255.255.255.0 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${netmask} -| | Add first ipv4 address -| | ... | ${node} | ${interface} | ${address} | ${netmask} - -| Honeycomb sets interface IPv4 address with prefix -| | [Documentation] | Uses Honeycomb API to assign an ipv4 address to the\ -| | ... | specified interface. Any existing addresses will be removed. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to set. Type: string -| | ... | - prefix - length of address network prefix. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb sets interface IPv4 address with prefix \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 24 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | Add first ipv4 address -| | ... | ${node} | ${interface} | ${address} | ${prefix} - -| Honeycomb adds interface IPv4 address -| | [Documentation] | Uses Honeycomb API to add an ipv4 address to the\ -| | ... | specified interface, without removing existing addresses. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to set. Type: string -| | ... | - prefix - length of address network prefix. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds interface IPv4 address \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 24 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | Add ipv4 address -| | ... | ${node} | ${interface} | ${address} | ${prefix} - -| Honeycomb fails to add interface IPv4 address -| | [Documentation] | Uses Honeycomb API to add an ipv4 address to the\ -| | ... | specified interface, and expects to fail with code 500. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to set. Type: string -| | ... | - prefix - length of address network prefix. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb fails to add interface IPv4 address \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 24 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | Run Keyword and Expect Error | *not successful. Status code: 500. -| | ... | Honeycomb adds interface IPv4 address -| | ... | ${node} | ${interface} | ${address} | ${prefix} - -| IPv4 address from Honeycomb should be -| | [Documentation] | Retrieves interface ipv4 address through Honeycomb\ -| | ... | and compares with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to expect. Type: string -| | ... | - prefix - prefix length to expect. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv4 address from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| ${24} \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${settings}= | Create Dictionary -| | ... | ip=${address} | prefix-length=${prefix} -| | Should contain | ${api_data['ietf-ip:ipv4']['address']} | ${settings} - -| IPv4 address from VAT should be -| | [Documentation] | Retrieves interface ipv4 address through VAT and\ -| | ... | compares with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to expect. Type: string -| | ... | - prefix - prefix length to expect. Type: string -| | ... | - netmask - subnet mask to expect. Type: string -| | ... | - sw_if_index - Index of interface. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv4 address from VAT should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| ${24} \| 255.255.255.0 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} | ${netmask} -| | ${sw_if_index}= | Vpp Get Interface Sw Index | ${node} | ${interface} -| | ${vpp_data}= | VPP get interface ip addresses -| | ... | ${node} | ${interface} | ipv4 -| | ${settings}= | Create Dictionary -| | ... | ip=${address} | netmask=${netmask} | sw_if_index=${sw_if_index} -| | ... | prefix_length=${prefix} | is_ipv6=${0} -| | Should contain | ${vpp_data} | ${settings} - -| Honeycomb removes interface IPv4 addresses -| | [Documentation] | Removes all configured ipv4 addresses from the specified\ -| | ... | interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes interface IPv4 addresses \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Remove all ipv4 addresses | ${node} | ${interface} - -| IPv4 address from Honeycomb should be empty -| | [Documentation] | Retrieves interface ipv4 configuration through Honeycomb\ -| | ... | and expects to find no IPv4 addresses. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv4 address from Honeycomb should be empty\| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError:* -| | ... | Set Variable | ${api_data['ietf-ip:ipv4']['address']} - -| IPv4 address from VAT should be empty -| | [Documentation] | Retrieves interface ipv4 configuration through VAT and\ -| | ... | and expects to find no ipv4 addresses. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv4 config from VAT should be empty \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${data}= | VPP get interface ip addresses | ${node} | ${interface} | ipv4 -| | Should be empty | ${data} - -| Honeycomb adds interface IPv4 neighbor -| | [Documentation] | Uses Honeycomb API to assign an ipv4 neighbor to the\ -| | ... | specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - fib_address - IP address to add to fib table. Type: string -| | ... | - fib_mac - MAC address to add to fib table. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds interface IPv4 neighbor \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.3 \| 08:00:27:c0:5d:37 \ -| | [Arguments] | ${node} | ${interface} | ${fib_address} | ${fib_mac} -| | Add ipv4 neighbor -| | ... | ${node} | ${interface} | ${fib_address} | ${fib_mac} - -| IPv4 neighbor from Honeycomb should be -| | [Documentation] | Retrieves ipv4 neighbor list through Honeycomb\ -| | ... | and checks if it contains address supplied in arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - ip_address - ipv4 address of expected neighbor entry. Type: string -| | ... | - mac_address - MAC address of expected neighbor entry. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv4 neighbor from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.4 \| 08:00:27:60:26:ab \| -| | [Arguments] | ${node} | ${interface} | ${ip_address} | ${mac_address} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${settings}= | Create Dictionary -| | ... | ip=${ip_address} | link-layer-address=${mac_address} | origin=static -| | Should contain | ${api_data['ietf-ip:ipv4']['neighbor']} | ${settings} - -| Honeycomb clears all interface IPv4 neighbors -| | [Documentation] | Uses Honeycomb API to remove all ipv4 neighbors from the\ -| | ... | specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb clears all interface IPv4 neighbors \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Remove all ipv4 neighbors | ${node} | ${interface} - -| IPv4 neighbor from Honeycomb should be empty -| | [Documentation] | Retrieves ipv4 neighbor list through Honeycomb\ -| | ... | and expects to find no ipv4 neighbors. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv4 neighbor from Honeycomb should be empty \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError:* -| | ... | Set Variable | ${api_data['ietf-ip:ipv4']['neighbor'][0]['ip']} - -| Honeycomb sets interface IPv6 address -| | [Documentation] | Uses Honeycomb API to change ipv6 address\ -| | ... | of the specified interface. Existing IPv6 addresses will be removed,\ -| | ... | with the exception of self-configured link-layer IPv6. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to set. Type: string -| | ... | - prefix - length of subnet prefix to set. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb sets interface IPv6 address \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | Add first ipv6 address -| | ... | ${node} | ${interface} | ${address} | ${prefix} - -| Honeycomb adds interface IPv6 address -| | [Documentation] | Uses Honeycomb API to add an ipv6 address\ -| | ... | to the specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to set. Type: string -| | ... | - prefix - length of subnet prefix to set. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds interface IPv6 address \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | Add ipv6 address -| | ... | ${node} | ${interface} | ${address} | ${prefix} - -| Honeycomb fails to add interface IPv6 address -| | [Documentation] | Uses Honeycomb API to add an ipv6 address to the\ -| | ... | specified interface, and expects to fail with code 500. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to set. Type: string -| | ... | - prefix - length of address network prefix. Type:integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb fails to add interface IPv6 address \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 10::10 \| 64 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | Run Keyword and Expect Error | *not successful. Status code: 500. -| | ... | Honeycomb adds interface IPv6 address -| | ... | ${node} | ${interface} | ${address} | ${prefix} - -| IPv6 address from Honeycomb should contain -| | [Documentation] | Retrieves interface ipv6 address through Honeycomb\ -| | ... | and compares with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to expect. Type: string -| | ... | - prefix - length of subnet prefix to expect. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv6 address from Honeycomb should contain \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${settings}= | Create Dictionary -| | ... | ip=${address} | prefix-length=${prefix} -| | Should contain | ${api_data['ietf-ip:ipv6']['address']} | ${settings} - -| IPv6 address from VAT should contain -| | [Documentation] | Retrieves interface ipv6 address through VAT and\ -| | ... | compares with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - address - IP address to expect. Type: string -| | ... | - prefix - length of subnet prefix to expect. Type: string -| | ... | - sw_if_index - index of interface. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv6 address from VAT should contain \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} | ${netmask} -| | ${sw_if_index}= | Vpp Get Interface Sw Index | ${node} | ${interface} -| | ${vpp_data}= | VPP get interface ip addresses -| | ... | ${node} | ${interface} | ipv6 -| | ${settings}= | Create Dictionary -| | ... | ip=${address} | netmask=${netmask} | sw_if_index=${sw_if_index} -| | ... | prefix_length=${prefix} | is_ipv6=${1} -| | Should contain | ${vpp_data} | ${settings} - -| Honeycomb removes interface IPv6 addresses -| | [Documentation] | Removes all configured ipv6 addresses from the specified\ -| | ... | interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes interface IPv6 addresses \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Remove all ipv6 addresses | ${node} | ${interface} - -| IPv6 address from Honeycomb should be empty -| | [Documentation] | Retrieves interface ipv6 configuration through Honeycomb\ -| | ... | and expects to find no IPv6 addresses. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv6 address from Honeycomb should be empty\| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError:* -| | ... | Set Variable | ${api_data['ietf-ip:ipv6']['address']} - -| IPv6 address from VAT should be empty -| | [Documentation] | Retrieves interface ipv6 configuration through VAT and\ -| | ... | expects to find no ipv6 addresses. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv6 config from VAT should be empty \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${data}= | VPP get interface ip addresses | ${node} | ${interface} | ipv6 -| | Should be empty | ${data} - -| Honeycomb adds interface IPv6 neighbor -| | [Documentation] | Uses Honeycomb API to assign an ipv6 neighbor to the\ -| | ... | specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - fib_address - IP address to add to fib table. Type: string -| | ... | - fib_mac - MAC address to add to fib table. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds interface IPv6 neighbor \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.3 \| 08:00:27:c0:5d:37 \| -| | [Arguments] | ${node} | ${interface} | ${fib_address} | ${fib_mac} -| | Add ipv6 neighbor -| | ... | ${node} | ${interface} | ${fib_address} | ${fib_mac} - -| IPv6 neighbor from Honeycomb should be -| | [Documentation] | Retrieves ipv6 neighbor list through Honeycomb\ -| | ... | and checks if it contains address supplied in arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - ip_address - ipv6 address of expected neighbor entry. Type: string -| | ... | - mac_address - MAC address of expected neighbor entry. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv6 neighbor from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.4 \| 08:00:27:60:26:ab \| -| | [Arguments] | ${node} | ${interface} | ${ip_address} | ${mac_address} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${settings}= | Create Dictionary -| | ... | ip=${ip_address} | link-layer-address=${mac_address} | origin=static -| | Should contain | ${api_data['ietf-ip:ipv6']['neighbor']} | ${settings} - -| Honeycomb clears all interface IPv6 neighbors -| | [Documentation] | Uses Honeycomb API to remove all ipv6 neighbors from the\ -| | ... | specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb clears all interface IPv6 neighbors \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Remove all ipv6 neighbors | ${node} | ${interface} - -| IPv6 neighbor from Honeycomb should be empty -| | [Documentation] | Retrieves ipv6 neighbor list through Honeycomb\ -| | ... | and expects to find no ipv6 neighbors. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv6 neighbor from Honeycomb should be empty \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError:* -| | ... | Set Variable | ${api_data['ietf-ip:ipv6']['neighbor'][0]['ip']} - -| Honeycomb sets interface ethernet configuration -| | [Documentation] | Uses Honeycomb API to change interface ethernet\ -| | ... | configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - ethernet - interface ethernet settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb sets interface ethernet configuration \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${{'mtu': 1500}} \ -| | [Arguments] | ${node} | ${interface} | ${ethernet} -| | :FOR | ${key} | IN | @{ethernet.keys()} -| | | Configure interface ethernet -| | | ... | ${node} | ${interface} | ${key} | ${ethernet['${key}']} - -| Interface ethernet Operational Data From Honeycomb Should Be -| | [Documentation] | Retrieves interface ethernet configuration\ -| | ... | through Honeycomb and compares with settings supplied in arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - ethernet - interface ethernet settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface ethernet Operational Data From Honeycomb Should Be \ -| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \ -| | ... | \| ${{'mtu': 1500}} \| -| | [Arguments] | ${node} | ${interface} | ${ethernet} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | :FOR | ${key} | IN | @{ethernet.keys()} -| | | Should be equal -| | | ... | ${api_data['v3po:ethernet']['${key}']} | ${ethernet['${key}']} - -| Interface ethernet Operational Data From VAT Should Be -| | [Documentation] | Retrieves interface ethernet configuration\ -| | ... | through VAT and compares with settings supplied in arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - mtu - value of maximum transmission unit expected. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface ethernet Operational Data From VAT Should Be \ -| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1500} \| -| | [Arguments] | ${node} | ${interface} | ${mtu} -| | ${vat_data}= | VPP get interface data | ${node} | ${interface} -| | Should be equal | ${vat_data['mtu']} | ${mtu} - -| Honeycomb sets interface VRF ID -| | [Documentation] | Uses Honeycomb API to change interface vrf\ -| | ... | configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - vrf_id - vrf ID to configure. Type:integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb sets interface VRF ID \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| ipv4 \| -| | [Arguments] | ${node} | ${interface} | ${vrf_id} | ${ip_version} -| | Configure interface routing -| | ... | ${node} | ${interface} | ${ip_version}-vrf-id | ${vrf_id} - -| Interface VRF ID from Honeycomb should be -| | [Documentation] | Retrieves interface ethernet configuration\ -| | ... | through Honeycomb and compares with settings supplied in arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - vrf_id - vrf ID to expect. Type:integer -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface VRF ID from Honeycomb should be \ -| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \ -| | ... | \| ipv4 \| -| | [Arguments] | ${node} | ${interface} | ${vrf_id} | ${ip_version} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} | -| | Should be equal -| | ... | ${api_data['v3po:routing']['${ip_version}-vrf-id']} | ${vrf_id} - -| Interface VRF ID from VAT should be -| | [Documentation] | Retrieves interface ethernet configuration\ -| | ... | through VAT and compares with settings supplied in arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - vrf_id - vrf ID to expect. Type:integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface VRF ID from VAT should be \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| -| | [Arguments] | ${node} | ${interface} | ${vrf_id} -| | ${vat_data}= | get interface vrf table -| | ... | ${node} | ${interface} -| | Should be equal | ${vat_data} | ${vrf_id} - -| Interface Operational Data From Honeycomb Should Be empty -| | [Documentation] | Attempts to retrieve interface configuration through\ -| | ... | Honeycomb and expects to get empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of a interface on the specified node. Type:\ -| | ... | string -| | ... -| | ... | *Example:* -| | ... | \| Interface Operational Data From Honeycomb Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Should be empty | ${api_data} - -| Interface Operational Data From VAT Should Be empty -| | [Documentation] | Attempts to retrieve Interface configuration through\ -| | ... | VAT and expects to get empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of a Interface on the specified node. Type:\ -| | ... | string -| | ... -| | ... | *Example:* -| | ... | \| Interface Operational Data From VAT Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} | -| | ${vat_data}= | 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}= | Get interface oper data | ${node} | ${interface} -| | ${vat_data}= | 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} - -| Get interface index from oper data -| | [Documentation] | Retrieves interface operational data and returns\ -| | ... | if-index of the specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of the interface. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Get interface index from oper data \| ${nodes['DUT1']} \| local0 \| -| | [Arguments] | ${node} | ${interface} -| | ${data}= | Get interface oper data | ${node} | ${interface} -| | Return from keyword | ${data['if-index']} - -| Honeycomb should show disabled interface in oper data -| | [Documentation] | Retrieves list of disabled interfaces\ -| | ... | and verifies that there is at least one. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - index - index of the interface to be checked. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb should show disabled interface in oper data \ -| | ... | \| ${nodes['DUT1']} \| ${vx_interface} \| -| | [Arguments] | ${node} | ${index} -| | check disabled interface | ${node} | ${index} - -| Honeycomb should not show disabled interface in oper data -| | [Documentation] | Retrieves list of disabled interfaces\ -| | ... | and expects to fail with a 404 - not found. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - index - index of the interface to be checked. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb should not show disabled interface in oper data \ -| | ... | \| ${nodes['DUT1']} \| ${vx_interface} \| -| | [Arguments] | ${node} | ${index} -| | Run keyword and expect error | * -| | ... | Honeycomb should show disabled interface in oper data -| | ... | ${node} | ${index} - -| Ping and verify IP address -| | [Documentation] | Sends ICMP packet from IP (with source mac) to IP -| | ... | (with dest mac), then waits for ICMP reply. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | _NOTE:_ Arguments are based on topology: -| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) -| | ... -| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary -| | ... | - src_ip - IP of source interface (TG-if1). Type: integer -| | ... | - dst_ip - IP of destination interface (TG-if2). Type: integer -| | ... | - tx_port - Source interface (TG-if1). Type: string -| | ... | - tx_mac - MAC address of source interface (TG-if1). Type: string -| | ... | - rx_port - Destionation interface (TG-if1). Type: string -| | ... | - rx_mac - MAC address of destination interface (TG-if1). Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Ping verify IP address \| ${nodes['TG']} \ -| | ... | \| 16.0.0.1 \| 32.0.0.1 \| eth2 \| 08:00:27:cc:4f:54 \ -| | ... | \| eth4 \| 08:00:27:c9:6a:d5 \| -| | ... -| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_port} | -| | ... | ${tx_mac} | ${rx_port} | ${rx_mac} -| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_port} -| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} -| | ${args}= | Catenate | --src_mac | ${tx_mac} -| | ... | --dst_mac | ${rx_mac} -| | ... | --src_ip | ${src_ip} -| | ... | --dst_ip | ${dst_ip} -| | ... | --tx_if | ${tx_port_name} -| | ... | --rx_if | ${rx_port_name} -| | ... | --timeout | ${5} -| | Run Traffic Script On Node | send_icmp_wait_for_reply.py -| | ... | ${tg_node} | ${args} - -| Honeycomb adds unnumbered configuration to interface -| | [Documentation] | Adds unnumbered configuration to interface, borrowing IP -| | ... | address from the other specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - Name of the interface to be configured. Type: string -| | ... | - interface_src - Name of the interface to borrow IP address from.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds unnumbered configuration to interface \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \| -| | ... -| | [Arguments] | ${node} | ${Interface} | ${interface_src} -| | Configure interface unnumbered | ${node} | ${interface} | ${interface_src} - -| Honeycomb removes unnumbered configuration from interface -| | [Documentation] | Removes unnumbered configuration from the specified -| | ... | interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - Name of the interface to be configured. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds unnumbered configuration to interface \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${Interface} -| | Configure interface unnumbered | ${node} | ${interface} diff --git a/resources/libraries/robot/honeycomb/ipv6_control.robot b/resources/libraries/robot/honeycomb/ipv6_control.robot deleted file mode 100644 index 8e50a31927..0000000000 --- a/resources/libraries/robot/honeycomb/ipv6_control.robot +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.DHCP.DHCPRelayKeywords -| Library | resources.libraries.python.Dhcp.DhcpProxy -| Library | resources.libraries.python.DUTSetup -| Documentation | Keywords used to test Honeycomb DHCP features. - -*** Keywords *** -| Convert data-plane interface to control-plane -| | [Documentation] | Unbinds an interface from VPP and binds it to kernel\ -| | ... | driver specified in topology. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the interface in topology. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Convert data-plane interface to control-plane \| ${nodes['DUT1']} \ -| | ... | \| port3 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ${new_driver}= | Get Variable Value -| | ... | ${node['interfaces']['${interface}']['driver']} -| | PCI Driver Unbind | ${node} -| | ... | ${node['interfaces']['${interface}']['pci_address']} -| | Run Keyword If | '${new_driver}' == 'None' -| | ... | PCI Driver Bind | ${node} -| | ... | ${node['interfaces']['${interface}']['pci_address']} | virtio-pci -| | ... | ELSE -| | ... | PCI Driver Bind | ${node} -| | ... | ${node['interfaces']['${interface}']['pci_address']} | ${new_driver} diff --git a/resources/libraries/robot/honeycomb/l2_fib.robot b/resources/libraries/robot/honeycomb/l2_fib.robot deleted file mode 100644 index d103d41de6..0000000000 --- a/resources/libraries/robot/honeycomb/l2_fib.robot +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.HcAPIKwBridgeDomain.BridgeDomainKeywords -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Resource | resources/libraries/robot/honeycomb/papi.robot - -*** Keywords *** -| Honeycomb adds L2 FIB entry to bridge domain -| | [Documentation] | Add L2 FIB entry to the specified bridge domain using \ -| | ... | Honyecomb API. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - l2_fib_settings - The parameters of the new L2 FIB entry. \ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb adds L2 FIB entry to bridge domain \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| ${l2_fib_forward_cfg} \| -| | ... -| | [Arguments] | ${node} | ${bd_name} | ${l2_fib_settings} -| | ... -| | Add L2 FIB Entry | ${node} | ${bd_name} | ${l2_fib_settings} - -| L2 FIB Table from Honeycomb should be empty -| | [Documentation] | Check if the L2 FIB table in the specified bridge domain \ -| | ... | is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... -| | ... | *Example:* -| | ... | \| L2 FIB Table from Honeycomb should be empty \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| -| | ... -| | [Arguments] | ${node} | ${bd_name} -| | ... -| | ${l2_fib_data}= | Get All L2 FIB Entries | ${node} | ${bd_name} -| | Should be empty | ${l2_fib_data} - -| L2 FIB Entry from Honeycomb should be -| | [Documentation] | Retrieves the operational data about the specified L2 \ -| | ... | FIB entry and checks if they are as expected. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - l2_fib_ref_data - L2 FIB entry referential data. Type: dictionay -| | ... -| | ... | *Example:* -| | ... | \| L2 FIB Entry from Honeycomb should be \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| ${l2_fib_forward_oper} \| -| | ... -| | [Arguments] | ${node} | ${bd_name} | ${l2_fib_ref_data} -| | ... -| | ${l2_fib_data}= | Get L2 FIB Entry | ${node} | ${bd_name} -| | ... | ${l2_fib_ref_data['phys-address']} -| | Compare Data Structures | ${l2_fib_data} | ${l2_fib_ref_data} - -| Honeycomb removes L2 FIB entry -| | [Documentation] | Remove the specified L2 FIB entry from the bridge \ -| | ... | domain's L2 FIB table. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - mac - MAC address used as the key in L2 FIB data structure. \ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb removes L2 FIB entry \ -| | ... | \| ${nodes['DUT1']} \| test_bd \ -| | ... | \| ${l2_fib_forward_oper['phys-address']} \| -| | ... -| | [Arguments] | ${node} | ${bd_name} | ${mac} -| | ... -| | Remove L2 FIB Entry | ${node} | ${bd_name} | ${mac} - -| Honeycomb removes all L2 FIB entries -| | [Documentation] | Remove all L2 FIB enties from the bridge domain's L2 FIB \ -| | ... | table. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb removes all L2 FIB entries \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| -| | ... -| | [Arguments] | ${node} | ${bd_name} -| | ... -| | Remove all L2 FIB entries | ${node} | ${bd_name} - -| Honeycomb fails to add wrong L2 FIB entry -| | [Documentation] | Honeycomb tries to add a wrong L2 FIB entry and expects \ -| | ... | that it fails. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - l2_fib_settings - The wrong parameters of the new L2 FIB entry. \ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb fails to add wrong L2 FIB entry \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| ${l2_fib_wrong_cfg} \| -| | ... -| | [Arguments] | ${node} | ${bd_name} | ${l2_fib_settings} -| | ... -| | Run keyword and expect error | *HoneycombError: * was not successful. *00. -| | ... | Add L2 FIB Entry | ${node} | ${bd_name} | ${l2_fib_settings} - -| Honeycomb fails to modify L2 FIB entry -| | [Documentation] | Honeycomb tries to modify an existing L2 FIB entry and \ -| | ... | expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_name - Name of the bridge domain. Type: string -| | ... | - mac - MAC address used as the key in L2 FIB data structure. \ -| | ... | Type: string -| | ... | - param - The parameter to be modified. Type: string -| | ... | - value - The new value of the parameter. Type: string or integer -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb fails to modify L2 FIB entry \ -| | ... | \| ${nodes['DUT1']} \| test_bd \ -| | ... | \| ${l2_fib_forward_oper['phys-address']} \| action \ -| | ... | \| l2-fib-forward \| -| | ... -| | [Arguments] | ${node} | ${bd_name} | ${mac} | ${param} | ${value} -| | ... -| | Run keyword and expect error | *HoneycombError: * was not successful. *00. -| | ... | Modify L2 FIB Entry -| | ... | ${node} | ${bd_name} | ${mac} | ${param} | ${value} - -| L2 FIB entry from PAPI should be -| | [Documentation] | Retrieves the operational data about the specified L2 \ -| | ... | FIB entry using Python API and checks if it is as expected. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_index - Index of the bridge domain. Type: integer -| | ... | - l2_fib_ref_data - L2 FIB entry referential data. Type: dictionay -| | ... -| | ... | *Example:* -| | ... | \| L2 FIB entry from PAPI should be \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| ${l2_fib_forward_oper} \| -| | ... -| | [Arguments] | ${node} | ${bd_index} | ${l2_fib_ref_data} -| | ... -| | ${l2_fib_data}= | Get L2 FIB entry PAPI | ${node} | ${bd_index} -| | ... | ${l2_fib_ref_data['mac']} -| | Compare Data Structures | ${l2_fib_data} | ${l2_fib_ref_data} - -| L2 FIB Table from PAPI should be empty -| | [Documentation] | Check if the L2 FIB table in the specified bridge domain \ -| | ... | is empty. Python API is used to get operational data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_index - Index of the bridge domain. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| L2 FIB Table from PAPI should be empty \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| -| | ... -| | [Arguments] | ${node} | ${bd_index} -| | ... -| | ${l2_fib_data}= | Get L2 FIB table PAPI | ${node} | ${bd_index} -| | Should be empty | ${l2_fib_data} diff --git a/resources/libraries/robot/honeycomb/lisp.robot b/resources/libraries/robot/honeycomb/lisp.robot deleted file mode 100644 index 5decf6b6e8..0000000000 --- a/resources/libraries/robot/honeycomb/lisp.robot +++ /dev/null @@ -1,718 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.Lisp.LispKeywords -| Library | resources.libraries.python.LispUtil -| Documentation | Keywords used to test Honeycomb Lisp features. - -*** Keywords *** -| Honeycomb enables LISP -| | [Documentation] | Uses Honeycomb API to enable LISP. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables LISP \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Set LISP state | ${node} | ${TRUE} - -| Honeycomb disables LISP -| | [Documentation] | Uses Honeycomb API to disable LISP. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables LISP \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Set LISP state | ${node} | ${FALSE} - -| Honeycomb adds locator set -| | [Documentation] | Uses Honeycomb API to enable LISP. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - Name of an interface on the node. Type: string -| | ... | - locator_set - Name for the new locator set. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds locator set \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| loc_01 \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${locator_set} -| | ... -| | Add locator | ${node} | ${interface} | ${locator_set} - -| Honeycomb adds LISP Mapping -| | [Documentation] | Uses Honeycomb API to configure a LISP mapping. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - data - LISP settings to use. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds LISP Mapping \| ${nodes['DUT1']} \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${data} -| | ... -| | Configure LISP Mapping | ${node} | ${data} - -| Honeycomb removes all LISP mappings -| | [Documentation] | Uses Honeycomb API to clear the eid-table. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes all LISP mappings \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Configure LISP mapping | ${node} | ${NONE} - -| LISP should not be configured -| | [Documentation] | Retrieves LISP configuration from Honeycomb operational\ -| | ... | data, and expects an empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP should not be configured \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | 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\ -| | ... | data, and compares LISP state with expected value. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - Expected LISP state. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP state from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| enabled \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ${data}= | Get LISP operational data | ${node} -| | ... -| | Run keyword if | $state == 'enabled' -| | ... | Should be equal as strings -| | ... | ${data['lisp-state']['enable']} | ${True} -| | Run keyword if | $state == 'disabled' -| | ... | Should be equal as strings -| | ... | ${data['lisp-state']['enable']} | ${False} - -| LISP state from VAT should be -| | [Documentation] | Retrieves LISP state from VAT,\ -| | ... | and compares LISP state with expected value. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - Expected LISP state. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP state from VAT should be \| ${nodes['DUT1']} \| enabled \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${status}= | VPP show LISP State | ${node} -| | Should match | ${status['feature_status']} | ${state} - -| LISP mapping from Honeycomb should be -| | [Documentation] | Retrieves LISP mapping from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - settings - Expected LISP mapping data. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP mapping from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| ${settings} \| -| | ... -| | [Arguments] | ${node} | ${settings} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | ${data}= | Set Variable | ${data['eid-table']['vni-table'][0]} -| | Compare data structures | ${data} | ${settings} - -| LISP mapping from VAT should be -| | [Documentation] | Retrieves LISP mapping from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - settings - Expected LISP mapping data. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP mapping from VAT should be \| ${nodes['DUT1']} \ -| | ... | \| ${settings} \| -| | ... -| | [Arguments] | ${node} | ${settings} -| | ... -| | ${data}= | VPP show LISP eid table | ${node} -| | Compare data structures | ${data[0]} | ${settings} - -| LISP mappings from Honeycomb should not exist -| | [Documentation] | Retrieves LISP mappings from operational\ -| | ... | data, and expects to find none. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP mappings from Honeycomb should not exist \ -| | ... | \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | Should be empty | ${data['eid-table']['vni-table']} - -| LISP mappings from VAT should not exist -| | [Documentation] | Retrieves LISP mappings from VAT,\ -| | ... | and expects to receive an empty list. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP mappings from VAT should not exist \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | ${data}= | VPP show LISP eid table | ${node} -| | Should be empty | ${data} - -| Locator set from Honeycomb should be -| | [Documentation] | Retrieves LISP locator set from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - Interface that should be referenced by locator.\ -| | ... | Type: dictionary -| | ... | - locator_set - Expected locator set name. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Locator set From Honeycomb Should Be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| loc01 \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${locator_set} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${loc_data}= | Set Variable -| | ... | ${data['lisp-state']['lisp-feature-data']['locator-sets']} -| | Should be equal -| | ... | ${loc_data['locator-set'][0]['name']} -| | ... | ${locator_set} -| | Should be equal -| | ... | ${loc_data['locator-set'][0]['interface'][0]['interface-ref']} -| | ... | ${interface} - -| Honeycomb adds LISP adjacency -| | [Documentation] | Uses Honeycomb API to configure LISP adjacency. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - vni - Virtual network identifier number. Type: integer -| | ... | - map - Name of an existing remote mapping. Type: string -| | ... | - adjacency - Name for the new adjacency. Type: string -| | ... | - data - LISP adjacency settings to use. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds LISP adjacency \| ${nodes['DUT1']} \| ${1} \| map1\ -| | ... | \| adj1 \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${vni} | ${map} | ${adjacency} | ${data} -| | ... -| | Add LISP adjacency -| | ... | ${node} | ${vni} | ${map} | ${adjacency} | ${data} - -| Honeycomb adds LISP map resolver -| | [Documentation] | Uses Honeycomb API to configure LISP map resolver. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_address - IP address for the map resolver. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds LISP map resolver \| ${nodes['DUT1']} \ -| | ... | \| 192.168.0.2 \| -| | ... -| | [Arguments] | ${node} | ${ip_address} -| | ... -| | Add map resolver | ${node} | ${ip_address} - -| Honeycomb adds LISP Map register -| | [Documentation] | Uses Honeycomb API to configure LISP map register. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - add_map_register - Set boolean value of map register. Type: bool -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds LISP Map register \| ${nodes['DUT1']} \ -| | ... | \| ${True} \| -| | ... -| | [Arguments] | ${node} | ${add_map_register} -| | ... -| | Set Map Register | ${node} | ${add_map_register} - -| Honeycomb sets LISP Map request Mode -| | [Documentation] | Uses Honeycomb API to configure LISP map request mode. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - set_map_request - Set boolean value of map request mode. Type: bool -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds LISP Map Request Mode \| ${nodes['DUT1']} \ -| | ... | \| ${True} \| -| | ... -| | [Arguments] | ${node} | ${set_map_request} -| | ... -| | Set Map Request Mode | ${node} | ${set_map_request} - -| Map resolver from Honeycomb should be -| | [Documentation] | Retrieves LISP map resolver from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_address - IP address that should be referenced in map resolver.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Map resolver From Honeycomb Should Be \| ${nodes['DUT1']} \ -| | ... | \| 192.168.1.2 \| -| | ... -| | [Arguments] | ${node} | ${ip_address} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | ${data}= | Set Variable | ${data['map-resolvers']['map-resolver'][0]} -| | Should be equal | ${data['ip-address']} | ${ip_address} - -| Map resolver from VAT should be -| | [Documentation] | Retrieves LISP mapping from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_address - IP address that should be referenced in map resolver.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Map resolver From VAT Should Be \| ${nodes['DUT1']} \ -| | ... | \| 192.168.1.2 \| -| | ... -| | [Arguments] | ${node} | ${ip_address} -| | ... -| | ${data}= | Vpp show LISP map resolver | ${node} -| | Should be equal | ${data[0]['map resolver']} | ${ip_address} - -| Honeycomb adds LISP Map Server -| | [Documentation] | Uses Honeycomb API to configure LISP Map Server. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_addresses - IP addresses for the Map Server.\ -| | ... | Type: any number of strings -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds LISP Map Server \| ${nodes['DUT1']} \ -| | ... | \| 192.168.0.2 \| 192.168.0.3 \| -| | ... -| | [Arguments] | ${node} | @{ip_addresses} -| | ... -| | Add Map Server | ${node} | @{ip_addresses} - -| Map Register from Honeycomb should be -| | [Documentation] | Retrieves LISP Map Register from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - Desired state - True. Type: bool -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Map Register From Honeycomb Should Be \| ${nodes['DUT1']} \ -| | ... | \| ${True} \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | ${data}= | Set Variable | ${data['map-register']} -| | Should be equal | ${data['enabled']} | ${state} - -| Map Server from Honeycomb should be -| | [Documentation] | Retrieves LISP Map Server from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_addresses - IP addresses that should be referenced\ -| | ... | in Map Server. Type: any number of strings -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Map Server From Honeycomb Should Be \| ${nodes['DUT1']} \ -| | ... | \| 192.168.1.2 \| 192.168.1.7 \| -| | ... -| | [Arguments] | ${node} | @{ip_addresses} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | Verify Map Server Data from Honeycomb | ${data} | ${ip_addresses} - - -| Map Server from VAT should be -| | [Documentation] | Retrieves LISP mapping from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_addresses - IP addresses that should be referenced\ -| | ... | in Map Server. Type: any number of strings -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Map Server From VAT Should Be \| ${nodes['DUT1']} \ -| | ... | \| 192.168.1.2 \| 192.168.1.7 \| -| | ... -| | [Arguments] | ${node} | @{ip_addresses} -| | ... -| | ${data}= | Vpp show LISP Map Server | ${node} -| | Verify Map Server Data from VAT | ${data} | ${ip_addresses} - -| Map Register from VAT should be -| | [Documentation] | Retrieves LISP mapping from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - Desired state - "enabled". Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Map Register From VAT Should Be \| ${nodes['DUT1']} \ -| | ... | \| enabled \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${data}= | Vpp show LISP Map Register | ${node} -| | Should be equal | ${data['state']} | ${state} - -| Map Request Mode from VAT should be -| | [Documentation] | Retrieves LISP Request Mode from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - destination - Source or Destination in Map\ -| | ... | Request Mode. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Map Request Mode From VAT Should Be \| ${nodes['DUT1']} \ -| | ... | \| src-dst \| -| | ... -| | [Arguments] | ${node} | ${destination} -| | ... -| | ${data}= | Vpp show LISP Map Request Mode | ${node} -| | Should be equal | ${data['map_request_mode']} | ${destination} - -| Honeycomb enables LISP PITR feature -| | [Documentation] | Uses Honeycomb API to configure LISP PITR feature. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - locator_set - Name of an existing locator set. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables LISP PITR feature \| ${nodes['DUT1']} \| loc1 \| -| | ... -| | [Arguments] | ${node} | ${locator_set} -| | ... -| | Configure PITR | ${node} | ${locator_set} - -| Honeycomb enables LISP PETR feature -| | [Documentation] | Uses Honeycomb API to configure LISP PETR feature. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_address - IP address. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables LISP PETR feature \| ${nodes['DUT1']}\ -| | ... | \| 192.168.0.1 \| -| | ... -| | [Arguments] | ${node} | ${ip_address} -| | ... -| | Configure PETR | ${node} | ${ip_address} - -| Honeycomb enables LISP RLOC feature -| | [Documentation] | Uses Honeycomb API to enable the LISP RLOC feature. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables LISP RLOC feature\ -| | ... | \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Set RLOC probe state | ${node} | ${TRUE} - -| PITR config from Honeycomb should be -| | [Documentation] | Retrieves PITR config from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - locator_set - Name of locator set that should be referenced\ -| | ... | in PITR config. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| PITR config from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| loc01 \| -| | ... -| | [Arguments] | ${node} | ${locator_set} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | ${data}= | Set Variable | ${data['pitr-cfg']} -| | Should be equal | ${data['locator-set']} | ${locator_set} - -| PETR configuration from Honeycomb should be -| | [Documentation] | Retrieves PETR config from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - ip_address - IP address for PETR config. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| PETR config from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| 192.168.0.1 \| -| | ... -| | [Arguments] | ${node} | ${ip_address} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | ${data}= | Set Variable | ${data['petr-cfg']['petr-address']} -| | Should be equal | ${data} | ${ip_address} - -| Map Request Mode from Honeycomb should be -| | [Documentation] | Retrieves List Map Request Mode from Honeycomb\ -| | ... | operational data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - destination - source-destination. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| List Map Request Mode from Honeycomb should be \| ${nodes['DUT1']}\ -| | ... | \| 192.168.0.1 \| -| | ... -| | [Arguments] | ${node} | ${destination} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | ${data}= | Set Variable | ${data['map-request-mode']['mode']} -| | Should be equal | ${data} | ${destination} - -| RLOC probing from Honeycomb should be -| | [Documentation] | Retrieves RLOC config from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - desired state -True/False. Type: bool -| | ... -| | ... | *Example:* -| | ... -| | ... | \| RLOC probing from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| ${True} \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${data}= | Get LISP operational data | ${node} -| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']} -| | ${data}= | Set Variable | ${data['rloc-probe']['enabled']} -| | Should be equal | ${data} | ${state} - -| PETR configuration from VAT should be -| | [Documentation] | Retrieves LISP mapping from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - state of PETR config - enabled/disabled.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| PETR configuration From VAT Should Be \| ${nodes['DUT1']} \ -| | ... | \| enabled \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${data}= | Vpp show LISP PETR config | ${node} -| | Should be equal | ${data['status']} | ${state} - -| RLOC probing from VAT should be -| | [Documentation] | Retrieves LISP mapping from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - state of RLOC config - enabled/disabled.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| RLOC configuration From VAT Should Be \| ${nodes['DUT1']} \ -| | ... | \| enabled \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${data}= | Vpp show LISP RLOC config | ${node} -| | Should be equal | ${data['state']} | ${state} - -| PITR config from VAT should be -| | [Documentation] | Retrieves PITR config from VAT,\ -| | ... | and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - locator_set - Name of locator set that should be referenced\ -| | ... | in PITR config. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| PITR config from VAT should be \| ${nodes['DUT1']} \ -| | ... | \| loc01 \| -| | ... -| | [Arguments] | ${node} | ${locator_set} -| | ... -| | ${data}= | VPP show LISP PITR | ${node} -| | Should be equal | ${data['status']} | enabled -| | Should be equal | ${data['locator_set']} | ${locator_set} - -| Honeycomb disables all LISP features -| | [Documentation] | Uses Honeycomb API to remove all LISP configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables all LISP features \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Disable LISP | ${node} - -| Send packet and verify LISP encap -| | [Documentation] | Send ICMP packet to DUT out one interface and receive\ -| | ... | a LISP encapsulated packet on the other interface. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | _NOTE:_ Arguments are based on topology: -| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) -| | ... -| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary -| | ... | - src_ip - IP of source interface (TG-if1). Type: string -| | ... | - dst_ip - IP of destination interface (TG-if2). Type: string -| | ... | - tx_src_port - Interface of TG-if1. Type: string -| | ... | - tx_src_mac - MAC address of TG-if1. Type: string -| | ... | - tx_dst_mac - MAC address of DUT-if1. Type: string -| | ... | - rx_port - Interface of TG-if1. Type: string -| | ... | - rx_src_mac - MAC address of DUT1-if2. Type: string -| | ... | - rx_dst_mac - MAC address of TG-if2. Type: string -| | ... | - src_rloc - configured RLOC source address. Type: string -| | ... | - dst_rloc - configured RLOC destination address. Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send packet and verify LISP encap \| ${nodes['TG']} \| 10.0.0.1 \ -| | ... | \| 32.0.0.1 \| eth2 \| 08:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \ -| | ... | \| eth3 \| 08:00:27:4d:ca:7a \| 08:00:27:7d:fd:10 \| 10.0.1.1 \ -| | ... | \| 10.0.1.2 \| -| | ... -| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_src_port} -| | ... | ${tx_src_mac} | ${tx_dst_mac} | ${rx_port} | ${rx_src_mac} -| | ... | ${rx_dst_mac} | ${src_rloc} | ${dst_rloc} -| | ... -| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_src_port} -| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} -| | ${args}= | Catenate | --tg_src_mac | ${tx_src_mac} | --tg_dst_mac -| | ... | ${rx_dst_mac} | --dut_if1_mac | ${tx_dst_mac} | --dut_if2_mac -| | ... | ${rx_src_mac} | --src_ip | ${src_ip} | --dst_ip | ${dst_ip} -| | ... | --tx_if | ${tx_port_name} | --rx_if | ${rx_port_name} -| | ... | --src_rloc | ${src_rloc} | --dst_rloc | ${dst_rloc} -| | Run Traffic Script On Node | lisp/lisp_check.py | ${tg_node} -| | ... | ${args} - -| LISP Functional Traffic Test Teardown -| | [Documentation] | Teardown for LISP functional traffic test. -| | Show Packet Trace on all DUTs | ${nodes} -| | VPP Show LISP EID Table | ${node} -| | Disable LISP | ${node} diff --git a/resources/libraries/robot/honeycomb/lisp_gpe.robot b/resources/libraries/robot/honeycomb/lisp_gpe.robot deleted file mode 100644 index 2b265c83c6..0000000000 --- a/resources/libraries/robot/honeycomb/lisp_gpe.robot +++ /dev/null @@ -1,252 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.Lisp.LispGPEKeywords -| Library | resources.libraries.python.LispUtil -| Documentation | Keywords used to test Honeycomb Lisp GPE features. - -*** Keywords *** -| Honeycomb enables LISP GPE -| | [Documentation] | Uses Honeycomb API to enable LISP GPE. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables LISP GPE \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Set LISPGPE state | ${node} | ${TRUE} - -| Honeycomb disables LISP GPE -| | [Documentation] | Uses Honeycomb API to disable LISP GPE. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables LISP GPE \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Set LISPGPE state | ${node} | ${FALSE} - -| Honeycomb adds first LISP GPE Mapping -| | [Documentation] | Uses Honeycomb API to configure a LISP mapping. Removes -| | ... | any existing mappings. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - data - LISP settings to use. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds first LISP GPE Mapping \| ${nodes['DUT1']} \ -| | ... | \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${data} -| | ... -| | Configure LISPGPE Mapping | ${node} | ${data} - -| Honeycomb adds LISP GPE Mapping -| | [Documentation] | Uses Honeycomb API to configure a LISP mapping. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - data - LISP settings to use. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb adds LISP GPE Mapping \| ${nodes['DUT1']} \| ${data} \| -| | ... -| | [Arguments] | ${node} | ${data} -| | ... -| | Add LISPGPE Mapping | ${node} | ${data['id']} | ${data} - -| Honeycomb removes LISP GPE mapping -| | [Documentation] | Uses Honeycomb API to remove the specified mapping. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes LISP GPE mapping \| ${nodes['DUT1']} \ -| | ... | \| map_name \| -| | ... -| | [Arguments] | ${node} | ${mapping} -| | ... -| | Delete LISPGPE mapping | ${node} | ${mapping} - -| LISP GPE should not be configured -| | [Documentation] | Retrieves LISP GPE configuration from Honeycomb operational\ -| | ... | data, and expects an empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP GPE should not be configured \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | ${data}= | Get LISP GPE operational data | ${node} -| | Should be Equal -| | ... | ${data['gpe-state']['gpe-feature-data']['enable']} | ${FALSE} - -| LISP GPE state from Honeycomb should be -| | [Documentation] | Retrieves LISP GPE state from Honeycomb operational\ -| | ... | data, and compares LISP state with expected value. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - Expected LISP state. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP GPE state from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| enabled \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${data}= | Get LISPGPE operational data | ${node} -| | Run keyword if | $state == 'enabled' -| | ... | Should be equal as strings -| | ... | ${data['gpe-state']['gpe-feature-data']['enable']} | ${True} -| | Run keyword if | $state == 'disabled' -| | ... | Should be equal as strings -| | ... | ${data['gpe-state']['gpe-feature-data']['enable']} | ${False} - -| LISP GPE state from VAT should be -| | [Documentation] | Retrieves LISP state from VAT,\ -| | ... | and compares LISP state with expected value. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - state - Expected LISP state. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP state from VAT should be \| ${nodes['DUT1']} \| enabled \| -| | ... -| | [Arguments] | ${node} | ${state} -| | ... -| | ${status}= | VPP show LISP State | ${node} -| | Should match | ${status['gpe_status']} | ${state} - -| LISP GPE mapping from Honeycomb should be -| | [Documentation] | Retrieves LISP GPE mapping from Honeycomb operational\ -| | ... | data, and compares with expected data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - settings - Expected LISP mapping data. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP GPE mapping from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| ${settings} \| -| | ... -| | [Arguments] | ${node} | ${settings} -| | ... -| | ${data}= | Get LISPGPE mapping | ${node} | ${settings['id']} -| | Compare data structures | ${data} | ${settings} - -| LISP GPE mappings from Honeycomb should not exist -| | [Documentation] | Retrieves LISP GPE mappings from operational\ -| | ... | data, and expects to find none. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| LISP GPE mappings from Honeycomb should not exist \ -| | ... | \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | ${data}= | Get LISPGPE operational data | ${node} -| | Variable Should Not Exist -| | ... | ${data['gpe-state']['gpe-feature-data']['gpe-entry']} - -| Honeycomb disables all LISP GPE features -| | [Documentation] | Uses Honeycomb API to remove all LISP GPE configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables all LISP GPE features \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ... -| | Disable LISPGPE | ${node} - -| Send packet and verify LISP GPE encap -| | [Documentation] | Send ICMP packet to DUT out one interface and receive\ -| | ... | a LISP-GPE encapsulated packet on the other interface. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | _NOTE:_ Arguments are based on topology: -| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) -| | ... -| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary -| | ... | - src_ip - IP of source interface (TG-if1). Type: string -| | ... | - dst_ip - IP of destination interface (TG-if2). Type: string -| | ... | - tx_src_port - Interface of TG-if1. Type: string -| | ... | - tx_src_mac - MAC address of TG-if1. Type: string -| | ... | - tx_dst_mac - MAC address of DUT-if1. Type: string -| | ... | - rx_port - Interface of TG-if1. Type: string -| | ... | - rx_src_mac - MAC address of DUT1-if2. Type: string -| | ... | - rx_dst_mac - MAC address of TG-if2. Type: string -| | ... | - src_rloc - configured RLOC source address. Type: string -| | ... | - dst_rloc - configured RLOC destination address. Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send packet and verify LISP GPE encap \| ${nodes['TG']} \ -| | ... | \| 10.0.0.1 \| 32.0.0.1 \| -| | ... | \| eth2 \| 08:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \ -| | ... | \| eth3 \| 08:00:27:4d:ca:7a \| 08:00:27:7d:fd:10 \ -| | ... | \| 10.0.1.1 \| 10.0.1.2 \| -| | ... -| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_src_port} | -| | ... | ${tx_src_mac} | ${tx_dst_mac} | ${rx_port} | ${rx_src_mac} -| | ... | ${rx_dst_mac} | ${src_rloc} | ${dst_rloc} -| | ... -| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_src_port} -| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} -| | ${args}= | Catenate | --tg_src_mac | ${tx_src_mac} | --tg_dst_mac -| | ... | ${rx_dst_mac} | --dut_if1_mac | ${tx_dst_mac} | --dut_if2_mac -| | ... | ${rx_src_mac} | --src_ip | ${src_ip} | --dst_ip | ${dst_ip} -| | ... | --tx_if | ${tx_port_name} | --rx_if | ${rx_port_name} -| | ... | --src_rloc | ${src_rloc} | --dst_rloc | ${dst_rloc} -| | Run Traffic Script On Node | lisp/lispgpe_check.py | ${tg_node} -| | ... | ${args} - -| LISPGPE Functional Traffic Test Teardown -| | [Documentation] | Teardown for LISP GPE functional traffic test. -| | Show Packet Trace on all DUTs | ${nodes} -| | VPP Show LISP EID Table | ${node} -| | Disable LISPGPE | ${node} diff --git a/resources/libraries/robot/honeycomb/nat.robot b/resources/libraries/robot/honeycomb/nat.robot deleted file mode 100644 index c02507f412..0000000000 --- a/resources/libraries/robot/honeycomb/nat.robot +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Library | resources.libraries.python.honeycomb.NAT.NATKeywords -| Documentation | Keywords used to test Honeycomb NAT node. - -*** Keywords *** -| NAT Operational Data From Honeycomb Should Be empty -| | [Documentation] | Uses Honeycomb API to retrieve NAT operational data\ -| | ... | and expects to find only default values. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - default_settings - NAT default settings. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NAT Operational Data From Honeycomb Should Be empty \ -| | ... | \| ${nodes['DUT1']} \| ${default_settings} \| -| | [Arguments] | ${node} | ${default_settings} -| | ${data}= | Get NAT Oper data | ${node} -| | Compare data structures | ${data} | ${default_settings} - -| Honeycomb configures NAT entry -| | [Documentation] | Uses Honeycomb API to configure a static NAT entry. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - data - NAT entry to configure. Type: dictionary -| | ... | - instance - NAT instance on VPP node. Type: integer -| | ... | - index - Index of NAT entry. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures NAT entry \| ${nodes['DUT1']} \| ${data} \ -| | ... | \| ${0} \| ${1} \| -| | [Arguments] | ${node} | ${data} | ${instance}=0 | ${index}=1 -| | Configure NAT entries | ${node} | ${data} | ${instance} | ${index} - -| NAT entries from Honeycomb should be -| | [Documentation] | Uses Honeycomb API to retrieve NAT operational data\ -| | ... | and compares against expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - settings - NAT entry to expect. Type: dictionary -| | ... | - instance - NAT instance on VPP node. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NAT entries from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| ${settings} \| ${0} \| -| | [Arguments] | ${node} | ${settings} | ${instance}=0 -| | ${data}= | Get NAT Oper data | ${node} -| | ${data}= | Set Variable -| | ... | ${data['instances']['instance'][${instance}]['mapping-table']} -| | Compare data structures | ${data} | ${settings} - -| Honeycomb configures NAT on interface -| | [Documentation] | Uses Honeycomb API to configure NAT on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - direction - NAT direction parameter, inbound or outbound.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures NAT on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| outbound \| -| | [Arguments] | ${node} | ${interface} | ${direction} -| | Configure NAT on interface -| | ... | ${node} | ${interface} | ${direction} - -| Honeycomb removes NAT interface configuration -| | [Documentation] | Uses Honeycomb API to remove an existing NAT interface\ -| | ... | configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - direction - NAT direction parameter, inbound or outbound.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes NAT interface configuration \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| outbound \| -| | [Arguments] | ${node} | ${interface} | ${direction} -| | Configure NAT on interface -| | ... | ${node} | ${interface} | ${direction} | ${True} - -| NAT interface Operational Data From Honeycomb Should Be -| | [Documentation] | Uses Honeycomb API to retrieve interface operational data\ -| | ... | and compares the NAT section against expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - direction - NAT direction parameter, inbound or outbound.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NAT interface Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| outbound \| -| | [Arguments] | ${node} | ${interface} | ${direction} -| | ${data}= | Get interface oper data | ${node} | ${interface} -| | Variable should exist | ${data['interface-nat:nat']['${direction}']} - -| NAT interface Operational Data From Honeycomb Should Be empty -| | [Documentation] | Uses Honeycomb API to retrieve interface operational data\ -| | ... | and expects to find no data for the given direction. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - direction - NAT direction parameter, inbound or outbound.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NAT interface Operational Data From Honeycomb Should Be empty \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| outbound \| -| | [Arguments] | ${node} | ${interface} | ${direction} -| | ${data}= | Get interface oper data | ${node} | ${interface} -| | Variable should not exist | ${data['interface-nat:nat']['${direction}']} - -| NAT interface Operational Data From VAT Should Be -| | [Documentation] | Uses Honeycomb API to retrieve NAT configured interfaces\ -| | ... | and compares with expected settings. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - settings - settings to expect. Type: dictionary -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NAT interface Operational Data From VAT Should Be \ -| | ... | \| ${nodes['DUT1']} \| ${settings} \| -| | [Arguments] | ${node} | ${settings} -| | ${data}= | VPP get NAT interfaces | ${node} -| | Compare data structures | ${data} | ${settings} diff --git a/resources/libraries/robot/honeycomb/netconf.robot b/resources/libraries/robot/honeycomb/netconf.robot deleted file mode 100644 index 1fd287dcd4..0000000000 --- a/resources/libraries/robot/honeycomb/netconf.robot +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.Netconf -| Variables | resources/test_data/honeycomb/netconf/hello.py -| Documentation | Keywords for managing Netconf communication. - -*** Keywords *** -| Netconf session should be established -| | [Documentation] | Open a communication channel on the Netconf session\ -| | ... | and exchange hello messages. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Netconf session should be established \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Create session | ${node} | ${hello} - -| Error trigger is sent -| | [Documentation] | Send the specified error trigger through the channel. -| | ... -| | ... | *Arguments:* -| | ... | - trigger - RPC sequence that triggers a specific error. Type: string -| | ... | - params - Parameters for the trigger template. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Error trigger is sent \| <rpc>_some data_</rpc>]]>]]> \| -| | [Arguments] | ${trigger} | &{params} -| | Send | ${trigger} | &{params} - -| Replies should not contain RPC errors -| | [Documentation] | Read response received through the channel, and check if\ -| | ... | it is an error report. -| | ... -| | ... | *Arguments:* -| | ... | none -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Replies should not contain RPC errors \| -| | ${resp}= | Get all responses -| | should not contain | ${resp} | rpc-error diff --git a/resources/libraries/robot/honeycomb/notifications.robot b/resources/libraries/robot/honeycomb/notifications.robot deleted file mode 100644 index c5a481739c..0000000000 --- a/resources/libraries/robot/honeycomb/notifications.robot +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.Notifications -| Variables | resources/test_data/honeycomb/netconf/hello.py -| Variables | resources/test_data/honeycomb/netconf/subscription.py -| Documentation | Keywords used to test Honeycomb notifications over Netconf. - -*** Keywords *** -| Notification listener should be established -| | [Documentation] | Connects to Honeycomb notification service. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Notification listener should be established \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Create session | ${node} | ${hello} -| | Add notification listener | ${subscription} - -| Honeycomb should send interface state notification -| | [Documentation] | Reads notification from Honeycomb and verifies\ -| | ... | notification type, interface name and interface admin-state. -| | ... -| | ... | *Arguments:* -| | ... | - interface - name of the affected interface. Type: string -| | ... | - state - expected state of interface, 'up' or 'down'. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb should send interface state notification \ -| | ... | \| GigabitEthernet0/8/0 \| up \| -| | [Arguments] | ${interface} | ${state} -| | ${reply}= | Get notification -| | Should contain | ${reply} | <interface-change -| | Should contain | ${reply} | <name>${interface}</name> -| | Should contain | ${reply} | <admin-status>${state}</admin-status> - -| Honeycomb should send interface deleted notification -| | [Documentation] | Reads notification from Honeycomb and verifies\ -| | ... | notification type and interface name. -| | ... -| | ... | *Arguments:* -| | ... | - interface - name of the deleted interface. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb should send interface deleted notification \ -| | ... | \| temp_interface \| -| | [Arguments] | ${interface} -| | ${reply}= | Get notification -| | Should contain | ${reply} | <interface-deleted -| | Should contain | ${reply} | <name>${interface}</name> diff --git a/resources/libraries/robot/honeycomb/nsh.robot b/resources/libraries/robot/honeycomb/nsh.robot deleted file mode 100644 index dfb0c989f6..0000000000 --- a/resources/libraries/robot/honeycomb/nsh.robot +++ /dev/null @@ -1,145 +0,0 @@ -# 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 -| Library | resources.libraries.python.honeycomb.HcAPIKwNSH.NSHKeywords -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Documentation | Keywords used to test Honeycomb NSH node. - -*** Keywords *** -| NSH Operational Data From Honeycomb Should Be empty -| | [Documentation] | Uses Honeycomb API to retrieve NSH configuration\ -| | ... | and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NSH Operational Data From Honeycomb Should Be empty \ -| | ... | \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Run keyword and expect error | *Status code: 404* -| | ... | Get NSH oper data | ${node} - -| Honeycomb adds NSH entry -| | [Documentation] | Uses Honeycomb API to configure an NSH entry. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... | - name - name for the NSH entry. Type: string -| | ... | - data - settings for the NSH entry. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures NSH entry \| ${nodes['DUT1']} \| nsh_1 \ -| | ... | \| ${data} \| -| | [Arguments] | ${node} | ${name} | ${data} -| | Add NSH entry | ${node} | ${name} | ${data} - -| Honeycomb removes NSH entry -| | [Documentation] | Uses Honeycomb API to delete the specified NSH entry. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... | - name - name of the NSH entry to be deleted. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes NSH entry \| ${nodes['DUT1']} \| nsh_1 \| -| | [Arguments] | ${node} | ${name} -| | Remove NSH entry | ${node} | ${name} - -| Honeycomb adds NSH map -| | [Documentation] | Uses Honeycomb API to configure an NSH map. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... | - name - name for the NSH map. Type: string -| | ... | - data - settings for the NSH map. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures NSH map \| ${nodes['DUT1']} \| nsh_1 \ -| | ... | \| ${data} \| -| | [Arguments] | ${node} | ${name} | ${data} -| | Add NSH map | ${node} | ${name} | ${data} - -| Honeycomb removes NSH map -| | [Documentation] | Uses Honeycomb API to delete an NSH map. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... | - name - name of the NSH map to be deleted. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes NSH map \| ${nodes['DUT1']} \| nsh_1 \| -| | [Arguments] | ${node} | ${name} -| | Remove NSH map | ${node} | ${name} - -| NSH entry from Honeycomb should be -| | [Documentation] | Retrieves oper data for NSH entry and compares\ -| | ... | with provided values. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... | - name - name of the NSH entry. Type: string -| | ... | - data - expected NSH entry settings. Type dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NSH entry from Honeycomb should be \| ${nodes['DUT1']} \| nsh_1 \ -| | ... | \| ${data} \| -| | [Arguments] | ${node} | ${name} | ${data} -| | ${oper_data}= | Get NSH oper data | ${node} | entry_name=${name} -| | Compare data structures | ${oper_data} | ${data} - -| NSH map from Honeycomb should be -| | [Documentation] | Retrieves oper data for NSH map and compares\ -| | ... | with provided values. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... | - name - name of the NSH map. Type: string -| | ... | - data - expected NSH map settings. Type dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NSH map from Honeycomb should be \| ${nodes['DUT1']} \| nsh_1 \ -| | ... | \| ${data} \| -| | [Arguments] | ${node} | ${name} | ${data} -| | ${oper_data}= | Get NSH oper data | ${node} | map_name=${name} -| | Compare data structures | ${oper_data} | ${data} - -| NSH map from Honeycomb should not exist -| | [Documentation] | Retrieves oper data for NSH map and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dict -| | ... | - name - name of the NSH map. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| NSH map from Honeycomb should not exist \| ${nodes['DUT1']} \ -| | ... | \| nsh_1 \| -| | [Arguments] | ${node} | ${name} -| | Run keyword and expect error | *Status code: 404* -| | ... | Get NSH oper data | ${node} | map_name=${name} - -| Honeycomb clears NSH configuration -| | [Documentation] | Uses Honeycomb API to remove all NSH settings. -| | ... -| | [Arguments] | ${node} -| | Clear NSH settings | ${node}
\ No newline at end of file diff --git a/resources/libraries/robot/honeycomb/papi.robot b/resources/libraries/robot/honeycomb/papi.robot deleted file mode 100644 index 33797f1aea..0000000000 --- a/resources/libraries/robot/honeycomb/papi.robot +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2019 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.L2Util - -*** Keywords *** -| Get L2 FIB entry PAPI -| | [Documentation] | Retrieve the operational data about the specified L2 \ -| | ... | FIB entry using Python API. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_index - Index of the bridge domain. Type: integer -| | ... | - mac - MAC address. Type: string -| | ... -| | ... | *Example:* -| | ... | \| Get L2 FIB entry PAPI \ -| | ... | \| ${nodes['DUT1']} \| test_bd \| 00:fe:c8:e5:46:d1 \| -| | ... -| | [Arguments] | ${node} | ${bd_index} | ${mac} -| | ... -| | [Return] | ${l2_fib_data} -| | ... -| | ${l2_fib_data}= | Get L2 FIB entry by MAC | ${node} | ${bd_index} -| | ... | ${mac} - -| Get L2 FIB table PAPI -| | [Documentation] | Retrieve L2 FIB table data of the specified bridge \ -| | ... | domain using Python API. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - bd_index - Index of the bridge domain. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| Get L2 FIB table PAPI \| ${nodes['DUT1']} \| test_bd \| -| | ... -| | [Arguments] | ${node} | ${bd_index} -| | ... -| | [Return] | ${l2_fib_data} -| | ... -| | ${l2_fib_data}= | Get L2 FIB table | ${node} | ${bd_index} diff --git a/resources/libraries/robot/honeycomb/performance.robot b/resources/libraries/robot/honeycomb/performance.robot deleted file mode 100644 index a4d8d101e7..0000000000 --- a/resources/libraries/robot/honeycomb/performance.robot +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.Performance -| Library | resources.libraries.python.InterfaceUtil -| Resource | resources/libraries/robot/honeycomb/honeycomb.robot -| Documentation | Keywords used in Honeycomb performance testing. - -*** Keywords *** -| Configure Honeycomb Netconf threads -| | [Documentation] | Modify thread configuration of Honeycomb's Netconf server, -| | ... | Requires a restart of Honeycomb to take effect. -| | ... -| | ... | *Arguments:* -| | ... | - node - Node to change configuration on. Type: dictionary -| | ... | - threads - Number of threads to configure. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure Honeycomb Netconf Threads \| ${nodes[DUT1]} \| ${2} \| -| | ... -| | [Arguments] | ${node} | ${threads} -| | Configure Netconf Threads | ${node} | ${threads} - -| Run base operational read performance trial -| | [Documentation] | Send Netconf requests over plain TCP to obtain VPP version -| | ... | from Honeycomb operational data. -| | ... -| | ... | *Arguments:* -| | ... | - node - Node to run test on. Type: dictionary -| | ... | - cores - Number of available processor cores. Type: integer -| | ... | - cycles - Number of test cycles to run. Final results will\ -| | ... | be averaged across all runs. Type: integer -| | ... | - threads - Number of threads to use for generating traffic.\ -| | ... | Type: integer -| | ... | - requests - Number of requests to send in each thread and cycle.\ -| | ... | Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Run base operational read performance trial \| ${nodes[DUT1]} \ -| | ... | \| ${36} \| ${1} \| ${4} \| ${10000} \| -| | ... -| | [Arguments] | ${node} | ${cores} | ${cycles} | ${threads} | ${requests} -| | ${result}= | Run traffic script on DUT | ${node} | read_vpp_version.py -| | ... | ${cores} | cycles=${cycles} | threads=${threads} -| | ... | requests=${requests} -| | Set Test Message | ${result} - -| Generate VPP Startup Configuration for Honeycomb Test on DUT -| | [Arguments] | ${node} -| | [Documentation] | Create VPP base startup configuration on DUT, then restart -| | ... | VPP to apply the configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - VPP node to configure. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Generate VPP Startup Configuration for Honeycomb Test on DUT \ -| | ... | \| ${nodes[DUT1]} \| -| | ... -| | Import Library | resources.libraries.python.VppConfigGenerator -| | ... | WITH NAME | VPP_config -| | Run keyword | VPP_config.Set Node | ${node} -| | Run keyword | VPP_config.Add Unix Log -| | Run keyword | VPP_config.Add Unix CLI Listen -| | Run keyword | VPP_config.Add Unix Nodaemon -| | Run keyword | VPP_config.Add Socksvr -| | Run keyword | VPP_config.Add CPU Main Core | ${1} -| | Run keyword | VPP_config.Apply Config - -| Log Honeycomb and VPP process distribution on cores -| | [Documentation] | Log the distribution of VPP and Honeycomb child processes -| | ... | over the CPU cores. -| | ... -| | ... | *Arguments:* -| | ... | - node - Honeycomb node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Log Honeycomb and VPP process distribution on cores \ -| | ... | \| ${nodes[DUT1]} \| -| | ... -| | [Arguments] | ${node} -| | Log Core Schedule | ${node} | vpp -| | Log Core Schedule | ${node} | java - -| Generate Honeycomb startup configuration for performance test -| | [Documentation] | Create HC startup configuration and apply to config -| | ... | file on DUT. Requires Honeycomb restart to take effect. -| | ... -| | ... | *Arguments:* -| | ... | - node - Honeycomb node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Generate Honeycomb startup configuration for performance test \ -| | ... | \| ${nodes[DUT1]} \| -| | ... -| | [Arguments] | ${node} | ${cores} -| | Import Library | resources.libraries.python.honeycomb.HoneycombSetup.HoneycombStartupConfig -| | ... | WITH NAME | HC_config -| | Run Keyword | HC_config.Set CPU Scheduler | FIFO -| | Run Keyword | HC_config.Set CPU Core Affinity | ${2} | ${cores} -| | Run Keyword | HC_config.Set JIT Compiler Mode | server -| | Run Keyword | HC_config.Set Memory Size | ${512} | ${2048} -| | Run Keyword | HC_config.Set Metaspace Size | ${128} | ${512} -| | Run Keyword | HC_config.Set NUMA Optimization -| | Run Keyword | HC_config.apply config | ${node} diff --git a/resources/libraries/robot/honeycomb/persistence.robot b/resources/libraries/robot/honeycomb/persistence.robot deleted file mode 100644 index bc2b167f28..0000000000 --- a/resources/libraries/robot/honeycomb/persistence.robot +++ /dev/null @@ -1,332 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Library | resources.libraries.python.honeycomb.HcPersistence -| Resource | resources/libraries/robot/honeycomb/honeycomb.robot -| Resource | resources/libraries/robot/honeycomb/interfaces.robot -| Resource | resources/libraries/robot/honeycomb/vxlan.robot -| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot -| Resource | resources/libraries/robot/honeycomb/tap.robot -| Resource | resources/libraries/robot/honeycomb/vhost_user.robot -| Resource | resources/libraries/robot/honeycomb/sub_interface.robot -| Variables | resources/test_data/honeycomb/persistence.py | ${interface} -| Documentation | Keywords used to test Honeycomb persistence. - -*** Keywords *** -| Restart Honeycomb -| | [Documentation] | Restarts Honeycomb without clearing persistence data. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Restart Honeycomb \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Stop Honeycomb service on DUTs | ${node} -| | Log Persisted Configuration | ${node} -| | Configure Honeycomb service on DUTs | ${node} - -| Restart VPP -| | [Documentation] | Restarts VPP and waits until it reconnects with Honeycomb. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Restart VPP \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Restart Vpp Service | ${node} -| | Verify Vpp | ${node} -| | VPP Enable Traces On DUT | ${node} -| | Check VPP connection | ${node} - -| Check VPP connection -| | [Documentation] | Checks if Honeycomb is connected to VPP by reading VPP\ -| | ... | version number from Honeycomb operational data. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Check VPP connection \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Wait until keyword succeeds | 2min | 20sec -| | ... | Check Honeycomb startup state | ${node} - -| Restart Honeycomb and VPP in pesistence test -| | [Documentation] | Stops Honeycomb, restarts VPP and then starts Honeycomb\ -| | ... | again. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Stop Honeycomb service on DUTs | ${node} -| | Log Persisted Configuration | ${node} -| | Restart Vpp Service | ${node} -| | Verify Vpp | ${node} -| | VPP Enable Traces On DUT | ${node} -| | Configure Honeycomb service on DUTs | ${node} - -| Multi-Feature Persistence Test Configuration -| | [Documentation] | Uses Honeycomb to set basic settings for VxLAN,\ -| | ... | bridge domains, TAP, vhost-user and VLAN. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Multi-Feature Persistence Test Configuration \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | Honeycomb sets interface VxLAN configuration -| | ... | ${node} | ${vx_interface} | ${vxlan_settings} -| | Honeycomb creates first l2 bridge domain -| | ... | ${node} | ${bd_name} | ${bd_settings} -| | Honeycomb creates TAP interface -| | ... | ${node} | ${tap_interface} | ${tap_settings} -| | Honeycomb creates vhost-user interface -| | ... | ${node} | ${vhost_interface} | ${vhost_user_client} -| | Honeycomb creates sub-interface | ${node} | ${interface} -| | ... | ${sub_if_1_match} | ${sub_if_1_tags} | ${sub_if_1_settings} -| | Honeycomb configures interface state | ${node} | ${interface} | up -| | Honeycomb sets the sub-interface up -| | ... | ${node} | ${interface} | ${sub_if_id} -| | Honeycomb adds sub-interface to bridge domain -| | ... | ${node} | ${interface} | ${sub_if_id} | ${sub_bd_settings} -| | Honeycomb configures tag rewrite -| | ... | ${node} | ${interface} | ${sub_if_id} | ${tag_rewrite_pop_1} - -| Multi-Feature persistence Test Verification -| | [Documentation] | Uses Honeycomb and VAT to verify settings for VxLAN,\ -| | ... | bridge domains, TAP, vhost-user and VLAN. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Multi-Feature persistence Test Verification \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | VxLAN Operational Data From Honeycomb Should Be -| | ... | ${node} | ${vx_interface} | ${vxlan_settings} -| | VxLAN Operational Data From VAT Should Be -| | ... | ${node} | ${vxlan_settings} -| | Bridge domain Operational Data From Honeycomb Should Be -| | ... | ${node} | ${bd_name} | ${bd_settings} -| | Bridge domain Operational Data From VAT Should Be -| | ... | ${node} | ${0} | ${bd_settings} -| | TAP Operational Data From Honeycomb Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings_oper} -| | TAP Operational Data From VAT Should Be -| | ... | ${node} | ${tap_interface_vat} | ${tap_settings_vat} -| | Vhost-user Operational Data From Honeycomb Should Be -| | ... | ${node} | ${vhost_interface} | ${vhost_user_client} -| | Vhost-user Operational Data From VAT Should Be -| | ... | ${node} | ${vhost_user_client} -| | Sub-interface Operational Data From Honeycomb Should Be -| | ... | ${node} | ${interface} | ${sub_if_id} | ${sub_if_1_oper} -| | Sub-interface Operational Data From VAT Should Be -| | ... | ${node} | ${sub_if_name} | ${sub_if_1_oper} -| | Interface state from Honeycomb should be | ${node} | ${interface} | up -| | Interface state from VAT should be | ${node} | ${interface} | up -| | Sub-interface bridge domain Operational Data From Honeycomb Should Be -| | ... | ${node} | ${interface} | ${sub_if_id} | ${sub_bd_settings} -| | Sub-interface bridge domain Operational Data From PAPI Should Be -| | ... | ${node} | ${sub_if_name} | ${sub_bd_settings} -| | Rewrite tag from Honeycomb should be -| | ... | ${node} | ${interface} | ${sub_if_id} | ${tag_rewrite_pop_1_oper} -| | Rewrite tag from VAT should be -| | ... | ${node} | ${sub_if_name} | ${tag_rewrite_pop_1_VAT} -| | ${data_conf}= | Get all interfaces cfg data | ${node} -| | ${data_oper}= | Get all interfaces oper data | ${node} -| | Compare interface lists | ${data_conf} | ${data_oper} - -| Honeycomb and VPP should have default configuration -| | [Documentation] | Uses Honeycomb and VAT to verify settings for VxLAN,\ -| | ... | bridge domains, TAP, vhost-user and VLAN. Expects default\ -| | ... | configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb and VPP should have default configuration \| -| | ... | ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | VxLAN Operational Data From Honeycomb Should Be empty -| | ... | ${node} | ${vx_interface} -| | VxLAN Operational Data From VAT Should Be empty | ${node} -| | Honeycomb should show no bridge domains | ${node} -| | PAPI should show no bridge domains | ${node} -| | TAP Operational Data From Honeycomb Should Be empty -| | ... | ${node} | ${tap_interface} -| | TAP Operational Data From VAT Should Be empty -| | ... | ${node} | ${tap_interface} -| | Vhost-user Operational Data From Honeycomb Should Be empty -| | ... | ${node} | ${vhost_interface} -| | Vhost-user Operational Data From VAT Should Be empty -| | ... | ${node} -| | interface state from Honeycomb should be -| | ... | ${node} | ${interface} | down -| | And interface state from VAT should be -| | ... | ${node} | ${interface} | down - -| Persistence file is damaged during restart -| | [Documentation] | Shuts down Honeycomb, modifies persistence files to\ -| | ... | simulate damage, then restarts VPP and starts up Honeycomb again. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Persistence file is damaged during restart \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Stop Honeycomb service on DUTs | ${node} -| | Modify persistence files | ${node} | { | abc -| | Restart Vpp Service | ${node} -| | Verify Vpp | ${node} -| | VPP Enable Traces On DUT | ${node} -| | Configure Honeycomb service on DUTs | ${node} - -| Log persisted configuration on node -| | [Documentation] | Logs the content of Honeycomb's persitence files. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Log persisted configuration on node \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Log persisted configuration | ${node} - -| Interface Persistence Setup -| | [Documentation] | Configure interface state, ipv4 and ipv6 addresses -| | ... | and neighbors. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface Persistence Setup \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Honeycomb and VPP should have default configuration | ${node} -| | Import Variables | resources/test_data/honeycomb/interface_ip.py -| | Honeycomb configures interface state | ${node} | ${interface} | up -| | Honeycomb sets interface IPv4 address with prefix -| | ... | ${node} | ${interface} | ${ipv4_address} | ${ipv4_prefix} -| | Honeycomb adds interface IPv4 neighbor -| | ... | ${node} | ${interface} | ${ipv4_neighbor} | ${neighbor_mac} -| | Honeycomb sets interface IPv6 address -| | ... | ${node} | ${interface} | ${ipv6_address} | ${ipv6_prefix} -| | Honeycomb adds interface IPv6 neighbor -| | ... | ${node} | ${interface} | ${ipv6_neighbor} | ${neighbor_mac} - -| Interface Persistence Check -| | [Documentation] | Verify interface state, ipv4 and ipv6 addresses -| | ... | and neighbors. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface Persistence Check \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Interface state from Honeycomb should be | ${node} | ${interface} | up -| | IPv4 address from Honeycomb should be -| | ... | ${node} | ${interface} | ${ipv4_address} | ${ipv4_prefix} -| | IPv4 address from VAT should be -| | ... | ${node} | ${interface} | ${ipv4_address} -| | ... | ${ipv4_prefix} | ${ipv4_mask} -| | IPv4 neighbor from Honeycomb should be -| | ... | ${node} | ${interface} | ${ipv4_neighbor} | ${neighbor_mac} -| | IPv6 address from Honeycomb should contain -| | ... | ${node} | ${interface} | ${ipv6_address} | ${ipv6_prefix} -| | IPv6 address from VAT should contain -| | ... | ${node} | ${interface} | ${ipv6_address} -| | ... | ${ipv6_prefix} | ${ipv6_mask} -| | IPv6 neighbor from Honeycomb should be -| | ... | ${node} | ${interface} | ${ipv6_neighbor} | ${neighbor_mac} - -| Bridge Domain Persistence Setup -| | [Documentation] | Configure bridge domain, BD interface assignment -| | ... | and L2 fib entry. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Bridge Domain Persistence Setup \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Honeycomb and VPP should have default configuration | ${node} -| | Import Variables | resources/test_data/honeycomb/l2_fib.py -| | ... | ${node} | ${interface} | ${interface} -| | Honeycomb creates first l2 bridge domain -| | ... | ${node} | ${bd_name} | ${bd_settings} -| | Honeycomb adds interface to bridge domain -| | ... | ${node} | ${interface} | ${bd_name} | ${if_bd_settings} -| | Honeycomb adds L2 FIB entry to bridge domain -| | ... | ${node} | ${bd_name} | ${l2_fib_forward_cfg} - -| Bridge Domain Persistence Check -| | [Documentation] | Verify bridge domain, BD interface assignment -| | ... | and L2 fib entry. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Bridge Domain Persistence Check \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | Bridge domain Operational Data From Honeycomb Should Be -| | ... | ${node} | ${bd_name} | ${bd_settings} -| | Bridge domain Operational Data From VAT Should Be -| | ... | ${node} | ${0} | ${bd_settings} -| | Bridge domain Operational Interface Assignment should be -| | ... | ${node} | ${interface} | ${if_bd_settings} -| | L2 FIB Entry from Honeycomb should be -| | ... | ${node} | ${bd_name} | ${l2_fib_forward_oper} -| | L2 FIB entry from PAPI should be -| | ... | ${node} | ${bd_index} | ${l2_fib_forward_vat}
\ No newline at end of file diff --git a/resources/libraries/robot/honeycomb/policer.robot b/resources/libraries/robot/honeycomb/policer.robot deleted file mode 100644 index 87b97470ac..0000000000 --- a/resources/libraries/robot/honeycomb/policer.robot +++ /dev/null @@ -1,162 +0,0 @@ -# Copyright (c) 2017 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/shared/traffic.robot -| Library | resources.libraries.python.honeycomb.Routing.RoutingKeywords -| Variables | resources/test_data/honeycomb/policer_variables.py -| Documentation | Keywords used to test Policer using Honeycomb. - -*** Keywords *** -| Honeycomb Configures Policer -| | [Documentation] | Uses Honeycomb API to configure Policer on the specified\ -| | ... | interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - policer_data - data needed to configure Policer. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb Configures Policer \| ${node} \ -| | ... | \| ${policer_data} \| -| | ... -| | [Arguments] | ${node} | ${policer_data} -| | Configure Policer -| | ... | ${node} | ${policer_data['name']} | ${policer_data} - -| Policer Operational Data From Honeycomb Should Be -| | [Documentation] | Retrieves Policer operational data and verifies if\ -| | ... | Policer is configured correctly. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - policer_data - data to compare configuration Policer with.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Policer Operational Data From Honeycomb Should Be \ -| | ... | \| ${node} \| ${policer_data} \| -| | ... -| | [Arguments] | ${node} | ${policer_data} -| | ${data}= | Get Policer oper data | ${node} | ${policer_data['name']} -| | Compare data structures | ${data[0]} | ${policer_data} - -| Policer Operational Data From Honeycomb Should Be empty -| | [Documentation] | Checks whether Policer configuration from Honeycomb \ -| | ... | is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Policer Operational Data From Honeycomb Should Be empty \ -| | ... | \| ${node} \| -| | ... -| | [Arguments] | ${node} -| | Run keyword and expect error | HoneycombError*404* -| | ... | Get Policer oper data | ${node} | ${policer_data['name']} - -| Honeycomb removes Policer configuration -| | [Documentation] | Uses Honeycomb API to remove Policer configuration\ -| | ... | from the specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes Policer configuration \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} -| | Configure Policer | ${node} | ${policer_data['name']} - -| Tear down policer test -| | [Documentation] | Uses Honeycomb API to remove Policer configuration\ -| | ... | and reset interface state. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes Policer configuration \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} -| | Honeycomb removes Policer configuration | ${node} - -| Honeycomb enables Policer on interface -| | [Documentation] | Uses Honeycomb API to enable Policer on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - table_name - name of an ACL table. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables ACL on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabithEthernet0/8/0 \| table0 \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${table_name} -| | Enable Policer on interface -| | ... | ${node} | ${interface} | ${table_name} - -| Honeycomb disables Policer on interface -| | [Documentation] | Uses Honeycomb API to disable Policer on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables Policer on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabithEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | Disable Policer on interface -| | ... | ${node} | ${interface} - -| Honeycomb Send packet and verify marking -| | [Documentation] | Send packet and verify DSCP of the received packet. -| | ... -| | ... | *Arguments:* -| | ... | - node - TG node. Type: dictionary -| | ... | - tx_if - TG transmit interface. Type: string -| | ... | - rx_if - TG receive interface. Type: string -| | ... | - src_mac - Packet source MAC. Type: string -| | ... | - dst_mac - Packet destination MAC. Type: string -| | ... | - src_ip - Packet source IP address. Type: string -| | ... | - dst_ip - Packet destination IP address. Type: string -| | ... | - dscp_num - DSCP value to verify. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| ${dscp}= \| DSCP AF22 \| -| | ... | \| Send packet and verify marking \| ${nodes['TG']} \| eth1 \| eth2 \ -| | ... | \| 08:00:27:87:4d:f7 \| 52:54:00:d4:d8:22 \| 192.168.122.2 \ -| | ... | \| 192.168.122.1 \| ${dscp} \| -| | ... -| | [Arguments] | ${node} | ${tx_if} | ${rx_if} | ${src_mac} | ${dst_mac} -| | ... | ${src_ip} | ${dst_ip} | ${dscp_num} -| | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_if} -| | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_if} -| | ${args}= | Traffic Script Gen Arg | ${rx_if_name} | ${tx_if_name} -| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} -| | ${args}= | Set Variable | ${args} --dscp ${dscp_num} -| | Run Traffic Script On Node | policer.py | ${node} | ${args} diff --git a/resources/libraries/robot/honeycomb/port_mirroring.robot b/resources/libraries/robot/honeycomb/port_mirroring.robot deleted file mode 100644 index 5ae0c46ae1..0000000000 --- a/resources/libraries/robot/honeycomb/port_mirroring.robot +++ /dev/null @@ -1,254 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Library | resources.libraries.python.telemetry.SPAN -| Library | resources.libraries.python.InterfaceUtil -| Library | resources.libraries.python.IPUtil -| Library | resources.libraries.python.Trace - -*** Keywords *** -| Honeycomb configures SPAN on interface -| | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\ -| | ... | interface, mirroring one or more interfaces. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination interface. Type: string -| | ... | - src_interfaces - Mirroring source interfaces. Type: list \ -| | ... | of dictionaries -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures SPAN on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| [{'iface-ref': 'GigabitEthernet0/10/0', \ -| | ... | \| 'state': 'transmit'}, \ -| | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces} -| | Configure interface SPAN -| | ... | ${node} | ${dst_interface} | ${src_interfaces} - -| Interface SPAN Operational Data From Honeycomb Should Be -| | [Documentation] | Retrieves interface operational data and verifies that\ -| | ... | SPAN mirroring is configured with the provided interfaces. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination interface. Type: string -| | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\ -| | ... | any number of strings -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface SPAN Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces} -| | ${data}= | Get interface oper data | ${node} | ${dst_interface} -| | ${data}= | Set Variable -| | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']} -| | Sort list | ${data} -| | Sort list | ${src_interfaces} -| | Lists should be equal | ${data} | ${src_interfaces} - -| Interface SPAN Operational Data From Honeycomb Should Be empty -| | [Documentation] | Checks whether SPAN configuration from Honeycomb is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination interface. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface SPAN Operational Data From Honeycomb Should Be empty \ -| | ... | \| ${node} \| GigabitEthernetO/8/0 \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} -| | ${data}= | Get interface oper data | ${node} | ${dst_interface} -| | Variable should not exist -| | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']} - -| Interface SPAN Operational Data From VAT Should Be -| | [Documentation] | Retrieves SPAN configuration from VAT dump and verifies\ -| | ... | that SPAN mirroring is configured with the provided interfaces. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination interface. Type: string -| | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\ -| | ... | any number of strings -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface SPAN Operational Data From VAT Should Be \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces} -| | ${data}= | VPP get SPAN configuration by interface -| | ... | ${node} | ${dst_interface} | name -| | Sort list | ${data} -| | Sort list | ${src_interfaces} -| | Lists should be equal | ${data} | ${src_interfaces} - -| Honeycomb removes interface SPAN configuration -| | [Documentation] | Uses Honeycomb API to remove SPAN configuration\ -| | ... | from the specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination interface. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes interface SPAN configuration \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} -| | Configure interface SPAN | ${node} | ${dst_interface} - -| Interface SPAN Operational Data from Honeycomb should not exist -| | [Documentation] | Retrieves interface operational data and verifies that\ -| | ... | SPAN mirroring is not configured. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination interface. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| -| | [Arguments] | ${node} | ${dst_interface} -| | ${data}= | Get interface oper data | ${node} | ${dst_interface} -| | Run keyword and expect error | *KeyError* | Set Variable -| | ... | ${data['span']['mirrored-interfaces']['mirrored-interface']} - -| SPAN Operational Data from VAT should not exist -| | [Documentation] | Attmepts to retrieve SPAN Operational Data from VAT dump,\ -| | ... | and expects to fail with no data retrieved. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| SPAN Operational Data from VAT should not exist \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Run keyword and expect error | ValueError: No JSON object could be decoded -| | ... | VPP get SPAN configuration by interface | ${node} | local0 - -| Honeycomb Configures SPAN on sub-interface -| | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\ -| | ... | sub-interface, mirroring one or more interfaces. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination super-interface. Type: string -| | ... | - index - Index of mirroring destination sub-interface. Type: integer -| | ... | - src_interfaces - Mirroring source interfaces. Type: list \ -| | ... | of dictionaries -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb Configures SPAN on sub-interface \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| ${1} \ -| | ... | \|[{'iface-ref': 'GigabitEthernet0/10/0', 'state': 'transmit'}, \ -| | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces} -| | Configure sub interface SPAN -| | ... | ${node} | ${dst_interface} | ${index} | ${src_interfaces} - -| Sub-Interface SPAN Operational Data from Honeycomb should be -| | [Documentation] | Retrieves sub-interface operational data and verifies\ -| | ... | that SPAN mirroring is configured with the provided interfaces. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination super-interface. Type: string -| | ... | - index - Index of mirroring destination sub-interface. Type: integer -| | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\ -| | ... | any number of strings -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should be \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \ -| | ... | \| GigabitEthernet0/9/0 \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces} -| | ${data}= | Get sub interface oper data -| | ... | ${node} | ${dst_interface} | ${index} -| | ${data}= | Set Variable -| | ... | ${data['subinterface-span:span']['mirrored-interfaces']['mirrored-interface']} -| | Sort list | ${data} -| | Sort list | ${src_interfaces} -| | Lists should be equal | ${data} | ${src_interfaces} - -| Sub-Interface SPAN Operational Data from Honeycomb should be empty -| | [Documentation] | Checks whether SPAN Operational Data from Honeycomb is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination super-interface. Type: string -| | ... | - index - Index of mirroring destination sub-interface. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Interface SPAN Operational Data from Honeycomb should be empty \ -| | ... | \| ${node} \| GigabitEthernetO/8/0 \| ${1} \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} | ${index} -| | ${data}= | Get sub interface oper data -| | ... | ${node} | ${dst_interface} | ${index} -| | Variable should not exist -| | ... | ${data['subinterface-span:span']['mirrored-interfaces']['mirrored-interface']} - -| Honeycomb removes sub-interface SPAN configuration -| | [Documentation] | Uses Honeycomb API to remove SPAN Operational Data\ -| | ... | from the specified sub-interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination super-interface. Type: string -| | ... | - index - Index of mirroring destination sub-interface. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes sub-interface SPAN configuration \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| -| | ... -| | [Arguments] | ${node} | ${dst_interface} | ${index} -| | Configure sub interface SPAN -| | ... | ${node} | ${dst_interface} | ${index} - -| Sub-Interface SPAN Operational Data from Honeycomb should not exist -| | [Documentation] | Retrieves sub-interface operational data and verifies -| | ... | that SPAN mirroring is not configured. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - dst_interface - Mirroring destination super-interface. Type: string -| | ... | - index - Index of mirroring destination sub-interface. Type: integer -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should not exist \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| -| | .... -| | [Arguments] | ${node} | ${dst_interface} | ${index} -| | ${data}= | Get sub interface oper data -| | ... | ${node} | ${dst_interface} | ${index} -| | Run keyword and expect error | *KeyError* | Set Variable -| | ... | ${data['subinterface-span:span']['mirrored-interfaces']['mirrored-interface']}
\ No newline at end of file diff --git a/resources/libraries/robot/honeycomb/provider_backbone_bridge.robot b/resources/libraries/robot/honeycomb/provider_backbone_bridge.robot deleted file mode 100644 index 130e184d9c..0000000000 --- a/resources/libraries/robot/honeycomb/provider_backbone_bridge.robot +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords - -*** Keywords *** -| Honeycomb creates PBB sub-interface -| | [Documentation] | Uses Honeycomb API to set PBB sub-interface on an\ -| | ... | interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - sub_if_id - Sub-interface ID. Type: string -| | ... | - params - Parameters of the sub-interface to be created. -| | ... | Type - dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb creates PBB sub-interface \| ${node} \| ${super_if}\ -| | ... | \| ${cfg_pbb_sub_if_1} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${params} -| | ... -| | Set Interface Up | ${node} | ${super_if} -| | Create PBB Sub Interface -| | ... | ${node} | ${super_if} | ${params} - -| Honeycomb removes PBB sub-interface -| | [Documentation] | Uses Honeycomb API to remove PBB sub-interface from its\ -| | ... | super interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - sub_if_id - Sub-interface ID. Type: string -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb removes PBB sub-interface\ -| | ... | \| ${node} \| ${super_if} \| -| | ... -| | [Arguments] | ${node} | ${super_if} -| | ... -| | Delete PBB Sub Interface | ${node} | ${super_if} - -| Honeycomb fails to create PBB sub-interface -| | [Documentation] | Uses Honeycomb API to set PBB sub-interface with wrong\ -| | ... | parameter(s) and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - sub_if_id - Sub-interface ID. Type: string -| | ... | - params - Parameters of the sub-interface to be created. -| | ... | Type - dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb fails to create PBB sub-interface\ -| | ... | \| ${node} \| ${super_if} \| ${cfg_pbb_sub_if_no_vlan_tag} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${params} -| | ... -| | Set Interface Up | ${node} | ${super_if} -| | Run keyword and expect error | *HoneycombError*not successful*. -| | ... | Create PBB Sub Interface -| | ... | ${node} | ${super_if} | ${params} diff --git a/resources/libraries/robot/honeycomb/proxyarp.robot b/resources/libraries/robot/honeycomb/proxyarp.robot deleted file mode 100644 index 2df1d3c13a..0000000000 --- a/resources/libraries/robot/honeycomb/proxyarp.robot +++ /dev/null @@ -1,193 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.ProxyARP.ProxyARPKeywords -| Library | resources.libraries.python.honeycomb.ProxyARP.IPv6NDProxyKeywords -| Documentation | Keywords used to test Honeycomb ARP proxy and IPv6ND proxy. - -*** Keywords *** -| Honeycomb configures proxyARP -| | [Documentation] | Uses Honeycomb API to configure proxyARP for a specific\ -| | ... | destination IP range. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - data - Configuration to use. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures proxyARP \| ${nodes['DUT1']} \| ${data} \| -| | [Arguments] | ${node} | ${data} -| | Configure proxyARP | ${node} | ${data} - -| Honeycomb removes proxyARP configuration -| | [Documentation] | Uses Honeycomb API to remove existing proxyARP\ -| | ... | IP range configuration. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes proxyARP configuration \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Remove proxyARP configuration | ${node} - -| Honeycomb enables proxyARP on interface -| | [Documentation] | Uses Honeycomb API to enable the proxyARP\ -| | ... | feature on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb enables proxyARP on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | Set proxyARP interface config | ${node} | ${interface} | enable - -| Honeycomb disables proxyARP on interface -| | [Documentation] | Uses Honeycomb API to disable the proxyARP\ -| | ... | feature on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables proxyARP on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Set proxyARP interface config | ${node} | ${interface} | disable - -| Honeycomb configures IPv6 ND proxy on interface -| | [Documentation] | Uses Honeycomb API to enable the IPv6 ND proxy\ -| | ... | feature on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - addresses - one or more addresses to configure ND proxy with.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures IPv6 ND proxy on interface \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 10::10 \| 10::11 \| -| | ... -| | [Arguments] | ${node} | ${interface} | @{addresses} -| | Configure IPv6ND | ${node} | ${interface} | ${addresses} - -| Honeycomb disables IPv6 ND proxy on interface -| | [Documentation] | Uses Honeycomb API to disable the IPv6 ND proxy\ -| | ... | feature on an interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb disables IPv6 ND proxy on interface \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | [Arguments] | ${node} | ${interface} -| | Configure IPv6ND | ${node} | ${interface} - -| IPv6 ND proxy from Honeycomb should be -| | [Documentation] | Retrieves IPv6 ND proxy operational data and compares\ -| | ... | with expected values. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - addresses - one or more addresses to expect. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| IPv6 ND proxy from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 10::11 \| -| | ... -| | [Arguments] | ${node} | ${interface} | @{addresses} -| | ${oper_data}= | Get interface oper data | ${node} | ${interface} -| | ${oper_data}= | Set Variable -| | ... | ${oper_data['ietf-ip:ipv6']['nd-proxy:nd-proxies']['nd-proxy']} -| | ${data}= | Evaluate | [{"address":x} for x in $addresses] -| | Sort List | ${oper_data} -| | Sort List | ${data} -| | Should be equal | ${oper_data} | ${data} - -| IPv6 ND proxy from Honeycomb should be empty -| | [Documentation] | Retrieves IPv6 ND proxy operational data and expects\ -| | ... | to fail due to no data present. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \|IPv6 ND proxy from Honeycomb should be empty \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ${oper_data}= | Get interface oper data | ${node} | ${interface} -| | Variable Should Not Exist -| | ... | ${oper_data['ietf-ip:ipv6']['nd-proxy:nd-proxies']['nd-proxy']} - -| Verify IPv6ND proxy -| | [Documentation] | Send and receive ICMPv6 messages between TG interfaces -| | ... | through Neighbor Discovery proxy. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - tg_interface1 - TG interface. Type: string -| | ... | - tg_interface2 - TG interface. Type: string -| | ... | - src_ip - Source IPv6 address to use. Type: string -| | ... | - dst_ip - Destination IPv6 address to use. Type: string -| | ... | - src_mac - MAC address of source interface. Type: string -| | ... | - dst_mac - MAC address of destination interface. Type: string -| | ... | - proxy_to_src_mac - MAC address of DUT interface on link to source\ -| | ... | TG interface. Type: string -| | ... | - proxy_to_dst_mac - MAC address of DUT interface on link to dest\ -| | ... | TG interface. Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Verify IPv6ND proxy \| ${nodes['TG']} \ -| | ... | \| eth3 \| eth4 \| 3ffe:62::1 \| 3ffe:63::2 \ -| | ... | \| 08:00:27:cc:4f:54 \| 08:00:27:64:18:d2 \ -| | ... | \| 08:00:27:c9:6a:d5 \| 08:00:27:c4:75:3a \| -| | ... -| | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2} -| | ... | ${src_ip} | ${dst_ip} | ${src_mac} | ${dst_mac} -| | ... | ${proxy_to_src_mac} | ${proxy_to_dst_mac} -| | ${tg_interface_name1}= | Get interface name | ${tg_node} | ${tg_interface1} -| | ${tg_interface_name2}= | Get interface name | ${tg_node} | ${tg_interface2} -| | ${args}= | Catenate | --tx_if | ${tg_interface_name1} -| | ... | --rx_if | ${tg_interface_name2} -| | ... | --src_ip | ${src_ip} -| | ... | --dst_ip | ${dst_ip} -| | ... | --src_mac | ${src_mac} -| | ... | --dst_mac | ${dst_mac} -| | ... | --proxy_to_src_mac | ${proxy_to_src_mac} -| | ... | --proxy_to_dst_mac | ${proxy_to_dst_mac} -| | Run Traffic Script On Node | ipv6_nd_proxy_check.py -| | ... | ${tg_node} | ${args} diff --git a/resources/libraries/robot/honeycomb/routing.robot b/resources/libraries/robot/honeycomb/routing.robot deleted file mode 100644 index 752b4fe29e..0000000000 --- a/resources/libraries/robot/honeycomb/routing.robot +++ /dev/null @@ -1,203 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.Routing.RoutingKeywords -| Documentation | Keywords used to test Honeycomb routing. - -*** Keywords *** -| Honeycomb configures routing table -| | [Documentation] | Uses Honeycomb API to configure a routing table. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - name - name for the new routing table. Type: string -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type:string -| | ... | - data - Settings for the new routing table. Type: dictionary -| | ... | - vrf - vrf-id the new table will belong to. Type: integer -| | ... | - special - Does the table contain special rules. Type: boolean -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures routing table \| ${nodes['DUT1']} \ -| | ... | \| table1 \| ipv4 \| ${data} \| ${1} \| ${TRUE} \| -| | [Arguments] | ${node} | ${name} | ${ip_version} | ${data} | ${vrf}=${1} -| | ... | ${special}=${EMPTY} -| | Configure routing table | ${node} | ${name} | ${ip_version} | ${data} -| | ... | ${vrf} | ${special} - -| Routing data from Honeycomb should contain -| | [Documentation] | Uses Honeycomb API to retrieve operational data about\ -| | ... | a routing table, and compares with the data provided. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - name - name of the routing table. Type: string -| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type:string -| | ... | - expected_data - Data to compare against. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Routing data from Honeycomb should contain \| ${nodes['DUT1']} \ -| | ... | \| table1 \| ipv4 \| ${data} \| -| | [Arguments] | ${node} | ${name} | ${ip_version} | ${expected_data} -| | ${data}= | Get Routing Table Oper | ${node} | ${name} | ${ip_version} -| | Should Contain | ${data} | ${expected_data} - -| Log routing configuration from VAT -| | [Documentation] | Uses test API to read routing configuration from VPP\ -| | ... | and prints received response into robot log. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Log routing configuration from VAT \| ${nodes['DUT1']} \| -| | [Arguments] | ${node} -| | Log routing configuration | ${node} - -| Honeycomb removes routing configuration -| | [Documentation] | Uses Honeycomb API to remove Honeycomb-created\ -| | ... | routing configuration from the node. Entries configured automatically\ -| | ... | by VPP will not be removed. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - name - name of the routing table to remove. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes routing configuration \| ${nodes['DUT1']} \ -| | ... | \| table1 \| -| | [Arguments] | ${node} | ${name} -| | Delete routing table | ${node} | ${name} - -| Verify route IPv4 -| | [Documentation] | Send an ICMP packet from one TG interface and receive\ -| | ... | it on the other TG interface. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | _NOTE:_ Arguments are based on topology: -| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) -| | ... -| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary -| | ... | - src_ip - IP of source interface (TG-if1). Type: integer -| | ... | - dst_ip - IP of destination interface (TG-if2). Type: integer -| | ... | - tx_port - Source interface (TG-if1). Type: string -| | ... | - tx_mac - MAC address of source interface (TG-if1). Type: string -| | ... | - rx_port - Destionation interface (TG-if2). Type: string -| | ... | - rx_mac - MAC address of DUT interface (DUT-if1). Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Verify route IPv4 \| ${nodes['TG']} \ -| | ... | \| 16.0.0.1 \| 32.0.0.1 \| eth1 \| 08:00:27:cc:4f:54 \ -| | ... | \| eth2 \| 08:00:27:c9:6a:d5 \| -| | ... -| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_port} -| | ... | ${tx_mac} | ${rx_port} | ${rx_mac} -| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_port} -| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} -| | ${args}= | Catenate | --src_mac | ${tx_mac} -| | ... | --dst_mac | ${rx_mac} -| | ... | --src_ip | ${src_ip} -| | ... | --dst_ip | ${dst_ip} -| | ... | --tx_if | ${tx_port_name} -| | ... | --rx_if | ${rx_port_name} -| | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args} - -| Verify route IPv6 -| | [Documentation] | Send an ICMPv6 packet from one TG interface and receive\ -| | ... | it on the other TG interface. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | _NOTE:_ Arguments are based on topology: -| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) -| | ... -| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary -| | ... | - src_ip - IP of source interface (TG-if1). Type: integer -| | ... | - dst_ip - IP of destination interface (TG-if2). Type: integer -| | ... | - tx_port - Source interface (TG-if1). Type: string -| | ... | - tx_mac - MAC address of source interface (TG-if1). Type: string -| | ... | - rx_port - Destionation interface (TG-if2). Type: string -| | ... | - rx_mac - MAC address of DUT interface (DUT-if1). Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Verify route IPv6 \| ${nodes['TG']} \ -| | ... | \| 10::1 \| 11::1 \| eth2 \| 08:00:27:cc:4f:54 \ -| | ... | \| eth4 \| 08:00:27:c9:6a:d5 \| -| | ... -| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_port} -| | ... | ${tx_mac} | ${rx_port} | ${rx_mac} -| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_port} -| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} -| | ${args}= | Catenate | --src_mac | ${tx_mac} -| | ... | --dst_mac | ${rx_mac} -| | ... | --src_ip | ${src_ip} -| | ... | --dst_ip | ${dst_ip} -| | ... | --tx_if | ${tx_port_name} -| | ... | --rx_if | ${rx_port_name} -| | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args} - -| Verify multipath route -| | [Documentation] | Send 100 ICMP or ICMPv6 packets from one TG interface\ -| | ... | and receive them on the other TG interface. Verify destination MAC\ -| | ... | addresses of the packets so that exactly 50 of them use the first\ -| | ... | address and the other 50 use the second address. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | _NOTE:_ Arguments are based on topology: -| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) -| | ... -| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary -| | ... | - src_ip - IP of source interface (TG-if1). Type: integer -| | ... | - dst_ip - IP of destination interface (TG-if2). Type: integer -| | ... | - tx_port - Source interface (TG-if1). Type: string -| | ... | - tx_src_mac - MAC address of source interface (TG-if1). Type: string -| | ... | - rx_port - Destionation interface (TG-if2). Type: string -| | ... | - tx_dst_mac - MAC address of DUT ingress interface (DUT-if1).\ -| | ... | Type: string -| | ... | - rx_src_mac - MAC address of DUT egress interface (DUT-if2).\ -| | ... | Type: string -| | ... | - rx_dst_mac1 - MAC address of first next-hop option. Type: string -| | ... | - rx_dst_mac2 - MAC address of second next-hop option. Type: string -| | ... | -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Verify multipath route \| ${nodes['TG']} \ -| | ... | \| 16.0.0.1 \| 32.0.0.1 \| eth2 \| 08:00:27:cc:4f:54 \ -| | ... | \| eth4 \| 08:00:27:c9:6a:d5 \| -| | ... | \| 00:00:00:00:00:01 \| 00:00:00:00:00:02 \| -| | ... -| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_port} -| | ... | ${tx_src_mac} | ${rx_port} | ${tx_dst_mac} | ${rx_src_mac} -| | ... | ${rx_dst_mac1} | ${rx_dst_mac2} -| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_port} -| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} -| | ${args}= | Catenate | --tg_if1_mac | ${tx_src_mac} -| | ... | --dut_if1_mac | ${tx_dst_mac} -| | ... | --src_ip | ${src_ip} -| | ... | --dst_ip | ${dst_ip} -| | ... | --tx_if | ${tx_port_name} -| | ... | --rx_if | ${rx_port_name} -| | ... | --dut_if2_mac | ${rx_src_mac} -| | ... | --path_1_mac | ${rx_dst_mac_1} -| | ... | --path_2_mac | ${rx_dst_mac_2} -| | Run Traffic Script On Node | send_icmp_check_multipath.py | ${tg_node} -| | ... | ${args}
\ No newline at end of file diff --git a/resources/libraries/robot/honeycomb/slaac.robot b/resources/libraries/robot/honeycomb/slaac.robot deleted file mode 100644 index 036d4d06ce..0000000000 --- a/resources/libraries/robot/honeycomb/slaac.robot +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -| Library | resources.libraries.python.honeycomb.Routing.RoutingKeywords -| Library | resources.libraries.python.Trace -| Documentation | Keywords used to test SLAAC using Honeycomb. - -*** Keywords *** -| Honeycomb configures SLAAC -| | [Documentation] | Uses Honeycomb API to configure SLAAC on the specified\ -| | ... | interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - slaac_data - data needed to configure SLAAC. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb configures SLAAC \| ${node} \| ${interface} \ -| | ... | \| ${slaac_data} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${slaac_data} -| | Configure interface SLAAC -| | ... | ${node} | ${interface} | ${slaac_data} - -| SLAAC Operational Data From Honeycomb Should Be -| | [Documentation] | Retrieves SLAAC operational data and verifies that\ -| | ... | SLAAC is configured with the provided interfaces. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... | - slaac_data - data to compare configuration SLAAC with.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| SLAAC Operational Data From Honeycomb Should Be \ -| | ... | \| ${node} \| ${interface} \| ${slaac_data} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${slaac_data} -| | ${data}= | Get interface SLAAC oper data | ${node} | ${interface} -| | Dictionaries should be equal | ${data} | ${slaac_data} - -| SLAAC Operational Data From Honeycomb Should Be empty -| | [Documentation] | Checks whether SLAAC configuration from Honeycomb \ -| | ... | is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| SLAAC Operational Data From Honeycomb Should Be empty \ -| | ... | \| ${node} \| ${interface} \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | Run keyword and expect error | HoneycombError*40* -| | ... | Get interface SLAAC oper data | ${node} | ${interface} - -| Honeycomb removes SLAAC configuration -| | [Documentation] | Uses Honeycomb API to remove SLAAC confirugation\ -| | ... | from the specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes SLAAC configuration \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | Configure interface SLAAC | ${node} | ${interface} - -| SLAAC test teardown -| | [Documentation] | Uses Honeycomb API to remove SLAAC confirugation\ -| | ... | and reset interface state. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes SLAAC configuration \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | Honeycomb removes SLAAC configuration | ${node} | ${interface} -| | And Honeycomb configures interface state | ${node} | ${interface} | down -| | Honeycomb removes interface IPv6 addresses | ${node} | ${interface} diff --git a/resources/libraries/robot/honeycomb/sub_interface.robot b/resources/libraries/robot/honeycomb/sub_interface.robot deleted file mode 100644 index 8bb95f51b8..0000000000 --- a/resources/libraries/robot/honeycomb/sub_interface.robot +++ /dev/null @@ -1,670 +0,0 @@ -# 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 -| Library | resources.libraries.python.IPUtil -| Library | resources.libraries.python.L2Util -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot -| Documentation | Keywords used to manipulate sub-interfaces. - -*** Keywords *** -| Honeycomb creates sub-interface -| | [Documentation] | Create a sub-interface using Honeycomb API. -| | ... -| | ... | *Arguments:* -| | ... | - 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']} \| GigabitEthernet0/8/0\ -| | ... | \| vlan-tagged-exact-match \| ${sub_if_1_tags}\ -| | ... | \| ${sub_if_1_settings} \| -| | ... -| | [Arguments] | ${node} | ${super_interface} -| | ... | ${match} | ${tags} | ${sub_interface_settings} -| | ... -| | Honeycomb Create sub interface | ${node} | ${super_interface} -| | ... | ${match} | ${tags} | &{sub_interface_settings} - -| Sub-interface Operational Data 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 -| | ... | - 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 Operational Data From Honeycomb Should Be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\ -| | ... | \| ${sub_if_1_params} \| -| | ... -| | [Arguments] | ${node} | ${super_interface} | ${identifier} -| | ... | ${sub_if_settings} -| | ... -| | ${api_data}= | Get sub interface oper data -| | ... | ${node} | ${super_interface} | ${identifier} -| | Compare Data Structures | ${api_data} | ${sub_if_settings} - -| Sub-interface Operational Data From Honeycomb Should Be empty -| | [Documentation] | Retrieves sub-interface configuration through Honeycomb \ -| | ... | and expects no data. -| | ... -| | ... | *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 Operational Data From Honeycomb Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| -| | ... -| | [Arguments] | ${node} | ${super_interface} | ${identifier} -| | ... -| | Run keyword and expect error | *KeyError: 'vpp-vlan:sub-interfaces'* -| | ... | Get sub interface oper data -| | ... | ${node} | ${super_interface} | ${identifier} - -| Sub-interface state from Honeycomb should be -| | [Documentation] | Retrieves sub-interface configuration through Honeycomb \ -| | ... | and checks the administrative and operational state. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_interface - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... | - admin_state - Required administrative state - up or down. \ -| | ... | Type: string -| | ... | - oper_state - Required operational state - up or down. Type: string -| | ... -| | ... | *Example:* -| | ... | \| Sub-interface state from Honeycomb should be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| up \| up \| -| | ... -| | [Arguments] | ${node} | ${super_interface} | ${identifier} -| | ... | ${admin_state} | ${oper_state} -| | ... -| | ${api_data}= | Get sub interface oper data -| | ... | ${node} | ${super_interface} | ${identifier} -| | Should be equal | ${api_data['admin-status']} | ${admin_state} -| | Should be equal | ${api_data['oper-status']} | ${oper_state} - -| Sub-interface Operational Data 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 -| | ... | - 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 Operational Data From VAT Should Be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_if_1_params} \| -| | ... -| | [Arguments] | ${node} | ${sub_interface} | ${sub_interface_settings} -| | ... -| | ${vat_data}= | VPP get interface data -| | ... | ${node} | ${sub_interface} -| | Should be equal as strings | ${vat_data['sub_id']} -| | ... | ${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 state from VAT should be -| | [Documentation] | Retrieves sub-interface configuration through VAT and \ -| | ... | checks the administrative and operational state. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - sub_interface - Name of an sub-interface on the specified node. \ -| | ... | Type: string -| | ... | - admin_state - Required administrative state - up or down. \ -| | ... | Type: string -| | ... | - oper_state - Required operational state - up or down. Type: string -| | ... -| | ... | *Example:* -| | ... | \| Sub-interface state from VAT should be \ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| up \| up \| -| | ... -| | [Arguments] | ${node} | ${sub_interface} | ${admin_state} | ${oper_state} -| | ... -| | ${vat_data}= | VPP get interface data -| | ... | ${node} | ${sub_interface} -| | Run keyword if | '${admin_state}' == 'down' -| | ... | Should be equal as strings | ${vat_data['admin_up_down']} | 0 -| | Run keyword if | '${admin_state}' == 'up' -| | ... | Should be equal as strings | ${vat_data['admin_up_down']} | 1 -| | Run keyword if | '${oper_state}' == 'down' -| | ... | Should be equal as strings | ${vat_data['link_up_down']} | 0 -| | Run keyword if | '${oper_state}' == 'up' -| | ... | Should be equal as strings | ${vat_data['link_up_down']} | 1 - -| 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}= | Get sub interface oper data -| | ... | ${node} | ${super_interface} | ${identifier} -| | ${vat_data}= | 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} -| | ... -| | 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} -| | ... -| | 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. -| | ... | 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 -| | ... | - 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']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings} -| | ... -| | Add bridge domain to sub interface -| | ... | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings} - -| Sub-interface bridge domain Operational Data 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 -| | ... | - 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 Operational Data From Honeycomb Should Be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} -| | ... -| | ${if_data}= | Get BD data from sub interface -| | ... | ${node} | ${super_if} | ${identifier} -| | Should be equal | ${if_data['bridge-domain']} -| | ... | ${settings['bridge-domain']} - -| Sub-interface bridge domain Operational Data From PAPI 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 Operational Data From PAPI Should Be\ -| | ... | \| ${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_details'][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']} -# interface[1] = sw_if_index, interface[2] = shg -| | Should be equal as strings | ${sw_if_data[2]} -| | ... | ${settings['split-horizon-group']} - -| 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 -| | ... | - super_if - Super-interface. Type: string -| | ... -| | ... | *Example:* -| | ... | \| 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. -| | ... | Remove all sub interfaces -| | ... | ${node} | ${super_if} - -| Honeycomb configures tag rewrite -| | [Documentation] | Honeycomb configures tag-rewrite -| | ... -| | ... | *Arguments:* -| | ... | - 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 configures tag rewrite\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\ -| | ... | \| ${tag_rewrite_push} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} -| | ... -| | Configure tag rewrite -| | ... | ${node} | ${super_if} | ${identifier} | ${settings} - -| 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 -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... -| | ... | *Example:* -| | ... | \| Rewrite tag from Honeycomb should be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} -| | ... -| | Run keyword and expect error | *Hon*Error*oper*does not contain*tag-rewrite* -| | ... | Get tag rewrite oper data -| | ... | ${node} | ${super_if} | ${identifier} - -| 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 -| | ... | - 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:* -| | ... | \| Rewrite tag from Honeycomb should be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\ -| | ... | \| ${tag_rewrite_push_oper} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} -| | ${api_data}= | Get tag rewrite oper data -| | ... | ${node} | ${super_if} | ${identifier} -| | Compare Data Structures -| | ... | ${api_data} | ${settings} - -| 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 -| | ... | - interface - name of a sub-interface on the specified node.\ -| | ... | Type: string -| | ... | - rw_settings - Parameters to be set while setting the rewrite tag.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Rewrite tag from VAT should be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${rw_params} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${rw_settings} -| | ${vat_data}= | VPP get interface data | ${node} | ${interface} -| | Compare Data Structures | ${vat_data} | ${rw_settings} - -| Honeycomb fails to set wrong rewrite tag -| | [Documentation] | Honeycomb tries to set wrong rewrite tag and expects\ -| | ... | an error. -| | ... -| | ... | *Arguments:* -| | ... | - 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']} \| GigabitEthernet0/8/0 \| 1\ -| | ... | \| ${tag_rewrite_push_WRONG} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings} -| | Run keyword and expect error | *HoneycombError: * was not successful. *00. -| | ... | Configure tag rewrite -| | ... | ${node} | ${super_if} | ${identifier} | ${settings} - -| Honeycomb sets sub-interface ipv4 address -| | [Documentation] | Uses Honeycomb API to configure an ipv4 address on the\ -| | ... | spcified sub-interface. Replaces any existing ipv4 addresses. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... | - address - IPv4 address to set. Type: string -| | ... | - prefix - IPv4 network prefix length to set. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| | Honeycomb sets sub-interface ipv4 address\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \ -| | ... | \| 192.168.0.2 \| ${24} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} -| | Add ip address to sub_interface -| | ... | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} | ipv4 - -| Sub-interface ipv4 address from Honeycomb should be -| | [Documentation] | Uses Honeycomb API to verify ipv4 address configuration\ -| | ... | on the specified sub-interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... | - address - IPv4 address to expect. Type: string -| | ... | - prefix - IPv4 network prefix length to expect. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| sub-interface ipv4 address from Honeycomb should be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \ -| | ... | \| 192.168.0.2 \| ${24} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} -| | ${if_data}= | Get sub interface oper data -| | ... | ${node} | ${super_if} | ${identifier} -| | Should be equal -| | ... | ${if_data['ipv4']['address'][0]['ip']} | ${address} -| | Should be equal -| | ... | ${if_data['ipv4']['address'][0]['prefix-length']} | ${prefix} - -| Sub-interface ipv4 address from VAT should be -| | [Documentation] | Uses VAT to verify ipv4 address configuration\ -| | ... | on the specified sub-interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - sub_interface - Name of an sub-interface on the specified node.\ -| | ... | Type: string -| | ... | - address - IPv4 address to expect. Type: string -| | ... | - prefix - IPv4 network prefix length to expect. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| sub-interface ipv4 address from VAT should be\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| -| | ... -| | [Arguments] | ${node} | ${sub_interface} | ${address} | ${prefix} -| | ${data}= | VPP get interface ip addresses -| | ... | ${node} | ${sub_interface} | ipv4 -| | Should be equal | ${data[0]['ip']} | ${address} -| | Should be equal | ${data[0]['prefix_length']} | ${prefix} - -| Honeycomb removes all sub-interface ipv4 addresses -| | [Documentation] | Uses Honeycomb API to remove all configured ipv4\ -| | ... | addresses from the sub-interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb removes all sub-interface ipv4 addresses\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} -| | Remove all ip addresses from sub_interface -| | ... | ${node} | ${super_if} | ${identifier} | ipv4 - -| Sub-interface ipv4 address from Honeycomb should be empty -| | [Documentation] | Uses Honeycomb API to verify that ipv4 address\ -| | ... | configuration on the specified sub-interface is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... -| | ... | *Example:* -| | ... | \| sub-interface ipv4 address from Honeycomb should be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} -| | ${if_data}= | Get sub interface oper data -| | ... | ${node} | ${super_if} | ${identifier} -| | Run keyword and expect error | *KeyError: 'ipv4'* -| | ... | Set Variable | ${if_data['ipv4']['address'][0]['ip']} - -| Sub-interface ipv4 address from VAT should be empty -| | [Documentation] | Uses VAT to verify that ipv4 address\ -| | ... | configuration on the specified sub-interface is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - sub_interface - Name of an sub-interface on the specified node.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... | \| sub-interface ipv4 address from VAT should be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| -| | ... -| | [Arguments] | ${node} | ${sub_interface} -| | ${data}= | VPP get interface ip addresses -| | ... | ${node} | ${sub_interface} | ipv4 -| | Should be empty | ${data} - -| Honeycomb sets sub-interface ipv6 address -| | [Documentation] | Uses Honeycomb API to configure an ipv6 address on the\ -| | ... | spcified sub-interface. Replaces any existing ipv6 addresses. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... | - address - IPv6 address to set. Type: string -| | ... | - prefix - IPv6 network prefix length to set. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| | Honeycomb sets sub-interface ipv6 address\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \ -| | ... | \| 10::10 \| ${64} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} -| | Add ip address to sub_interface -| | ... | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} | ipv6 - -| Sub-interface IPv6 address from Honeycomb should contain -| | [Documentation] | Uses Honeycomb API to verify ipv6 address configuration\ -| | ... | on the specified sub-interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... | - address - IPv6 address to expect. Type: string -| | ... | - prefix - IPv6 network prefix length to expect. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| sub-interface IPv6 address from Honeycomb should contain\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \ -| | ... | \| 10::10 \| ${64} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} -| | ${if_data}= | Get sub interface oper data -| | ... | ${node} | ${super_if} | ${identifier} -| | ${settings}= | Create Dictionary -| | ... | ip=${address} | prefix-length=${prefix} -| | Should contain | ${if_data['ipv6']['address']} | ${settings} - -| Sub-interface IPv6 address from VAT should contain -| | [Documentation] | Uses VAT to verify ipv6 address configuration\ -| | ... | on the specified sub-interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - sub_interface - Name of an sub-interface on the specified node.\ -| | ... | Type: string -| | ... | - address - IPv6 address to expect. Type: string -| | ... | - prefix - IPv6 network prefix length to expect. Type: integer -| | ... -| | ... | *Example:* -| | ... | \| sub-interface IPv6 address from VAT should contain\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| -| | ... -| | [Arguments] | ${node} | ${sub_interface} | ${address} | ${prefix} -| | ${data}= | VPP get interface ip addresses -| | ... | ${node} | ${sub_interface} | ipv6 -| | Should be equal | ${data[0]['ip']} | ${address} -| | Should be equal | ${data[0]['prefix_length']} | ${prefix} - -| Honeycomb removes all sub-interface ipv6 addresses -| | [Documentation] | Uses Honeycomb API to remove all configured ipv6\ -| | ... | addresses from the sub-interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb removes all sub-interface ipv6 addresses\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} -| | Remove all ip addresses from sub_interface -| | ... | ${node} | ${super_if} | ${identifier} | ipv6 - -| Sub-interface ipv6 address from Honeycomb should be empty -| | [Documentation] | Uses Honeycomb API to verify that ipv6 address\ -| | ... | configuration on the specified sub-interface is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - super_if - Super-interface. Type: string -| | ... | - identifier - Sub-interface ID. Type: integer or string -| | ... -| | ... | *Example:* -| | ... | \| sub-interface ipv6 address from Honeycomb should be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| -| | ... -| | [Arguments] | ${node} | ${super_if} | ${identifier} -| | ${if_data}= | Get sub interface oper data -| | ... | ${node} | ${super_if} | ${identifier} -| | Run keyword and expect error | *KeyError: 'ipv6'* -| | ... | Set Variable | ${if_data['ipv6']['address'][0]['ip']} - -| Sub-interface ipv6 address from VAT should be empty -| | [Documentation] | Uses VAT to verify that ipv6 address\ -| | ... | configuration on the specified sub-interface is empty. -| | ... -| | ... | *Arguments:* -| | ... | - node - Information about a DUT node. Type: dictionary -| | ... | - sub_interface - Name of an sub-interface on the specified node.\ -| | ... | Type: string -| | ... -| | ... | *Example:* -| | ... | \| sub-interface ipv6 address from VAT should be empty\ -| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| -| | ... -| | [Arguments] | ${node} | ${sub_interface} -| | ${data}= | VPP get interface ip addresses -| | ... | ${node} | ${sub_interface} | ipv6 -| | Should be empty | ${data} diff --git a/resources/libraries/robot/honeycomb/tap.robot b/resources/libraries/robot/honeycomb/tap.robot deleted file mode 100644 index 37d6a02f52..0000000000 --- a/resources/libraries/robot/honeycomb/tap.robot +++ /dev/null @@ -1,144 +0,0 @@ -# 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 -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Documentation | Keywords used to manipulate TAP interfaces. - -*** Keywords *** -| Honeycomb creates TAP interface -| | [Documentation] | Uses Honeycomb API to configure a new TAP interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for TAP. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb creates TAP interface \ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'host-interface-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Create TAP interface | ${node} | ${interface} -| | ... | &{settings} - -| Honeycomb configures TAP interface -| | [Documentation] | Uses Honeycomb API to configure an existing TAP interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for TAP. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb configures TAP interface \ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'host-interface-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Configure interface TAP | ${node} | ${interface} -| | ... | &{settings} - -| Honeycomb removes TAP interface -| | [Documentation] | Uses Honeycomb API to remove a TAP interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes TAP interface \ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| -| | [Arguments] | ${node} | ${interface} -| | Delete interface | ${node} | ${interface} - -| TAP Operational Data From Honeycomb Should Be -| | [Documentation] | Retrieves interface TAP configuration through Honeycomb\ -| | ... | and compares with settings supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for TAP. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| TAP Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'host-interface-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${api_tap}= | Set Variable | ${api_data['v3po:tap-v2']} -| | Should be equal | ${api_tap['device-name']} | ${settings['device-name']} -| | ${api_mac}= | Set Variable | ${api_data['phys-address']} -| | Should be equal | ${api_mac} | ${settings['mac']} - -| TAP Operational Data From VAT Should Be -| | [Documentation] | Retrieves interface TAP configuration through VAT and\ -| | ... | compares with settings supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - settings - Configuration data for TAP. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| TAP Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| ${{'host-interface-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | ${vat_data}= | TAP Dump | ${node} | ${interface} -| | Should be equal | ${vat_data['dev_name']} | ${settings['dev_name']} -| | Should be equal | ${vat_data['rx_ring_sz']} | ${settings['rx_ring_sz']} -| | Should be equal | ${vat_data['tx_ring_sz']} | ${settings['tx_ring_sz']} -# other settings not accessible through VAT commands - -| TAP Operational Data From Honeycomb Should Be empty -| | [Documentation] | Attempts to retrieve interface TAP configuration\ -| | ... | through Honeycomb and expects to recieve an empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| TAP Operational Data From Honeycomb Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError: 'v3po:tap-v2' | Set Variable -| | ... | ${api_data['v3po:tap-v2']} - -| TAP Operational Data From VAT Should Be empty -| | [Documentation] | Attempts to retrieve interface TAP configuration\ -| | ... | through VAT and expects a "no data" error. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| TAP Operational Data From VAT Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ${data}= | TAP Dump | ${node} | ${interface} -| | Should be empty | ${data} diff --git a/resources/libraries/robot/honeycomb/vhost_user.robot b/resources/libraries/robot/honeycomb/vhost_user.robot deleted file mode 100644 index d60917703f..0000000000 --- a/resources/libraries/robot/honeycomb/vhost_user.robot +++ /dev/null @@ -1,180 +0,0 @@ -# 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 -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords -| Documentation | Keywords used to manipulate vhost-user unterfaces. - -*** Keywords *** -| Honeycomb creates vhost-user interface -| | [Documentation] | Create a vhost-user interface using Honeycomb API. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for vhost-user interface.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb creates vhost-user interface\ -| | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Create vhost user interface | ${node} | ${interface} -| | ... | &{settings} - -| Honeycomb removes vhost-user interface -| | [Documentation] | Remove a vhost-user interface using Honeycomb API. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb removes vhost-user interface\ -| | ... | \| ${nodes['DUT1']} \| vhost_test \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | Delete interface | ${node} | ${interface} - -| Honeycomb configures vhost-user interface -| | [Documentation] | Configure a vhost-user interface using Honeycomb API. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for vhost-user interface.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb configures vhost-user interface\ -| | ... | \| ${nodes['DUT1']} \| vhost_test \| ${new_vhost_user_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Configure interface vhost user | ${node} | ${interface} -| | ... | &{settings} - -| Vhost-user Operational Data From Honeycomb Should Be -| | [Documentation] | Retrieves interface vhost-user 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 -| | ... | - settings - Configuration data for vhost-user interface.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Vhost-user Operational Data From Honeycomb Should Be\ -| | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${api_vhost}= | Set Variable | ${api_data['v3po:vhost-user']} -| | :FOR | ${key} | IN | @{settings.keys()} -| | | Should be equal | ${api_vhost['${key}']} | ${settings['${key}']} - -| Vhost-user Operational Data From VAT Should Be -| | [Documentation] | Retrieves interface vhost-user configuration through VAT\ -| | ... | and compares it with settings supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - settings - Configuration data for vhost-user interface.\ -| | ... | Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Vhost-user Operational Data From VAT Should Be\ -| | ... | \| ${nodes['DUT1']} \| vhost_test \| -| | ... -| | ... | *Note:* -| | ... | Due to the difficulty of identifying newly created interfaces by name\ -| | ... | or by sw_index, this keyword assumes there is only one vhost-user\ -| | ... | interface present on the specified node. -| | ... -| | [Arguments] | ${node} | ${settings} -| | &{translate}= | Create dictionary | server=1 | client=0 -| | ${vat_data}= | vhost user Dump | ${node} -| | ${vat_data}= | Set Variable | ${vat_data[0]} -| | Should be equal | ${vat_data['sock_filename']} | ${settings['socket']} -| | should be equal as strings | ${vat_data['is_server']} -| | ... | ${translate['${settings['role']}']} - -| Vhost-user Operational Data From Honeycomb Should Be empty -| | [Documentation] | Attempts to retrieve interface vhost-user configuration\ -| | ... | through Honeycomb and expects to recieve an empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... | \| Vhost-user Operational Data From Honeycomb Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| vhost_test \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError: 'v3po:vhost-user' -| | ... | Should be empty | ${api_data['v3po:vhost-user']} - -| Vhost-user Operational Data From VAT Should Be empty -| | [Documentation] | Attempts to retrieve interface vhost-user configuration\ -| | ... | through VAT and expects a "no data" error. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Vhost-user Operational Data From VAT Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ${data}= | vhost user Dump | ${node} -| | Should be empty | ${data} - -| Honeycomb fails setting vhost-user on different interface type -| | [Documentation] | Attempts to set vhost-user settings on an ethernet\ -| | ... | type interface and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for vhost-user. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb fails setting vhost-user on different interface type\ -| | ... | \| ${nodes['DUT1']} \| ${interface} \| ${vhost_user_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Run Keyword And Expect Error | HoneycombError: * Status code: 500. -| | ... | Configure interface vhost user | ${node} | ${interface} -| | ... | &{settings} - -| Honeycomb fails setting invalid vhost-user configuration -| | [Documentation] | Attempts to create a vhost-user interface with invalid\ -| | ... | configuration and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings_list - Bad configuration data for vhost-user. Type: list -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb fails setting invalid vhost-user configuration\ -| | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Run Keyword And Expect Error | HoneycombError: * Status code: 400. -| | ... | Configure interface vhost user | ${node} | ${interface} -| | ... | &{settings} diff --git a/resources/libraries/robot/honeycomb/vxlan.robot b/resources/libraries/robot/honeycomb/vxlan.robot deleted file mode 100644 index 951a0d109c..0000000000 --- a/resources/libraries/robot/honeycomb/vxlan.robot +++ /dev/null @@ -1,171 +0,0 @@ -# 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 -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords - -*** Keywords *** -| Honeycomb sets interface VxLAN configuration -| | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for VxLAN. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb sets interface VxLAN configuration \ -| | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'192.168.0.2',\ -| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Honeycomb Create VxLAN interface | ${node} | ${interface} -| | ... | &{settings} - -| Honeycomb removes VxLAN tunnel settings -| | [Documentation] | Uses Honeycomb API to disable a VxLAN tunnel and remove\ -| | ... | it from configuration data. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes VxLAN tunnel \| ${nodes['DUT1']} \| vxlan_01 \| -| | [Arguments] | ${node} | ${interface} -| | Delete interface | ${node} | ${interface} - -| VxLAN Operational Data From Honeycomb Should Be -| | [Documentation] | Retrieves interface VxLAN configuration through Honeycomb\ -| | ... | and compares with settings supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for VxLAN. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| VxLAN Operational Data From Honeycomb Should Be \ -| | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'192.168.0.2',\ -| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${api_vxlan}= | Set Variable | ${api_data['v3po:vxlan']} -| | :FOR | ${key} | IN | @{settings.keys()} -| | | Should be equal | ${api_vxlan['${key}']} | ${settings['${key}']} - -| VxLAN Operational Data From VAT Should Be -| | [Documentation] | Retrieves interface VxLAN configuration through VAT and\ -| | ... | compares with settings supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - settings - Configuration data for VxLAN. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| VxLAN Operational Data From Honeycomb Should Be \ -| | ... | \|${nodes['DUT1']} \| ${{'src':'192.168.0.2',\ -| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| -| | ... -| | ... | *Note:* -| | ... | Due to the difficulty of identifying newly created interfaces by name\ -| | ... | or by sw_index, this keyword assumes there is only one VxLAN tunnel\ -| | ... | present on the specified node. -| | [Arguments] | ${node} | ${settings} -| | ${vat_data}= | VxLAN Dump | ${node} -| | ${vat_data}= | Set Variable | ${vat_data[0]} -| | Should be equal | ${vat_data['dst_address']} | ${settings['dst']} -| | Should be equal | ${vat_data['src_address']} | ${settings['src']} -| | Should be equal | ${vat_data['vni']} | ${settings['vni']} -| | Should be equal -| | ... | ${vat_data['encap_vrf_id']} | ${settings['encap-vrf-id']} - -| VxLAN Operational Data From Honeycomb Should Be empty -| | [Documentation] | Attempts to retrieve interface VxLAN configuration\ -| | ... | through Honeycomb and expects to recieve an empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| VxLAN Operational Data From Honeycomb Should Be empty\ -| | ... | \|${nodes['DUT1']} \| vxlan_01 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError: 'v3po:vxlan' | Set Variable -| | ... | ${api_data['v3po:vxlan']} - -| VxLAN Operational Data From VAT Should Be empty -| | [Documentation] | Attempts to retrieve interface VxLAN configuration\ -| | ... | through VAT and expects a "no data" error. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| VxLAN Operational Data From VAT Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ${data}= | VxLAN Dump | ${node} -| | Should be empty | ${data} - -| Honeycomb fails setting VxLan on different interface type -| | [Documentation] | Attempts to set VxLAN settings on an ethernet\ -| | ... | type interface and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings - Configuration data for VxLAN. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb fails setting VxLan on different interface type\ -| | ... | \|${nodes['DUT1']} \| GigabitEthernet0/9/0 \| ${{'src':'192.168.0.2',\ -| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings} -| | Run Keyword And Expect Error | HoneycombError: * Status code: 500. -| | ... | Honeycomb Configure interface vxlan -| | ... | ${node} | ${interface} | &{settings} - -| Honeycomb fails setting invalid VxLAN configuration -| | [Documentation] | Attempts to create a VxLAN interface with invalid\ -| | ... | configuration and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - settings_list - Bad configuration data for VxLAN. Type: list -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb fails setting invalid VxLAN configuration\ -| | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'abcd', 'vni':-3}} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${settings_list} -| | :FOR | ${settings} | IN | @{settings_list} -| | | Run Keyword And Expect Error | HoneycombError: * Status code: 500. -| | | ... | Honeycomb Create VxLAN interface -| | | ... | ${node} | ${interface} | &{settings} diff --git a/resources/libraries/robot/honeycomb/vxlan_gpe.robot b/resources/libraries/robot/honeycomb/vxlan_gpe.robot deleted file mode 100644 index 20ca7f5f1a..0000000000 --- a/resources/libraries/robot/honeycomb/vxlan_gpe.robot +++ /dev/null @@ -1,208 +0,0 @@ -# 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 -| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords - -*** Variables *** -# Translation table used to convert values received from Honeycomb to values -# received from VAT. -| &{protocols}= -| ... | -=0 -| ... | ipv4=1 -| ... | ipv6=2 -| ... | ethernet=3 -| ... | nsh=4 - -*** Keywords *** -| Honeycomb creates VxLAN GPE interface -| | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface to be created. Type: string -| | ... | - base_settings - configuration data common for all interfaces.\ -| | ... | Type: dictionary -| | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb creates VxLAN GPE interface \ -| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${base_params} \ -| | ... | \| ${vxlan_gpe_params} \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ... | ${base_settings} | ${vxlan_gpe_settings} -| | ... -| | Create VxLAN GPE interface -| | ... | ${node} | ${interface} | &{base_settings} | &{vxlan_gpe_settings} - -| Honeycomb removes VxLAN GPE interface -| | [Documentation] | Uses Honeycomb API to remove VxLAN GPE interface from\ -| | ... | node. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of the interface to be removed. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Honeycomb removes VxLAN GPE interface \ -| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ... -| | Delete interface | ${node} | ${interface} - -| VxLAN GPE Operational Data From Honeycomb Should Be -| | [Documentation] | Uses Honeycomb API to get operational data about the\ -| | ... | given interface and compares them to the values provided as arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface to be checked. Type: string -| | ... | - base_settings - configuration data common for all interfaces.\ -| | ... | Type: dictionary -| | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| VxLAN GPE Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${base_params} \ -| | ... | \| ${vxlan_gpe_params} \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ... | ${base_settings} | ${vxlan_gpe_settings} -| | ... -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Should be equal as strings -| | ... | ${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 keywords -| | ... | Should be equal as strings | ${api_data['admin-status']} | up -| | ... | AND -| | ... | Should be equal as strings | ${api_data['oper-status']} | up -| | ... | ELSE -| | ... | Run keywords -| | ... | Should be equal as strings | ${api_data['admin-status']} | down -| | ... | AND -| | ... | Should be equal as strings | ${api_data['oper-status']} | down - -| VxLAN GPE Operational Data From VAT Should Be -| | [Documentation] | Uses VAT to get operational data about the given\ -| | ... | interface and compares them to the values provided as arguments. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface to be checked. Type: string -| | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| VxLAN GPE Operational Data From VAT Should Be \ -| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${vxlan_gpe_params} \| -| | ... -| | [Arguments] | ${node} | ${interface} | ${vxlan_gpe_params} -| | ... -| | ${if1}= | Vpp Get Interface Sw Index | ${node} | ${interface} -| | ${vat_data}= | VxLAN GPE Dump | ${node} | ${if1} -| | Should be equal as strings -| | ... | ${vat_data['local']} | ${vxlan_gpe_params['local']} -| | Should be equal as strings -| | ... | ${vat_data['remote']} | ${vxlan_gpe_params['remote']} -| | Should be equal as strings -| | ... | ${vat_data['vni']} | ${vxlan_gpe_params['vni']} -| | Should be equal as strings -| | ... | ${vat_data['encap_vrf_id']} | ${vxlan_gpe_params['encap-vrf-id']} -| | Should be equal as strings -| | ... | ${vat_data['decap_vrf_id']} | ${vxlan_gpe_params['decap-vrf-id']} -| | Should be equal as strings | ${vat_data['protocol']} -| | ... | ${protocols['${vxlan_gpe_params['next-protocol']}']} - -| 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 -| | ... | - interface - name of the interface to be checked. Type: string -| | ... -| | ... | *Example:* -| | ... -| | ... | \| VxLAN GPE Interface indices from Honeycomb and VAT should \ -| | ... | correspond \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ... -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${if1}= | Vpp Get Interface Sw Index | ${node} | ${interface} -| | ${vat_data}= | VxLAN GPE Dump | ${node} | ${if1} -| | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1 -| | Should be equal as strings -| | ... | ${api_data['if-index']} | ${sw_if_index} - -| VxLAN GPE Operational Data From Honeycomb Should Be empty -| | [Documentation] | Uses Honeycomb API to get operational data about\ -| | ... | the given interface and expects to fail. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| VxLAN GPE Operational Data From Honeycomb Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ... -| | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Should be empty | ${api_data} - -| VxLAN GPE Operational Data From VAT Should Be empty -| | [Documentation] | Uses VAT to get operational data about the given\ -| | ... | interface and expects an empty dictionary. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| VxLAN GPE Operational Data From VAT Should Be empty\ -| | ... | \| ${nodes['DUT1']} \| -| | ... -| | [Arguments] | ${node} -| | ${data}= | VxLAN Dump | ${node} -| | Should be empty | ${data} - -| Honeycomb fails to create VxLAN GPE interface -| | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel with wrong\ -| | ... | configuration data. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface to be created. Type: string -| | ... | - base_settings - Configuration data common for all interfaces.\ -| | ... | Type: dictionary -| | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb fails to create VxLAN GPE interface \ -| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${wrong_base_params} \ -| | ... | \| ${vxlan_gpe_params} \| -| | ... -| | [Arguments] | ${node} | ${interface} -| | ... | ${base_settings} | ${vxlan_gpe_settings} -| | ... -| | Run keyword and expect error | *HoneycombError*not successful. * code: *00. -| | ... | Create VxLAN GPE interface -| | ... | ${node} | ${interface} | &{base_settings} | &{vxlan_gpe_settings} |