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