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 | DRV_VFIO_PCI
19| ... | RXQ_SIZE_0 | TXQ_SIZE_0
20| ... | ethicmpv4-ip4base-eth-1tap
21|
22| Suite Setup | Setup suite topology interfaces | scapy
23| Test Setup | Setup test | namespace
24| Test Teardown | Tear down test | packet_trace | namespace
25|
26| Test Template | Local Template
27|
28| Documentation | *Tap Interface Traffic Tests*
29| ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
30| ... | between nodes.
31| ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for L2 switching of
32| ... | IPv4.
33| ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with L2
34| ... | bridge-domain (L2BD) MAC learning enabled; Split Horizon Groups (SHG)
35| ... | are set depending on test case; Namespaces (NM)
36| ... | are set on DUT1 with attached linux-TAP.
37| ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets
38| ... | are sent by TG on link to DUT1; On receipt TG verifies packets
39| ... | for correctness and their IPv4 src-addr, dst-addr, and MAC addresses.
40| ... | *[Ref] Applicable standard specifications:*
41
42*** Variables ***
43| @{plugins_to_enable}= | dpdk_plugin.so
44| ${crypto_type}= | ${None}
45| ${nic_name}= | virtual
46| ${nic_driver}= | vfio-pci
47| ${nic_rxq_size}= | 0
48| ${nic_txq_size}= | 0
49| ${nic_pfs}= | 2
50| ${nic_vfs}= | 0
51| ${overhead}= | ${0}
52| ${tap1_VPP_ip}= | 16.0.10.1
53| ${tap1_NM_ip}= | 16.0.10.2
54| ${tap1_NM_mac}= | 02:00:00:00:00:02
55| ${dut_ip_address}= | 192.168.0.1
56| ${tg_ip_address}= | 192.168.0.2
57| ${tg_ip_address_GW}= | 192.168.0.0
58| ${prefix}= | 24
59
60*** Keywords ***
61| Local Template
62| | [Documentation]
63| | ... | [Cfg] On DUT1 configure two interface addresses with IPv4 of which\
64| | ... | one is TAP interface (dut_to_tg_if and TAP) and one is linux-TAP.
65| | ... | [Ver] Packet sent from TG gets to the destination and ICMP-reply is\
66| | ... | received on TG.
67| |
68| | ... | *Arguments:*
69| | ... | - frame_size - Framesize in Bytes in integer. Type: integer
70| | ... | - phy_cores - Number of physical cores. Type: integer
71| | ... | - rxq - Number of RX queues, default value: ${None}. Type: integer
72| |
73| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${None}
74| |
75| | Set Test Variable | \${frame_size}
76| |
77| | Given Set Max Rate And Jumbo
78| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq}
79| | And Pre-initialize layer driver | ${nic_driver}
80| | And Apply startup configuration on all VPP DUTs | with_trace=${True}
81| | When Initialize layer driver | ${nic_driver}
82| | And Initialize layer interface
83| | ${int1}= | And Add Tap Interface | ${dut1} | tap0
84| | And VPP Interface Set IP Address
85| | ... | ${dut1} | ${int1} | ${tap1_VPP_ip} | ${prefix}
86| | And VPP Interface Set IP Address
87| | ... | ${dut1} | ${DUT1_${int}1}[0] | ${dut_ip_address} | ${prefix}
88| | And Set Interface State | ${dut1} | ${int1} | up
89| | And Set Linux Interface MAC | ${dut1} | tap0 | ${tap1_NM_mac}
90| | And Set Linux Interface IP | ${dut1} | tap0 | ${tap1_NM_ip} | ${prefix}
91| | And Add Linux Route
92| | ... | ${dut1} | ${tg_ip_address_GW} | ${prefix} | ${tap1_VPP_ip}
93| | And VPP Add IP Neighbor
94| | ... | ${dut1} | ${DUT1_${int}1}[0] | ${tg_ip_address} | ${TG_pf1_mac}[0]
95| | And VPP Add IP Neighbor
96| | ... | ${dut1} | ${int1} | ${tap1_NM_ip} | ${tap1_NM_mac}
97| | Then Send ICMP echo request and verify answer
98| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_vf1_mac}[0] | ${TG_pf1_mac}[0]
99| | ... | ${tap1_NM_ip} | ${tg_ip_address}
100
101*** Test Cases ***
102| tc01-64B-ethicmpv4-ip4base-eth-1tap-dev
103| | [Tags] | 64B
104| | frame_size=${64} | phy_cores=${0}
105