1# Copyright (c) 2020 Cisco and/or its affiliates.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at:
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14*** Settings ***
15| Resource | resources/libraries/robot/shared/default.robot
16|
17| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY
18| ... | NIC_Virtual | ETH | IP4FWD | BASE | IP4BASE | 1TAP | NAMESPACE
19| ... | DRV_VFIO_PCI
20| ... | RXQ_SIZE_0 | TXQ_SIZE_0
21| ... | ethicmpv4-ip4base-eth-1tap-namespace
22|
23| Suite Setup | Setup suite topology interfaces | scapy
24| Test Setup | Setup test | namespace
25| Test Teardown | Tear down test | packet_trace | namespace
26|
27| Test Template | Local Template
28|
29| Documentation | *Tap Interface Traffic Tests*
30| ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
31| ... | between nodes.
32| ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for L2 switching of
33| ... | IPv4.
34| ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with L2
35| ... | bridge-domain (L2BD) MAC learning enabled; Split Horizon Groups (SHG)
36| ... | are set depending on test case; Namespaces (NM)
37| ... | are set on DUT1 with attached linux-TAP.
38| ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets
39| ... | are sent by TG on link to DUT1; On receipt TG verifies packets
40| ... | for correctness and their IPv4 src-addr, dst-addr, and MAC addresses.
41| ... | *[Ref] Applicable standard specifications:*
42
43*** Variables ***
44| @{plugins_to_enable}= | dpdk_plugin.so
45| ${crypto_type}= | ${None}
46| ${nic_name}= | virtual
47| ${nic_driver}= | vfio-pci
48| ${nic_rxq_size}= | 0
49| ${nic_txq_size}= | 0
50| ${nic_pfs}= | 2
51| ${nic_vfs}= | 0
52| ${overhead}= | ${0}
53| ${tap1_VPP_ip}= | 16.0.10.1
54| ${tap1_NM_ip}= | 16.0.10.2
55| ${tap1_NM_mac}= | 02:00:00:00:00:02
56| ${dut_ip_address}= | 192.168.0.1
57| ${tg_ip_address}= | 192.168.0.2
58| ${tg_ip_address_GW}= | 192.168.0.0
59| ${prefix}= | 24
60
61*** Keywords ***
62| Local Template
63| | [Documentation]
64| | ... | [Cfg] On DUT1 configure two interface addresses with IPv4 of which\
65| | ... | one is TAP interface (dut_to_tg_if and TAP) and one is linux-TAP in\
66| | ... | namespace.
67| | ... | [Ver] Packet sent from TG gets to the destination and ICMP-reply is\
68| | ... | received on TG.
69| |
70| | ... | *Arguments:*
71| | ... | - frame_size - Framesize in Bytes in integer. Type: integer
72| | ... | - phy_cores - Number of physical cores. Type: integer
73| | ... | - rxq - Number of RX queues, default value: ${None}. Type: integer
74| |
75| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${None}
76| |
77| | Set Test Variable | \${frame_size}
78| |
79| | Given Set Max Rate And Jumbo
80| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq}
81| | And Pre-initialize layer driver | ${nic_driver}
82| | And Apply startup configuration on all VPP DUTs | with_trace=${True}
83| | When Initialize layer driver | ${nic_driver}
84| | And Initialize layer interface
85| | ${int1}= | And Add Tap Interface | ${dut1} | tap0
86| | And VPP Interface Set IP Address
87| | ... | ${dut1} | ${int1} | ${tap1_VPP_ip} | ${prefix}
88| | And VPP Interface Set IP Address
89| | ... | ${dut1} | ${DUT1_${int}1}[0] | ${dut_ip_address} | ${prefix}
90| | And Set Interface State | ${dut1} | ${int1} | up
91| | And Create Namespace | ${dut1} | nmspace1
92| | And Attach Interface To Namespace | ${dut1} | nmspace1 | tap0
93| | And Set Linux Interface MAC
94| | ... | ${dut1} | tap0 | ${tap1_NM_mac} | nmspace1
95| | And Set Linux Interface IP
96| | ... | ${dut1} | tap0 | ${tap1_NM_ip} | ${prefix} | nmspace1
97| | And VPP Add IP Neighbor
98| | ... | ${dut1} | ${DUT1_${int}1}[0] | ${tg_ip_address} | ${TG_pf1_mac}[0]
99| | And VPP Add IP Neighbor
100| | ... | ${dut1} | ${int1} | ${tap1_NM_ip} | ${tap1_NM_mac}
101| | And Add Linux Route
102| | ... | ${dut1} | ${tg_ip_address_GW} | ${prefix} | ${tap1_VPP_ip} | nmspace1
103| | Then Send ICMP echo request and verify answer
104| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_vf1_mac}[0] | ${TG_pf1_mac}[0]
105| | ... | ${tap1_NM_ip} | ${tg_ip_address}
106
107*** Test Cases ***
108| tc01-64B-ethicmpv4-ip4base-eth-1tap-namespace-dev
109| | [Tags] | 64B
110| | frame_size=${64} | phy_cores=${0}
111