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