CSIT-1386 KernelVM - Part I
[csit.git] / tests / vpp / func / vm_vhost / l2bd / eth2p-ethip4-l2bdbase-vhost-client-reconnect-2vm-func.robot
1 # Copyright (c) 2016 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 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
17 | Resource | resources/libraries/robot/shared/testing_path.robot
18 | Resource | resources/libraries/robot/overlay/vxlan.robot
19 | Library  | resources.libraries.python.Trace
20 | Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO | VPP_VM_ENV
21 | Test Setup | Set up functional test
22 | Test Teardown | Run Keywords
23 | ... | resources.libraries.python.QemuUtils.Qemu Kill All | ${dut_node} | AND
24 | ... | Tear down functional test
25 | Documentation | *Vhost-User Interface Traffic Tests*
26 | ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
27 | ... | between nodes.
28 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-VXLAN-ETH-IP on TG-DUT link.
29 | ... | ETH-IP on VirtualEthernet-VM interface.
30 | ... | *[Cfg] DUT configuration:* On DUT is running 2 VM with 2 vhost-user
31 | ... | interface on each VM. DUT is configured with VXLAN and vhost-user
32 | ... | interfaces in bridge-domain (L2BD).
33 | ... | *[Cfg] VM configuration:* VM has both vhost-user interfaces added into
34 | ... | Linux Bridge.
35 | ... | *[Ver] TG verification:*
36 | ... | VXLAN packet is send to DUT where is decapsulated and send bridged to
37 | ... | vhost-user inteface. VM forwards frame to its second interface and VPP
38 | ... | encapsulates it to another VXLAN tunnel. Packets
39 | ... | are sent and received by TG on link to DUT.
40
41 *** Variables ***
42 | ${tg_if1_ip}= | 192.168.0.1
43 | ${dut_if1_ip}= | 192.168.0.2
44 | ${prefix_length}= | ${24}
45
46 | ${sock_vm1_1}= | /tmp/sock1
47 | ${sock_vm1_2}= | /tmp/sock2
48 | ${sock_vm2_1}= | /tmp/sock3
49 | ${sock_vm2_2}= | /tmp/sock4
50
51 *** Test Cases ***
52 | TC01: Qemu reconnects to VPPs vhost-user when Qemu is killed and restarted
53 | | Given Configure path in 2-node circular topology
54 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
55 | | And Set interfaces in 2-node circular topology up
56 | | And Set Interface Address | ${dut_node} | ${dut_to_tg_if1} | ${dut_if1_ip}
57 | | ... | ${prefix_length}
58 | | And Add IP Neighbor | ${dut_node} | ${dut_to_tg_if1} | ${tg_if1_ip}
59 | | ... | ${tg_to_dut_if1_mac}
60 | | ${vxlan1}= | And Create VXLAN interface | ${dut_node} | ${101}
61 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
62 | | ${vxlan2}= | And Create VXLAN interface | ${dut_node} | ${102}
63 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
64 | | ${vxlan3}= | And Create VXLAN interface | ${dut_node} | ${103}
65 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
66 | | ${vxlan4}= | And Create VXLAN interface | ${dut_node} | ${104}
67 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
68 | | And Set Interface State | ${dut_node} | ${vxlan1} | up
69 | | And Set Interface State | ${dut_node} | ${vxlan2} | up
70 | | And Set Interface State | ${dut_node} | ${vxlan3} | up
71 | | And Set Interface State | ${dut_node} | ${vxlan4} | up
72 | | ${vhost_if1}= | And Vpp Create Vhost User Interface
73 | | ... | ${dut_node} | ${sock_vm1_1}
74 | | ${vhost_if2}= | And Vpp Create Vhost User Interface
75 | | ... | ${dut_node} | ${sock_vm1_2}
76 | | ${vhost_if3}= | And Vpp Create Vhost User Interface
77 | | ... | ${dut_node} | ${sock_vm2_1}
78 | | ${vhost_if4}= | And Vpp Create Vhost User Interface
79 | | ... | ${dut_node} | ${sock_vm2_2}
80 | | And Set Interface State | ${dut_node} | ${vhost_if1} | up
81 | | And Set Interface State | ${dut_node} | ${vhost_if2} | up
82 | | And Set Interface State | ${dut_node} | ${vhost_if3} | up
83 | | And Set Interface State | ${dut_node} | ${vhost_if4} | up
84 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${101} | ${vxlan1}
85 | | ... | ${vhost_if1}
86 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${102} | ${vxlan2}
87 | | ... | ${vhost_if2}
88 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${103} | ${vxlan3}
89 | | ... | ${vhost_if3}
90 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${104} | ${vxlan4}
91 | | ... | ${vhost_if4}
92 | | And Configure QEMU vhost and run it VM | ${dut_node} | ${sock_vm1_1}
93 | | ... | ${sock_vm1_2} | ${1}
94 | | And Configure QEMU vhost and run it VM | ${dut_node} | ${sock_vm2_1}
95 | | ... | ${sock_vm2_2} | ${2}
96 | | And Check traffic through VM
97 | | When Run keyword | qemu-1.Qemu Kill
98 | | ${vm1}= | And Run Keyword | qemu-1.Qemu Start
99 | | ${vhost_int_1}= | And Get Vhost User If Name By Sock | ${vm1}
100 | | ... | ${sock_vm1_1}
101 | | ${vhost_int_2}= | And Get Vhost User If Name By Sock | ${vm1}
102 | | ... | ${sock_vm1_2}
103 | | And Linux Add Bridge | ${vm1} | br0 | ${vhost_int_1} | ${vhost_int_2}
104 | | And Set Interface State | ${vm1} | ${vhost_int_1} | up | if_type=name
105 | | And Set Interface State | ${vm1} | ${vhost_int_2} | up | if_type=name
106 | | Then Check traffic through VM
107
108
109 | TC02: VPP reconnects to Qemu vhost-user when Restart VPP and reconfigured
110 | | [Tags] | EXPECTED_FAILING
111 | | [Documentation]
112 | | ... | *Failing:* Qemu doesn't support reconnect prior to version 2.7.
113 | | Given Configure path in 2-node circular topology
114 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
115 | | And Set interfaces in 2-node circular topology up
116 | | And Set Interface Address | ${dut_node} | ${dut_to_tg_if1} | ${dut_if1_ip}
117 | | ... | ${prefix_length}
118 | | And Add IP Neighbor | ${dut_node} | ${dut_to_tg_if1} | ${tg_if1_ip}
119 | | ... | ${tg_to_dut_if1_mac}
120 | | ${vxlan1}= | And Create VXLAN interface | ${dut_node} | ${101}
121 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
122 | | ${vxlan2}= | And Create VXLAN interface | ${dut_node} | ${102}
123 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
124 | | ${vxlan3}= | And Create VXLAN interface | ${dut_node} | ${103}
125 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
126 | | ${vxlan4}= | And Create VXLAN interface | ${dut_node} | ${104}
127 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
128 | | And Set Interface State | ${dut_node} | ${vxlan1} | up
129 | | And Set Interface State | ${dut_node} | ${vxlan2} | up
130 | | And Set Interface State | ${dut_node} | ${vxlan3} | up
131 | | And Set Interface State | ${dut_node} | ${vxlan4} | up
132 | | ${vhost_if1}= | And Vpp Create Vhost User Interface | ${dut_node}
133 | | ... | ${sock_vm1_1}
134 | | ${vhost_if2}= | And Vpp Create Vhost User Interface | ${dut_node}
135 | | ... | ${sock_vm1_2}
136 | | ${vhost_if3}= | And Vpp Create Vhost User Interface | ${dut_node}
137 | | ... | ${sock_vm2_1}
138 | | ${vhost_if4}= | And Vpp Create Vhost User Interface | ${dut_node}
139 | | ... | ${sock_vm2_2}
140 | | And Set Interface State | ${dut_node} | ${vhost_if1} | up
141 | | And Set Interface State | ${dut_node} | ${vhost_if2} | up
142 | | And Set Interface State | ${dut_node} | ${vhost_if3} | up
143 | | And Set Interface State | ${dut_node} | ${vhost_if4} | up
144 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${101} | ${vxlan1}
145 | | ... | ${vhost_if1}
146 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${102} | ${vxlan2}
147 | | ... | ${vhost_if2}
148 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${103} | ${vxlan3}
149 | | ... | ${vhost_if3}
150 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${104} | ${vxlan4}
151 | | ... | ${vhost_if4}
152 | | And Configure QEMU vhost and run it VM | ${dut_node} | ${sock_vm1_1}
153 | | ... | ${sock_vm1_2} | ${1}
154 | | And Configure QEMU vhost and run it VM | ${dut_node} | ${sock_vm2_1}
155 | | ... | ${sock_vm2_2} | ${2}
156 | | And Check traffic through VM
157 | | And Verify VPP PID in Teardown
158 | | When Setup All Duts | ${nodes}
159 | | And Save VPP PIDs
160 | | And Set interfaces in 2-node circular topology up
161 | | And Set Interface Address | ${dut_node} | ${dut_to_tg_if1} | ${dut_if1_ip}
162 | | ... | ${prefix_length}
163 | | And Add IP Neighbor | ${dut_node} | ${dut_to_tg_if1} | ${tg_if1_ip}
164 | | ... | ${tg_to_dut_if1_mac}
165 | | ${vxlan1}= | And Create VXLAN interface | ${dut_node} | ${101}
166 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
167 | | ${vxlan2}= | And Create VXLAN interface | ${dut_node} | ${102}
168 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
169 | | ${vxlan3}= | And Create VXLAN interface | ${dut_node} | ${103}
170 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
171 | | ${vxlan4}= | And Create VXLAN interface | ${dut_node} | ${104}
172 | | ... | ${dut_if1_ip} | ${tg_if1_ip}
173 | | And Set Interface State | ${dut_node} | ${vxlan1} | up
174 | | And Set Interface State | ${dut_node} | ${vxlan2} | up
175 | | And Set Interface State | ${dut_node} | ${vxlan3} | up
176 | | And Set Interface State | ${dut_node} | ${vxlan4} | up
177 | | ${vhost_if1}= | And Vpp Create Vhost User Interface | ${dut_node}
178 | | ... | ${sock_vm1_1}
179 | | ${vhost_if2}= | And Vpp Create Vhost User Interface | ${dut_node}
180 | | ... | ${sock_vm1_2}
181 | | ${vhost_if3}= | And Vpp Create Vhost User Interface | ${dut_node}
182 | | ... | ${sock_vm2_1}
183 | | ${vhost_if4}= | And Vpp Create Vhost User Interface | ${dut_node}
184 | | ... | ${sock_vm2_2}
185 | | And Set Interface State | ${dut_node} | ${vhost_if1} | up
186 | | And Set Interface State | ${dut_node} | ${vhost_if2} | up
187 | | And Set Interface State | ${dut_node} | ${vhost_if3} | up
188 | | And Set Interface State | ${dut_node} | ${vhost_if4} | up
189 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${101} | ${vxlan1}
190 | | ... | ${vhost_if1}
191 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${102} | ${vxlan2}
192 | | ... | ${vhost_if2}
193 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${103} | ${vxlan3}
194 | | ... | ${vhost_if3}
195 | | And Vpp Add L2 Bridge Domain | ${dut_node} | ${104} | ${vxlan4}
196 | | ... | ${vhost_if4}
197 | | Then Check traffic through VM
198
199
200 *** Keywords ***
201 | Configure QEMU vhost and run it VM
202 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${qemu_id}
203 | | Import Library | resources.libraries.python.QemuUtils | qemu_id=${qemu_id}
204 | | ... | WITH NAME | qemu-${qemu_id}
205 | | ${q_add_vhost}= | Replace Variables | qemu-${qemu_id}.Qemu Add Vhost User If
206 | | ${q_set_node}= | Replace Variables | qemu-${qemu_id}.Qemu Set Node
207 | | ${q_start}= | Replace Variables | qemu-${qemu_id}.Qemu Start
208 | | Run keyword | ${q_set_node} | ${dut_node}
209 | | Run keyword | ${q_add_vhost} | ${sock1}
210 | | Run keyword | ${q_add_vhost} | ${sock2}
211 | | ${vm}= | Run keyword | ${q_start}
212 | | ${vhost1}= | Get Vhost User If Name By Sock | ${vm} | ${sock1}
213 | | ${vhost2}= | Get Vhost User If Name By Sock | ${vm} | ${sock2}
214 | | Linux Add Bridge | ${vm} | br0 | ${vhost1} | ${vhost2}
215 | | Set Interface State | ${vm} | ${vhost1} | up | if_type=name
216 | | Set Interface State | ${vm} | ${vhost2} | up | if_type=name
217 | | Set Test Variable | ${qemu-${qemu_id}} | ${vm}
218
219 | Check traffic through VM
220 | | [Documentation] | Send VXLAN traffic through both configured VMs.
221 | | Send VXLAN encapsulated packet and verify received packet | ${tg_node}
222 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1}
223 | | ... | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
224 | | ... | ${tg_if1_ip} | ${dut_if1_ip} | ${101}
225 | | ... | ${dut_if1_ip} | ${tg_if1_ip} | ${102}
226 | | Send VXLAN encapsulated packet and verify received packet | ${tg_node}
227 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1}
228 | | ... | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
229 | | ... | ${tg_if1_ip} | ${dut_if1_ip} | ${103}
230 | | ... | ${dut_if1_ip} | ${tg_if1_ip} | ${104}