diff options
author | Jan Gelety <jgelety@cisco.com> | 2019-07-12 13:13:00 +0200 |
---|---|---|
committer | Jan Gelety <jgelety@cisco.com> | 2019-07-19 14:08:50 +0000 |
commit | 87c41b8df8b3c50a90e9d3d740ac629028109dc1 (patch) | |
tree | 941c7112c4eb0fdb9bb1e68fbde276076678f737 /resources | |
parent | b02ab5b1588750decd66b53c6e20f1002b7c8238 (diff) |
Remove un-interested VIRL tests and related resources
Change-Id: I712f5dc238fdf480c7c35250148c12d03ed96d74
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r-- | resources/libraries/python/Dhcp.py | 56 | ||||
-rw-r--r-- | resources/libraries/python/Map.py | 281 | ||||
-rw-r--r-- | resources/libraries/python/ProxyArp.py | 57 | ||||
-rw-r--r-- | resources/libraries/robot/features/dhcp_client.robot | 141 | ||||
-rw-r--r-- | resources/libraries/robot/features/dhcp_proxy.robot | 159 | ||||
-rw-r--r-- | resources/templates/vat/add_proxy_arp.vat | 1 | ||||
-rw-r--r-- | resources/templates/vat/dhcp_client.vat | 1 | ||||
-rw-r--r-- | resources/templates/vat/dhcp_proxy_config.vat | 1 | ||||
-rw-r--r-- | resources/templates/vat/map_add_del_rule.vat | 1 | ||||
-rw-r--r-- | resources/templates/vat/map_add_domain.vat | 1 | ||||
-rw-r--r-- | resources/templates/vat/map_del_domain.vat | 1 | ||||
-rw-r--r-- | resources/test_data/softwire/map_e_domains.py | 57 | ||||
-rw-r--r-- | resources/test_data/softwire/map_utils.py | 53 |
13 files changed, 1 insertions, 809 deletions
diff --git a/resources/libraries/python/Dhcp.py b/resources/libraries/python/Dhcp.py index 5f76e434ec..cd074c3702 100644 --- a/resources/libraries/python/Dhcp.py +++ b/resources/libraries/python/Dhcp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# 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: @@ -15,66 +15,12 @@ from resources.libraries.python.VatExecutor import VatExecutor -from resources.libraries.python.topology import Topology - - -class DhcpClient(object): - """DHCP Client utilities.""" - - @staticmethod - def set_dhcp_client_on_interface(vpp_node, interface, hostname=None): - """Set DHCP client on interface. - - :param vpp_node: VPP node to set DHCP client on. - :param interface: Interface name to set DHCP client on. - :param hostname: Hostname used in DHCP DISCOVER. - :type vpp_node: dict - :type interface: str - :type hostname: str - :raises RuntimeError: If unable to set DHCP client on interface. - """ - sw_if_index = Topology.get_interface_sw_index(vpp_node, interface) - interface = 'sw_if_index {}'.format(sw_if_index) - hostname = 'hostname {}'.format(hostname) if hostname else '' - output = VatExecutor.cmd_from_template(vpp_node, - "dhcp_client.vat", - interface=interface, - hostname=hostname) - output = output[0] - - if output["retval"] != 0: - raise RuntimeError('Unable to set DHCP client on node {} and' - ' interface {}.' - .format(vpp_node, interface)) class DhcpProxy(object): """DHCP Proxy utilities.""" @staticmethod - def dhcp_proxy_config(vpp_node, server_address, source_address): - """Set DHCP proxy. - - :param vpp_node: VPP node to set DHCP proxy. - :param server_address: DHCP server IP address. - :param source_address: DHCP proxy address. - :type vpp_node: dict - :type server_address: str - :type source_address: str - :raises RuntimeError: If unable to set DHCP proxy. - """ - - output = VatExecutor.cmd_from_template(vpp_node, - "dhcp_proxy_config.vat", - server_address=server_address, - source_address=source_address) - output = output[0] - - if output["retval"] != 0: - raise RuntimeError('Unable to set DHCP proxy on node {}' - .format(vpp_node)) - - @staticmethod def vpp_get_dhcp_proxy(node, ip_version): """Retrieve DHCP relay configuration. diff --git a/resources/libraries/python/Map.py b/resources/libraries/python/Map.py deleted file mode 100644 index ec1d22cec8..0000000000 --- a/resources/libraries/python/Map.py +++ /dev/null @@ -1,281 +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. - -"""Map utilities library.""" - - -import ipaddress - -from resources.libraries.python.VatExecutor import VatExecutor - - -class Map(object): - """Utilities for manipulating MAP feature in VPP.""" - - @staticmethod - def map_add_domain(vpp_node, ip4_pfx, ip6_pfx, ip6_src, ea_bits_len, - psid_offset, psid_len, map_t=False): - """Add map domain on node. - - :param vpp_node: VPP node to add map domain on. - :param ip4_pfx: Rule IPv4 prefix. - :param ip6_pfx: Rule IPv6 prefix. - :param ip6_src: MAP domain IPv6 BR address / Tunnel source. - :param ea_bits_len: Embedded Address bits length. - :param psid_offset: Port Set Identifier (PSID) offset. - :param psid_len: Port Set Identifier (PSID) length. - :param map_t: Mapping using translation instead of encapsulation. - Default False. - :type vpp_node: dict - :type ip4_pfx: str - :type ip6_pfx: str - :type ip6_src: str - :type ea_bits_len: int - :type psid_offset: int - :type psid_len: int - :type map_t: bool - :returns: Index of created map domain. - :rtype: int - :raises RuntimeError: If unable to add map domain. - """ - translate = 'map-t' if map_t else '' - - output = VatExecutor.cmd_from_template(vpp_node, "map_add_domain.vat", - ip4_pfx=ip4_pfx, - ip6_pfx=ip6_pfx, - ip6_src=ip6_src, - ea_bits_len=ea_bits_len, - psid_offset=psid_offset, - psid_len=psid_len, - map_t=translate) - if output[0]["retval"] == 0: - return output[0]["index"] - else: - raise RuntimeError('Unable to add map domain on node {}' - .format(vpp_node['host'])) - - @staticmethod - def map_add_rule(vpp_node, index, psid, dst, delete=False): - """Add or delete map rule on node. - - :param vpp_node: VPP node to add map rule on. - :param index: Map domain index to add rule to. - :param psid: Port Set Identifier. - :param dst: MAP CE IPv6 address. - :param delete: If set to True, delete rule. Default False. - :type vpp_node: dict - :type index: int - :type psid: int - :type dst: str - :type delete: bool - :raises RuntimeError: If unable to add map rule. - """ - output = VatExecutor.cmd_from_template(vpp_node, "map_add_del_rule.vat", - index=index, - psid=psid, - dst=dst, - delete='del' if delete else '') - - if output[0]["retval"] != 0: - raise RuntimeError('Unable to add map rule on node {}' - .format(vpp_node['host'])) - - @staticmethod - def map_del_domain(vpp_node, index): - """Delete map domain on node. - - :param vpp_node: VPP node to delete map domain on. - :param index: Index of the map domain. - :type vpp_node: dict - :type index: int - :raises RuntimeError: If unable to delete map domain. - """ - output = VatExecutor.cmd_from_template(vpp_node, "map_del_domain.vat", - index=index) - if output[0]["retval"] != 0: - raise RuntimeError('Unable to delete map domain {} on node {}' - .format(index, vpp_node['host'])) - - @staticmethod - def get_psid_from_port(port, psid_len, psid_offset): - """Return PSID from port.:: - - 0 1 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - +-----------+-----------+-------+ - Ports in | A | PSID | j | - the CE port set | > 0 | | | - +-----------+-----------+-------+ - | a bits | k bits |m bits | - - - :param port: Port to compute PSID from. - :param psid_len: PSID length. - :param psid_offset: PSID offset. - :type port: int - :type psid_len: int - :type psid_offset: int - :returns: PSID. - :rtype: int - """ - ones = 2**16-1 - mask = ones >> (16 - psid_len) - psid = port >> (16 - psid_len - psid_offset) - psid &= mask - return psid - - @staticmethod - def _make_ea_bits(ipv4_net, ipv4_host, ea_bit_len, psid_len, psid): - """ - _note_: host(or prefix) part of destination ip in rule prefix, + psid - - :param ipv4_net: IPv4 domain prefix. - :param ipv4_host: Destination IPv4 address. - :param ea_bit_len: EA bit length. - :param psid_len: PSID length. - :param psid: PSID. - :type ipv4_net: ipaddress.IPv4Network - :type ipv4_host: ipaddress.IPv4Address - :type ea_bit_len: int - :type psid_len: int - :type psid: int - :returns: Number representing EA bit field of destination IPv6 address. - :rtype: int - """ - v4_suffix_len = ipv4_net.max_prefixlen - ipv4_net.prefixlen - v4_suffix = int(ipv4_net.network_address) ^ int(ipv4_host) - - if ipv4_net.prefixlen + ea_bit_len <= 32: - ea_bits = v4_suffix >> (v4_suffix_len - ea_bit_len) - return ea_bits - else: - q_len = ea_bit_len - v4_suffix_len - # p_bits = v4_suffix << q_len # option 1: psid right padded - p_bits = v4_suffix << psid_len # option 2: psid left padded - if q_len < psid_len: - raise Exception("invalid configuration: q_len < psid_len") - ea_bits = p_bits | psid - ea_bits <<= q_len - psid_len # option 2: psid left padded - return ea_bits - - @staticmethod - def _make_interface_id(rule_net, dst_ip, ea_bit_len, psid): - """ - _note_: if prefix or complete ip (<= 32), psid is 0 - - :param rule_net: IPv4 domain prefix. - :param dst_ip: Destination IPv4 address. - :param ea_bit_len: EA bit length. - :param psid: PSID. - :type rule_net: ipaddress.IPv4Network - :type dst_ip: ipaddress.IPv4Address - :type ea_bit_len: int - :type psid: int - :returns: Number representing interface id field of destination IPv6 - address. - :rtype: int - """ - if rule_net.prefixlen + ea_bit_len < 32: - v4_suffix_len = rule_net.max_prefixlen - rule_net.prefixlen - v4_suffix = int(rule_net.network_address) ^ int(dst_ip) - ea_bits = v4_suffix >> (v4_suffix_len - ea_bit_len) - address = int(rule_net.network_address) >> v4_suffix_len - address <<= ea_bit_len - address |= ea_bits - address <<= 32 - rule_net.prefixlen - ea_bit_len - address <<= 16 - elif rule_net.prefixlen + ea_bit_len == 32: - address = int(dst_ip) << 16 - else: - address = int(dst_ip) << 16 - address |= psid - return address - - return address - - @staticmethod - def compute_ipv6_map_destination_address(ipv4_pfx, ipv6_pfx, ea_bit_len, - psid_offset, psid_len, ipv4_dst, - dst_port): - """Compute IPv6 destination address from IPv4 address for MAP algorithm. - (RFC 7597):: - - | n bits | o bits | s bits | 128-n-o-s bits | - +--------------------+-----------+---------+-----------------------+ - | Rule IPv6 prefix | EA bits |subnet ID| interface ID | - +--------------------+-----------+---------+-----------------------+ - |<--- End-user IPv6 prefix --->| - - :param ipv4_pfx: Domain IPv4 preffix. - :param ipv6_pfx: Domain IPv6 preffix. - :param ea_bit_len: Domain EA bits length. - :param psid_offset: Domain PSID offset. - :param psid_len: Domain PSID length. - :param ipv4_dst: Destination IPv4 address. - :param dst_port: Destination port number or ICMP ID. - :type ipv4_pfx: str - :type ipv6_pfx: str - :type ea_bit_len: int - :type psid_offset: int - :type psid_len: int - :type ipv4_dst: str - :type dst_port: int - :returns: Computed IPv6 address. - :rtype: str - """ - ipv6_net = ipaddress.ip_network(unicode(ipv6_pfx)) - ipv4_net = ipaddress.ip_network(unicode(ipv4_pfx)) - ipv4_host = ipaddress.ip_address(unicode(ipv4_dst)) - - ipv6_host_len = ipv6_net.max_prefixlen - ipv6_net.prefixlen - end_user_v6_pfx_len = ipv6_net.prefixlen + ea_bit_len - psid = Map.get_psid_from_port(dst_port, psid_len, psid_offset) - - rule_v6_pfx = int(ipv6_net.network_address) >> ipv6_host_len - ea_bits = Map._make_ea_bits(ipv4_net, ipv4_host, ea_bit_len, psid_len, - psid) - interface_id = Map._make_interface_id(ipv4_net, ipv4_host, ea_bit_len, - psid) - - address = rule_v6_pfx << ea_bit_len - address |= ea_bits # add EA bits - - if end_user_v6_pfx_len > 64: - # If the End-user IPv6 prefix length is larger than 64, - # the most significant parts of the interface identifier are - # overwritten by the prefix. - mask = (2**128-1) >> end_user_v6_pfx_len - interface_id &= mask - address <<= (128 - end_user_v6_pfx_len) - address |= interface_id # add Interface ID bits - - return str(ipaddress.ip_address(address)) - - @staticmethod - def compute_ipv6_map_source_address(ipv6_pfx, ipv4_src): - """Compute IPv6 source address from IPv4 address for MAP-T algorithm. - - :param ipv6_pfx: 96 bit long IPv6 prefix. - :param ipv4_src: IPv4 source address - :type ipv6_pfx: str - :type ipv4_src: str - :returns: IPv6 address, combination of IPv6 prefix and IPv4 address. - :rtype: str - """ - ipv6_net = ipaddress.ip_network(unicode(ipv6_pfx)) - ipv4_host = ipaddress.ip_address(unicode(ipv4_src)) - - address = int(ipv6_net.network_address) - address |= int(ipv4_host) - - return str(ipaddress.ip_address(address)) diff --git a/resources/libraries/python/ProxyArp.py b/resources/libraries/python/ProxyArp.py deleted file mode 100644 index e05bfe3a61..0000000000 --- a/resources/libraries/python/ProxyArp.py +++ /dev/null @@ -1,57 +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. - -"""Proxy ARP library""" - -from resources.libraries.python.InterfaceUtil import InterfaceUtil -from resources.libraries.python.PapiExecutor import PapiSocketExecutor -from resources.libraries.python.VatExecutor import VatTerminal - - -class ProxyArp(object): - """Proxy ARP utilities.""" - - @staticmethod - def vpp_add_proxy_arp(node, lo_ip4_addr, hi_ip4_addr): - """Enable proxy ARP for a range of IP addresses. - - :param node: VPP node to enable proxy ARP. - :param lo_ip4_addr: The lower limit of the IP addresses. - :param hi_ip4_addr: The upper limit of the IP addresses. - :type node: dict - :type lo_ip4_addr: str - :type hi_ip4_addr: str - """ - with VatTerminal(node) as vat: - vat.vat_terminal_exec_cmd_from_template("add_proxy_arp.vat", - lo_ip4_addr=lo_ip4_addr, - hi_ip4_addr=hi_ip4_addr) - - @staticmethod - def vpp_proxy_arp_interface_enable(node, interface): - """Enable proxy ARP on interface. - - :param node: VPP node to enable proxy ARP on interface. - :param interface: Interface to enable proxy ARP. - :type node: dict - :type interface: str or int - """ - - cmd = 'proxy_arp_intfc_enable_disable' - args = dict( - sw_if_index=InterfaceUtil.get_interface_index(node, interface), - enable_disable=1) - err_msg = 'Failed to enable proxy ARP on interface {ifc}'.format( - ifc=interface) - with PapiSocketExecutor(node) as papi_exec: - papi_exec.add(cmd, **args).get_reply(err_msg) diff --git a/resources/libraries/robot/features/dhcp_client.robot b/resources/libraries/robot/features/dhcp_client.robot deleted file mode 100644 index efc016741a..0000000000 --- a/resources/libraries/robot/features/dhcp_client.robot +++ /dev/null @@ -1,141 +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 | Collections -| Resource | resources/libraries/robot/shared/default.robot -| Library | resources.libraries.python.Dhcp.DhcpClient -| Library | resources.libraries.python.TrafficScriptExecutor -| Documentation | DHCP Client specific keywords. - -*** Keywords *** -| Verify DHCP DISCOVER header -| | [Documentation] | Check if DHCP DISCOVER message contains all required -| | ... | fields. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - interface - TG interface where listen for DHCP DISCOVER message. -| | ... | Type: string -| | ... | - src_mac - DHCP client MAC address. Type: string -| | ... | - hostname - DHCP client hostname (Optional, Default="", if not -| | ... | specified, the hostname is not checked). Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Verify DHCP DISCOVER header \| ${nodes['TG']} \ -| | ... | \| eth2 \| 08:00:27:66:b8:57 \| -| | ... | \| Verify DHCP DISCOVER header \| ${nodes['TG']} \ -| | ... | \| eth2 \| 08:00:27:66:b8:57 \| client-hostname \| -| | ... -| | [Arguments] | ${tg_node} | ${interface} | ${src_mac} | ${hostname}=${EMPTY} -| | ${interface_name}= | Get interface name | ${tg_node} | ${interface} -| | ${args}= | Catenate | --rx_if | ${interface_name} | --rx_src_mac | ${src_mac} -| | ${args}= | Run Keyword If | "${hostname}" == "" | Set Variable | ${args} -| | ... | ELSE | Catenate | ${args} | --hostname | ${hostname} -| | Run Traffic Script On Node | dhcp/check_dhcp_discover.py -| | ... | ${tg_node} | ${args} - - -| Verify DHCP REQUEST after OFFER -| | [Documentation] | Check if DHCP REQUEST message contains all required -| | ... | fields. DHCP REQUEST should be send by a client after DHCP OFFER -| | ... | message sent by a server. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - tg_interface - TG interface where listen for DHCP DISCOVER, -| | ... | send DHCP OFFER and listen for DHCP REQUEST messages. Type: string -| | ... | - server_mac - DHCP server MAC address. Type: string -| | ... | - server_ip - DHCP server IP address. Type: string -| | ... | - client_mac - DHCP client MAC address. Type: string -| | ... | - client_ip - IP address that should be offered to client. -| | ... | Type: string -| | ... | - client_mask - IP netmask that should be offered to client. -| | ... | Type: string -| | ... | - hostname - DHCP client hostname (Optional, Default="", if not -| | ... | specified, the hostname is not checked). Type: string -| | ... | - offer_xid - Transaction ID (Optional, Default="", if not specified -| | ... | xid field in DHCP OFFER is same as in DHCP DISCOVER message). -| | ... | Type: integer -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Raises:* -| | ... | - DHCP REQUEST Rx timeout - if no DHCP REQUEST is received. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Verify DHCP REQUEST after OFFER \| ${nodes['TG']} \ -| | ... | \| eth2 \| 08:00:27:66:b8:57 \| 192.168.23.1 \ -| | ... | \| 08:00:27:46:2b:4c \| 192.168.23.10 \| 255.255.255.0 \| -| | ... -| | ... | \| Run Keyword And Expect Error \| DHCP REQUEST Rx timeout \ -| | ... | \| Verify DHCP REQUEST after OFFER \ -| | ... | \| ${nodes['TG']} \| eth2 \| 08:00:27:66:b8:57 \| 192.168.23.1 \ -| | ... | \| 08:00:27:46:2b:4c \| 192.168.23.10 \| 255.255.255.0 \ -| | ... | \| offer_xid=11113333 \| -| | ... -| | [Arguments] | ${tg_node} | ${tg_interface} | ${server_mac} | ${server_ip} -| | ... | ${client_mac} | ${client_ip} | ${client_mask} -| | ... | ${hostname}=${EMPTY} | ${offer_xid}=${EMPTY} -| | ${tg_interface_name}= | Get interface name | ${tg_node} | ${tg_interface} -| | ${args}= | Catenate | --rx_if | ${tg_interface_name} | --server_mac -| | ... | ${server_mac} | --server_ip | ${server_ip} | --client_mac -| | ... | ${client_mac} | --client_ip | ${client_ip} | --client_mask -| | ... | ${client_mask} -| | ${args}= | Run Keyword If | "${hostname}" == "" | Set Variable | ${args} -| | ... | ELSE | Catenate | ${args} | --hostname | ${hostname} -| | ${args}= | Run Keyword If | "${offer_xid}" == "" | Set Variable | ${args} -| | ... | ELSE | Catenate | ${args} | --offer_xid | ${offer_xid} -| | Run Traffic Script On Node | dhcp/check_dhcp_request.py -| | ... | ${tg_node} | ${args} - - -| Configure IP on client via DHCP -| | [Documentation] | Run script that sends IP configuration to the DHCP client. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - tg_interface - TG interface where listen for DHCP DISCOVER, -| | ... | send DHCP OFFER and DHCP ACK after DHCP REQUEST messages. -| | ... | Type: string -| | ... | - server_mac - DHCP server MAC address. Type: string -| | ... | - server_ip - DHCP server IP address. Type: string -| | ... | - client_ip - IP address that is offered to client. Type: string -| | ... | - client_mask - IP netmask that is offered to client. Type: string -| | ... | - lease_time - IP lease time in seconds. Type: integer -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure IP on client via DHCP \| ${nodes['TG']} \ -| | ... | \| eth2 \| 08:00:27:66:b8:57 \| 192.168.23.1 \ -| | ... | \| 192.168.23.10 \| 255.255.255.0 \| 86400 \| -| | ... -| | [Arguments] | ${tg_node} | ${tg_interface} -| | ... | ${server_mac} | ${server_ip} | ${client_ip} | ${client_mask} -| | ... | ${lease_time} -| | ${tg_interface_name}= | Get interface name | ${tg_node} | ${tg_interface} -| | ${args}= | Catenate | --rx_if | ${tg_interface_name} -| | ... | --server_mac | ${server_mac} | --server_ip | ${server_ip} -| | ... | --client_ip | ${client_ip} | --client_mask | ${client_mask} -| | ... | --lease_time | ${lease_time} -| | Run Traffic Script On Node | dhcp/check_dhcp_request_ack.py -| | ... | ${tg_node} | ${args} diff --git a/resources/libraries/robot/features/dhcp_proxy.robot b/resources/libraries/robot/features/dhcp_proxy.robot deleted file mode 100644 index e6ea69d5d0..0000000000 --- a/resources/libraries/robot/features/dhcp_proxy.robot +++ /dev/null @@ -1,159 +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 | Collections -| Resource | resources/libraries/robot/shared/default.robot -| Library | resources.libraries.python.Dhcp.DhcpProxy -| Library | resources.libraries.python.TrafficScriptExecutor -| Documentation | DHCP Proxy specific keywords. - -*** Keywords *** -| Send DHCP messages and check answer -| | [Documentation] | Send and receive DHCP messages between client -| | ... | and server through DHCP proxy. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - tg_interface1 - TG interface. Type: string -| | ... | - tg_interface2 - TG interface. Type: string -| | ... | - server_ip - DHCP server IP address. Type: string -| | ... | - server_mac - DHCP server MAC address. Type: string -| | ... | - client_ip - Client IP address. Type: string -| | ... | - client_mac - Client MAC address. Type: string -| | ... | - proxy_ip - DHCP proxy IP address. Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send DHCP messages and check answer \| ${nodes['TG']} \ -| | ... | \| eth3 \| eth4 \| 192.168.0.100 \| 08:00:27:cc:4f:54 \ -| | ... | \| 172.16.0.2 \| 08:00:27:64:18:d2 \| 172.16.0.1 \| -| | ... -| | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2} -| | ... | ${server_ip} | ${server_mac} | ${client_ip} | ${client_mac} -| | ... | ${proxy_ip} | -| | ${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} -| | ... | --server_ip | ${server_ip} -| | ... | --server_mac | ${server_mac} -| | ... | --client_ip | ${client_ip} -| | ... | --client_mac | ${client_mac} -| | ... | --proxy_ip | ${proxy_ip} -| | Run Traffic Script On Node | dhcp/send_and_check_proxy_messages.py -| | ... | ${tg_node} | ${args} - -| Send DHCP DISCOVER and check answer -| | [Documentation] | Send and receive DHCP DISCOVER. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - tg_interface1 - TG interface. Type: string -| | ... | - tg_interface2 - TG interface. Type: string -| | ... | - tx_src_ip - Source address of DHCP DISCOVER packet. Type: string -| | ... | - tx_dst_ip - Destination address of DHCP DISCOVER packet. Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send DHCP DISCOVER and check answer \| ${nodes['TG']} \ -| | ... | \| eth3 \| eth4 \| 0.0.0.0 \| 255.255.255.255 \| -| | ... -| | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2} -| | ... | ${tx_src_ip} | ${tx_dst_ip} | -| | ${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} -| | ... | --tx_src_ip | ${tx_src_ip} -| | ... | --tx_dst_ip | ${tx_dst_ip} -| | Run Traffic Script On Node | dhcp/send_and_check_proxy_discover.py -| | ... | ${tg_node} | ${args} - -| DHCP DISCOVER should fail -| | [Documentation] | Send and receive DHCP DISCOVER should fail. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - tg_interface1 - TG interface. Type: string -| | ... | - tg_interface2 - TG interface. Type: string -| | ... | - tx_src_ip - Source address of DHCP DISCOVER packet. Type: string -| | ... | - tx_dst_ip - Destination address of DHCP DISCOVER packet. Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| DHCP DISCOVER should fail \| ${nodes['TG']} \ -| | ... | \| eth3 \| eth4 \| 0.0.0.0 \| 255.255.255.1 \| -| | ... -| | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2} -| | ... | ${tx_src_ip} | ${tx_dst_ip} | -| | ${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} -| | ... | --tx_src_ip | ${tx_src_ip} -| | ... | --tx_dst_ip | ${tx_dst_ip} -| | Run Keyword And Expect Error | DHCP DISCOVER Rx timeout -| | ... | Run Traffic Script On Node | dhcp/send_and_check_proxy_discover.py -| | ... | ${tg_node} | ${args} - -| Send DHCPv6 Messages -| | [Documentation] | Send and receive DHCPv6 messages between client -| | ... | and server through DHCPv6 proxy. -| | ... -| | ... | *Arguments:* -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - tg_interface1 - TG interface. Type: string -| | ... | - tg_interface2 - TG interface. Type: string -| | ... | - proxy_ip - DHCPv6 proxy IP address. Type: string -| | ... | - proxy_mac - Proxy MAC address. Type: string -| | ... | - server_ip - DHCPv6 server IP address. Type: string -| | ... | - server_mac - Server MAC address. Type: string -| | ... | - client_mac - Client MAC address. Type: string -| | ... | - proxy_to_server_mac - MAC address of proxy interface -| | ... | connected to server. Type: string -| | ... -| | ... | *Return:* -| | ... | - No value returned. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send DHCPv6 Messages \| ${nodes['TG']} \ -| | ... | \| eth3 \| eth4 \| 3ffe:62::1 \| 08:00:27:54:59:f9 \ -| | ... | \| 3ffe:63::2 \| 08:00:27:cc:4f:54 \| -| | ... | \| 08:00:27:64:18:d2 \| 08:00:27:c9:6a:d5 \| -| | ... -| | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2} | ${proxy_ip} -| | ... | ${proxy_mac} | ${server_ip} | ${server_mac} | ${client_mac} -| | ... | ${proxy_to_server_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} -| | ... | --proxy_ip | ${proxy_ip} -| | ... | --proxy_mac | ${proxy_mac} -| | ... | --server_ip | ${server_ip} -| | ... | --server_mac | ${server_mac} -| | ... | --client_mac | ${client_mac} -| | ... | --proxy_to_server_mac | ${proxy_to_server_mac} -| | Run Traffic Script On Node | dhcp/send_dhcp_v6_messages.py -| | ... | ${tg_node} | ${args} diff --git a/resources/templates/vat/add_proxy_arp.vat b/resources/templates/vat/add_proxy_arp.vat deleted file mode 100644 index 42dd3992bb..0000000000 --- a/resources/templates/vat/add_proxy_arp.vat +++ /dev/null @@ -1 +0,0 @@ -proxy_arp_add_del {lo_ip4_addr} - {hi_ip4_addr}
\ No newline at end of file diff --git a/resources/templates/vat/dhcp_client.vat b/resources/templates/vat/dhcp_client.vat deleted file mode 100644 index 2fd99e3470..0000000000 --- a/resources/templates/vat/dhcp_client.vat +++ /dev/null @@ -1 +0,0 @@ -dhcp_client_config {interface} {hostname} diff --git a/resources/templates/vat/dhcp_proxy_config.vat b/resources/templates/vat/dhcp_proxy_config.vat deleted file mode 100644 index 365b8d7de1..0000000000 --- a/resources/templates/vat/dhcp_proxy_config.vat +++ /dev/null @@ -1 +0,0 @@ -dhcp_proxy_config svr {server_address} src {source_address}
\ No newline at end of file diff --git a/resources/templates/vat/map_add_del_rule.vat b/resources/templates/vat/map_add_del_rule.vat deleted file mode 100644 index 4d82b36674..0000000000 --- a/resources/templates/vat/map_add_del_rule.vat +++ /dev/null @@ -1 +0,0 @@ -map_add_del_rule index {index} psid {psid} dst {dst} {delete} diff --git a/resources/templates/vat/map_add_domain.vat b/resources/templates/vat/map_add_domain.vat deleted file mode 100644 index 4895f04794..0000000000 --- a/resources/templates/vat/map_add_domain.vat +++ /dev/null @@ -1 +0,0 @@ -map_add_domain ip4-pfx {ip4_pfx} ip6-pfx {ip6_pfx} ip6-src {ip6_src} ea-bits-len {ea_bits_len} psid-offset {psid_offset} psid-len {psid_len} {map_t}
\ No newline at end of file diff --git a/resources/templates/vat/map_del_domain.vat b/resources/templates/vat/map_del_domain.vat deleted file mode 100644 index eeafd8f93a..0000000000 --- a/resources/templates/vat/map_del_domain.vat +++ /dev/null @@ -1 +0,0 @@ -map_del_domain index {index}
\ No newline at end of file diff --git a/resources/test_data/softwire/map_e_domains.py b/resources/test_data/softwire/map_e_domains.py deleted file mode 100644 index 44cb661b01..0000000000 --- a/resources/test_data/softwire/map_e_domains.py +++ /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.l - -"""Variables for MAP-e feature tests.""" - -from resources.libraries.python.Map import Map -from random import sample, randint -from itertools import product - - -def get_variables(count): - """Generate variables with random generated MAP-E configuration sets and - IP test sets. - - domain_set = [IPv4_prefix, IPv6_prefix, IPv6_source, 16, 0, 0] - ip_set = [IPv4_dst_address, IPv6_dst_address, dst_port, IPv6_src_address] - - :param count: Generate "count" map domain configuration parameters. - :type count: int - :return: Variable dictionary with domain_sets and ip_sets. - :rtype: dict - """ - domain_sets = [] - ip_sets = [] - - ip_product = [x for x in list(product(xrange(2, 224), xrange(0, 256))) - if x[0] != 127] - - for n1, n2 in sample(ip_product, count): - v4_pfx = '{}.{}.0.0/16'.format(n1, n2) - v6_pfx = '2001:{:x}{:x}::/48'.format(n1, n2) - ipv6_br = '2001:ffff::1' - domain_set = [v4_pfx, - v6_pfx, - ipv6_br, 16, 0, 0] - port = randint(1025, 65500) - ipv4_addr = '{}.{}.20.30'.format(n1, n2) - ipv6_addr = Map.compute_ipv6_map_destination_address( - v4_pfx, v6_pfx, 16, 0, 0, ipv4_addr, port) - domain_sets.append(domain_set) - ip_sets.append([ipv4_addr, ipv6_addr, port, ipv6_br]) - - variables = { - "domain_sets": domain_sets, - "ip_sets": ip_sets - } - return variables diff --git a/resources/test_data/softwire/map_utils.py b/resources/test_data/softwire/map_utils.py deleted file mode 100644 index 58ef551d7a..0000000000 --- a/resources/test_data/softwire/map_utils.py +++ /dev/null @@ -1,53 +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. - -"""Utils for MAP feature.""" - - -def map_port_ranges(psid, length, offset=6): - """Return list of port ranges for given PSID in tuple <min, max>. - - :param psid: PSID. - :param length: PSID length. - :param offset: PSID offset. - :type psid: int - :type length: int - :type offset: int - :return: List of (min, max) port range tuples inclusive. - :rtype: list - - 0 1 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - +-----------+-----------+-------+ - Ports in | A | PSID | j | - the CE port set | > 0 | | | - +-----------+-----------+-------+ - | a bits | k bits |m bits | - """ - - port_field_len = 16 - port_field_min = int('0x0000', 16) - port_field_max = int('0xffff', 16) - - a = offset - k = length - m = port_field_len - offset - length - km = k + m - j_max = port_field_max >> a + k - - port_ranges = [] - for A in range(1, (port_field_max >> km) + 1): - port_ranges.append((((A << k) | psid) << m, - ((A << k) | psid) << m | j_max)) - - return port_ranges |