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