16daa2d79SPeter Mikus# Copyright (c) 2020 Cisco and/or its affiliates.
2982e81efSJan Gelety# Licensed under the Apache License, Version 2.0 (the "License");
3982e81efSJan Gelety# you may not use this file except in compliance with the License.
4982e81efSJan Gelety# You may obtain a copy of the License at:
5982e81efSJan Gelety#
6982e81efSJan Gelety#     http://www.apache.org/licenses/LICENSE-2.0
7982e81efSJan Gelety#
8982e81efSJan Gelety# Unless required by applicable law or agreed to in writing, software
9982e81efSJan Gelety# distributed under the License is distributed on an "AS IS" BASIS,
10982e81efSJan Gelety# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11982e81efSJan Gelety# See the License for the specific language governing permissions and
12982e81efSJan Gelety# limitations under the License.
13982e81efSJan Gelety
14982e81efSJan Gelety*** Settings ***
151577123aSPeter Mikus| Resource | resources/libraries/robot/shared/default.robot
16d68951acSJan Gelety|
17533fcfe3SPeter Mikus| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV | SCAPY
18ac89ba8aSPeter Mikus| ... | NIC_Virtual | ETH | IP4FWD | BASE | IP4BASE | 1TAP | DRV_VFIO_PCI
196daa2d79SPeter Mikus| ... | RXQ_SIZE_0 | TXQ_SIZE_0
20e916ab4dSVratko Polak| ... | ethicmpv4-ip4base-eth-1tap
21d68951acSJan Gelety|
2214a71b74SPeter Mikus| Suite Setup | Setup suite topology interfaces | scapy
231577123aSPeter Mikus| Test Setup | Setup test | namespace
246871d4e7SPeter Mikus| Test Teardown | Tear down test | packet_trace | namespace
25d68951acSJan Gelety|
26d2a7114dSPeter Mikus| Test Template | Local Template
27d68951acSJan Gelety|
28982e81efSJan Gelety| Documentation | *Tap Interface Traffic Tests*
29982e81efSJan Gelety| ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
30982e81efSJan Gelety| ... | between nodes.
31982e81efSJan Gelety| ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for L2 switching of
32982e81efSJan Gelety| ... | IPv4.
33982e81efSJan Gelety| ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with L2
34982e81efSJan Gelety| ... | bridge-domain (L2BD) MAC learning enabled; Split Horizon Groups (SHG)
35982e81efSJan Gelety| ... | are set depending on test case; Namespaces (NM)
36982e81efSJan Gelety| ... | are set on DUT1 with attached linux-TAP.
37982e81efSJan Gelety| ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets
38982e81efSJan Gelety| ... | are sent by TG on link to DUT1; On receipt TG verifies packets
39982e81efSJan Gelety| ... | for correctness and their IPv4 src-addr, dst-addr, and MAC addresses.
40982e81efSJan Gelety| ... | *[Ref] Applicable standard specifications:*
41982e81efSJan Gelety
42982e81efSJan Gelety*** Variables ***
431577123aSPeter Mikus| @{plugins_to_enable}= | dpdk_plugin.so
44ac89ba8aSPeter Mikus| ${crypto_type}= | ${None}
451577123aSPeter Mikus| ${nic_name}= | virtual
46fcc77752SPeter Mikus| ${nic_driver}= | vfio-pci
476daa2d79SPeter Mikus| ${nic_rxq_size}= | 0
486daa2d79SPeter Mikus| ${nic_txq_size}= | 0
4914a71b74SPeter Mikus| ${nic_pfs}= | 2
5014a71b74SPeter Mikus| ${nic_vfs}= | 0
51533fcfe3SPeter Mikus| ${overhead}= | ${0}
52982e81efSJan Gelety| ${tap1_VPP_ip}= | 16.0.10.1
53982e81efSJan Gelety| ${tap1_NM_ip}= | 16.0.10.2
54982e81efSJan Gelety| ${tap1_NM_mac}= | 02:00:00:00:00:02
55982e81efSJan Gelety| ${dut_ip_address}= | 192.168.0.1
56982e81efSJan Gelety| ${tg_ip_address}= | 192.168.0.2
57982e81efSJan Gelety| ${tg_ip_address_GW}= | 192.168.0.0
58982e81efSJan Gelety| ${prefix}= | 24
59982e81efSJan Gelety
60d2a7114dSPeter Mikus*** Keywords ***
61d2a7114dSPeter Mikus| Local Template
62982e81efSJan Gelety| | [Documentation]
6353d69321STibor Frank| | ... | [Cfg] On DUT1 configure two interface addresses with IPv4 of which\
6453d69321STibor Frank| | ... | one is TAP interface (dut_to_tg_if and TAP) and one is linux-TAP.
6553d69321STibor Frank| | ... | [Ver] Packet sent from TG gets to the destination and ICMP-reply is\
66982e81efSJan Gelety| | ... | received on TG.
67d68951acSJan Gelety| |
68d2a7114dSPeter Mikus| | ... | *Arguments:*
69d2a7114dSPeter Mikus| | ... | - frame_size - Framesize in Bytes in integer. Type: integer
70d2a7114dSPeter Mikus| | ... | - phy_cores - Number of physical cores. Type: integer
71d2a7114dSPeter Mikus| | ... | - rxq - Number of RX queues, default value: ${None}. Type: integer
72d68951acSJan Gelety| |
73d2a7114dSPeter Mikus| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${None}
74d68951acSJan Gelety| |
75d2a7114dSPeter Mikus| | Set Test Variable | \${frame_size}
76d68951acSJan Gelety| |
77ac89ba8aSPeter Mikus| | Given Set Max Rate And Jumbo
78ac89ba8aSPeter Mikus| | And Add worker threads to all DUTs | ${phy_cores} | ${rxq}
79ac89ba8aSPeter Mikus| | And Pre-initialize layer driver | ${nic_driver}
80d2a7114dSPeter Mikus| | And Apply startup configuration on all VPP DUTs | with_trace=${True}
81fcc77752SPeter Mikus| | When Initialize layer driver | ${nic_driver}
82fcc77752SPeter Mikus| | And Initialize layer interface
83533fcfe3SPeter Mikus| | ${int1}= | And Add Tap Interface | ${dut1} | tap0
840e28406bSJan Gelety| | And VPP Interface Set IP Address
85533fcfe3SPeter Mikus| | ... | ${dut1} | ${int1} | ${tap1_VPP_ip} | ${prefix}
860e28406bSJan Gelety| | And VPP Interface Set IP Address
8714a71b74SPeter Mikus| | ... | ${dut1} | ${DUT1_${int}1}[0] | ${dut_ip_address} | ${prefix}
88533fcfe3SPeter Mikus| | And Set Interface State | ${dut1} | ${int1} | up
89533fcfe3SPeter Mikus| | And Set Linux Interface MAC | ${dut1} | tap0 | ${tap1_NM_mac}
90533fcfe3SPeter Mikus| | And Set Linux Interface IP | ${dut1} | tap0 | ${tap1_NM_ip} | ${prefix}
91533fcfe3SPeter Mikus| | And Add Linux Route
92533fcfe3SPeter Mikus| | ... | ${dut1} | ${tg_ip_address_GW} | ${prefix} | ${tap1_VPP_ip}
93533fcfe3SPeter Mikus| | And VPP Add IP Neighbor
9414a71b74SPeter Mikus| | ... | ${dut1} | ${DUT1_${int}1}[0] | ${tg_ip_address} | ${TG_pf1_mac}[0]
95533fcfe3SPeter Mikus| | And VPP Add IP Neighbor
96533fcfe3SPeter Mikus| | ... | ${dut1} | ${int1} | ${tap1_NM_ip} | ${tap1_NM_mac}
97533fcfe3SPeter Mikus| | Then Send ICMP echo request and verify answer
9814a71b74SPeter Mikus| | ... | ${tg} | ${TG_pf1}[0] | ${DUT1_vf1_mac}[0] | ${TG_pf1_mac}[0]
99982e81efSJan Gelety| | ... | ${tap1_NM_ip} | ${tg_ip_address}
100982e81efSJan Gelety
101d2a7114dSPeter Mikus*** Test Cases ***
102f8452762SPeter Mikus| tc01-64B-ethicmpv4-ip4base-eth-1tap-dev
103d2a7114dSPeter Mikus| | [Tags] | 64B
104d2a7114dSPeter Mikus| | frame_size=${64} | phy_cores=${0}
105