2 Documentation Test reconciliation of chained groups and flows after switch connection and controller are restarted.
3 Suite Setup Initialization Phase
4 Suite Teardown Final Phase
5 Library RequestsLibrary
6 Resource ../../../libraries/ClusterManagement.robot
7 Resource ../../../libraries/TemplatedRequests.robot
8 Resource ../../../libraries/MininetKeywords.robot
9 Resource ../../../libraries/FlowLib.robot
10 Resource ../../../libraries/Utils.robot
11 Resource ../../../variables/Variables.robot
16 ${VAR_DIR} ${CURDIR}/../../../variables/openflowplugin
19 Add Group 1 In Every Switch
20 [Documentation] Add ${ITER} groups of type 1 in every switch.
21 : FOR ${switch} IN RANGE 1 ${switches+1}
22 \ TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-group-1 mapping={"SWITCH":"${switch}"} session=session iterations=${iter}
24 Add Group 2 In Every Switch
25 [Documentation] Add ${ITER} groups of type 2 in every switch.
26 : FOR ${switch} IN RANGE 1 ${switches+1}
27 \ TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-group-2 mapping={"SWITCH":"${switch}"} session=session iterations=${iter}
29 Add Flow to Group 2 In Every Switch
30 [Documentation] Add ${ITER} flows to group type 2 in every switch.
31 : FOR ${switch} IN RANGE 1 ${switches+1}
32 \ TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-flow mapping={"SWITCH":"${switch}"} session=session iterations=${ITER}
35 [Documentation] Start Mininet Linear with ${SWITCHES} switches.
36 MininetKeywords.Start Mininet Linear ${SWITCHES}
39 [Documentation] Check Linear Topology.
40 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Linear Topology ${SWITCHES}
42 Check Flows In Operational DS
43 [Documentation] Check Groups after mininet starts.
44 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Number Of Flows ${all_flows}
46 Check Groups In Operational DS
47 [Documentation] Check Flows after mininet starts.
48 FlowLib.Check Number Of Groups ${all_groups}
51 [Documentation] Check Flows after mininet starts.
52 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${all_flows}
55 [Documentation] Disconnect Mininet.
56 Disconnect Controller Mininet
58 Check No Switches After Disconnect
59 [Documentation] Check no switches in topology.
60 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check No Switches In Topology ${SWITCHES}
63 [Documentation] Connect Mininet.
64 Disconnect Controller Mininet restore
66 Check Linear Topology After Mininet Reconnects
67 [Documentation] Check Linear Topology.
68 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Linear Topology ${SWITCHES}
70 Remove Flows And Groups After Mininet Reconnects
71 [Documentation] Remove some groups and flows while network is down.
72 : FOR ${switch} IN RANGE 1 ${switches+1}
73 \ RequestsLibrary.Delete Request session ${CONFIG_NODES_API}/node/openflow:${switch}/table/0/flow/1
74 \ RequestsLibrary.Delete Request session ${CONFIG_NODES_API}/node/openflow:${switch}/group/1
75 \ RequestsLibrary.Delete Request session ${CONFIG_NODES_API}/node/openflow:${switch}/group/1000
77 Check Flows In Operational DS After Mininet Reconnects
78 [Documentation] Check Flows after mininet starts.
79 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Number Of Flows ${less_flows}
81 Check Groups In Operational DS After Mininet Reconnects
82 [Documentation] Check Flows after mininet starts.
83 FlowLib.Check Number Of Groups ${less_groups}
85 Check Flows In Switch After Mininet Reconnects
86 [Documentation] Check Flows after mininet starts.
87 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${less_flows}
90 [Documentation] Stop and Start controller.
91 # Try to stop contoller, if stop does not work or takes too long, kill controller.
92 ${status} ${result}= BuiltIn.Run Keyword And Ignore Error ClusterManagement.Stop_Members_From_List_Or_All
93 BuiltIn.Run Keyword If '${status}' != 'PASS' ClusterManagement.Kill_Members_From_List_Or_All
94 ClusterManagement.Start_Members_From_List_Or_All wait_for_sync=False
96 Check Linear Topology After Controller Restarts
97 [Documentation] Check Linear Topology.
98 BuiltIn.Wait Until Keyword Succeeds 300s 2s FlowLib.Check Linear Topology ${SWITCHES}
100 Check Flows In Operational DS After Controller Restarts
101 [Documentation] Check Flows after mininet starts.
102 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Number Of Flows ${less_flows}
104 Check Groups In Operational DS After Controller Restarts
105 [Documentation] Check Flows after mininet starts.
106 FlowLib.Check Number Of Groups ${less_groups}
108 Check Flows In Switch After Controller Restarts
109 [Documentation] Check Flows after mininet starts.
110 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${less_flows}
113 [Documentation] Stop Mininet.
114 MininetKeywords.Stop Mininet And Exit
117 [Documentation] Check no switches in topology.
118 BuiltIn.Wait Until Keyword Succeeds 5s 1s FlowLib.Check No Switches In Topology ${SWITCHES}
122 [Documentation] Create controller session and set variables.
123 ClusterManagement.ClusterManagement_Setup
124 # Still need to open controller HTTP session with name session because of old FlowLib.robot library dependency.
125 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
126 ${switches} Convert To Integer ${SWITCHES}
127 ${iter} Convert To Integer ${ITER}
128 ${all_groups}= BuiltIn.Evaluate ${switches} * ${iter} * 2
129 ${less_groups}= BuiltIn.Evaluate ${all_groups} - ${switches} * 2
130 # Stale flows/groups feature enabled in Boron onwards.
131 ${less_groups}= CompareStream.Set Variable If At Least Boron ${less_groups} ${all_groups}
132 ${all_flows}= BuiltIn.Evaluate ${switches} * ${iter+1}
133 ${less_flows}= BuiltIn.Evaluate ${all_flows} - ${switches}
134 # Stale flows/groups feature enabled in Boron onwards.
135 ${less_flows}= CompareStream.Set Variable If At Least Boron ${less_flows} ${all_flows}
136 BuiltIn.Set Suite Variable ${switches}
137 BuiltIn.Set Suite Variable ${iter}
138 BuiltIn.Set Suite Variable ${all_groups}
139 BuiltIn.Set Suite Variable ${less_groups}
140 BuiltIn.Set Suite Variable ${all_flows}
141 BuiltIn.Set Suite Variable ${less_flows}
142 BuiltIn.Set Suite Variable ${no_flows} ${SWITCHES}
145 [Documentation] Delete all sessions.
146 ${command} = BuiltIn.Set Variable sudo iptables -v -F
147 Utils.Run Command On Controller cmd=${command}
148 BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${CONFIG_NODES_API}
149 RequestsLibrary.Delete All Sessions
151 Disconnect Controller Mininet
152 [Arguments] ${action}=break
153 [Documentation] Break and restore controller to mininet connection via iptables.
154 ${rule} = BuiltIn.Set Variable OUTPUT -p all --source ${ODL_SYSTEM_IP} --destination ${TOOLS_SYSTEM_IP} -j DROP
155 ${command} = BuiltIn.Set Variable If '${action}'=='restore' sudo /sbin/iptables -D ${rule} sudo /sbin/iptables -I ${rule}
156 Utils.Run Command On Controller cmd=${command}
157 ${command} = BuiltIn.Set Variable sudo /sbin/iptables -L -n
158 ${output} = Utils.Run Command On Controller cmd=${command}
159 BuiltIn.Log ${output}