Remove variables and scripts for netvirt
[integration/test.git] / csit / suites / openstack / extensions / sfc.robot
1 *** Settings ***
2 Documentation       Test suite to verify SFC configuration and packet flows.
3
4 Library             SSHLibrary
5 Library             OperatingSystem
6 Library             RequestsLibrary
7 Resource            ../../../libraries/DevstackUtils.robot
8 Resource            ../../../libraries/LiveMigration.robot
9 Resource            ../../../libraries/OpenStackOperations.robot
10 Resource            ../../../libraries/SetupUtils.robot
11 Resource            ../../../libraries/Utils.robot
12 Resource            ../../../libraries/KarafKeywords.robot
13
14 Suite Setup         Suite Setup
15 Suite Teardown      OpenStackOperations.OpenStack Suite Teardown
16 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
17 Test Teardown       BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
18 ...                     AND    OpenStackOperations.Get Test Teardown Debugs For SFC
19
20
21 *** Variables ***
22 ${SECURITY_GROUP}           sg-sfc
23 @{NETWORKS}                 network_1
24 @{SUBNETS}                  l2_subnet_1
25 @{NET_1_VMS}                sf1    sourcevm    destvm
26 @{NON_SF_VMS}               sourcevm    destvm
27 @{SUBNET_CIDRS}             30.0.0.0/24
28 @{PORTS}                    p1in    p1out    source_vm_port    dest_vm_port
29 ${NC_COMMAND}               nc -zv -w 5
30 ${RES_SUCCESS}              open
31 ${RES_FAILURE}              Operation timed out
32 ${WEBSERVER_80}             (python -m SimpleHTTPServer 80 > /dev/null 2>&1 &)
33 ${WEBSERVER_81}             (python -m SimpleHTTPServer 81 > /dev/null 2>&1 &)
34 ${WEBSERVER_82}             (python -m SimpleHTTPServer 82 > /dev/null 2>&1 &)
35 ${WEBSERVER_83}             (python -m SimpleHTTPServer 83 > /dev/null 2>&1 &)
36 ${WEBSERVER_84}             (python -m SimpleHTTPServer 84 > /dev/null 2>&1 &)
37 ${WEBSERVER_85}             (python -m SimpleHTTPServer 85 > /dev/null 2>&1 &)
38 ${WEBSERVER_100}            (python -m SimpleHTTPServer 100 > /dev/null 2>&1 &)
39 ${WEBSERVER_101}            (python -m SimpleHTTPServer 101 > /dev/null 2>&1 &)
40 ${WEBSERVER_102}            (python -m SimpleHTTPServer 102 > /dev/null 2>&1 &)
41 ${WEBSERVER_103}            (python -m SimpleHTTPServer 103 > /dev/null 2>&1 &)
42 ${WEBSERVER_CMDS}
43 ...                         ${WEBSERVER_80} && ${WEBSERVER_81} && ${WEBSERVER_82} && ${WEBSERVER_83} && ${WEBSERVER_84} && ${WEBSERVER_85} && ${WEBSERVER_100} && ${WEBSERVER_101} && ${WEBSERVER_102} && ${WEBSERVER_103}
44 ${CLOUD_IMAGE}              "https://artifacts.opnfv.org/sfc/images/sfc_nsh_fraser.qcow2"
45 ${CLOUD_IMAGE_NAME}         sfc_nsh_fraser
46 ${CLOUD_FLAVOR_NAME}        sfc_nsh_fraser
47 ${ETH_IN}                   eth0
48 ${ETH_OUT}                  eth1
49 ${CLOUD_IMAGE_USER}         root
50 ${CLOUD_IMAGE_PASS}         opnfv
51 ${CLOULD_IMAGE_CONSOLE}     root
52
53
54 *** Test Cases ***
55 Create Flow Classifiers For Basic Test
56     [Documentation]    Create SFC Flow Classifier for TCP traffic between source VM and destination VM
57     OpenStackOperations.Create SFC Flow Classifier
58     ...    FC_80
59     ...    ${NET1_VM_IPS}[0]
60     ...    ${NET1_VM_IPS}[1]
61     ...    tcp
62     ...    source_vm_port
63     ...    args=--destination-port 80:80
64     OpenStackOperations.Create SFC Flow Classifier
65     ...    FC_81
66     ...    ${NET1_VM_IPS}[0]
67     ...    ${NET1_VM_IPS}[1]
68     ...    tcp
69     ...    source_vm_port
70     ...    args=--destination-port 81:81
71     OpenStackOperations.Create SFC Flow Classifier
72     ...    FC_83_85
73     ...    ${NET1_VM_IPS}[0]
74     ...    ${NET1_VM_IPS}[1]
75     ...    tcp
76     ...    source_vm_port
77     ...    args=--destination-port 83:85
78
79 Create Port Pair
80     [Documentation]    Create SFC Port Pairs
81     OpenStackOperations.Create SFC Port Pair    SFPP1    p1in    p1out
82
83 Create Port Pair Groups
84     [Documentation]    Create SFC Port Pair Groups
85     OpenStackOperations.Create SFC Port Pair Group    SFPPG1    SFPP1
86
87 Test Communication From Vm Instance1 In net_1 No SF
88     [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.
89     ${DEST_VM_LIST}    BuiltIn.Create List    ${NET1_VM_IPS}[1]
90     ${nc_resp}    OpenStackOperations.Execute Command on VM Instance
91     ...    ${NETWORKS}[0]
92     ...    ${NET1_VM_IPS}[0]
93     ...    ${NC_COMMAND} ${NET1_VM_IPS}[1] 80
94     ...    user=${CLOUD_IMAGE_USER}
95     ...    password=${CLOUD_IMAGE_PASS}
96     ...    console=${CLOULD_IMAGE_CONSOLE}
97     BuiltIn.Should Contain    ${nc_resp}    ${RES_SUCCESS}
98     ${nc_resp}    OpenStackOperations.Execute Command on VM Instance
99     ...    ${NETWORKS}[0]
100     ...    ${NET1_VM_IPS}[0]
101     ...    ${NC_COMMAND} ${NET1_VM_IPS}[1] 81
102     ...    user=${CLOUD_IMAGE_USER}
103     ...    password=${CLOUD_IMAGE_PASS}
104     ...    console=${CLOULD_IMAGE_CONSOLE}
105     BuiltIn.Should Contain    ${nc_resp}    ${RES_SUCCESS}
106     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
107     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
108     ...    AND    OpenStackOperations.Exit From Vm Console
109
110 Create Port Chain For Src->Dest Port 80
111     [Documentation]    Create SFC Port Chain using port group and classifier created previously
112     OpenStackOperations.Create SFC Port Chain    SFPC1    args=--port-pair-group SFPPG1 --flow-classifier FC_80
113
114 Test Communication From Vm Instance1 In net_1 Port 80 via SF
115     [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.
116     Start Vxlan Tool in SF
117     ...    ${NETWORKS}[0]
118     ...    ${SF1_IP}
119     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
120     Wait Until Keyword Succeeds
121     ...    3x
122     ...    10s
123     ...    Check Network Reachability
124     ...    ${NETWORKS}[0]
125     ...    ${NET1_VM_IPS}[0]
126     ...    ${NC_COMMAND}
127     ...    80
128     ...    ${RES_SUCCESS}
129     Wait Until Keyword Succeeds
130     ...    3x
131     ...    10s
132     ...    Check Network Reachability
133     ...    ${NETWORKS}[0]
134     ...    ${NET1_VM_IPS}[0]
135     ...    ${NC_COMMAND}
136     ...    81
137     ...    ${RES_SUCCESS}
138     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
139     Start Vxlan Tool in SF
140     ...    ${NETWORKS}[0]
141     ...    ${SF1_IP}
142     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
143     BuiltIn.Comment    Port 80 communication should fail as the SF blocks the same
144     Wait Until Keyword Succeeds
145     ...    3x
146     ...    10s
147     ...    Check Network Reachability
148     ...    ${NETWORKS}[0]
149     ...    ${NET1_VM_IPS}[0]
150     ...    ${NC_COMMAND}
151     ...    80
152     ...    ${RES_FAILURE}
153     BuiltIn.Comment    Test to confirm Port 81 is not blocked
154     Wait Until Keyword Succeeds
155     ...    3x
156     ...    10s
157     ...    Check Network Reachability
158     ...    ${NETWORKS}[0]
159     ...    ${NET1_VM_IPS}[0]
160     ...    ${NC_COMMAND}
161     ...    81
162     ...    ${RES_SUCCESS}
163     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
164     Start Vxlan Tool in SF
165     ...    ${NETWORKS}[0]
166     ...    ${SF1_IP}
167     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 81
168     Wait Until Keyword Succeeds
169     ...    3x
170     ...    10s
171     ...    Check Network Reachability
172     ...    ${NETWORKS}[0]
173     ...    ${NET1_VM_IPS}[0]
174     ...    ${NC_COMMAND}
175     ...    80
176     ...    ${RES_SUCCESS}
177     Wait Until Keyword Succeeds
178     ...    3x
179     ...    10s
180     ...    Check Network Reachability
181     ...    ${NETWORKS}[0]
182     ...    ${NET1_VM_IPS}[0]
183     ...    ${NC_COMMAND}
184     ...    81
185     ...    ${RES_SUCCESS}
186     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
187     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
188     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
189     ...    AND    OpenStackOperations.Exit From Vm Console
190
191 Update Port Chain To Use Flow Classifier For Port 81
192     [Documentation]    Update Port Chain to use FC_81 instead of FC_80
193     OpenStackOperations.Update SFC Port Chain With A New Flow Classifier    SFPC1    FC_81
194     OpenStackOperations.Update SFC Port Chain Removing A Flow Classifier    SFPC1    FC_80
195
196 Test Communication From Vm Instance1 In net_1 Port 81 via SF
197     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
198     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
199     Start Vxlan Tool in SF
200     ...    ${NETWORKS}[0]
201     ...    ${SF1_IP}
202     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
203     Wait Until Keyword Succeeds
204     ...    3x
205     ...    10s
206     ...    Check Network Reachability
207     ...    ${NETWORKS}[0]
208     ...    ${NET1_VM_IPS}[0]
209     ...    ${NC_COMMAND}
210     ...    80
211     ...    ${RES_SUCCESS}
212     Wait Until Keyword Succeeds
213     ...    3x
214     ...    10s
215     ...    Check Network Reachability
216     ...    ${NETWORKS}[0]
217     ...    ${NET1_VM_IPS}[0]
218     ...    ${NC_COMMAND}
219     ...    81
220     ...    ${RES_SUCCESS}
221     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
222     Start Vxlan Tool in SF
223     ...    ${NETWORKS}[0]
224     ...    ${SF1_IP}
225     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 81
226     BuiltIn.Comment    Port 81 communication should fail as the SF blocks the same
227     Wait Until Keyword Succeeds
228     ...    3x
229     ...    10s
230     ...    Check Network Reachability
231     ...    ${NETWORKS}[0]
232     ...    ${NET1_VM_IPS}[0]
233     ...    ${NC_COMMAND}
234     ...    80
235     ...    ${RES_SUCCESS}
236     Wait Until Keyword Succeeds
237     ...    3x
238     ...    10s
239     ...    Check Network Reachability
240     ...    ${NETWORKS}[0]
241     ...    ${NET1_VM_IPS}[0]
242     ...    ${NC_COMMAND}
243     ...    81
244     ...    ${RES_FAILURE}
245     BuiltIn.Comment    Test to confirm Port 80 does not continue to get routed through SF
246     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
247     Start Vxlan Tool in SF
248     ...    ${NETWORKS}[0]
249     ...    ${SF1_IP}
250     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
251     Wait Until Keyword Succeeds
252     ...    3x
253     ...    10s
254     ...    Check Network Reachability
255     ...    ${NETWORKS}[0]
256     ...    ${NET1_VM_IPS}[0]
257     ...    ${NC_COMMAND}
258     ...    80
259     ...    ${RES_SUCCESS}
260     Wait Until Keyword Succeeds
261     ...    3x
262     ...    10s
263     ...    Check Network Reachability
264     ...    ${NETWORKS}[0]
265     ...    ${NET1_VM_IPS}[0]
266     ...    ${NC_COMMAND}
267     ...    81
268     ...    ${RES_SUCCESS}
269     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
270     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
271     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
272     ...    AND    OpenStackOperations.Exit From Vm Console
273
274 Update Port Chain To Use Flow Classifier For Port Range 83-85
275     [Documentation]    Update Port Chain to use FC_83_85
276     OpenStackOperations.Update SFC Port Chain With A New Flow Classifier    SFPC1    FC_83_85
277
278 Test Communication From Vm Instance1 In net_1 Port 84 And 85 via SF
279     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
280     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
281     Start Vxlan Tool in SF
282     ...    ${NETWORKS}[0]
283     ...    ${SF1_IP}
284     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
285     Wait Until Keyword Succeeds
286     ...    3x
287     ...    10s
288     ...    Check Network Reachability
289     ...    ${NETWORKS}[0]
290     ...    ${NET1_VM_IPS}[0]
291     ...    ${NC_COMMAND}
292     ...    80
293     ...    ${RES_SUCCESS}
294     Wait Until Keyword Succeeds
295     ...    3x
296     ...    10s
297     ...    Check Network Reachability
298     ...    ${NETWORKS}[0]
299     ...    ${NET1_VM_IPS}[0]
300     ...    ${NC_COMMAND}
301     ...    83
302     ...    ${RES_SUCCESS}
303     Wait Until Keyword Succeeds
304     ...    3x
305     ...    10s
306     ...    Check Network Reachability
307     ...    ${NETWORKS}[0]
308     ...    ${NET1_VM_IPS}[0]
309     ...    ${NC_COMMAND}
310     ...    84
311     ...    ${RES_SUCCESS}
312     Wait Until Keyword Succeeds
313     ...    3x
314     ...    10s
315     ...    Check Network Reachability
316     ...    ${NETWORKS}[0]
317     ...    ${NET1_VM_IPS}[0]
318     ...    ${NC_COMMAND}
319     ...    85
320     ...    ${RES_SUCCESS}
321     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
322     Start Vxlan Tool in SF
323     ...    ${NETWORKS}[0]
324     ...    ${SF1_IP}
325     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 83
326     BuiltIn.Comment    Port 83 communication should fail as the SF blocks the same
327     Wait Until Keyword Succeeds
328     ...    3x
329     ...    10s
330     ...    Check Network Reachability
331     ...    ${NETWORKS}[0]
332     ...    ${NET1_VM_IPS}[0]
333     ...    ${NC_COMMAND}
334     ...    80
335     ...    ${RES_SUCCESS}
336     Wait Until Keyword Succeeds
337     ...    3x
338     ...    10s
339     ...    Check Network Reachability
340     ...    ${NETWORKS}[0]
341     ...    ${NET1_VM_IPS}[0]
342     ...    ${NC_COMMAND}
343     ...    83
344     ...    ${RES_FAILURE}
345     Wait Until Keyword Succeeds
346     ...    3x
347     ...    10s
348     ...    Check Network Reachability
349     ...    ${NETWORKS}[0]
350     ...    ${NET1_VM_IPS}[0]
351     ...    ${NC_COMMAND}
352     ...    84
353     ...    ${RES_SUCCESS}
354     Wait Until Keyword Succeeds
355     ...    3x
356     ...    10s
357     ...    Check Network Reachability
358     ...    ${NETWORKS}[0]
359     ...    ${NET1_VM_IPS}[0]
360     ...    ${NC_COMMAND}
361     ...    85
362     ...    ${RES_SUCCESS}
363     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
364     Start Vxlan Tool in SF
365     ...    ${NETWORKS}[0]
366     ...    ${SF1_IP}
367     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 84
368     BuiltIn.Comment    Port 84 communication should fail as the SF blocks the same
369     Wait Until Keyword Succeeds
370     ...    3x
371     ...    10s
372     ...    Check Network Reachability
373     ...    ${NETWORKS}[0]
374     ...    ${NET1_VM_IPS}[0]
375     ...    ${NC_COMMAND}
376     ...    80
377     ...    ${RES_SUCCESS}
378     Wait Until Keyword Succeeds
379     ...    3x
380     ...    10s
381     ...    Check Network Reachability
382     ...    ${NETWORKS}[0]
383     ...    ${NET1_VM_IPS}[0]
384     ...    ${NC_COMMAND}
385     ...    84
386     ...    ${RES_FAILURE}
387     Wait Until Keyword Succeeds
388     ...    3x
389     ...    10s
390     ...    Check Network Reachability
391     ...    ${NETWORKS}[0]
392     ...    ${NET1_VM_IPS}[0]
393     ...    ${NC_COMMAND}
394     ...    83
395     ...    ${RES_SUCCESS}
396     Wait Until Keyword Succeeds
397     ...    3x
398     ...    10s
399     ...    Check Network Reachability
400     ...    ${NETWORKS}[0]
401     ...    ${NET1_VM_IPS}[0]
402     ...    ${NC_COMMAND}
403     ...    85
404     ...    ${RES_SUCCESS}
405     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
406     Start Vxlan Tool in SF
407     ...    ${NETWORKS}[0]
408     ...    ${SF1_IP}
409     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 85
410     BuiltIn.Comment    Port 85 communication should fail as the SF blocks the same
411     Wait Until Keyword Succeeds
412     ...    3x
413     ...    10s
414     ...    Check Network Reachability
415     ...    ${NETWORKS}[0]
416     ...    ${NET1_VM_IPS}[0]
417     ...    ${NC_COMMAND}
418     ...    80
419     ...    ${RES_SUCCESS}
420     Wait Until Keyword Succeeds
421     ...    3x
422     ...    10s
423     ...    Check Network Reachability
424     ...    ${NETWORKS}[0]
425     ...    ${NET1_VM_IPS}[0]
426     ...    ${NC_COMMAND}
427     ...    83
428     ...    ${RES_SUCCESS}
429     Wait Until Keyword Succeeds
430     ...    3x
431     ...    10s
432     ...    Check Network Reachability
433     ...    ${NETWORKS}[0]
434     ...    ${NET1_VM_IPS}[0]
435     ...    ${NC_COMMAND}
436     ...    84
437     ...    ${RES_SUCCESS}
438     Wait Until Keyword Succeeds
439     ...    3x
440     ...    10s
441     ...    Check Network Reachability
442     ...    ${NETWORKS}[0]
443     ...    ${NET1_VM_IPS}[0]
444     ...    ${NC_COMMAND}
445     ...    85
446     ...    ${RES_FAILURE}
447     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
448     Start Vxlan Tool in SF
449     ...    ${NETWORKS}[0]
450     ...    ${SF1_IP}
451     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
452     Wait Until Keyword Succeeds
453     ...    3x
454     ...    10s
455     ...    Check Network Reachability
456     ...    ${NETWORKS}[0]
457     ...    ${NET1_VM_IPS}[0]
458     ...    ${NC_COMMAND}
459     ...    80
460     ...    ${RES_SUCCESS}
461     Wait Until Keyword Succeeds
462     ...    3x
463     ...    10s
464     ...    Check Network Reachability
465     ...    ${NETWORKS}[0]
466     ...    ${NET1_VM_IPS}[0]
467     ...    ${NC_COMMAND}
468     ...    83
469     ...    ${RES_SUCCESS}
470     Wait Until Keyword Succeeds
471     ...    3x
472     ...    10s
473     ...    Check Network Reachability
474     ...    ${NETWORKS}[0]
475     ...    ${NET1_VM_IPS}[0]
476     ...    ${NC_COMMAND}
477     ...    84
478     ...    ${RES_SUCCESS}
479     Wait Until Keyword Succeeds
480     ...    3x
481     ...    10s
482     ...    Check Network Reachability
483     ...    ${NETWORKS}[0]
484     ...    ${NET1_VM_IPS}[0]
485     ...    ${NC_COMMAND}
486     ...    85
487     ...    ${RES_SUCCESS}
488
489 Update Port Chain To Use Flow Classifier For Input Port Range 101-103
490     [Documentation]    Update Port Chain to use FC_101_103
491     BuiltIn.Comment    Removing and Deleting Existing Conflicting Flow Classifiers
492     OpenStackOperations.Update SFC Port Chain Removing A Flow Classifier    SFPC1    FC_81
493     OpenStackOperations.Update SFC Port Chain Removing A Flow Classifier    SFPC1    FC_83_85
494     OpenStackOperations.Delete SFC Flow Classifier    FC_80
495     OpenStackOperations.Delete SFC Flow Classifier    FC_81
496     OpenStackOperations.Delete SFC Flow Classifier    FC_83_85
497     OpenStackOperations.Create SFC Flow Classifier
498     ...    FC_101_103
499     ...    ${NET1_VM_IPS}[0]
500     ...    ${NET1_VM_IPS}[1]
501     ...    tcp
502     ...    source_vm_port
503     ...    args=--source-port 101:103
504     OpenStackOperations.Update SFC Port Chain With A New Flow Classifier    SFPC1    FC_101_103
505
506 Test Communication From Vm Instance1 In net_1 Port 100 And 102 via SF
507     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
508     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
509     Start Vxlan Tool in SF
510     ...    ${NETWORKS}[0]
511     ...    ${SF1_IP}
512     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
513     Wait Until Keyword Succeeds
514     ...    3x
515     ...    10s
516     ...    Check Network Reachability
517     ...    ${NETWORKS}[0]
518     ...    ${NET1_VM_IPS}[0]
519     ...    ${NC_COMMAND} -p 80
520     ...    83
521     ...    ${RES_SUCCESS}
522     Wait Until Keyword Succeeds
523     ...    3x
524     ...    10s
525     ...    Check Network Reachability
526     ...    ${NETWORKS}[0]
527     ...    ${NET1_VM_IPS}[0]
528     ...    ${NC_COMMAND} -p 100
529     ...    83
530     ...    ${RES_SUCCESS}
531     Wait Until Keyword Succeeds
532     ...    3x
533     ...    10s
534     ...    Check Network Reachability
535     ...    ${NETWORKS}[0]
536     ...    ${NET1_VM_IPS}[0]
537     ...    ${NC_COMMAND} -p 101
538     ...    83
539     ...    ${RES_SUCCESS}
540     Wait Until Keyword Succeeds
541     ...    3x
542     ...    10s
543     ...    Check Network Reachability
544     ...    ${NETWORKS}[0]
545     ...    ${NET1_VM_IPS}[0]
546     ...    ${NC_COMMAND} -p 102
547     ...    83
548     ...    ${RES_SUCCESS}
549     Wait Until Keyword Succeeds
550     ...    3x
551     ...    10s
552     ...    Check Network Reachability
553     ...    ${NETWORKS}[0]
554     ...    ${NET1_VM_IPS}[0]
555     ...    ${NC_COMMAND} -p 103
556     ...    83
557     ...    ${RES_SUCCESS}
558     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
559     Start Vxlan Tool in SF
560     ...    ${NETWORKS}[0]
561     ...    ${SF1_IP}
562     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 83
563     Wait Until Keyword Succeeds
564     ...    3x
565     ...    10s
566     ...    Check Network Reachability
567     ...    ${NETWORKS}[0]
568     ...    ${NET1_VM_IPS}[0]
569     ...    ${NC_COMMAND} -p 80
570     ...    83
571     ...    ${RES_SUCCESS}
572     Wait Until Keyword Succeeds
573     ...    3x
574     ...    10s
575     ...    Check Network Reachability
576     ...    ${NETWORKS}[0]
577     ...    ${NET1_VM_IPS}[0]
578     ...    ${NC_COMMAND} -p 100
579     ...    83
580     ...    ${RES_SUCCESS}
581     Wait Until Keyword Succeeds
582     ...    3x
583     ...    10s
584     ...    Check Network Reachability
585     ...    ${NETWORKS}[0]
586     ...    ${NET1_VM_IPS}[0]
587     ...    ${NC_COMMAND} -p 101
588     ...    83
589     ...    ${RES_FAILURE}
590     Wait Until Keyword Succeeds
591     ...    3x
592     ...    10s
593     ...    Check Network Reachability
594     ...    ${NETWORKS}[0]
595     ...    ${NET1_VM_IPS}[0]
596     ...    ${NC_COMMAND} -p 102
597     ...    83
598     ...    ${RES_FAILURE}
599     Wait Until Keyword Succeeds
600     ...    3x
601     ...    10s
602     ...    Check Network Reachability
603     ...    ${NETWORKS}[0]
604     ...    ${NET1_VM_IPS}[0]
605     ...    ${NC_COMMAND} -p 103
606     ...    83
607     ...    ${RES_FAILURE}
608
609 Delete And Recreate Port Chain And Flow Classifiers For Symmetric Test
610     OpenStackOperations.Create SFC Flow Classifier
611     ...    FC_SYM
612     ...    ${NET1_VM_IPS}[0]
613     ...    ${NET1_VM_IPS}[1]
614     ...    tcp
615     ...    source_vm_port
616     ...    args=--destination-port 82:82 --source-port 2000 --logical-destination-port dest_vm_port
617     OpenStackOperations.Delete SFC Port Chain    SFPC1
618     OpenStackOperations.Create SFC Port Chain
619     ...    SFPSYM
620     ...    args=--port-pair-group SFPPG1 --flow-classifier FC_SYM --chain-parameters symmetric=true
621
622 Test Communication From Vm Instance1 For Symmetric Chain
623     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
624     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
625     Start Vxlan Tool in SF
626     ...    ${NETWORKS}[0]
627     ...    ${SF1_IP}
628     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
629     Start Vxlan Tool in SF
630     ...    ${NETWORKS}[0]
631     ...    ${SF1_IP}
632     ...    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
633     Wait Until Keyword Succeeds
634     ...    8x
635     ...    20s
636     ...    Check Network Reachability
637     ...    ${NETWORKS}[0]
638     ...    ${NET1_VM_IPS}[0]
639     ...    ${NC_COMMAND} -p 2000
640     ...    82
641     ...    ${RES_SUCCESS}
642     BuiltIn.Comment    Test to confirm the SRC->DEST Port 82 is routed through SF
643     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
644     Start Vxlan Tool in SF
645     ...    ${NETWORKS}[0]
646     ...    ${SF1_IP}
647     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 82
648     Start Vxlan Tool in SF
649     ...    ${NETWORKS}[0]
650     ...    ${SF1_IP}
651     ...    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
652     Wait Until Keyword Succeeds
653     ...    8x
654     ...    20s
655     ...    Check Network Reachability
656     ...    ${NETWORKS}[0]
657     ...    ${NET1_VM_IPS}[0]
658     ...    ${NC_COMMAND} -p 2000
659     ...    82
660     ...    ${RES_FAILURE}
661     BuiltIn.Comment    Test to confirm DEST->SRC Port 2000 path SFC traversal
662     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
663     Start Vxlan Tool in SF
664     ...    ${NETWORKS}[0]
665     ...    ${SF1_IP}
666     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
667     Start Vxlan Tool in SF
668     ...    ${NETWORKS}[0]
669     ...    ${SF1_IP}
670     ...    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off --block 2000
671     Wait Until Keyword Succeeds
672     ...    8x
673     ...    20s
674     ...    Check Network Reachability
675     ...    ${NETWORKS}[0]
676     ...    ${NET1_VM_IPS}[0]
677     ...    ${NC_COMMAND} -p 2000
678     ...    82
679     ...    ${RES_FAILURE}
680     BuiltIn.Comment    Test to confirm the Normalcy restored
681     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
682     Start Vxlan Tool in SF
683     ...    ${NETWORKS}[0]
684     ...    ${SF1_IP}
685     ...    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
686     Start Vxlan Tool in SF
687     ...    ${NETWORKS}[0]
688     ...    ${SF1_IP}
689     ...    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
690     Wait Until Keyword Succeeds
691     ...    8x
692     ...    20s
693     ...    Check Network Reachability
694     ...    ${NETWORKS}[0]
695     ...    ${NET1_VM_IPS}[0]
696     ...    ${NC_COMMAND} -p 2000
697     ...    82
698     ...    ${RES_SUCCESS}
699     Stop Vxlan Tool in SF    ${NETWORKS}[0]    ${SF1_IP}
700     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
701     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
702     ...    AND    OpenStackOperations.Exit From Vm Console
703
704 Delete Configurations
705     [Documentation]    Delete all elements that were created in the test case section. These are done
706     ...    in a local keyword so this can be called as part of the Suite Teardown. When called as part
707     ...    of the Suite Teardown, all steps will be attempted. This prevents robot framework from bailing
708     ...    on the rest of a test case if one step intermittently has trouble and fails. The goal is to attempt
709     ...    to leave the test environment as clean as possible upon completion of this suite.
710     FOR    ${vm}    IN    @{NET_1_VMS}
711         OpenStackOperations.Delete Vm Instance    ${vm}
712     END
713     OpenStackOperations.Delete SFC Port Chain    SFPSYM
714     OpenStackOperations.Delete SFC Port Pair Group    SFPPG1
715     OpenStackOperations.Delete SFC Port Pair    SFPP1
716     OpenStackOperations.Delete SFC Flow Classifier    FC_101_103
717     OpenStackOperations.Delete SFC Flow Classifier    FC_SYM
718     FOR    ${port}    IN    @{PORTS}
719         OpenStackOperations.Delete Port    ${port}
720     END
721     OpenStackOperations.Delete SubNet    l2_subnet_1
722     FOR    ${network}    IN    @{NETWORKS}
723         OpenStackOperations.Delete Network    ${network}
724     END
725     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
726
727
728 *** Keywords ***
729 Suite Setup
730     OpenStackOperations.OpenStack Suite Setup
731     Create Basic Networks
732     Create Ports For Testing
733     Create Instances For Testing
734     Check Vm Instances Have Ip Address And Ready For Test
735     Start Applications on VM Instances For Test
736
737 Create Basic Networks
738     BuiltIn.Comment    Create Network For Testing
739     OpenStackOperations.Create Network    ${NETWORKS}[0]
740     BuiltIn.Comment    Create Subnet For Testing
741     OpenStackOperations.Create SubNet    ${NETWORKS}[0]    ${SUBNETS}[0]    ${SUBNET_CIDRS}[0]
742     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
743     BuiltIn.Comment    Create Neutron Ports with no port security for SFC Tests
744     OpenStackOperations.Get Suite Debugs
745
746 Create Ports For Testing
747     FOR    ${port}    IN    @{PORTS}
748         OpenStackOperations.Create Port    ${NETWORKS}[0]    ${port}    sg=${SECURITY_GROUP}
749     END
750     OpenStackOperations.Update Port    p1in    additional_args=--no-security-group
751     OpenStackOperations.Update Port    p1in    additional_args=--disable-port-security
752     OpenStackOperations.Update Port    p1out    additional_args=--no-security-group
753     OpenStackOperations.Update Port    p1out    additional_args=--disable-port-security
754     OpenStackOperations.Get Suite Debugs
755
756 Create Instances For Testing
757     ${SF_COMP_HOST}    BuiltIn.Set Variable If    2 < ${NUM_OS_SYSTEM}    ${OS_CMP2_HOSTNAME}    ${OS_CMP1_HOSTNAME}
758     OpenStackOperations.Add New Image From Url    ${CLOUD_IMAGE}    ${CLOUD_IMAGE_NAME}
759     OpenStackOperations.Create Flavor    ${CLOUD_FLAVOR_NAME}    512    1
760     OpenStackOperations.Create Vm Instance With Ports On Compute Node
761     ...    p1in
762     ...    p1out
763     ...    sf1
764     ...    ${SF_COMP_HOST}
765     ...    image=${CLOUD_IMAGE_NAME}
766     ...    flavor=${CLOUD_FLAVOR_NAME}
767     ...    sg=${SECURITY_GROUP}
768     OpenStackOperations.Create Vm Instance With Port On Compute Node
769     ...    source_vm_port
770     ...    sourcevm
771     ...    ${OS_CMP1_HOSTNAME}
772     ...    image=${CLOUD_IMAGE_NAME}
773     ...    flavor=${CLOUD_FLAVOR_NAME}
774     ...    sg=${SECURITY_GROUP}
775     OpenStackOperations.Create Vm Instance With Port On Compute Node
776     ...    dest_vm_port
777     ...    destvm
778     ...    ${OS_CMP1_HOSTNAME}
779     ...    image=${CLOUD_IMAGE_NAME}
780     ...    flavor=${CLOUD_FLAVOR_NAME}
781     ...    sg=${SECURITY_GROUP}
782     OpenStackOperations.Show Debugs    @{NET_1_VMS}
783     OpenStackOperations.Get Suite Debugs
784
785 Check Vm Instances Have Ip Address And Ready For Test
786     OpenStackOperations.Poll VM Is ACTIVE    sf1
787     OpenStackOperations.Poll VM Is ACTIVE    sourcevm
788     OpenStackOperations.Poll VM Is ACTIVE    destvm
789     ${sfc1_mac}    OpenStackOperations.Get Port Mac    p1in
790     ${SF1_IP}    OpenStackOperations.Get Port Ip    p1in
791     BuiltIn.Wait Until Keyword Succeeds
792     ...    500s
793     ...    60s
794     ...    OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace
795     ...    ${NETWORKS}[0]
796     ...    ${sfc1_mac}
797     ...    ${SF1_IP}
798     ${src_mac}    OpenStackOperations.Get Port Mac    source_vm_port
799     ${src_ip}    OpenStackOperations.Get Port Ip    source_vm_port
800     BuiltIn.Wait Until Keyword Succeeds
801     ...    500s
802     ...    60s
803     ...    OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace
804     ...    ${NETWORKS}[0]
805     ...    ${src_mac}
806     ...    ${src_ip}
807     ${dest_mac}    OpenStackOperations.Get Port Mac    dest_vm_port
808     ${dest_ip}    OpenStackOperations.Get Port Ip    dest_vm_port
809     BuiltIn.Wait Until Keyword Succeeds
810     ...    500s
811     ...    60s
812     ...    OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace
813     ...    ${NETWORKS}[0]
814     ...    ${dest_mac}
815     ...    ${dest_ip}
816     BuiltIn.Comment    If the Tests reach this point, all the Instances are reachable.
817     ${NET1_VM_IPS}    BuiltIn.Create List    ${src_ip}    ${dest_ip}
818     BuiltIn.Set Suite Variable    @{NET1_VM_IPS}
819     BuiltIn.Set Suite Variable    ${SF1_IP}
820     BuiltIn.Set Suite Variable    ${OS_SYSTEM_PROMPT}    \#
821     BuiltIn.Wait Until Keyword Succeeds
822     ...    300s
823     ...    60s
824     ...    OpenStackOperations.Check If Instance Is Ready For Ssh Login Using Password
825     ...    ${NETWORKS}[0]
826     ...    ${SF1_IP}
827     ...    user=${CLOUD_IMAGE_USER}
828     ...    password=${CLOUD_IMAGE_PASS}
829     ...    console=${CLOULD_IMAGE_CONSOLE}
830     BuiltIn.Wait Until Keyword Succeeds
831     ...    300s
832     ...    60s
833     ...    OpenStackOperations.Check If Instance Is Ready For Ssh Login Using Password
834     ...    ${NETWORKS}[0]
835     ...    ${NET1_VM_IPS}[0]
836     ...    user=${CLOUD_IMAGE_USER}
837     ...    password=${CLOUD_IMAGE_PASS}
838     ...    console=${CLOULD_IMAGE_CONSOLE}
839     BuiltIn.Wait Until Keyword Succeeds
840     ...    300s
841     ...    60s
842     ...    OpenStackOperations.Check If Instance Is Ready For Ssh Login Using Password
843     ...    ${NETWORKS}[0]
844     ...    ${NET1_VM_IPS}[1]
845     ...    user=${CLOUD_IMAGE_USER}
846     ...    password=${CLOUD_IMAGE_PASS}
847     ...    console=${CLOULD_IMAGE_CONSOLE}
848     OpenStackOperations.Show Debugs    @{NET_1_VMS}
849     OpenStackOperations.Get Suite Debugs
850
851 Start Applications on VM Instances For Test
852     BuiltIn.Comment    Run Web server Scripts on destination vm listening to 80,81 and 82 ports
853     ${resp}    OpenStackOperations.Execute Command on VM Instance
854     ...    ${NETWORKS}[0]
855     ...    ${NET1_VM_IPS}[1]
856     ...    ${WEBSERVER_CMDS} && (echo done)
857     ...    user=${CLOUD_IMAGE_USER}
858     ...    password=${CLOUD_IMAGE_PASS}
859     ...    console=${CLOULD_IMAGE_CONSOLE}
860     BuiltIn.Should Contain    ${resp}    done
861
862 Start Vxlan Tool in SF
863     [Documentation]    Starts the tool in the SF VM's
864     [Arguments]    ${network}    ${sf_vm_ip}    ${args}=${EMPTY}
865     OpenStackOperations.Execute Command on VM Instance
866     ...    ${network}
867     ...    ${sf_vm_ip}
868     ...    nohup python vxlan_tool.py ${args} &
869     ...    user=${CLOUD_IMAGE_USER}
870     ...    password=${CLOUD_IMAGE_PASS}
871     ...    console=${CLOULD_IMAGE_CONSOLE}
872
873 Stop Vxlan Tool in SF
874     [Documentation]    Starts the tool in the SF VM's
875     [Arguments]    ${network}    ${sf_vm_ip}
876     OpenStackOperations.Execute Command on VM Instance
877     ...    ${network}
878     ...    ${sf_vm_ip}
879     ...    pkill python
880     ...    user=${CLOUD_IMAGE_USER}
881     ...    password=${CLOUD_IMAGE_PASS}
882     ...    console=${CLOULD_IMAGE_CONSOLE}
883
884 Check Network Reachability
885     [Arguments]    ${net_name}    ${source_vm_ip}    ${command}    ${port}    ${ret_code}    ${cmd_timeout}=30s
886     ${nc_resp}    OpenStackOperations.Execute Command on VM Instance
887     ...    ${net_name}
888     ...    ${source_vm_ip}
889     ...    ${command} ${NET1_VM_IPS}[1] ${port}
890     ...    cmd_timeout=${cmd_timeout}
891     ...    user=${CLOUD_IMAGE_USER}
892     ...    password=${CLOUD_IMAGE_PASS}
893     ...    console=${CLOULD_IMAGE_CONSOLE}
894     BuiltIn.Should Contain    ${nc_resp}    ${ret_code}