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