Repair OF test
[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
140 Disconnect Mininet From Successor
141     [Documentation]    Disconnect mininet from the Successor.
142     MininetKeywords.Disconnect Cluster Mininet    break    ${new_successor_list}
143
144 Check Entity Owner Status And Find New Owner and Successor After Disconnect
145     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
146     ${current_owner}    ${current_successor_list}    BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1
147     ...    1    ${owner_list}    after_stop=True
148     BuiltIn.Set Suite Variable    ${current_owner}
149     BuiltIn.Set Suite Variable    ${current_successor_list}
150
151 Disconnect Mininet From Current Owner
152     [Documentation]    Disconnect mininet from the owner
153     ${current_owner_list}=    BuiltIn.Create List    ${current_owner}
154     MininetKeywords.Disconnect Cluster Mininet    break    ${current_owner_list}
155
156 Check Entity Owner Status And Find Current Owner and Successor After Disconnect
157     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
158     ${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
159     ...    1    ${original_owner_list}    after_stop=True
160     BuiltIn.Set Suite Variable    ${current_new_owner}
161     BuiltIn.Set Suite Variable    ${current_new_successor_list}
162
163 Check Switch Moves To Current Master
164     [Documentation]    Check switch s1 is connected to original Master.
165     ${current_new_master}=    BuiltIn.Set Variable    ${ODL_SYSTEM_${current_new_owner}_IP}
166     BuiltIn.Wait Until Keyword Succeeds    10s    1s    OvsManager.Should Be Master    s1    ${current_new_master}    update_data=${True}
167     BuiltIn.Should Be Equal    ${current_new_owner}    ${original_owner}
168
169 Check Linear Topology After Owner Disconnect
170     [Documentation]    Check Linear Topology.
171     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
172
173 Check Stats Are Not Frozen After Owner Disconnect
174     [Documentation]    Check that duration flow stat is increasing.
175     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
176
177 Remove Flows And Groups After Owner Disconnected
178     [Documentation]    Remove 1 group 1&2 and 1 flow in every switch.
179     Remove Single Group And Flow On Member
180
181 Check Flows In Operational DS After Owner Disconnected
182     [Documentation]    Check Flows in Operational DS.
183     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${less_flows}
184
185 Check Groups In Operational DS After Owner Disconnected
186     [Documentation]    Check Groups in Operational DS.
187     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${less_groups}
188
189 Check Flows In Switch After Owner Disconnected
190     [Documentation]    Check Flows in switch.
191     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${less_flows}
192
193 Disconnect Mininet From Cluster
194     [Documentation]    Disconnect Mininet from Cluster.
195     MininetKeywords.Disconnect Cluster Mininet    break    ${original_owner_list}
196
197 Check No Switches After Disconnect
198     [Documentation]    Check no switches in topology.
199     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check No Switches On Member    ${SWITCHES}
200
201 Check Switch Is Not Connected
202     [Documentation]    Check switch s1 is not connected to any controller.
203     : FOR    ${index}    IN    @{cluster_index_list}
204     \    BuiltIn.Wait Until Keyword Succeeds    10s    1s    OvsManager.Should Be Disconnected    s1    ${ODL_SYSTEM_${index}_IP}
205     \    ...    update_data=${True}
206
207 Reconnect Mininet To Cluster
208     [Documentation]    Reconnect mininet to cluster by removing Iptables drop rules that were used to disconnect
209     MininetKeywords.Disconnect Cluster Mininet    restore
210
211 Check Linear Topology After Mininet Reconnects
212     [Documentation]    Check Linear Topology.
213     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
214
215 Add Flows And Groups After Mininet Reconnects
216     [Documentation]    Add 1 group type 1&2 and 1 flow in every switch.
217     Add Single Group And Flow On Member
218
219 Check Flows In Operational DS After Mininet Reconnects
220     [Documentation]    Check Flows in Operational DS.
221     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
222
223 Check Groups In Operational DS After Mininet Reconnects
224     [Documentation]    Check Groups in Operational DS.
225     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
226
227 Check Flows In Switch After Mininet Reconnects
228     [Documentation]    Check Flows in switch.
229     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
230
231 Check Entity Owner Status And Find Owner and Successor Before Owner Stop
232     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
233     ${original_owner}    ${original_successor_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    1
234     ${original_successor}=    Collections.Get From List    ${original_successor_list}    0
235     BuiltIn.Set Suite Variable    ${original_owner}
236     BuiltIn.Set Suite Variable    ${original_successor_list}
237     BuiltIn.Set Suite Variable    ${original_successor}
238
239 Check Switch Generates Slave Connection Before Owner Stop
240     [Documentation]    Check switch s1 is connected to Slave.
241     ${original_slave}=    BuiltIn.Set Variable    ${ODL_SYSTEM_${original_successor}_IP}
242     BuiltIn.Wait Until Keyword Succeeds    50s    1s    OvsManager.Should Be Slave    s1    ${original_slave}    update_data=${True}
243
244 Check Shards Status Before Owner Stop
245     [Documentation]    Check Status for all shards in OpenFlow application.
246     ClusterOpenFlow.Check OpenFlow Shards Status
247
248 Stop Owner Instance
249     [Documentation]    Stop Owner Instance and verify it is shutdown
250     ClusterManagement.Stop Single Member    ${original_owner}
251     BuiltIn.Set Suite Variable    ${new_cluster_list}    ${original_successor_list}
252
253 Check Shards Status After Stop
254     [Documentation]    Check Status for all shards in OpenFlow application.
255     ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event    ${new_cluster_list}
256
257 Check Entity Owner Status And Find Owner and Successor After Stop
258     [Documentation]    Check Entity Owner Status and identify owner and successor.
259     ${new_owner}    ${new_successor_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    ${original_successor}    ${new_cluster_list}    after_stop=True
260     BuiltIn.Set Suite Variable    ${new_owner}
261
262 Check Stats Are Not Frozen After Owner Stop
263     [Documentation]    Check that duration flow stat is increasing in new owner.
264     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen    ${new_owner}
265
266 Remove Configuration In Owner and Verify After Owner Stop
267     [Documentation]    Remove 1 group 1&2 and 1 flow in every switch.
268     Remove Single Group And Flow On Member    ${new_owner}
269
270 Check Flows After Owner Stop In Operational DS
271     [Documentation]    Check Flows in Operational DS in new owner.
272     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${less_flows}    ${new_owner}
273
274 Check Groups After Owner Stop In Operational DS
275     [Documentation]    Check Groups in Operational DS in new owner.
276     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${less_groups}    ${new_owner}
277
278 Check Flows In Switch After Owner Stop
279     [Documentation]    Check Flows in switch.
280     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${less_flows}
281
282 Start Old Owner Instance
283     [Documentation]    Start old Owner Instance and verify it is up.
284     ClusterManagement.Start Single Member    ${original_owner}
285
286 Check Entity Owner Status And Find Owner and Successor After Start Owner
287     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
288     ${owner}    ${successor_list}    BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1
289     ...    1
290
291 Check Linear Topology After Owner Restart
292     [Documentation]    Check Linear Topology.
293     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
294
295 Add Configuration In Owner and Verify After Owner Restart
296     [Documentation]    Add 1 group type 1&2 and 1 flow in every switch.
297     Add Single Group And Flow On Member    ${new_owner}
298
299 Check Stats Are Not Frozen After Owner Restart
300     [Documentation]    Check that duration flow stat is increasing.
301     Log    ${new_owner}
302     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
303
304 Check Flows In Operational DS After Owner Restart
305     [Documentation]    Check Flows in Operational DS.
306     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
307
308 Check Groups In Operational DS After Owner Restart
309     [Documentation]    Check Groups in Operational DS.
310     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
311
312 Check Flows In Switch After Owner Restart
313     [Documentation]    Check Flows in switch.
314     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
315
316 Restart Cluster
317     [Documentation]    Stop and Start cluster.
318     # Try to stop contoller, if stop does not work or takes too long, kill controller.
319     ${status}    ${result}=    BuiltIn.Run Keyword And Ignore Error    ClusterManagement.Stop_Members_From_List_Or_All
320     BuiltIn.Run Keyword If    '${status}' != 'PASS'    ClusterManagement.Kill_Members_From_List_Or_All
321     ClusterManagement.Start_Members_From_List_Or_All    wait_for_sync=False
322
323 Check Linear Topology After Controller Restarts
324     [Documentation]    Check Linear Topology
325     BuiltIn.Wait Until Keyword Succeeds    300s    2s    ClusterOpenFlow.Check Linear Topology On Member    ${SWITCHES}
326
327 Check Stats Are Not Frozen After Cluster Restart
328     [Documentation]    Check that duration flow stat is increasing.
329     BuiltIn.Wait Until Keyword Succeeds    30s    1s    Check Flow Stats Are Not Frozen
330
331 Check Flows In Operational DS After Controller Restarts
332     [Documentation]    Check Flows in Operational DS.
333     BuiltIn.Wait Until Keyword Succeeds    30s    1s    ClusterOpenFlow.Check Number Of Flows On Member    ${all_flows}
334
335 Check Groups In Operational DS After Controller Restarts
336     [Documentation]    Check Groups in Operational DS.
337     BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Check Number Of Groups On Member    ${all_groups}
338
339 Check Flows In Switch After Controller Restarts
340     [Documentation]    Check Flows in switch.
341     MininetKeywords.Check Flows In Mininet    ${mininet_conn_id}    ${all_flows}
342
343 Stop Mininet
344     [Documentation]    Stop Mininet.
345     MininetKeywords.Stop Mininet And Exit
346
347 Check No Switches
348     [Documentation]    Check no switches in topology.
349     BuiltIn.Wait Until Keyword Succeeds    5s    1s    ClusterOpenFlow.Check No Switches On Member    ${SWITCHES}
350
351 *** Keywords ***
352 Initialization Phase
353     [Documentation]    Create controller session and set variables.
354     SetupUtils.Setup_Utils_For_Setup_And_Teardown
355     RequestsLibrary.Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
356     ${switches}    Convert To Integer    ${SWITCHES}
357     ${iter}    Convert To Integer    ${ITER}
358     ${all_groups}=    BuiltIn.Evaluate    ${switches} * ${iter} * 2
359     ${less_groups}=    BuiltIn.Evaluate    ${all_groups} - ${switches} * 2
360     # Stale flows/groups feature enabled in Boron onwards.
361     ${less_groups}=    CompareStream.Set Variable If At Most Beryllium    ${all_groups}    ${less_groups}
362     ${all_flows}=    BuiltIn.Evaluate    ${switches} * ${iter+1}
363     ${less_flows}=    BuiltIn.Evaluate    ${all_flows} - ${switches}
364     # Stale flows/groups feature enabled in Boron onwards.
365     ${less_flows}=    CompareStream.Set Variable If At Most Beryllium    ${all_flows}    ${less_flows}
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
390 Add Single Group And Flow On Member
391     [Arguments]    ${member_index}=1
392     [Documentation]    Add 1 group 1&2 and 1 flow in every switch.
393     Add Groups And Flows On Member    1    ${member_index}
394
395 Remove Single Group And Flow On Member
396     [Arguments]    ${member_index}=1
397     [Documentation]    Remove 1 group 1&2 and 1 flow in every switch.
398     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
399     : FOR    ${switch}    IN RANGE    1    ${switches+1}
400     \    RequestsLibrary.Delete Request    ${session}    ${CONFIG_NODES_API}/node/openflow:${switch}/table/0/flow/1
401     \    RequestsLibrary.Delete Request    ${session}    ${CONFIG_NODES_API}/node/openflow:${switch}/group/1
402     \    RequestsLibrary.Delete Request    ${session}    ${CONFIG_NODES_API}/node/openflow:${switch}/group/1000
403
404 Check Flow Stats Are Not Frozen
405     [Arguments]    ${member_index}=1    ${period_in_seconds}=5
406     [Documentation]    Verify flow stats are not frozen for flow 1 and switch 1.
407     ${duration_1} =    Extract Flow Duration    ${member_index}
408     ${duration_1}    Builtin.Convert To Integer    ${duration_1}
409     BuiltIn.Sleep    ${period_in_seconds}
410     ${duration_2} =    Extract Flow Duration    ${member_index}
411     ${duration_2}    Builtin.Convert To Integer    ${duration_2}
412     Should Not Be Equal As Integers    ${duration_1}    ${duration_2}
413
414 Extract Flow Duration
415     [Arguments]    ${member_index}
416     [Documentation]    Extract duration for flow 1 in switch 1.
417     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
418     ${resp}    RequestsLibrary.Get Request    ${session}    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/flow/1    headers=${headers}
419     Log    ${resp.content}
420     ${json_resp} =    RequestsLibrary.To_Json    ${resp.content}
421     ${flow_list} =    Collections.Get_From_Dictionary    ${json_resp}    flow-node-inventory:flow
422     ${flow_stats} =    Collections.Get_From_Dictionary    @{flow_list}[0]    opendaylight-flow-statistics:flow-statistics
423     ${duration} =    Collections.Get_From_Dictionary    &{flow_stats}[duration]    second
424     Return From Keyword    ${duration}