2 Documentation Test suite to verify SFC configuration and packet flows.
3 Suite Setup Suite Setup
4 Suite Teardown OpenStackOperations.OpenStack Suite Teardown
5 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Test Teardown BuiltIn.Run Keywords OpenStackOperations.Get Test Teardown Debugs
7 ... AND OpenStackOperations.Get Test Teardown Debugs For SFC
9 Library OperatingSystem
10 Library RequestsLibrary
11 Resource ../../../libraries/DevstackUtils.robot
12 Resource ../../../libraries/LiveMigration.robot
13 Resource ../../../libraries/OpenStackOperations.robot
14 Resource ../../../libraries/SetupUtils.robot
15 Resource ../../../libraries/Utils.robot
16 Resource ../../../libraries/KarafKeywords.robot
19 ${SECURITY_GROUP} sg-sfc
21 @{SUBNETS} l2_subnet_1
22 @{NET_1_VMS} sf1 sourcevm destvm
23 @{NON_SF_VMS} sourcevm destvm
24 @{SUBNET_CIDRS} 30.0.0.0/24
25 @{PORTS} p1in p1out source_vm_port dest_vm_port
26 ${NC_COMMAND} nc -zv -w 5
28 ${RES_FAILURE} Operation timed out
29 ${WEBSERVER_80} python -m SimpleHTTPServer 80 > /dev/null 2>&1 &
30 ${WEBSERVER_81} python -m SimpleHTTPServer 81 > /dev/null 2>&1 &
31 ${WEBSERVER_82} python -m SimpleHTTPServer 82 > /dev/null 2>&1 &
32 ${CLOUD_IMAGE} "https://artifacts.opnfv.org/sfc/images/sfc_nsh_fraser.qcow2"
33 ${CLOUD_IMAGE_NAME} sfc_nsh_fraser
34 ${CLOUD_FLAVOR_NAME} sfc_nsh_fraser
35 @{NETVIRT_DIAG_SERVICES} OPENFLOW IFM ITM DATASTORE ELAN
38 ${CLOUD_IMAGE_USER} root
39 ${CLOUD_IMAGE_PASS} opnfv
40 ${CLOULD_IMAGE_CONSOLE} root
43 Create Flow Classifiers For Basic Test
44 [Documentation] Create SFC Flow Classifier for TCP traffic between source VM and destination VM
45 OpenStackOperations.Create SFC Flow Classifier FC_80 @{NET1_VM_IPS}[0] @{NET1_VM_IPS}[1] tcp source_vm_port args=--destination-port 80:80
46 OpenStackOperations.Create SFC Flow Classifier FC_81 @{NET1_VM_IPS}[0] @{NET1_VM_IPS}[1] tcp source_vm_port args=--destination-port 81:81
49 [Documentation] Create SFC Port Pairs
50 OpenStackOperations.Create SFC Port Pair SFPP1 p1in p1out
52 Create Port Pair Groups
53 [Documentation] Create SFC Port Pair Groups
54 OpenStackOperations.Create SFC Port Pair Group SFPPG1 SFPP1
56 Test Communication From Vm Instance1 In net_1 No SF
57 [Documentation] Login to the source VM instance, and send a nc req to the destination VM instance, If the SF handles the traffic, there will be delay causing the time for nc to be higher.
58 ${DEST_VM_LIST} BuiltIn.Create List @{NET1_VM_IPS}[1]
59 ${nc_resp} OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND} @{NET1_VM_IPS}[1] 80 user=${CLOUD_IMAGE_USER} password=${CLOUD_IMAGE_PASS}
60 ... console=${CLOULD_IMAGE_CONSOLE}
61 BuiltIn.Should Contain ${nc_resp} ${RES_SUCCESS}
62 ${nc_resp} OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND} @{NET1_VM_IPS}[1] 81 user=${CLOUD_IMAGE_USER} password=${CLOUD_IMAGE_PASS}
63 ... console=${CLOULD_IMAGE_CONSOLE}
64 BuiltIn.Should Contain ${nc_resp} ${RES_SUCCESS}
65 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Get Test Teardown Debugs
66 ... AND OpenStackOperations.Get Test Teardown Debugs For SFC
67 ... AND OpenStackOperations.Exit From Vm Console
69 Create Port Chain For Src->Dest Port 80
70 [Documentation] Create SFC Port Chain using port group and classifier created previously
71 OpenStackOperations.Create SFC Port Chain SFPC1 args=--port-pair-group SFPPG1 --flow-classifier FC_80
73 Test Communication From Vm Instance1 In net_1 Port 80 via SF
74 [Documentation] Login to the source VM instance, and send a nc req to the destination VM instance, If the SF handles the traffic, there will be delay causing the time for nc to be higher.
75 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
76 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
78 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
80 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
81 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
82 BuiltIn.Comment Port 80 communication should fail as the SF blocks the same
83 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
85 BuiltIn.Comment Test to confirm Port 81 is not blocked
86 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
88 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
89 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 81
90 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
92 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
94 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
95 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Get Test Teardown Debugs
96 ... AND OpenStackOperations.Get Test Teardown Debugs For SFC
97 ... AND OpenStackOperations.Exit From Vm Console
99 Update Port Chain To Use Flow Classifier For Port 81
100 [Documentation] Update Port Chain to use FC_81 instead of FC_80
101 OpenStackOperations.Update SFC Port Chain With A New Flow Classifier SFPC1 FC_81
102 OpenStackOperations.Update SFC Port Chain Removing A Flow Classifier SFPC1 FC_80
104 Test Communication From Vm Instance1 In net_1 Port 81 via SF
105 [Documentation] Login to the source VM instance, and send a nc req to the destination VM instance, If the SF handles the traffic, there will be delay causing the time for nc to be higher.
106 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
107 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
108 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
109 ... 80 ${RES_SUCCESS}
110 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
111 ... 81 ${RES_SUCCESS} cmd_timeout=60s
112 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
113 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 81
114 BuiltIn.Comment Port 81 communication should fail as the SF blocks the same
115 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
116 ... 80 ${RES_SUCCESS}
117 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
118 ... 81 ${RES_FAILURE} cmd_timeout=60s
119 BuiltIn.Comment Test to confirm Port 80 does not continue to get routed through SF
120 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
121 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
122 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
123 ... 80 ${RES_SUCCESS}
124 Wait Until Keyword Succeeds 3x 10s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND}
125 ... 81 ${RES_SUCCESS} cmd_timeout=60s
126 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
127 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Get Test Teardown Debugs
128 ... AND OpenStackOperations.Get Test Teardown Debugs For SFC
129 ... AND OpenStackOperations.Exit From Vm Console
131 Delete And Recreate Port Chain And Flow Classifiers For Symmetric Test
132 OpenStackOperations.Create SFC Flow Classifier FC_SYM @{NET1_VM_IPS}[0] @{NET1_VM_IPS}[1] tcp source_vm_port args=--destination-port 82:82 --source-port 2000 --logical-destination-port dest_vm_port
133 OpenStackOperations.Delete SFC Port Chain SFPC1
134 OpenStackOperations.Create SFC Port Chain SFPSYM args=--port-pair-group SFPPG1 --flow-classifier FC_SYM --chain-parameters symmetric=true
136 Test Communication From Vm Instance1 For Symmetric Chain
137 [Documentation] Login to the source VM instance, and send a nc req to the destination VM instance, If the SF handles the traffic, there will be delay causing the time for nc to be higher.
138 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
139 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
140 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
141 Wait Until Keyword Succeeds 8x 20s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND} -p 2000
142 ... 82 ${RES_SUCCESS} cmd_timeout=80s
143 BuiltIn.Comment Test to confirm the SRC->DEST Port 82 is routed through SF
144 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
145 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 82
146 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
147 Wait Until Keyword Succeeds 8x 20s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND} -p 2000
148 ... 82 ${RES_FAILURE} cmd_timeout=80s
149 BuiltIn.Comment Test to confirm DEST->SRC Port 2000 path SFC traversal
150 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
151 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
152 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off --block 2000
153 Wait Until Keyword Succeeds 8x 20s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND} -p 2000
154 ... 82 ${RES_FAILURE} cmd_timeout=80s
155 BuiltIn.Comment Test to confirm the Normalcy restored
156 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
157 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
158 Start Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP} args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
159 Wait Until Keyword Succeeds 8x 20s Check Network Reachability @{NETWORKS}[0] @{NET1_VM_IPS}[0] ${NC_COMMAND} -p 2000
160 ... 82 ${RES_SUCCESS} cmd_timeout=80s
161 Stop Vxlan Tool in SF @{NETWORKS}[0] ${SF1_IP}
162 [Teardown] BuiltIn.Run Keywords OpenStackOperations.Get Test Teardown Debugs
163 ... AND OpenStackOperations.Get Test Teardown Debugs For SFC
164 ... AND OpenStackOperations.Exit From Vm Console
166 Delete Configurations
167 [Documentation] Delete all elements that were created in the test case section. These are done
168 ... in a local keyword so this can be called as part of the Suite Teardown. When called as part
169 ... of the Suite Teardown, all steps will be attempted. This prevents robot framework from bailing
170 ... on the rest of a test case if one step intermittently has trouble and fails. The goal is to attempt
171 ... to leave the test environment as clean as possible upon completion of this suite.
172 : FOR ${vm} IN @{NET_1_VMS}
173 \ OpenStackOperations.Delete Vm Instance ${vm}
174 OpenStackOperations.Delete SFC Port Chain SFPSYM
175 OpenStackOperations.Delete SFC Port Pair Group SFPPG1
176 OpenStackOperations.Delete SFC Port Pair SFPP1
177 OpenStackOperations.Delete SFC Flow Classifier FC_80
178 OpenStackOperations.Delete SFC Flow Classifier FC_81
179 OpenStackOperations.Delete SFC Flow Classifier FC_SYM
180 : FOR ${port} IN @{PORTS}
181 \ OpenStackOperations.Delete Port ${port}
182 OpenStackOperations.Delete SubNet l2_subnet_1
183 : FOR ${network} IN @{NETWORKS}
184 \ OpenStackOperations.Delete Network ${network}
185 OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP}
189 OpenStackOperations.OpenStack Suite Setup
190 Create Basic Networks
191 Create Ports For Testing
192 Create Instances For Testing
193 Check Vm Instances Have Ip Address And Ready For Test
194 Start Applications on VM Instances For Test
196 Create Basic Networks
197 BuiltIn.Comment Create Network For Testing
198 OpenStackOperations.Create Network @{NETWORKS}[0]
199 BuiltIn.Comment Create Subnet For Testing
200 OpenStackOperations.Create SubNet @{NETWORKS}[0] @{SUBNETS}[0] @{SUBNET_CIDRS}[0]
201 OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP}
202 BuiltIn.Comment Create Neutron Ports with no port security for SFC Tests
203 OpenStackOperations.Get Suite Debugs
205 Create Ports For Testing
206 : FOR ${port} IN @{PORTS}
207 \ OpenStackOperations.Create Port @{NETWORKS}[0] ${port} sg=${SECURITY_GROUP}
208 OpenStackOperations.Update Port p1in additional_args=--no-security-group
209 OpenStackOperations.Update Port p1in additional_args=--disable-port-security
210 OpenStackOperations.Update Port p1out additional_args=--no-security-group
211 OpenStackOperations.Update Port p1out additional_args=--disable-port-security
212 CompareStream.Run_Keyword_If_Equals oxygen OpenStackOperations.Update Port source_vm_port additional_args=--no-security-group
213 CompareStream.Run_Keyword_If_Equals oxygen OpenStackOperations.Update Port source_vm_port additional_args=--disable-port-security
214 CompareStream.Run_Keyword_If_Equals oxygen OpenStackOperations.Update Port dest_vm_port additional_args=--no-security-group
215 CompareStream.Run_Keyword_If_Equals oxygen OpenStackOperations.Update Port dest_vm_port additional_args=--disable-port-security
216 OpenStackOperations.Get Suite Debugs
218 Create Instances For Testing
219 ${SF_COMP_HOST} = BuiltIn.Set Variable If 2 < ${NUM_OS_SYSTEM} ${OS_CMP2_HOSTNAME} ${OS_CMP1_HOSTNAME}
220 OpenStackOperations.Add New Image From Url ${CLOUD_IMAGE} ${CLOUD_IMAGE_NAME}
221 OpenStackOperations.Create Flavor ${CLOUD_FLAVOR_NAME} 512 1
222 OpenStackOperations.Create Vm Instance With Ports On Compute Node p1in p1out sf1 ${SF_COMP_HOST} image=${CLOUD_IMAGE_NAME} flavor=${CLOUD_FLAVOR_NAME}
223 ... sg=${SECURITY_GROUP}
224 OpenStackOperations.Create Vm Instance With Port On Compute Node source_vm_port sourcevm ${OS_CMP1_HOSTNAME} image=${CLOUD_IMAGE_NAME} flavor=${CLOUD_FLAVOR_NAME} sg=${SECURITY_GROUP}
225 OpenStackOperations.Create Vm Instance With Port On Compute Node dest_vm_port destvm ${OS_CMP1_HOSTNAME} image=${CLOUD_IMAGE_NAME} flavor=${CLOUD_FLAVOR_NAME} sg=${SECURITY_GROUP}
226 OpenStackOperations.Show Debugs @{NET_1_VMS}
227 OpenStackOperations.Get Suite Debugs
229 Check Vm Instances Have Ip Address And Ready For Test
230 OpenStackOperations.Poll VM Is ACTIVE sf1
231 OpenStackOperations.Poll VM Is ACTIVE sourcevm
232 OpenStackOperations.Poll VM Is ACTIVE destvm
233 ${sfc1_mac} OpenStackOperations.Get Port Mac p1in
234 ${SF1_IP} OpenStackOperations.Get Port Ip p1in
235 BuiltIn.Wait Until Keyword Succeeds 500s 60s OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace @{NETWORKS}[0] ${sfc1_mac} ${SF1_IP}
236 ${src_mac} OpenStackOperations.Get Port Mac source_vm_port
237 ${src_ip} OpenStackOperations.Get Port Ip source_vm_port
238 BuiltIn.Wait Until Keyword Succeeds 500s 60s OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace @{NETWORKS}[0] ${src_mac} ${src_ip}
239 ${dest_mac} OpenStackOperations.Get Port Mac dest_vm_port
240 ${dest_ip} OpenStackOperations.Get Port Ip dest_vm_port
241 BuiltIn.Wait Until Keyword Succeeds 500s 60s OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace @{NETWORKS}[0] ${dest_mac} ${dest_ip}
242 BuiltIn.Comment If the Tests reach this point, all the Instances are reachable.
243 ${NET1_VM_IPS} BuiltIn.Create List ${src_ip} ${dest_ip}
244 BuiltIn.Set Suite Variable @{NET1_VM_IPS}
245 BuiltIn.Set Suite Variable ${SF1_IP}
246 BuiltIn.Set Suite Variable ${OS_SYSTEM_PROMPT} \#
247 BuiltIn.Wait Until Keyword Succeeds 300s 60s OpenStackOperations.Check If Instance Is Ready For Ssh Login Using Password @{NETWORKS}[0] ${SF1_IP} user=${CLOUD_IMAGE_USER}
248 ... password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
249 BuiltIn.Wait Until Keyword Succeeds 300s 60s OpenStackOperations.Check If Instance Is Ready For Ssh Login Using Password @{NETWORKS}[0] @{NET1_VM_IPS}[0] user=${CLOUD_IMAGE_USER}
250 ... password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
251 BuiltIn.Wait Until Keyword Succeeds 300s 60s OpenStackOperations.Check If Instance Is Ready For Ssh Login Using Password @{NETWORKS}[0] @{NET1_VM_IPS}[1] user=${CLOUD_IMAGE_USER}
252 ... password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
253 OpenStackOperations.Show Debugs @{NET_1_VMS}
254 OpenStackOperations.Get Suite Debugs
256 Start Applications on VM Instances For Test
257 BuiltIn.Comment Run Web server Scripts on destination vm listening to 80,81 and 82 ports
258 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[1] ${WEBSERVER_80} user=${CLOUD_IMAGE_USER} password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
259 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[1] ${WEBSERVER_81} user=${CLOUD_IMAGE_USER} password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
260 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{NET1_VM_IPS}[1] ${WEBSERVER_82} user=${CLOUD_IMAGE_USER} password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
262 Start Vxlan Tool in SF
263 [Arguments] ${network} ${sf_vm_ip} ${args}=${EMPTY}
264 [Documentation] Starts the tool in the SF VM's
265 OpenStackOperations.Execute Command on VM Instance ${network} ${sf_vm_ip} nohup python vxlan_tool.py ${args} & user=${CLOUD_IMAGE_USER} password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
267 Stop Vxlan Tool in SF
268 [Arguments] ${network} ${sf_vm_ip}
269 [Documentation] Starts the tool in the SF VM's
270 OpenStackOperations.Execute Command on VM Instance ${network} ${sf_vm_ip} pkill python user=${CLOUD_IMAGE_USER} password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
272 Check Network Reachability
273 [Arguments] ${net_name} ${vm_ip} ${command} ${port} ${ret_code} ${cmd_timeout}=30s
274 ${nc_resp} OpenStackOperations.Execute Command on VM Instance ${net_name} ${vm_ip} ${command} @{NET1_VM_IPS}[1] ${port} cmd_timeout=${cmd_timeout} user=${CLOUD_IMAGE_USER}
275 ... password=${CLOUD_IMAGE_PASS} console=${CLOULD_IMAGE_CONSOLE}
276 BuiltIn.Should Contain ${nc_resp} ${ret_code}