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