From: selias Date: Fri, 17 Feb 2017 10:59:15 +0000 (+0100) Subject: CSIT-522 HC Test: tests for secondary IP address X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=commitdiff_plain;h=9aab55627669dd002fed544fc1358760793c77c5 CSIT-522 HC Test: tests for secondary IP address - fix and update ipv4 and ipv6 tests - add tests for ipv6 neighbor and vrf-id - add tests for secondary IP address on ipv4, ipv6 Change-Id: I1e422e61108493a63a65ad91f649e69dfff0842f Signed-off-by: selias --- diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 5d6d8f7044..558e99b4e7 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -847,6 +847,29 @@ class InterfaceUtil(object): sw_if_index=sw_if_index) return data[0] + @staticmethod + def get_interface_vrf_table(node, interface): + """Get vrf ID for the given interface. + + :param node: VPP node. + :param interface: Name or sw_if_index of a specific interface. + :type node: dict + :type interface: str or int + :returns: vrf ID of the specified interface. + :rtype: int + """ + + if isinstance(interface, basestring): + sw_if_index = InterfaceUtil.get_sw_if_index(node, interface) + else: + sw_if_index = interface + + with VatTerminal(node) as vat: + data = vat.vat_terminal_exec_cmd_from_template( + "interface_vrf_dump.vat", + sw_if_index=sw_if_index) + return data[0]["vrf_id"] + @staticmethod def get_sw_if_index(node, interface_name): """Get sw_if_index for the given interface from actual interface dump. diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index a62cee85c7..92b1b8019e 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -44,7 +44,7 @@ class InterfaceKeywords(object): "temporary-valid-lifetime", "temporary-preferred-lifetime") ETH_PARAMS = ("mtu", ) - ROUTING_PARAMS = ("vrf-id", ) + 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") @@ -513,9 +513,9 @@ class InterfaceKeywords(object): path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4", "address") if isinstance(network, basestring): - address = {"address": [{"ip": ip_addr, "netmask": network}, ]} + address = [{"ip": ip_addr, "netmask": network}] elif isinstance(network, int) and (0 < network < 33): - address = {"address": [{"ip": ip_addr, "prefix-length": network}, ]} + address = [{"ip": ip_addr, "prefix-length": network}] else: raise HoneycombError("Value {0} is not a valid netmask or network " "prefix length.".format(network)) diff --git a/resources/libraries/robot/honeycomb/interfaces.robot b/resources/libraries/robot/honeycomb/interfaces.robot index 3c91c77eb7..cb4f6187e9 100644 --- a/resources/libraries/robot/honeycomb/interfaces.robot +++ b/resources/libraries/robot/honeycomb/interfaces.robot @@ -16,6 +16,8 @@ | ... | WITH NAME | interfaceCLI | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords | ... | WITH NAME | InterfaceAPI +| Library | resources.libraries.python.IPv4Util +| Library | resources.libraries.python.TrafficScriptExecutor *** Keywords *** | Honeycomb sets interface state @@ -76,7 +78,7 @@ | Honeycomb sets interface ipv4 address | | [Documentation] | Uses Honeycomb API to change ipv4 address\ -| | ... | of the specified interface. +| | ... | of the specified interface. Any existing addresses will be removed. | | ... | | ... | *Arguments:* | | ... | - node - information about a DUT node. Type: dictionary @@ -100,7 +102,7 @@ | | ... | - 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: int +| | ... | - prefix - length of address network prefix. Type: integer | | ... | | ... | *Example:* | | ... @@ -110,6 +112,43 @@ | | interfaceAPI.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} +| | interfaceAPI.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. @@ -123,13 +162,12 @@ | | ... | *Example:* | | ... | | ... | \| IPv4 address from Honeycomb should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 255.255.255.0 \ +| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| ${24} \| | | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} -| | Should be equal | ${address} -| | ... | ${api_data['ietf-ip:ipv4']['address'][0]['ip']} -| | Should be equal | ${prefix} -| | ... | ${api_data['ietf-ip:ipv4']['address'][0]['prefix-length']} +| | ${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\ @@ -139,17 +177,19 @@ | | ... | - 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 | | ... | | ... | *Example:* | | ... | | ... | \| IPv4 address from VAT should be \| ${nodes['DUT1']} \ -| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 255.255.255.0 \| -| | [Arguments] | ${node} | ${interface} | ${address} | ${netmask} +| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| ${24} \| 255.255.255.0 \| +| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} | ${netmask} | | ${vpp_data}= | interfaceCLI.VPP get interface ip addresses | | ... | ${node} | ${interface} | ipv4 -| | Should be equal | ${vpp_data[0]['ip']} | ${address} -| | Should be equal | ${vpp_data[0]['netmask']} | ${netmask} +| | ${settings}= | Create Dictionary +| | ... | ip=${address} | netmask=${netmask} | prefix_length=${prefix} +| | Should contain | ${vpp_data} | ${settings} | Honeycomb removes interface ipv4 addresses | | [Documentation] | Removes all configured ipv4 addresses from the specified\ @@ -180,7 +220,7 @@ | | ... | \| GigabitEthernet0/8/0 \| | | [Arguments] | ${node} | ${interface} | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError: 'ietf-ip:ipv4' +| | Run keyword and expect error | *KeyError:* | | ... | Set Variable | ${api_data['ietf-ip:ipv4']['address']} | IPv4 address from VAT should be empty @@ -220,7 +260,7 @@ | IPv4 neighbor from Honeycomb should be | | [Documentation] | Retrieves ipv4 neighbor list through Honeycomb\ -| | ... | and compares the first entry with addresses supplied in arguments. +| | ... | and checks if it contains address supplied in arguments. | | ... | | ... | *Arguments:* | | ... | - node - information about a DUT node. Type: dictionary @@ -234,13 +274,12 @@ | | ... | \| GigabitEthernet0/8/0 \| 192.168.0.4 \| 08:00:27:60:26:ab \| | | [Arguments] | ${node} | ${interface} | ${ip_address} | ${mac_address} | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} -| | Should be equal | ${ip_address} -| | ... | ${api_data['ietf-ip:ipv4']['neighbor'][0]['ip']} -| | Should be equal | ${mac_address} -| | ... | ${api_data['ietf-ip:ipv4']['neighbor'][0]['link-layer-address']} +| | ${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 assign an ipv4 neighbor to the\ +| | [Documentation] | Uses Honeycomb API to remove all ipv4 neighbors from the\ | | ... | specified interface. | | ... | | ... | *Arguments:* @@ -254,9 +293,27 @@ | | [Arguments] | ${node} | ${interface} | | interfaceAPI.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}= | interfaceAPI.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. +| | ... | 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 @@ -272,6 +329,43 @@ | | interfaceAPI.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} +| | interfaceAPI.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 be | | [Documentation] | Retrieves interface ipv6 address through Honeycomb\ | | ... | and compares with state supplied in argument. @@ -313,6 +407,125 @@ | | ... | ip=${address} | prefix_length=${prefix} | | 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}= | interfaceAPI.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} +| | Run keyword and expect error | *No JSON object could be decoded* +| | ... | InterfaceCLI.VPP get interface ip addresses +| | ... | ${node} | ${interface} | ipv6 + +| 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} +| | InterfaceAPI.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}= | interfaceAPI.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} +| | interfaceAPI.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}= | interfaceAPI.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. @@ -324,7 +537,7 @@ | | ... | | ... | *Example:* | | ... -| | ... | \| Honeycomb sets interface ethernet and routing configuration \ +| | ... | \| Honeycomb sets interface ethernet configuration \ | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${{'mtu': 1500}} \ | | [Arguments] | ${node} | ${interface} | ${ethernet} | | :FOR | ${key} | IN | @{ethernet.keys()} @@ -342,7 +555,7 @@ | | ... | | ... | *Example:* | | ... -| | ... | \| Interface ethernet and routing configuration from Honeycomb \ +| | ... | \| Interface ethernet configuration from Honeycomb should be \ | | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \ | | ... | \| ${{'mtu': 1500}} \| | | [Arguments] | ${node} | ${interface} | ${ethernet} @@ -362,12 +575,67 @@ | | ... | | ... | *Example:* | | ... -| | ... | \| Interface ethernet and routing configuration from VAT \ +| | ... | \| Interface ethernet configuration from VAT should be \ | | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1500} \| | | [Arguments] | ${node} | ${interface} | ${mtu} | | ${vat_data}= | InterfaceCLI.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} +| | interfaceAPI.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}= | interfaceAPI.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}= | InterfaceCLI.get interface vrf table +| | ... | ${node} | ${interface} +| | Should be equal | ${vat_data} | ${vrf_id} + | Interface configuration from Honeycomb should be empty | | [Documentation] | Attempts to retrieve interface configuration through\ | | ... | Honeycomb and expects to get empty dictionary. @@ -470,3 +738,40 @@ | | 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} diff --git a/tests/func/honeycomb/mgmt-cfg-intip4-intip6-apihc-apivat-func.robot b/tests/func/honeycomb/mgmt-cfg-intip4-intip6-apihc-apivat-func.robot index 6675d18d9c..ccdd3ebe04 100644 --- a/tests/func/honeycomb/mgmt-cfg-intip4-intip6-apihc-apivat-func.robot +++ b/tests/func/honeycomb/mgmt-cfg-intip4-intip6-apihc-apivat-func.robot @@ -15,14 +15,17 @@ # Interface to run tests on. | ${interface}= | ${node['interfaces']['port1']['name']} # Configuration which will be set and verified during tests. -| ${ipv4_address}= | 192.168.0.2 -| ${ipv4_address2}= | 192.168.0.3 +| @{ipv4_address}= | 192.168.0.2 | ${24} +| @{ipv4_address2}= | 192.168.1.2 | ${24} | ${ipv4_mask}= | 255.255.255.0 | ${ipv4_prefix}= | ${24} | @{ipv4_neighbor}= | 192.168.0.4 | 08:00:27:c0:5d:37 +| @{ipv4_neighbor2}= | 192.168.1.4 | 08:00:27:c0:5d:37 | &{ipv4_settings}= | mtu=${9000} | @{ipv6_address}= | 10::10 | ${64} +| @{ipv6_address2}= | 11::10 | ${64} | @{ipv6_neighbor}= | 10::11 | 08:00:27:c0:5d:37 +| @{ipv6_neighbor2}= | 11::11 | 08:00:27:c0:5d:37 | &{ipv6_settings}= | enabled=${True} | forwarding=${True} | mtu=${9000} | ... | dup-addr-detect-transmits=${5} | &{ethernet}= | mtu=${9000} @@ -34,8 +37,11 @@ | Resource | resources/libraries/robot/default.robot | Resource | resources/libraries/robot/honeycomb/interfaces.robot | Resource | resources/libraries/robot/honeycomb/honeycomb.robot +| Resource | resources/libraries/robot/testing_path.robot +| Resource | resources/libraries/robot/ipv6.robot | Force Tags | honeycomb_sanity -| Suite Teardown | Run Keyword If Any Tests Failed +| Suite Setup | Vpp nodes ra suppress link layer | ${nodes} +| Suite Teardown | | ... | Restart Honeycomb And VPP And Clear Persisted Configuration | ${node} | Documentation | *Honeycomb interface management test suite.* @@ -61,19 +67,19 @@ | | Given IPv4 address from Honeycomb should be empty | ${node} | ${interface} | | And ipv4 address from VAT should be empty | ${node} | ${interface} | | When Honeycomb sets interface ipv4 address | ${node} | ${interface} -| | ... | ${ipv4_address} | ${ipv4_mask} +| | ... | ${ipv4_address[0]} | ${ipv4_mask} | | Then IPv4 address from Honeycomb should be -| | ... | ${node} | ${interface} | ${ipv4_address} | ${ipv4_prefix} +| | ... | ${node} | ${interface} | ${ipv4_address[0]} | ${ipv4_prefix} | | And IPv4 address from VAT should be -| | ... | ${node} | ${interface} | ${ipv4_address} | ${ipv4_mask} +| | ... | ${node} | ${interface} | @{ipv4_address} | ${ipv4_mask} | TC03: Honeycomb removes IPv4 address from interface | | [Documentation] | Check if Honeycomb API can remove configured ipv4\ | | ... | addresses from interface. | | Given IPv4 address from Honeycomb should be -| | ... | ${node} | ${interface} | ${ipv4_address} | ${ipv4_prefix} +| | ... | ${node} | ${interface} | @{ipv4_address} | | And IPv4 address from VAT should be -| | ... | ${node} | ${interface} | ${ipv4_address} | ${ipv4_mask} +| | ... | ${node} | ${interface} | @{ipv4_address} | ${ipv4_mask} | | When Honeycomb removes interface ipv4 addresses | ${node} | ${interface} | | Then IPv4 address from Honeycomb should be empty | ${node} | ${interface} | | And ipv4 address from VAT should be empty | ${node} | ${interface} @@ -86,16 +92,18 @@ | | Given IPv4 address from Honeycomb should be empty | ${node} | ${interface} | | And ipv4 address from VAT should be empty | ${node} | ${interface} | | When Honeycomb sets interface ipv4 address with prefix -| | ... | ${node} | ${interface} | ${ipv4_address2} | ${ipv4_prefix} +| | ... | ${node} | ${interface} | @{ipv4_address2} | | Then IPv4 address from Honeycomb should be -| | ... | ${node} | ${interface} | ${ipv4_address2} | ${ipv4_prefix} +| | ... | ${node} | ${interface} | @{ipv4_address2} | | And IPv4 address from VAT should be -| | ... | ${node} | ${interface} | ${ipv4_address2} | ${ipv4_mask} +| | ... | ${node} | ${interface} | @{ipv4_address2} | ${ipv4_mask} | TC05: Honeycomb modifies IPv4 neighbor table | | [Documentation] | Check if Honeycomb API can add and remove ARP entries. | | [Teardown] | Honeycomb clears all interface ipv4 neighbors | | ... | ${node} | ${interface} +| | Given IPv4 neighbor from Honeycomb should be empty +| | ... | ${node} | ${interface} | | When Honeycomb adds interface ipv4 neighbor | | ... | ${node} | ${interface} | @{ipv4_neighbor} | | Then IPv4 neighbor from Honeycomb should be @@ -103,6 +111,12 @@ | TC06: Honeycomb modifies interface configuration - IPv6 | | [Documentation] | Check if Honeycomb API can configure interfaces for ipv6. +| | [Teardown] | Honeycomb removes interface ipv6 addresses | ${node} +| | ... | ${interface} +| | Given IPv6 address from Honeycomb should be empty +| | ... | ${node} | ${interface} +| | And IPv6 address from VAT should be empty +| | ... | ${node} | ${interface} | | When Honeycomb sets interface ipv6 address | | ... | ${node} | ${interface} | @{ipv6_address} | | Then IPv6 address from Honeycomb should be @@ -110,9 +124,18 @@ | | And IPv6 address from VAT should be | | ... | ${node} | ${interface} | @{ipv6_address} -# TODO: Honeycomb modifies IPv6 neighbor table +| TC07: Honeycomb modifies IPv6 neighbor table +| | [Documentation] | Check if Honeycomb API can add and remove ARP entries. +| | [Teardown] | Honeycomb clears all interface ipv6 neighbors +| | ... | ${node} | ${interface} +| | Given IPv6 neighbor from Honeycomb should be empty +| | ... | ${node} | ${interface} +| | When Honeycomb adds interface ipv6 neighbor +| | ... | ${node} | ${interface} | @{ipv6_neighbor} +| | Then IPv6 neighbor from Honeycomb should be +| | ... | ${node} | ${interface} | @{ipv6_neighbor} -| TC07: Honeycomb modifies interface configuration - MTU +| TC08: Honeycomb modifies interface configuration - MTU | | [Documentation] | Check if Honeycomb API can configure interface\ | | ... | MTU value. | | When Honeycomb sets interface ethernet configuration @@ -122,4 +145,93 @@ | | And Interface ethernet configuration from VAT should be | | ... | ${node} | ${interface} | ${ethernet['mtu']} -# TODO: Honeycomb configures routing on interface +| TC09: Honeycomb modifies interface configuration - vrf +| | [Documentation] | Check if Honeycomb API can configure interface\ +| | ... | vrf ID. +| | [Teardown] | Honeycomb sets interface vrf ID +| | ... | ${node} | ${interface} | ${0} | ipv4 +| | When Honeycomb sets interface vrf ID +| | ... | ${node} | ${interface} | ${1} | ipv4 +| | Then Interface vrf ID from Honeycomb should be +| | ... | ${node} | ${interface} | ${1} | ipv4 +| | And Interface vrf ID from VAT should be +| | ... | ${node} | ${interface} | ${1} + +| TC10: Honeycomb can configure multiple IP addresses on one interface +| | [Documentation] | [Top] TG=DUT1=TG. +| | ... | [Enc] Eth-IPv4-ICMP; Eth-IPv6-ICMPv6 +| | ... | [Cfg] (Using Honeycomb API) On DUT1 set two IPv4 addresses\ +| | ... | and two IPv6 addresses on first interfaces to TG and add ARP entries\ +| | ... | for each address. +| | ... | [Ver] Send ICMP packets from TG to DUT, using different sets\ +| | ... | of source and destination IP addresses. Receive an ICMP reply\ +| | ... | for every packet sent. +| | When Honeycomb sets interface ipv4 address with prefix +| | ... | ${node} | ${interface} | @{ipv4_address} +| | And Honeycomb adds interface ipv4 address +| | ... | ${node} | ${interface} | @{ipv4_address2} +| | And Honeycomb sets interface ipv6 address +| | ... | ${node} | ${interface} | @{ipv6_address} +| | And Honeycomb adds interface ipv6 address +| | ... | ${node} | ${interface} | @{ipv6_address2} +| | Then IPv4 address from Honeycomb should be +| | ... | ${node} | ${interface} | @{ipv4_address} +| | And IPv4 address from VAT should be +| | ... | ${node} | ${interface} | @{ipv4_address} | ${ipv4_mask} +| | And IPv6 address from Honeycomb should be +| | ... | ${node} | ${interface} | @{ipv6_address} +| | And IPv6 address from VAT should be +| | ... | ${node} | ${interface} | @{ipv6_address} +| | When Path for 2-node testing is set +| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']} +| | And Honeycomb sets interface state | ${dut_node} | ${interface} | up +| | And Honeycomb adds interface ipv4 neighbor | ${dut_node} | ${interface} +| | ... | @{ipv4_neighbor} +| | And Honeycomb adds interface ipv4 neighbor | ${dut_node} | ${interface} +| | ... | @{ipv4_neighbor2} +| | And Honeycomb adds interface ipv6 neighbor | ${dut_node} | ${interface} +| | ... | @{ipv6_neighbor} +| | And Honeycomb adds interface ipv6 neighbor | ${dut_node} | ${interface} +| | ... | @{ipv6_neighbor2} +| | Then Ping and Verify IP address | ${nodes['TG']} +| | ... | ${ipv4_neighbor[0]} | ${ipv4_address[0]} +| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} +| | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} +| | And Ping and Verify IP address | ${nodes['TG']} +| | ... | ${ipv4_neighbor2[0]} | ${ipv4_address2[0]} +| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} +| | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} +| | And Ping and Verify IP address | ${nodes['TG']} +| | ... | ${ipv6_neighbor[0]} | ${ipv6_address[0]} +| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} +| | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} +| | And Ping and Verify IP address | ${nodes['TG']} +| | ... | ${ipv6_neighbor2[0]} | ${ipv6_address2[0]} +| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} +| | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} + +TC11: Honeycomb fails to configure two IPv4 addresses from the same subnet +| | [Documentation] | Check if Honeycomb can configure two IPv4 addresses in\ +| | ... | the same subnet onto a single interface. It should not be possible. +| | [Teardown] | Honeycomb removes interface ipv4 addresses | ${node} +| | ... | ${interface} +| | When Honeycomb sets interface ipv4 address with prefix +| | ... | ${node} | ${interface} | 192.168.0.1 | ${9} +| | Then Honeycomb fails to add interface ipv4 address +| | ... | ${node} | ${interface} | 192.168.0.2 | ${9} +| | And Honeycomb fails to add interface ipv4 address +| | ... | ${node} | ${interface} | 192.232.0.2 | ${9} + +TC12: Honeycomb fails to configure two IPv6 addresses from the same subnet +| | [Documentation] | Check if Honeycomb can configure two IPv6 addresses in\ +| | ... | the same subnet onto a single interface. It should not be possible. +| | [Tags] | EXPECTED_FAILING +# Subnet validation on IPv6 not supported. +| | [Teardown] | Honeycomb removes interface ipv6 addresses | ${node} +| | ... | ${interface} +| | When Honeycomb sets interface ipv6 address +| | ... | ${node} | ${interface} | 10::FF10 | ${64} +| | Then Honeycomb fails to add interface ipv6 address +| | ... | ${node} | ${interface} | 10::FF11 | ${64} +| | And Honeycomb fails to add interface ipv6 address +| | ... | ${node} | ${interface} | 10::FFFF | ${64} \ No newline at end of file