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}
25 Add Group 2 In Every Switch
26 [Documentation] Add ${ITER} groups of type 2 in every switch.
27 FOR ${switch} IN RANGE 1 ${switches+1}
28 TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-group-2 mapping={"SWITCH":"${switch}"} session=session iterations=${iter}
31 Add Flow to Group 2 In Every Switch
32 [Documentation] Add ${ITER} flows to group type 2 in every switch.
33 FOR ${switch} IN RANGE 1 ${switches+1}
34 TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-flow mapping={"SWITCH":"${switch}"} session=session iterations=${ITER}
38 [Documentation] Start Mininet Linear with ${SWITCHES} switches.
39 MininetKeywords.Start Mininet Linear ${SWITCHES}
42 [Documentation] Check Linear Topology.
43 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Linear Topology ${SWITCHES}
45 Check Flows In Operational DS
46 [Documentation] Check Groups after mininet starts.
47 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Number Of Flows ${all_flows}
49 Check Groups In Operational DS
50 [Documentation] Check Flows after mininet starts.
51 FlowLib.Check Number Of Groups ${all_groups}
54 [Documentation] Check Flows after mininet starts.
55 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${all_flows}
58 [Documentation] Disconnect Mininet.
59 Disconnect Controller Mininet
61 Check No Switches After Disconnect
62 [Documentation] Check no switches in topology.
63 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check No Switches In Topology ${SWITCHES}
66 [Documentation] Connect Mininet.
67 Disconnect Controller Mininet restore
69 Check Linear Topology After Mininet Reconnects
70 [Documentation] Check Linear Topology.
71 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Linear Topology ${SWITCHES}
73 Remove Flows And Groups After Mininet Reconnects
74 [Documentation] Remove some groups and flows while network is down.
75 FOR ${switch} IN RANGE 1 ${switches+1}
76 RequestsLibrary.Delete Request session ${CONFIG_NODES_API}/node/openflow:${switch}/table/0/flow/1
77 RequestsLibrary.Delete Request session ${CONFIG_NODES_API}/node/openflow:${switch}/group/1
78 RequestsLibrary.Delete Request session ${CONFIG_NODES_API}/node/openflow:${switch}/group/1000
81 Check Flows In Operational DS After Mininet Reconnects
82 [Documentation] Check Flows after mininet starts.
83 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Number Of Flows ${less_flows}
85 Check Groups In Operational DS After Mininet Reconnects
86 [Documentation] Check Flows after mininet starts.
87 FlowLib.Check Number Of Groups ${less_groups}
89 Check Flows In Switch After Mininet Reconnects
90 [Documentation] Check Flows after mininet starts.
91 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${less_flows}
94 [Documentation] Stop and Start controller.
95 # Try to stop contoller, if stop does not work or takes too long, kill controller.
96 ${status} ${result}= BuiltIn.Run Keyword And Ignore Error ClusterManagement.Stop_Members_From_List_Or_All
97 BuiltIn.Run Keyword If '${status}' != 'PASS' ClusterManagement.Kill_Members_From_List_Or_All
98 ClusterManagement.Start_Members_From_List_Or_All wait_for_sync=False
100 Check Linear Topology After Controller Restarts
101 [Documentation] Check Linear Topology.
102 BuiltIn.Wait Until Keyword Succeeds 300s 2s FlowLib.Check Linear Topology ${SWITCHES}
104 Check Flows In Operational DS After Controller Restarts
105 [Documentation] Check Flows after mininet starts.
106 BuiltIn.Wait Until Keyword Succeeds 30s 1s FlowLib.Check Number Of Flows ${less_flows}
108 Check Groups In Operational DS After Controller Restarts
109 [Documentation] Check Flows after mininet starts.
110 FlowLib.Check Number Of Groups ${less_groups}
112 Check Flows In Switch After Controller Restarts
113 [Documentation] Check Flows after mininet starts.
114 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${less_flows}
117 [Documentation] Stop Mininet.
118 MininetKeywords.Stop Mininet And Exit
121 [Documentation] Check no switches in topology.
122 BuiltIn.Wait Until Keyword Succeeds 5s 1s FlowLib.Check No Switches In Topology ${SWITCHES}
126 [Documentation] Create controller session and set variables.
127 ClusterManagement.ClusterManagement_Setup
128 # Still need to open controller HTTP session with name session because of old FlowLib.robot library dependency.
129 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
130 ${switches} Convert To Integer ${SWITCHES}
131 ${iter} Convert To Integer ${ITER}
132 ${all_groups}= BuiltIn.Evaluate ${switches} * ${iter} * 2
133 ${less_groups}= BuiltIn.Evaluate ${all_groups} - ${switches} * 2
134 # Stale flows/groups feature enabled in Boron onwards.
135 ${all_flows}= BuiltIn.Evaluate ${switches} * ${iter+1}
136 ${less_flows}= BuiltIn.Evaluate ${all_flows} - ${switches}
137 # Stale flows/groups feature enabled in Boron onwards.
138 BuiltIn.Set Suite Variable ${switches}
139 BuiltIn.Set Suite Variable ${iter}
140 BuiltIn.Set Suite Variable ${all_groups}
141 BuiltIn.Set Suite Variable ${less_groups}
142 BuiltIn.Set Suite Variable ${all_flows}
143 BuiltIn.Set Suite Variable ${less_flows}
144 BuiltIn.Set Suite Variable ${no_flows} ${SWITCHES}
147 [Documentation] Delete all sessions.
148 ${command} = BuiltIn.Set Variable sudo iptables -v -F
149 Utils.Run Command On Controller cmd=${command}
150 BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${CONFIG_NODES_API}
151 RequestsLibrary.Delete All Sessions
153 Disconnect Controller Mininet
154 [Arguments] ${action}=break
155 [Documentation] Break and restore controller to mininet connection via iptables.
156 ${rule} = BuiltIn.Set Variable OUTPUT -p all --source ${ODL_SYSTEM_IP} --destination ${TOOLS_SYSTEM_IP} -j DROP
157 ${command} = BuiltIn.Set Variable If '${action}'=='restore' sudo /sbin/iptables -D ${rule} sudo /sbin/iptables -I ${rule}
158 Utils.Run Command On Controller cmd=${command}
159 ${command} = BuiltIn.Set Variable sudo /sbin/iptables -L -n
160 ${output} = Utils.Run Command On Controller cmd=${command}
161 BuiltIn.Log ${output}