Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / openflowplugin / Clustered_Reconciliation / 010_Group_Flows.robot
1 *** Settings ***
2 Documentation     Switch connections and cluster are restarted.
3 Suite Setup       Initialization Phase
4 Suite Teardown    Final Phase
5 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Library           RequestsLibrary
7 Library           Collections
8 Resource          ../../../libraries/SetupUtils.robot
9 Resource          ../../../libraries/ClusterManagement.robot
10 Resource          ../../../libraries/ClusterOpenFlow.robot
11 Resource          ../../../libraries/TemplatedRequests.robot
12 Resource          ../../../libraries/MininetKeywords.robot
13 Resource          ../../../libraries/Utils.robot
14 Resource          ../../../libraries/OvsManager.robot
15 Resource          ../../../variables/Variables.robot
16
17 *** Variables ***
18 ${SWITCHES}       3
19 ${ITER}           100
20 ${VAR_DIR}        ${CURDIR}/../../../variables/openflowplugin
21
22 *** Test Cases ***
23 Add Groups And Flows
24     [Documentation]    Add ${ITER} groups 1&2 and flows in every switch.
25     Add Groups And Flows On Member    ${ITER}
26
27 Start Mininet Multiple Connections
28     [Documentation]    Start mininet linear with connection to all cluster instances.
29     ${cluster_index_list}=    ClusterManagement.List All Indices
30     ${mininet_conn_id}=    MininetKeywords.Start Mininet Multiple Controllers    ${TOOLS_SYSTEM_IP}    ${cluster_index_list}    --topo linear,${SWITCHES}
31     BuiltIn.Set Suite Variable    ${cluster_index_list}
32     BuiltIn.Set Suite Variable    ${mininet_conn_id}
33     BuiltIn.Wait Until Keyword Succeeds    10s    1s    OVSDB.Check OVS OpenFlow Connections    ${TOOLS_SYSTEM_IP}    ${SWITCHES*3}
34
35 Check Linear Topology
36     [Documentation]    Check Linear Topology.
37     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
38
39 Check Stats Are Not Frozen
40     [Documentation]    Check that duration flow stat is increasing.
41     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
42
43 Check Flows In Operational DS
44     [Documentation]    Check Flows in operational DS.
45     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
46
47 Check Groups In Operational DS
48     [Documentation]    Check Groups in operational DS.
49     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
50
51 Check Flows In Switch
52     [Documentation]    Check Flows in switch.
53     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
54
55 Check Entity Owner Status And Find Owner and Successor Before Fail
56     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
57     ${original_owner}    ${original_successor_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    1
58     BuiltIn.Set Suite Variable    ${original_owner}
59     BuiltIn.Set Suite Variable    ${new_cluster_list}    ${original_successor_list}
60
61 Disconnect Mininet From Owner
62     [Documentation]    Disconnect mininet from the owner
63     ${original_owner_list}    BuiltIn.Create List    ${original_owner}
64     MininetKeywords.Disconnect Cluster Mininet    break    ${original_owner_list}
65     BuiltIn.Set Suite Variable    ${original_owner_list}
66
67 Check Entity Owner Status And Find Owner and Successor After Fail
68     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
69     ${new_owner}    ${new_successor_list}    BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1
70     ...    1    ${new_cluster_list}    after_stop=True
71     ${owner_list}=    BuiltIn.Create List    ${original_owner}    ${new_owner}
72     BuiltIn.Set Suite Variable    ${owner_list}
73     BuiltIn.Set Suite Variable    ${new_owner}
74     BuiltIn.Set Suite Variable    ${new_successor_list}
75
76 Check Switch Moves To New Master
77     [Documentation]    Check switch s1 is connected to new Master.
78     ${new_master}=    BuiltIn.Set Variable    ${ODL_SYSTEM_${new_owner}_IP}
79     BuiltIn.Wait Until Keyword Succeeds    10s    1s    OvsManager.Should Be Master    s1    ${new_master}    update_data=${True}
80
81 Check Linear Topology After Disconnect
82     [Documentation]    Check Linear Topology.
83     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
84
85 Check Stats Are Not Frozen After Disconnect
86     [Documentation]    Check that duration flow stat is increasing
87     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
88
89 Remove Flows And Groups After Mininet Is Disconnected
90     [Documentation]    Remove 1 group 1&2 and 1 flow in every switch.
91     Remove Single Group And Flow On Member
92
93 Check Flows In Operational DS After Mininet Is Disconnected
94     [Documentation]    Check Flows in Operational DS.
95     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${less_flows}
96
97 Check Groups In Operational DS After Mininet Is Disconnected
98     [Documentation]    Check Groups in Operational DS.
99     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${less_groups}
100
101 Check Flows In Switch After Mininet Is Disconnected
102     [Documentation]    Check Flows in switch.
103     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${less_flows}
104
105 Reconnect Mininet To Owner
106     [Documentation]    Reconnect mininet to switch 1 owner.
107     MininetKeywords.Disconnect Cluster Mininet    restore    ${original_owner_list}
108
109 Check Entity Owner Status And Find Owner and Successor After Reconnect
110     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
111     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    1
112
113 Add Flows And Groups After Owner Reconnect
114     [Documentation]    Add 1 group type 1&2 and 1 flow in every switch.
115     Add Single Group And Flow On Member
116
117 Check Stats Are Not Frozen After Owner Reconnect
118     [Documentation]    Check that duration flow stat is increasing.
119     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
120
121 Check Flows After Owner Reconnect In Operational DS
122     [Documentation]    Check Flows in Operational DS.
123     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
124
125 Check Groups After Owner Reconnect In Operational DS
126     [Documentation]    Check Groups in Operational DS.
127     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
128
129 Check Flows After Owner Reconnect In Switch
130     [Documentation]    Check Flows in switch.
131     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
132
133 Check Switches Generate Slave Connection
134     [Documentation]    Check switches are connected to new Slave.
135     ${original_master}=    BuiltIn.Set Variable    ${ODL_SYSTEM_${original_owner}_IP}
136     FOR    ${switch}    IN RANGE    1    ${switches+1}
137         BuiltIn.Wait Until Keyword Succeeds    50s    1s    OvsManager.Should Be Slave    s${switch}    ${original_master}
138         ...    update_data=${True}
139     END
140
141 Disconnect Mininet From Successor
142     [Documentation]    Disconnect mininet from the Successor.
143     MininetKeywords.Disconnect Cluster Mininet    break    ${new_successor_list}
144
145 Check Entity Owner Status And Find New Owner and Successor After Disconnect
146     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
147     ${current_owner}    ${current_successor_list}    BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1
148     ...    1    ${owner_list}    after_stop=True
149     BuiltIn.Set Suite Variable    ${current_owner}
150     BuiltIn.Set Suite Variable    ${current_successor_list}
151
152 Disconnect Mininet From Current Owner
153     [Documentation]    Disconnect mininet from the owner
154     ${current_owner_list}=    BuiltIn.Create List    ${current_owner}
155     MininetKeywords.Disconnect Cluster Mininet    break    ${current_owner_list}
156
157 Check Entity Owner Status And Find Current Owner and Successor After Disconnect
158     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
159     ${current_new_owner}    ${current_new_successor_list}    BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1
160     ...    1    ${original_owner_list}    after_stop=True
161     BuiltIn.Set Suite Variable    ${current_new_owner}
162     BuiltIn.Set Suite Variable    ${current_new_successor_list}
163
164 Check Switch Moves To Current Master
165     [Documentation]    Check switch s1 is connected to original Master.
166     ${current_new_master}=    BuiltIn.Set Variable    ${ODL_SYSTEM_${current_new_owner}_IP}
167     BuiltIn.Wait Until Keyword Succeeds    10s    1s    OvsManager.Should Be Master    s1    ${current_new_master}    update_data=${True}
168     BuiltIn.Should Be Equal    ${current_new_owner}    ${original_owner}
169
170 Check Linear Topology After Owner Disconnect
171     [Documentation]    Check Linear Topology.
172     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
173
174 Check Stats Are Not Frozen After Owner Disconnect
175     [Documentation]    Check that duration flow stat is increasing.
176     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
177
178 Remove Flows And Groups After Owner Disconnected
179     [Documentation]    Remove 1 group 1&2 and 1 flow in every switch.
180     Remove Single Group And Flow On Member
181
182 Check Flows In Operational DS After Owner Disconnected
183     [Documentation]    Check Flows in Operational DS.
184     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${less_flows}
185
186 Check Groups In Operational DS After Owner Disconnected
187     [Documentation]    Check Groups in Operational DS.
188     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${less_groups}
189
190 Check Flows In Switch After Owner Disconnected
191     [Documentation]    Check Flows in switch.
192     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${less_flows}
193
194 Disconnect Mininet From Cluster
195     [Documentation]    Disconnect Mininet from Cluster.
196     MininetKeywords.Disconnect Cluster Mininet    break    ${original_owner_list}
197
198 Check No Switches After Disconnect
199     [Documentation]    Check no switches in topology.
200     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check No Switches On Member    ${SWITCHES}
201
202 Check Switch Is Not Connected
203     [Documentation]    Check switch s1 is not connected to any controller.
204     FOR    ${index}    IN    @{cluster_index_list}
205         BuiltIn.Wait Until Keyword Succeeds    10s    1s    OvsManager.Should Be Disconnected    s1    ${ODL_SYSTEM_${index}_IP}
206         ...    update_data=${True}
207     END
208
209 Reconnect Mininet To Cluster
210     [Documentation]    Reconnect mininet to cluster by removing Iptables drop rules that were used to disconnect
211     MininetKeywords.Disconnect Cluster Mininet    restore
212
213 Check Linear Topology After Mininet Reconnects
214     [Documentation]    Check Linear Topology.
215     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
216
217 Add Flows And Groups After Mininet Reconnects
218     [Documentation]    Add 1 group type 1&2 and 1 flow in every switch.
219     Add Single Group And Flow On Member
220
221 Check Flows In Operational DS After Mininet Reconnects
222     [Documentation]    Check Flows in Operational DS.
223     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
224
225 Check Groups In Operational DS After Mininet Reconnects
226     [Documentation]    Check Groups in Operational DS.
227     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
228
229 Check Flows In Switch After Mininet Reconnects
230     [Documentation]    Check Flows in switch.
231     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
232
233 Check Entity Owner Status And Find Owner and Successor Before Owner Stop
234     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
235     ${original_owner}    ${original_successor_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    1
236     ${original_successor}=    Collections.Get From List    ${original_successor_list}    0
237     BuiltIn.Set Suite Variable    ${original_owner}
238     BuiltIn.Set Suite Variable    ${original_successor_list}
239     BuiltIn.Set Suite Variable    ${original_successor}
240
241 Check Switch Generates Slave Connection Before Owner Stop
242     [Documentation]    Check switch s1 is connected to Slave.
243     ${original_slave}=    BuiltIn.Set Variable    ${ODL_SYSTEM_${original_successor}_IP}
244     BuiltIn.Wait Until Keyword Succeeds    50s    1s    OvsManager.Should Be Slave    s1    ${original_slave}    update_data=${True}
245
246 Check Shards Status Before Owner Stop
247     [Documentation]    Check Status for all shards in OpenFlow application.
248     ClusterOpenFlow.Check OpenFlow Shards Status
249
250 Stop Owner Instance
251     [Documentation]    Stop Owner Instance and verify it is shutdown
252     ClusterManagement.Stop Single Member    ${original_owner}
253     BuiltIn.Set Suite Variable    ${new_cluster_list}    ${original_successor_list}
254
255 Check Shards Status After Stop
256     [Documentation]    Check Status for all shards in OpenFlow application.
257     ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event    ${new_cluster_list}
258
259 Check Entity Owner Status And Find Owner and Successor After Stop
260     [Documentation]    Check Entity Owner Status and identify owner and successor.
261     ${new_owner}    ${new_successor_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    ${original_successor}    ${new_cluster_list}    after_stop=True
262     BuiltIn.Set Suite Variable    ${new_owner}
263
264 Check Stats Are Not Frozen After Owner Stop
265     [Documentation]    Check that duration flow stat is increasing in new owner.
266     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen    ${new_owner}
267
268 Remove Configuration In Owner and Verify After Owner Stop
269     [Documentation]    Remove 1 group 1&2 and 1 flow in every switch.
270     Remove Single Group And Flow On Member    ${new_owner}
271
272 Check Flows After Owner Stop In Operational DS
273     [Documentation]    Check Flows in Operational DS in new owner.
274     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${less_flows}    ${new_owner}
275
276 Check Groups After Owner Stop In Operational DS
277     [Documentation]    Check Groups in Operational DS in new owner.
278     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${less_groups}    ${new_owner}
279
280 Check Flows In Switch After Owner Stop
281     [Documentation]    Check Flows in switch.
282     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${less_flows}
283
284 Start Old Owner Instance
285     [Documentation]    Start old Owner Instance and verify it is up.
286     ClusterManagement.Start Single Member    ${original_owner}
287
288 Check Entity Owner Status And Find Owner and Successor After Start Owner
289     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
290     ${owner}    ${successor_list}    BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1
291     ...    1
292
293 Check Linear Topology After Owner Restart
294     [Documentation]    Check Linear Topology.
295     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
296
297 Add Configuration In Owner and Verify After Owner Restart
298     [Documentation]    Add 1 group type 1&2 and 1 flow in every switch.
299     Add Single Group And Flow On Member    ${new_owner}
300
301 Check Stats Are Not Frozen After Owner Restart
302     [Documentation]    Check that duration flow stat is increasing.
303     Log    ${new_owner}
304     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
305
306 Check Flows In Operational DS After Owner Restart
307     [Documentation]    Check Flows in Operational DS.
308     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
309
310 Check Groups In Operational DS After Owner Restart
311     [Documentation]    Check Groups in Operational DS.
312     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
313
314 Check Flows In Switch After Owner Restart
315     [Documentation]    Check Flows in switch.
316     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
317
318 Restart Cluster
319     [Documentation]    Stop and Start cluster.
320     # Try to stop contoller, if stop does not work or takes too long, kill controller.
321     ${status}    ${result}=    BuiltIn.Run Keyword And Ignore Error    ClusterManagement.Stop_Members_From_List_Or_All
322     BuiltIn.Run Keyword If    '${status}' != 'PASS'    ClusterManagement.Kill_Members_From_List_Or_All
323     ClusterManagement.Start_Members_From_List_Or_All    wait_for_sync=False
324
325 Check Linear Topology After Controller Restarts
326     [Documentation]    Check Linear Topology
327     BuiltIn.Wait Until Keyword Succeeds    300s    2s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
328
329 Check Stats Are Not Frozen After Cluster Restart
330     [Documentation]    Check that duration flow stat is increasing.
331     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
332
333 Check Flows In Operational DS After Controller Restarts
334     [Documentation]    Check Flows in Operational DS.
335     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
336
337 Check Groups In Operational DS After Controller Restarts
338     [Documentation]    Check Groups in Operational DS.
339     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
340
341 Check Flows In Switch After Controller Restarts
342     [Documentation]    Check Flows in switch.
343     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
344
345 Stop Mininet
346     [Documentation]    Stop Mininet.
347     MininetKeywords.Stop Mininet And Exit
348
349 Check No Switches
350     [Documentation]    Check no switches in topology.
351     BuiltIn.Wait Until Keyword Succeeds    5s    1s    ClusterOpenFlow.Check No Switches On Member    ${SWITCHES}
352
353 *** Keywords ***
354 Initialization Phase
355     [Documentation]    Create controller session and set variables.
356     SetupUtils.Setup_Utils_For_Setup_And_Teardown
357     RequestsLibrary.Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
358     ${switches}    Convert To Integer    ${SWITCHES}
359     ${iter}    Convert To Integer    ${ITER}
360     ${all_groups}=    BuiltIn.Evaluate    ${switches} * ${iter} * 2
361     ${less_groups}=    BuiltIn.Evaluate    ${all_groups} - ${switches} * 2
362     # Stale flows/groups feature enabled in Boron onwards.
363     ${all_flows}=    BuiltIn.Evaluate    ${switches} * ${iter+1}
364     ${less_flows}=    BuiltIn.Evaluate    ${all_flows} - ${switches}
365     # Stale flows/groups feature enabled in Boron onwards.
366     BuiltIn.Set Suite Variable    ${switches}
367     BuiltIn.Set Suite Variable    ${iter}
368     BuiltIn.Set Suite Variable    ${all_groups}
369     BuiltIn.Set Suite Variable    ${less_groups}
370     BuiltIn.Set Suite Variable    ${all_flows}
371     BuiltIn.Set Suite Variable    ${less_flows}
372     BuiltIn.Set Suite Variable    ${no_flows}    ${SWITCHES}
373
374 Final Phase
375     [Documentation]    Delete all sessions.
376     ${command} =    BuiltIn.Set Variable    sudo iptables -v -F
377     BuiltIn.Run Keyword And Ignore Error    ClusterManagement.Run_Bash_Command_On_List_Or_All    ${command}
378     BuiltIn.Run Keyword And Ignore Error    RequestsLibrary.Delete Request    session    ${CONFIG_NODES_API}
379     RequestsLibrary.Delete All Sessions
380
381 Add Groups And Flows On Member
382     [Arguments]    ${iter}=1    ${member_index}=1
383     [Documentation]    Add ${ITER} groups type 1 & 2 and flows in every switch.
384     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
385     FOR    ${switch}    IN RANGE    1    ${switches+1}
386         TemplatedRequests.Post As Json Templated    folder=${VAR_DIR}/add-group-1    mapping={"SWITCH":"${switch}"}    session=${session}    iterations=${iter}
387         TemplatedRequests.Post As Json Templated    folder=${VAR_DIR}/add-group-2    mapping={"SWITCH":"${switch}"}    session=${session}    iterations=${iter}
388         TemplatedRequests.Post As Json Templated    folder=${VAR_DIR}/add-flow    mapping={"SWITCH":"${switch}"}    session=${session}    iterations=${iter}
389     END
390
391 Add Single Group And Flow On Member
392     [Arguments]    ${member_index}=1
393     [Documentation]    Add 1 group 1&2 and 1 flow in every switch.
394     Add Groups And Flows On Member    1    ${member_index}
395
396 Remove Single Group And Flow On Member
397     [Arguments]    ${member_index}=1
398     [Documentation]    Remove 1 group 1&2 and 1 flow in every switch.
399     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
400     FOR    ${switch}    IN RANGE    1    ${switches+1}
401         RequestsLibrary.Delete Request    ${session}    ${CONFIG_NODES_API}/node/openflow:${switch}/table/0/flow/1
402         RequestsLibrary.Delete Request    ${session}    ${CONFIG_NODES_API}/node/openflow:${switch}/group/1
403         RequestsLibrary.Delete Request    ${session}    ${CONFIG_NODES_API}/node/openflow:${switch}/group/1000
404     END
405
406 Check Flow Stats Are Not Frozen
407     [Arguments]    ${member_index}=1    ${period_in_seconds}=5
408     [Documentation]    Verify flow stats are not frozen for flow 1 and switch 1.
409     ${duration_1} =    Extract Flow Duration    ${member_index}
410     ${duration_1}    Builtin.Convert To Integer    ${duration_1}
411     BuiltIn.Sleep    ${period_in_seconds}
412     ${duration_2} =    Extract Flow Duration    ${member_index}
413     ${duration_2}    Builtin.Convert To Integer    ${duration_2}
414     Should Not Be Equal As Integers    ${duration_1}    ${duration_2}
415
416 Extract Flow Duration
417     [Arguments]    ${member_index}
418     [Documentation]    Extract duration for flow 1 in switch 1.
419     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
420     ${resp}    RequestsLibrary.Get Request    ${session}    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/flow/1    headers=${headers}
421     Log    ${resp.content}
422     ${json_resp} =    RequestsLibrary.To_Json    ${resp.content}
423     ${flow_list} =    Collections.Get_From_Dictionary    ${json_resp}    flow-node-inventory:flow
424     ${flow_stats} =    Collections.Get_From_Dictionary    @{flow_list}[0]    opendaylight-flow-statistics:flow-statistics
425     ${duration} =    Collections.Get_From_Dictionary    &{flow_stats}[duration]    second
426     Return From Keyword    ${duration}