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