50aa28215b6cdfca15ab9787a5d31d3748f9825d
[csit.git] / tests / vpp / device / vm_vhost / ip4 / eth2p-ethip4-ip4base-eth-2vhost-1vm-dev.robot
1 # Copyright (c) 2019 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 | Library | resources.libraries.python.InterfaceUtil
16 | Library | resources.libraries.python.IPUtil
17 | Library | resources.libraries.python.NodePath
18 | Library | resources.libraries.python.topology.Topology
19 | Library | resources.libraries.python.Trace
20 | Library | resources.libraries.python.VhostUser
21 | Library | resources.libraries.python.VPPUtil
22 | Resource | resources/libraries/robot/ip/ip4.robot
23 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
24 | Resource | resources/libraries/robot/shared/default.robot
25 | Resource | resources/libraries/robot/shared/interfaces.robot
26 | Resource | resources/libraries/robot/shared/testing_path.robot
27 | Resource | resources/libraries/robot/shared/traffic.robot
28 | ...
29 | Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV
30 | ... | FUNCTEST | IP4FWD | BASE | ETH | VHOST | 1VM
31 | ...
32 | Test Setup | Set up VPP device test
33 | ...
34 | Test Teardown | Run Keywords
35 | ... | Stop and clear QEMU | ${dut_node}
36 | ... | AND | Tear down VPP device test
37 | ...
38 | Documentation | *IPv4 routing test cases with vhost user interface*
39 | ...
40 | ... | *[Top] Network Topologies:* TG-DUT1-TG 2-node circular topology with \
41 | ... | VM and single links between nodes.
42 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for IPv4 routing on \
43 | ... | both links.
44 | ... | *[Cfg] DUT configuration:* DUT1 is configured with IPv4 routing and \
45 | ... | two static IPv4 /24 route entries. Qemu Guest is connected to VPP via \
46 | ... | vhost-user interfaces. Guest is configured with linux bridge \
47 | ... | interconnecting vhost-user interfaces.
48 | ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets are sent in \
49 | ... | one direction by TG on links to DUT1; on receive TG verifies packets \
50 | ... | for correctness and their IPv4 src-addr, dst-addr and MAC addresses.
51 | ... | *[Ref] Applicable standard specifications:* RFC791, RFC826, RFC792
52
53 *** Variables ***
54 | ${net1}= | 10.0.1.0
55 | ${net3}= | 10.0.3.0
56 | ${net1_ip1}= | 10.0.1.1
57 | ${net1_ip2}= | 10.0.1.2
58 | ${net2_ip1}= | 10.0.2.1
59 | ${net2_ip2}= | 10.0.2.2
60 | ${net3_ip1}= | 10.0.3.1
61 | ${net3_ip2}= | 10.0.3.2
62 | ${prefix_length}= | 24
63 | ${fib_table_2}= | 20
64 | ${sock1}= | /tmp/sock1
65 | ${sock2}= | /tmp/sock2
66
67 *** Test Cases ***
68 | tc01-eth2p-ethip4-ip4base-eth-2vhost-1vm-device
69 | | [Documentation]
70 | | ... | Test uses two VRFs to route IPv4 traffic through two vhost-user \
71 | | ... | interfaces. Both interfaces are configured with IP addresses from \
72 | | ... | the same network. There is created linux bridge on VM to pass packet \
73 | | ... | from one vhost-user interface to another one.
74 | | ...
75 | | Given Configure path in 2-node circular topology
76 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
77 | | And Configure interfaces in path up
78 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut_node} | ${sock1}
79 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut_node} | ${sock2}
80 | | And Set Interface State | ${dut_node} | ${vhost1} | up
81 | | And Set Interface State | ${dut_node} | ${vhost2} | up
82 | | And Add Fib Table | ${dut_node} | ${fib_table_2}
83 | | And Assign Interface To Fib Table | ${dut_node}
84 | | ... | ${vhost2} | ${fib_table_2}
85 | | And Assign Interface To Fib Table | ${dut_node}
86 | | ... | ${dut_to_tg_if2} | ${fib_table_2}
87 | | And Configure IP addresses on interfaces
88 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_ip1} | ${prefix_length}
89 | | ... | ${dut_node} | ${vhost1} | ${net2_ip1} | ${prefix_length}
90 | | ... | ${dut_node} | ${vhost2} | ${net2_ip2} | ${prefix_length}
91 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip1} | ${prefix_length}
92 | | ${vhost2_mac}= | And Get Vhost User Mac By SW Index
93 | | ... | ${dut_node} | ${vhost2}
94 | | And Vpp Route Add | ${dut_node} | ${net3} | ${prefix_length}
95 | | ... | gateway=${net2_ip2} | interface=${vhost1} | resolve_attempts=${NONE}
96 | | ... | count=${NONE}
97 | | And Vpp Route Add | ${dut_node} | ${net1} | ${prefix_length}
98 | | ... | gateway=${net2_ip1} | interface=${vhost2} | resolve_attempts=${NONE}
99 | | ... | count=${NONE} | vrf=${fib_table_2}
100 | | Add IP Neighbor | ${dut_node} | ${vhost1} | ${net2_ip2} | ${vhost2_mac}
101 | | Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip2}
102 | | ... | ${tg_to_dut_if2_mac}
103 | | When Configure VM for vhost L2BD forwarding
104 | | ... | ${dut_node} | ${sock1} | ${sock2}
105 | | Then Send packet and verify headers
106 | | ... | ${tg_node} | ${net1_ip2} | ${net3_ip2}
107 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
108 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if2_mac} | ${tg_to_dut_if2_mac}