Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / openstack / extensions / sfc.robot
1 *** Settings ***
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
8 Library           SSHLibrary
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
17
18 *** Variables ***
19 ${SECURITY_GROUP}    sg-sfc
20 @{NETWORKS}       network_1
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
27 ${RES_SUCCESS}    open
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 ${WEBSERVER_83}    (python -m SimpleHTTPServer 83 > /dev/null 2>&1 &)
33 ${WEBSERVER_84}    (python -m SimpleHTTPServer 84 > /dev/null 2>&1 &)
34 ${WEBSERVER_85}    (python -m SimpleHTTPServer 85 > /dev/null 2>&1 &)
35 ${WEBSERVER_100}    (python -m SimpleHTTPServer 100 > /dev/null 2>&1 &)
36 ${WEBSERVER_101}    (python -m SimpleHTTPServer 101 > /dev/null 2>&1 &)
37 ${WEBSERVER_102}    (python -m SimpleHTTPServer 102 > /dev/null 2>&1 &)
38 ${WEBSERVER_103}    (python -m SimpleHTTPServer 103 > /dev/null 2>&1 &)
39 ${WEBSERVER_CMDS}    ${WEBSERVER_80} && ${WEBSERVER_81} && ${WEBSERVER_82} && ${WEBSERVER_83} && ${WEBSERVER_84} && ${WEBSERVER_85} && ${WEBSERVER_100} && ${WEBSERVER_101} && ${WEBSERVER_102} && ${WEBSERVER_103}
40 ${CLOUD_IMAGE}    "https://artifacts.opnfv.org/sfc/images/sfc_nsh_fraser.qcow2"
41 ${CLOUD_IMAGE_NAME}    sfc_nsh_fraser
42 ${CLOUD_FLAVOR_NAME}    sfc_nsh_fraser
43 @{NETVIRT_DIAG_SERVICES}    OPENFLOW    IFM    ITM    DATASTORE    ELAN
44 ${ETH_IN}         eth0
45 ${ETH_OUT}        eth1
46 ${CLOUD_IMAGE_USER}    root
47 ${CLOUD_IMAGE_PASS}    opnfv
48 ${CLOULD_IMAGE_CONSOLE}    root
49
50 *** Test Cases ***
51 Create Flow Classifiers For Basic Test
52     [Documentation]    Create SFC Flow Classifier for TCP traffic between source VM and destination VM
53     OpenStackOperations.Create SFC Flow Classifier    FC_80    @{NET1_VM_IPS}[0]    @{NET1_VM_IPS}[1]    tcp    source_vm_port    args=--destination-port 80:80
54     OpenStackOperations.Create SFC Flow Classifier    FC_81    @{NET1_VM_IPS}[0]    @{NET1_VM_IPS}[1]    tcp    source_vm_port    args=--destination-port 81:81
55     OpenStackOperations.Create SFC Flow Classifier    FC_83_85    @{NET1_VM_IPS}[0]    @{NET1_VM_IPS}[1]    tcp    source_vm_port    args=--destination-port 83:85
56
57 Create Port Pair
58     [Documentation]    Create SFC Port Pairs
59     OpenStackOperations.Create SFC Port Pair    SFPP1    p1in    p1out
60
61 Create Port Pair Groups
62     [Documentation]    Create SFC Port Pair Groups
63     OpenStackOperations.Create SFC Port Pair Group    SFPPG1    SFPP1
64
65 Test Communication From Vm Instance1 In net_1 No SF
66     [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.
67     ${DEST_VM_LIST}    BuiltIn.Create List    @{NET1_VM_IPS}[1]
68     ${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}
69     ...    console=${CLOULD_IMAGE_CONSOLE}
70     BuiltIn.Should Contain    ${nc_resp}    ${RES_SUCCESS}
71     ${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}
72     ...    console=${CLOULD_IMAGE_CONSOLE}
73     BuiltIn.Should Contain    ${nc_resp}    ${RES_SUCCESS}
74     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
75     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
76     ...    AND    OpenStackOperations.Exit From Vm Console
77
78 Create Port Chain For Src->Dest Port 80
79     [Documentation]    Create SFC Port Chain using port group and classifier created previously
80     OpenStackOperations.Create SFC Port Chain    SFPC1    args=--port-pair-group SFPPG1 --flow-classifier FC_80
81
82 Test Communication From Vm Instance1 In net_1 Port 80 via SF
83     [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.
84     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
85     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
86     ...    80    ${RES_SUCCESS}
87     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
88     ...    81    ${RES_SUCCESS}
89     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
90     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
91     BuiltIn.Comment    Port 80 communication should fail as the SF blocks the same
92     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
93     ...    80    ${RES_FAILURE}
94     BuiltIn.Comment    Test to confirm Port 81 is not blocked
95     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
96     ...    81    ${RES_SUCCESS}
97     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
98     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 81
99     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
100     ...    80    ${RES_SUCCESS}
101     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
102     ...    81    ${RES_SUCCESS}
103     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
104     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
105     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
106     ...    AND    OpenStackOperations.Exit From Vm Console
107
108 Update Port Chain To Use Flow Classifier For Port 81
109     [Documentation]    Update Port Chain to use FC_81 instead of FC_80
110     OpenStackOperations.Update SFC Port Chain With A New Flow Classifier    SFPC1    FC_81
111     OpenStackOperations.Update SFC Port Chain Removing A Flow Classifier    SFPC1    FC_80
112
113 Test Communication From Vm Instance1 In net_1 Port 81 via SF
114     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
115     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
116     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
117     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
118     ...    80    ${RES_SUCCESS}
119     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
120     ...    81    ${RES_SUCCESS}
121     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
122     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 81
123     BuiltIn.Comment    Port 81 communication should fail as the SF blocks the same
124     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
125     ...    80    ${RES_SUCCESS}
126     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
127     ...    81    ${RES_FAILURE}
128     BuiltIn.Comment    Test to confirm Port 80 does not continue to get routed through SF
129     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
130     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
131     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
132     ...    80    ${RES_SUCCESS}
133     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
134     ...    81    ${RES_SUCCESS}
135     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
136     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
137     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
138     ...    AND    OpenStackOperations.Exit From Vm Console
139
140 Update Port Chain To Use Flow Classifier For Port Range 83-85
141     [Documentation]    Update Port Chain to use FC_83_85
142     OpenStackOperations.Update SFC Port Chain With A New Flow Classifier    SFPC1    FC_83_85
143
144 Test Communication From Vm Instance1 In net_1 Port 84 And 85 via SF
145     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
146     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
147     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
148     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
149     ...    80    ${RES_SUCCESS}
150     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
151     ...    83    ${RES_SUCCESS}
152     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
153     ...    84    ${RES_SUCCESS}
154     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
155     ...    85    ${RES_SUCCESS}
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 --block 83
158     BuiltIn.Comment    Port 83 communication should fail as the SF blocks the same
159     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
160     ...    80    ${RES_SUCCESS}
161     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
162     ...    83    ${RES_FAILURE}
163     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
164     ...    84    ${RES_SUCCESS}
165     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
166     ...    85    ${RES_SUCCESS}
167     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
168     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 84
169     BuiltIn.Comment    Port 84 communication should fail as the SF blocks the same
170     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
171     ...    80    ${RES_SUCCESS}
172     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
173     ...    84    ${RES_FAILURE}
174     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
175     ...    83    ${RES_SUCCESS}
176     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
177     ...    85    ${RES_SUCCESS}
178     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
179     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 85
180     BuiltIn.Comment    Port 85 communication should fail as the SF blocks the same
181     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
182     ...    80    ${RES_SUCCESS}
183     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
184     ...    83    ${RES_SUCCESS}
185     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
186     ...    84    ${RES_SUCCESS}
187     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
188     ...    85    ${RES_FAILURE}
189     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
190     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 80
191     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
192     ...    80    ${RES_SUCCESS}
193     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
194     ...    83    ${RES_SUCCESS}
195     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
196     ...    84    ${RES_SUCCESS}
197     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND}
198     ...    85    ${RES_SUCCESS}
199
200 Update Port Chain To Use Flow Classifier For Input Port Range 101-103
201     [Documentation]    Update Port Chain to use FC_101_103
202     BuiltIn.Comment    Removing and Deleting Existing Conflicting Flow Classifiers
203     OpenStackOperations.Update SFC Port Chain Removing A Flow Classifier    SFPC1    FC_81
204     OpenStackOperations.Update SFC Port Chain Removing A Flow Classifier    SFPC1    FC_83_85
205     OpenStackOperations.Delete SFC Flow Classifier    FC_80
206     OpenStackOperations.Delete SFC Flow Classifier    FC_81
207     OpenStackOperations.Delete SFC Flow Classifier    FC_83_85
208     OpenStackOperations.Create SFC Flow Classifier    FC_101_103    @{NET1_VM_IPS}[0]    @{NET1_VM_IPS}[1]    tcp    source_vm_port    args=--source-port 101:103
209     OpenStackOperations.Update SFC Port Chain With A New Flow Classifier    SFPC1    FC_101_103
210
211 Test Communication From Vm Instance1 In net_1 Port 100 And 102 via SF
212     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
213     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
214     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
215     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 80
216     ...    83    ${RES_SUCCESS}
217     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 100
218     ...    83    ${RES_SUCCESS}
219     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 101
220     ...    83    ${RES_SUCCESS}
221     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 102
222     ...    83    ${RES_SUCCESS}
223     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 103
224     ...    83    ${RES_SUCCESS}
225     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
226     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 83
227     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 80
228     ...    83    ${RES_SUCCESS}
229     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 100
230     ...    83    ${RES_SUCCESS}
231     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 101
232     ...    83    ${RES_FAILURE}
233     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 102
234     ...    83    ${RES_FAILURE}
235     Wait Until Keyword Succeeds    3x    10s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 103
236     ...    83    ${RES_FAILURE}
237
238 Delete And Recreate Port Chain And Flow Classifiers For Symmetric Test
239     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
240     OpenStackOperations.Delete SFC Port Chain    SFPC1
241     OpenStackOperations.Create SFC Port Chain    SFPSYM    args=--port-pair-group SFPPG1 --flow-classifier FC_SYM --chain-parameters symmetric=true
242
243 Test Communication From Vm Instance1 For Symmetric Chain
244     [Documentation]    Login to the source VM instance, and send a nc req to the destination VM instance.
245     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
246     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
247     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
248     Wait Until Keyword Succeeds    8x    20s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 2000
249     ...    82    ${RES_SUCCESS}
250     BuiltIn.Comment    Test to confirm the SRC->DEST Port 82 is routed through SF
251     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
252     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off --block 82
253     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
254     Wait Until Keyword Succeeds    8x    20s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 2000
255     ...    82    ${RES_FAILURE}
256     BuiltIn.Comment    Test to confirm DEST->SRC Port 2000 path SFC traversal
257     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
258     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
259     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off --block 2000
260     Wait Until Keyword Succeeds    8x    20s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 2000
261     ...    82    ${RES_FAILURE}
262     BuiltIn.Comment    Test to confirm the Normalcy restored
263     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
264     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_IN} --output ${ETH_OUT} --verbose off
265     Start Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}    args=--do forward --interface ${ETH_OUT} --output ${ETH_IN} --verbose off
266     Wait Until Keyword Succeeds    8x    20s    Check Network Reachability    @{NETWORKS}[0]    @{NET1_VM_IPS}[0]    ${NC_COMMAND} -p 2000
267     ...    82    ${RES_SUCCESS}
268     Stop Vxlan Tool in SF    @{NETWORKS}[0]    ${SF1_IP}
269     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Get Test Teardown Debugs
270     ...    AND    OpenStackOperations.Get Test Teardown Debugs For SFC
271     ...    AND    OpenStackOperations.Exit From Vm Console
272
273 Delete Configurations
274     [Documentation]    Delete all elements that were created in the test case section. These are done
275     ...    in a local keyword so this can be called as part of the Suite Teardown. When called as part
276     ...    of the Suite Teardown, all steps will be attempted. This prevents robot framework from bailing
277     ...    on the rest of a test case if one step intermittently has trouble and fails. The goal is to attempt
278     ...    to leave the test environment as clean as possible upon completion of this suite.
279     FOR    ${vm}    IN    @{NET_1_VMS}
280         OpenStackOperations.Delete Vm Instance    ${vm}
281     END
282     OpenStackOperations.Delete SFC Port Chain    SFPSYM
283     OpenStackOperations.Delete SFC Port Pair Group    SFPPG1
284     OpenStackOperations.Delete SFC Port Pair    SFPP1
285     OpenStackOperations.Delete SFC Flow Classifier    FC_101_103
286     OpenStackOperations.Delete SFC Flow Classifier    FC_SYM
287     FOR    ${port}    IN    @{PORTS}
288         OpenStackOperations.Delete Port    ${port}
289     END
290     OpenStackOperations.Delete SubNet    l2_subnet_1
291     FOR    ${network}    IN    @{NETWORKS}
292         OpenStackOperations.Delete Network    ${network}
293     END
294     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
295
296 *** Keywords ***
297 Suite Setup
298     OpenStackOperations.OpenStack Suite Setup
299     Create Basic Networks
300     Create Ports For Testing
301     Create Instances For Testing
302     Check Vm Instances Have Ip Address And Ready For Test
303     Start Applications on VM Instances For Test
304
305 Create Basic Networks
306     BuiltIn.Comment    Create Network For Testing
307     OpenStackOperations.Create Network    @{NETWORKS}[0]
308     BuiltIn.Comment    Create Subnet For Testing
309     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
310     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
311     BuiltIn.Comment    Create Neutron Ports with no port security for SFC Tests
312     OpenStackOperations.Get Suite Debugs
313
314 Create Ports For Testing
315     FOR    ${port}    IN    @{PORTS}
316         OpenStackOperations.Create Port    @{NETWORKS}[0]    ${port}    sg=${SECURITY_GROUP}
317     END
318     OpenStackOperations.Update Port    p1in    additional_args=--no-security-group
319     OpenStackOperations.Update Port    p1in    additional_args=--disable-port-security
320     OpenStackOperations.Update Port    p1out    additional_args=--no-security-group
321     OpenStackOperations.Update Port    p1out    additional_args=--disable-port-security
322     CompareStream.Run_Keyword_If_Equals    oxygen    OpenStackOperations.Update Port    source_vm_port    additional_args=--no-security-group
323     CompareStream.Run_Keyword_If_Equals    oxygen    OpenStackOperations.Update Port    source_vm_port    additional_args=--disable-port-security
324     CompareStream.Run_Keyword_If_Equals    oxygen    OpenStackOperations.Update Port    dest_vm_port    additional_args=--no-security-group
325     CompareStream.Run_Keyword_If_Equals    oxygen    OpenStackOperations.Update Port    dest_vm_port    additional_args=--disable-port-security
326     OpenStackOperations.Get Suite Debugs
327
328 Create Instances For Testing
329     ${SF_COMP_HOST} =    BuiltIn.Set Variable If    2 < ${NUM_OS_SYSTEM}    ${OS_CMP2_HOSTNAME}    ${OS_CMP1_HOSTNAME}
330     OpenStackOperations.Add New Image From Url    ${CLOUD_IMAGE}    ${CLOUD_IMAGE_NAME}
331     OpenStackOperations.Create Flavor    ${CLOUD_FLAVOR_NAME}    512    1
332     OpenStackOperations.Create Vm Instance With Ports On Compute Node    p1in    p1out    sf1    ${SF_COMP_HOST}    image=${CLOUD_IMAGE_NAME}    flavor=${CLOUD_FLAVOR_NAME}
333     ...    sg=${SECURITY_GROUP}
334     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}
335     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}
336     OpenStackOperations.Show Debugs    @{NET_1_VMS}
337     OpenStackOperations.Get Suite Debugs
338
339 Check Vm Instances Have Ip Address And Ready For Test
340     OpenStackOperations.Poll VM Is ACTIVE    sf1
341     OpenStackOperations.Poll VM Is ACTIVE    sourcevm
342     OpenStackOperations.Poll VM Is ACTIVE    destvm
343     ${sfc1_mac}    OpenStackOperations.Get Port Mac    p1in
344     ${SF1_IP}    OpenStackOperations.Get Port Ip    p1in
345     BuiltIn.Wait Until Keyword Succeeds    500s    60s    OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace    @{NETWORKS}[0]    ${sfc1_mac}    ${SF1_IP}
346     ${src_mac}    OpenStackOperations.Get Port Mac    source_vm_port
347     ${src_ip}    OpenStackOperations.Get Port Ip    source_vm_port
348     BuiltIn.Wait Until Keyword Succeeds    500s    60s    OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace    @{NETWORKS}[0]    ${src_mac}    ${src_ip}
349     ${dest_mac}    OpenStackOperations.Get Port Mac    dest_vm_port
350     ${dest_ip}    OpenStackOperations.Get Port Ip    dest_vm_port
351     BuiltIn.Wait Until Keyword Succeeds    500s    60s    OpenStackOperations.Verify If Instance Is Arpingable From Dhcp Namespace    @{NETWORKS}[0]    ${dest_mac}    ${dest_ip}
352     BuiltIn.Comment    If the Tests reach this point, all the Instances are reachable.
353     ${NET1_VM_IPS}    BuiltIn.Create List    ${src_ip}    ${dest_ip}
354     BuiltIn.Set Suite Variable    @{NET1_VM_IPS}
355     BuiltIn.Set Suite Variable    ${SF1_IP}
356     BuiltIn.Set Suite Variable    ${OS_SYSTEM_PROMPT}    \#
357     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}
358     ...    password=${CLOUD_IMAGE_PASS}    console=${CLOULD_IMAGE_CONSOLE}
359     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}
360     ...    password=${CLOUD_IMAGE_PASS}    console=${CLOULD_IMAGE_CONSOLE}
361     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}
362     ...    password=${CLOUD_IMAGE_PASS}    console=${CLOULD_IMAGE_CONSOLE}
363     OpenStackOperations.Show Debugs    @{NET_1_VMS}
364     OpenStackOperations.Get Suite Debugs
365
366 Start Applications on VM Instances For Test
367     BuiltIn.Comment    Run Web server Scripts on destination vm listening to 80,81 and 82 ports
368     ${resp}    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET1_VM_IPS}[1]    ${WEBSERVER_CMDS} && (echo done)    user=${CLOUD_IMAGE_USER}    password=${CLOUD_IMAGE_PASS}
369     ...    console=${CLOULD_IMAGE_CONSOLE}
370     BuiltIn.Should Contain    ${resp}    done
371
372 Start Vxlan Tool in SF
373     [Arguments]    ${network}    ${sf_vm_ip}    ${args}=${EMPTY}
374     [Documentation]    Starts the tool in the SF VM's
375     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}
376
377 Stop Vxlan Tool in SF
378     [Arguments]    ${network}    ${sf_vm_ip}
379     [Documentation]    Starts the tool in the SF VM's
380     OpenStackOperations.Execute Command on VM Instance    ${network}    ${sf_vm_ip}    pkill python    user=${CLOUD_IMAGE_USER}    password=${CLOUD_IMAGE_PASS}    console=${CLOULD_IMAGE_CONSOLE}
381
382 Check Network Reachability
383     [Arguments]    ${net_name}    ${source_vm_ip}    ${command}    ${port}    ${ret_code}    ${cmd_timeout}=30s
384     ${nc_resp}    OpenStackOperations.Execute Command on VM Instance    ${net_name}    ${source_vm_ip}    ${command} @{NET1_VM_IPS}[1] ${port}    cmd_timeout=${cmd_timeout}    user=${CLOUD_IMAGE_USER}
385     ...    password=${CLOUD_IMAGE_PASS}    console=${CLOULD_IMAGE_CONSOLE}
386     BuiltIn.Should Contain    ${nc_resp}    ${ret_code}