2 Documentation Resource for OpenFlow workflows. This library can be used for scalability and longevity tests.
5 Library RequestsLibrary
7 Library SwitchClasses/BaseSwitch.py
10 Resource CompareStream.robot
11 Resource MininetKeywords.robot
12 Resource KarafKeywords.robot
13 Resource ../variables/Variables.robot
14 Resource ../variables/openflowplugin/Variables.robot
25 Workflow Linear Topology
26 [Arguments] ${switches} ${sustain_time}=0
27 [Documentation] Workflow to bring a Linear topology of ${switches} switches, push flows, hold for ${sustain_time} seconds, delete flows and stop topology.
28 ... This KW returns workflow state (PASS/FAIL), error message and topology discover time.
29 # Define required variables
30 ${error_message}= Set Variable Test has completed
31 ${topology_discover_time}= Set Variable ${0}
32 ${controller_list}= Create List ${ODL_SYSTEM_IP}
33 ${flow_count}= Convert to Integer ${flow_count}
34 ${flows_ovs_25}= Evaluate ${flow_count} + ${switches}
35 ${flows_before}= Set Variable ${switches}
36 ${flows_after}= Set Variable ${flows_ovs_25}
37 ${flows} ${notes} ScaleClient.Generate New Flow Details flows=${flow_count} switches=${switches} swspread=${swspread} tables=${tables}
38 ... tabspread=${tabspread}
41 Log To Console Starting mininet linear ${switches} switches
42 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Start Mininet Linear ${switches} mininet_timeout=${switches*4}
43 Return From Keyword If '${status}' == 'FAIL' ${status} Fail starting mininet ${topology_discover_time}
44 ${start_time}= DateTime.Get Current Date result_format=timestamp
45 Log To Console Verify controller is OK
46 ${status} ${result} Run Keyword And Ignore Error Utils.Verify Controller Is Not Dead ${ODL_SYSTEM_IP}
47 Return From Keyword If '${status}' == 'FAIL' ${status} Controller is dead ${topology_discover_time}
48 ${status} ${result} Run Keyword And Ignore Error Utils.Verify Controller Has No Null Pointer Exceptions ${ODL_SYSTEM_IP}
49 Return From Keyword If '${status}' == 'FAIL' ${status} Controller has NPE ${topology_discover_time}
50 ${status} ${result} Run Keyword And Ignore Error Utils.Verify Controller Has No Runtime Exceptions ${ODL_SYSTEM_IP}
51 Return From Keyword If '${status}' == 'FAIL' ${status} Controller has RuntimeException ${topology_discover_time}
52 Log To Console Checking ${switches} switches
53 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*2} 2s FlowLib.Check Switches In Inventory
55 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking switch ${topology_discover_time}
56 Log To Console Add table miss flows
57 ${status} ${result} Run Keyword And Ignore Error FlowLib.Add Table Miss Flows ${switches}
58 Return From Keyword If '${status}' == 'FAIL' ${status} Fail adding table Miss flows ${topology_discover_time}
59 Log To Console Checking Table Miss Flows
60 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches} 2s FlowLib.Check Table Miss Flows
62 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking table miss flows ${topology_discover_time}
63 Log To Console Checking Linear Topology
64 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches} 2s FlowLib.Check Linear Topology
66 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking topology ${topology_discover_time}
67 ${end_time}= DateTime.Get Current Date result_format=timestamp
68 ${topology_discover_time}= DateTime.Subtract Date From Date ${end_time} ${start_time}
69 Log To Console Topology Discovery Time = ${topology_discover_time} seconds
70 Log To Console Adding ${flow_count} flows
71 ${status} ${result} Run Keyword And Ignore Error ScaleClient.Configure Flows flow_details=${flows} controllers=${controller_list} nrthreads=${nrthreads}
72 Return From Keyword If '${status}' == 'FAIL' ${status} Fail configuring flows ${topology_discover_time}
73 Log To Console Checking ${flow_count} flows in Mininet
74 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Verify Aggregate Flow From Mininet Session ${mininet_conn_id} ${flows_after} ${switches}
75 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking flows in mininet ${topology_discover_time}
76 Log To Console Checking ${flow_count} flows in Operational DS
77 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*4} 2s FlowLib.Check Flows Operational Datastore
79 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking flows in operational DS ${topology_discover_time}
80 Log To Console Sleep for ${sustain_time} seconds
82 Log To Console Deleting ${flow_count} flows
83 ${status} ${result} Run Keyword And Ignore Error ScaleClient.Deconfigure Flows flow_details=${flows} controllers=${controller_list} nrthreads=${nrthreads}
84 Return From Keyword If '${status}' == 'FAIL' ${status} Fail deconfiguring flows ${topology_discover_time}
85 Log To Console Checking no flows in Mininet
86 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Verify Aggregate Flow From Mininet Session ${mininet_conn_id} ${flows_before} ${switches}
87 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no flows in mininet ${topology_discover_time}
88 Log To Console Checking no flows in Operational DS
89 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*4} 2s FlowLib.Check Flows Operational Datastore
91 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no flows in operational DS ${topology_discover_time}
92 Log To Console Stopping Mininet
93 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Stop Mininet And Exit
94 Return From Keyword If '${status}' == 'FAIL' ${status} Fail stopping mininet ${topology_discover_time}
95 Log To Console Checking No Switches
96 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 30s 2s FlowLib.Check No Switches In Inventory
98 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no switch ${topology_discover_time}
99 Log To Console Checking No Topology
100 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 10s 2s FlowLib.Check No Switches In Topology
102 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no topology ${topology_discover_time}
103 [Return] PASS ${error_message} ${topology_discover_time}
105 Workflow Full Mesh Topology
106 [Arguments] ${switches} ${sustain_time}=0
107 [Documentation] Workflow to bring a Full mesh topology of ${switches} switches, push some flows, delete flows and stop topology.
108 ... This KW returns workflow state (PASS/FAIL), error message and topology discover time.
109 # Define required variables
110 ${error_message}= Set Variable Test has completed
111 ${topology_discover_time}= Set Variable ${0}
112 ${mininet_timeout}= Evaluate ${switches} * ${switches}
113 ${links}= Evaluate ${switches} * ${switches-1}
114 ${controller_list}= Create List ${ODL_SYSTEM_IP}
115 ${flow_count}= Convert to Integer ${flow_count}
116 ${flows_ovs_25}= Evaluate ${flow_count} + ${switches}
117 ${flows_before}= Set Variable ${switches}
118 ${flows_after}= Set Variable ${flows_ovs_25}
119 ${flows} ${notes} ScaleClient.Generate New Flow Details flows=${flow_count} switches=${switches} swspread=${swspread} tables=${tables}
120 ... tabspread=${tabspread}
123 Log To Console Start a mininet full mesh ${switches} switches
124 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Start Mininet Full Mesh ${switches} mininet_timeout=${mininet_timeout}
125 Return From Keyword If '${status}' == 'FAIL' ${status} Fail starting mininet ${topology_discover_time}
126 ${start_time}= DateTime.Get Current Date result_format=timestamp
127 Log To Console Verify controller is OK
128 ${status} ${result} Run Keyword And Ignore Error Utils.Verify Controller Is Not Dead ${ODL_SYSTEM_IP}
129 Return From Keyword If '${status}' == 'FAIL' ${status} Controller is dead ${topology_discover_time}
130 ${status} ${result} Run Keyword And Ignore Error Utils.Verify Controller Has No Null Pointer Exceptions ${ODL_SYSTEM_IP}
131 Return From Keyword If '${status}' == 'FAIL' ${status} Controller has NPE ${topology_discover_time}
132 ${status} ${result} Run Keyword And Ignore Error Utils.Verify Controller Has No Runtime Exceptions ${ODL_SYSTEM_IP}
133 Return From Keyword If '${status}' == 'FAIL' ${status} Controller has RuntimeException ${topology_discover_time}
134 Log To Console Checking ${switches} switches
135 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 30s 2s FlowLib.Check Switches In Inventory
137 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking switch ${topology_discover_time}
138 Log To Console Check number of links in inventory is ${links}
139 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 10s 2s FlowLib.Check Number Of Links
141 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking topology ${topology_discover_time}
142 ${end_time}= DateTime.Get Current Date result_format=timestamp
143 ${topology_discover_time}= DateTime.Subtract Date From Date ${end_time} ${start_time}
144 Log To Console Topology Discovery Time = ${topology_discover_time} seconds
145 Log To Console Adding ${flow_count} flows
146 ${status} ${result} Run Keyword And Ignore Error ScaleClient.Configure Flows flow_details=${flows} controllers=${controller_list} nrthreads=${nrthreads}
147 Return From Keyword If '${status}' == 'FAIL' ${status} Fail configuring flows ${topology_discover_time}
148 Log To Console Checking ${flow_count} flows in Mininet
149 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Verify Aggregate Flow From Mininet Session ${mininet_conn_id} ${flows_after} ${switches}
150 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking flows in mininet ${topology_discover_time}
151 Log To Console Checking ${flow_count} flows in Operational DS
152 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*4} 2s FlowLib.Check Flows Operational Datastore
154 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking flows in operational DS ${topology_discover_time}
155 Log To Console Sleep for ${sustain_time} seconds
156 Sleep ${sustain_time}
157 Log To Console Deleting ${flow_count} flows
158 ${status} ${result} Run Keyword And Ignore Error ScaleClient.Deconfigure Flows flow_details=${flows} controllers=${controller_list} nrthreads=${nrthreads}
159 Return From Keyword If '${status}' == 'FAIL' ${status} Fail deconfiguring flows ${topology_discover_time}
160 Log To Console Checking no flows in Mininet
161 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Verify Aggregate Flow From Mininet Session ${mininet_conn_id} ${flows_before} ${switches}
162 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no flows in mininet ${topology_discover_time}
163 Log To Console Checking no flows in Operational DS
164 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*4} 2s FlowLib.Check Flows Operational Datastore
166 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no flows in operational DS ${topology_discover_time}
167 Log To Console Stopping Mininet
168 ${status} ${result} Run Keyword And Ignore Error MininetKeywords.Stop Mininet And Exit
169 Return From Keyword If '${status}' == 'FAIL' ${status} Fail stopping mininet ${topology_discover_time}
170 Log To Console Checking No Switches
171 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 10s 2s FlowLib.Check No Switches In Inventory
173 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no switch ${topology_discover_time}
174 Log To Console Checking No Topology
175 ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 10s 2s FlowLib.Check No Switches In Topology
177 Return From Keyword If '${status}' == 'FAIL' ${status} Fail checking no topology ${topology_discover_time}
178 [Return] PASS ${error_message} ${topology_discover_time}
181 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
182 Wait Until Keyword Succeeds 3x 1s KarafKeywords.Issue Command On Karaf Console log:set ${log_level}
185 [Documentation] Cleanup when workflow is interrupt
186 Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
187 Utils.Clean Mininet System
188 RequestsLibrary.Delete All Sessions