blob: 37512895192023e93ccb46ed54895416ccbe093f [file] [log] [blame]
GlennRC5147a422015-10-06 17:26:17 -07001class FUNCflow:
2
3 def __init__( self ):
4 self.default = ''
5
6 def CASE1( self, main ):
GlennRC5147a422015-10-06 17:26:17 -07007 import os
8 import imp
9
10 """
11 - Construct tests variables
12 - GIT ( optional )
13 - Checkout ONOS master branch
14 - Pull latest ONOS code
15 - Building ONOS ( optional )
16 - Install ONOS package
17 - Build ONOS package
18 """
GlennRC5147a422015-10-06 17:26:17 -070019 main.case( "Constructing test variables and building ONOS package" )
20 main.step( "Constructing test variables" )
GlennRC5147a422015-10-06 17:26:17 -070021
22 # Test variables
Jon Hallfc951072017-05-24 15:55:34 -070023 main.testOnDirectory = os.path.dirname( os.getcwd() )
GlennRC5147a422015-10-06 17:26:17 -070024 main.cellName = main.params[ 'ENV' ][ 'cellName' ]
25 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
26 gitBranch = main.params[ 'GIT' ][ 'branch' ]
GlennRC073e8bc2015-10-27 17:11:28 -070027 gitPull = main.params[ 'GIT' ][ 'pull' ]
28 main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
GlennRC5147a422015-10-06 17:26:17 -070029 main.dependencyPath = main.testOnDirectory + \
30 main.params[ 'DEPENDENCY' ][ 'path' ]
GlennRC5147a422015-10-06 17:26:17 -070031 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
GlennRC1704d072015-10-07 18:40:45 -070032 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
GlennRC073e8bc2015-10-27 17:11:28 -070033 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
34 main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
GlennRC5147a422015-10-06 17:26:17 -070035 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
GlennRC073e8bc2015-10-27 17:11:28 -070036 main.startMNSleep = int( main.params[ 'SLEEP' ][ 'startMN' ] )
37 main.addFlowSleep = int( main.params[ 'SLEEP' ][ 'addFlow' ] )
38 main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] )
alisone14d7b02016-07-06 10:31:51 -070039 main.debug = main.params[ 'DEBUG' ]
GlennRC073e8bc2015-10-27 17:11:28 -070040 main.swDPID = main.params[ 'TEST' ][ 'swDPID' ]
Jon Hallfc951072017-05-24 15:55:34 -070041 main.cellData = {} # for creating cell file
42 main.CLIs = []
43 main.ONOSip = []
GlennRC5147a422015-10-06 17:26:17 -070044
GlennRC956ea742015-11-05 16:14:15 -080045 main.debug = True if "on" in main.debug else False
46
Jon Hallfc951072017-05-24 15:55:34 -070047 main.ONOSip = main.ONOSbench.getOnosIps()
GlennRC5147a422015-10-06 17:26:17 -070048
49 # Assigning ONOS cli handles to a list
Jon Hallfc951072017-05-24 15:55:34 -070050 for i in range( 1, main.maxNodes + 1 ):
GlennRC5147a422015-10-06 17:26:17 -070051 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
52
53 # -- INIT SECTION, ONLY RUNS ONCE -- #
54 main.startUp = imp.load_source( wrapperFile1,
55 main.dependencyPath +
56 wrapperFile1 +
57 ".py" )
58
GlennRC1704d072015-10-07 18:40:45 -070059 main.topo = imp.load_source( wrapperFile2,
60 main.dependencyPath +
61 wrapperFile2 +
62 ".py" )
63
GlennRC94ed2232015-10-07 15:08:57 -070064 copyResult = main.ONOSbench.scp( main.Mininet1,
alisone14d7b02016-07-06 10:31:51 -070065 main.dependencyPath + main.topology,
66 main.Mininet1.home + '/custom/',
GlennRC94ed2232015-10-07 15:08:57 -070067 direction="to" )
68
alisone14d7b02016-07-06 10:31:51 -070069 utilities.assert_equals( expect=main.TRUE,
Jeremy Songstere7f3b342016-08-17 14:56:49 -070070 actual=copyResult,
71 onpass="Successfully copy " + "test variables ",
72 onfail="Failed to copy test variables" )
alisone14d7b02016-07-06 10:31:51 -070073
GlennRC5147a422015-10-06 17:26:17 -070074 if main.CLIs:
75 stepResult = main.TRUE
76 else:
77 main.log.error( "Did not properly created list of ONOS CLI handle" )
78 stepResult = main.FALSE
79
80 utilities.assert_equals( expect=main.TRUE,
81 actual=stepResult,
alisone14d7b02016-07-06 10:31:51 -070082 onpass="Successfully construct " + "test variables ",
GlennRC5147a422015-10-06 17:26:17 -070083 onfail="Failed to construct test variables" )
84
85 if gitPull == 'True':
86 main.step( "Building ONOS in " + gitBranch + " branch" )
87 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
88 stepResult = onosBuildResult
89 utilities.assert_equals( expect=main.TRUE,
90 actual=stepResult,
alisone14d7b02016-07-06 10:31:51 -070091 onpass="Successfully compiled " + "latest ONOS",
92 onfail="Failed to compile " + "latest ONOS" )
GlennRC5147a422015-10-06 17:26:17 -070093 else:
94 main.log.warn( "Did not pull new code so skipping mvn " +
95 "clean install" )
96
97 def CASE2( self, main ):
98 """
99 - Set up cell
100 - Create cell file
101 - Set cell file
102 - Verify cell file
103 - Kill ONOS process
104 - Uninstall ONOS cluster
105 - Verify ONOS start up
106 - Install ONOS cluster
107 - Connect to cli
108 """
alisone14d7b02016-07-06 10:31:51 -0700109 import time
GlennRC5147a422015-10-06 17:26:17 -0700110
111 main.numCtrls = int( main.maxNodes )
112
113 main.case( "Starting up " + str( main.numCtrls ) +
114 " node(s) ONOS cluster" )
115
116 #kill off all onos processes
117 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800118 " before initiating environment setup" )
GlennRC5147a422015-10-06 17:26:17 -0700119
120 for i in range( main.maxNodes ):
121 main.ONOSbench.onosDie( main.ONOSip[ i ] )
122
Jon Hall53c5e662016-04-13 16:06:56 -0700123 main.log.info( "NODE COUNT = " + str( main.numCtrls ) )
GlennRC5147a422015-10-06 17:26:17 -0700124
Jon Hallfc951072017-05-24 15:55:34 -0700125 tempOnosIp = []
GlennRC5147a422015-10-06 17:26:17 -0700126 for i in range( main.numCtrls ):
alisone14d7b02016-07-06 10:31:51 -0700127 tempOnosIp.append( main.ONOSip[ i ] )
GlennRC5147a422015-10-06 17:26:17 -0700128
Jon Hall53c5e662016-04-13 16:06:56 -0700129 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
130 "temp",
131 main.Mininet1.ip_address,
132 main.apps,
Devin Lim461f0872017-06-05 16:49:33 -0700133 tempOnosIp, main.ONOScli1.user_name )
GlennRC5147a422015-10-06 17:26:17 -0700134
135 main.step( "Apply cell to environment" )
136 cellResult = main.ONOSbench.setCell( "temp" )
Jon Hallfc951072017-05-24 15:55:34 -0700137 verifyResult = main.ONOSbench.verifyCell()
GlennRC5147a422015-10-06 17:26:17 -0700138 stepResult = cellResult and verifyResult
139 utilities.assert_equals( expect=main.TRUE,
140 actual=stepResult,
alisone14d7b02016-07-06 10:31:51 -0700141 onpass="Successfully applied cell to " + "environment",
GlennRC5147a422015-10-06 17:26:17 -0700142 onfail="Failed to apply cell to environment " )
143
144 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700145 packageResult = main.ONOSbench.buckBuild()
GlennRC5147a422015-10-06 17:26:17 -0700146 stepResult = packageResult
147 utilities.assert_equals( expect=main.TRUE,
148 actual=stepResult,
149 onpass="Successfully created ONOS package",
150 onfail="Failed to create ONOS package" )
151
152 time.sleep( main.startUpSleep )
153 main.step( "Uninstalling ONOS package" )
154 onosUninstallResult = main.TRUE
Jeremy86160992016-04-11 10:05:53 -0700155 for ip in main.ONOSip:
GlennRC5147a422015-10-06 17:26:17 -0700156 onosUninstallResult = onosUninstallResult and \
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700157 main.ONOSbench.onosUninstall( nodeIp=ip )
GlennRC5147a422015-10-06 17:26:17 -0700158 stepResult = onosUninstallResult
159 utilities.assert_equals( expect=main.TRUE,
160 actual=stepResult,
161 onpass="Successfully uninstalled ONOS package",
162 onfail="Failed to uninstall ONOS package" )
GlennRC5147a422015-10-06 17:26:17 -0700163 time.sleep( main.startUpSleep )
164 main.step( "Installing ONOS package" )
165 onosInstallResult = main.TRUE
166 for i in range( main.numCtrls ):
167 onosInstallResult = onosInstallResult and \
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700168 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
GlennRC5147a422015-10-06 17:26:17 -0700169 stepResult = onosInstallResult
170 utilities.assert_equals( expect=main.TRUE,
171 actual=stepResult,
172 onpass="Successfully installed ONOS package",
173 onfail="Failed to install ONOS package" )
174
You Wangf5de25b2017-01-06 15:13:01 -0800175 main.step( "Set up ONOS secure SSH" )
176 secureSshResult = main.TRUE
177 for i in range( int( main.numCtrls ) ):
Jon Hallfc951072017-05-24 15:55:34 -0700178 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
You Wangf5de25b2017-01-06 15:13:01 -0800179 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
180 onpass="Test step PASS",
181 onfail="Test step FAIL" )
182
GlennRC5147a422015-10-06 17:26:17 -0700183 time.sleep( main.startUpSleep )
184 main.step( "Starting ONOS service" )
185 stopResult = main.TRUE
186 startResult = main.TRUE
187 onosIsUp = main.TRUE
188
189 for i in range( main.numCtrls ):
190 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
191 if onosIsUp == main.TRUE:
192 main.log.report( "ONOS instance is up and ready" )
193 else:
194 main.log.report( "ONOS instance may not be up, stop and " +
195 "start ONOS again " )
196 for i in range( main.numCtrls ):
197 stopResult = stopResult and \
198 main.ONOSbench.onosStop( main.ONOSip[ i ] )
199 for i in range( main.numCtrls ):
200 startResult = startResult and \
201 main.ONOSbench.onosStart( main.ONOSip[ i ] )
202 stepResult = onosIsUp and stopResult and startResult
203 utilities.assert_equals( expect=main.TRUE,
204 actual=stepResult,
205 onpass="ONOS service is ready",
206 onfail="ONOS service did not start properly" )
207
208 main.step( "Start ONOS cli" )
209 cliResult = main.TRUE
210 for i in range( main.numCtrls ):
211 cliResult = cliResult and \
212 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
213 stepResult = cliResult
214 utilities.assert_equals( expect=main.TRUE,
215 actual=stepResult,
216 onpass="Successfully start ONOS cli",
217 onfail="Failed to start ONOS cli" )
218
GlennRC68449942015-10-16 16:03:12 -0700219 def CASE10( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -0700220 """
GlennRC68449942015-10-16 16:03:12 -0700221 Start Mininet
Jon Hallfc951072017-05-24 15:55:34 -0700222 """
GlennRC073e8bc2015-10-27 17:11:28 -0700223 import json
224
225 main.case( "Setup mininet and compare ONOS topology view to Mininet topology" )
226 main.caseExplanation = "Start mininet with custom topology and compare topology " +\
227 "elements between Mininet and ONOS"
228
GlennRC68449942015-10-16 16:03:12 -0700229 main.step( "Setup Mininet Topology" )
230 topology = main.Mininet1.home + '/custom/' + main.topology
Jon Hallfc951072017-05-24 15:55:34 -0700231 stepResult = main.Mininet1.startNet( topoFile=topology )
GlennRC68449942015-10-16 16:03:12 -0700232
233 utilities.assert_equals( expect=main.TRUE,
GlennRC073e8bc2015-10-27 17:11:28 -0700234 actual=stepResult,
GlennRC68449942015-10-16 16:03:12 -0700235 onpass="Successfully loaded topology",
236 onfail="Failed to load topology" )
237
GlennRC073e8bc2015-10-27 17:11:28 -0700238 main.step( "Assign switch to controller" )
Jon Hallfc951072017-05-24 15:55:34 -0700239 stepResult = main.Mininet1.assignSwController( "s1", main.ONOSip[ 0 ] )
GlennRC68449942015-10-16 16:03:12 -0700240
241 utilities.assert_equals( expect=main.TRUE,
GlennRC073e8bc2015-10-27 17:11:28 -0700242 actual=stepResult,
243 onpass="Successfully assigned switch to controller",
244 onfail="Failed to assign switch to controller" )
GlennRC68449942015-10-16 16:03:12 -0700245
GlennRC073e8bc2015-10-27 17:11:28 -0700246 time.sleep( main.startMNSleep )
GlennRC68449942015-10-16 16:03:12 -0700247
Jon Hall70b2ff42015-11-17 15:49:44 -0800248 main.step( "Comparing MN topology to ONOS topology" )
GlennRC073e8bc2015-10-27 17:11:28 -0700249 main.log.info( "Gathering topology information" )
GlennRC1704d072015-10-07 18:40:45 -0700250 devices = main.topo.getAllDevices( main )
251 hosts = main.topo.getAllHosts( main )
252 ports = main.topo.getAllPorts( main )
253 links = main.topo.getAllLinks( main )
GlennRC1704d072015-10-07 18:40:45 -0700254
Jon Hallfc951072017-05-24 15:55:34 -0700255 mnSwitches = main.Mininet1.getSwitches()
256 mnLinks = main.Mininet1.getLinks()
257 mnHosts = main.Mininet1.getHosts()
GlennRC1704d072015-10-07 18:40:45 -0700258
GlennRC1704d072015-10-07 18:40:45 -0700259 for controller in range( main.numCtrls ):
260 controllerStr = str( controller + 1 )
261 if devices[ controller ] and ports[ controller ] and\
Jon Hallfc951072017-05-24 15:55:34 -0700262 "Error" not in devices[ controller ] and\
263 "Error" not in ports[ controller ]:
GlennRC1704d072015-10-07 18:40:45 -0700264
265 currentDevicesResult = main.Mininet1.compareSwitches(
266 mnSwitches,
267 json.loads( devices[ controller ] ),
268 json.loads( ports[ controller ] ) )
269 else:
270 currentDevicesResult = main.FALSE
271 utilities.assert_equals( expect=main.TRUE,
272 actual=currentDevicesResult,
273 onpass="ONOS" + controllerStr +
GlennRC68449942015-10-16 16:03:12 -0700274 " Switches view is correct",
GlennRC1704d072015-10-07 18:40:45 -0700275 onfail="ONOS" + controllerStr +
GlennRC68449942015-10-16 16:03:12 -0700276 " Switches view is incorrect" )
GlennRC1704d072015-10-07 18:40:45 -0700277 if links[ controller ] and "Error" not in links[ controller ]:
278 currentLinksResult = main.Mininet1.compareLinks(
279 mnSwitches, mnLinks,
280 json.loads( links[ controller ] ) )
281 else:
282 currentLinksResult = main.FALSE
283 utilities.assert_equals( expect=main.TRUE,
284 actual=currentLinksResult,
285 onpass="ONOS" + controllerStr +
GlennRC68449942015-10-16 16:03:12 -0700286 " links view is correct",
GlennRC1704d072015-10-07 18:40:45 -0700287 onfail="ONOS" + controllerStr +
GlennRC68449942015-10-16 16:03:12 -0700288 " links view is incorrect" )
GlennRC1704d072015-10-07 18:40:45 -0700289
290 if hosts[ controller ] or "Error" not in hosts[ controller ]:
291 currentHostsResult = main.Mininet1.compareHosts(
292 mnHosts,
293 json.loads( hosts[ controller ] ) )
294 else:
295 currentHostsResult = main.FALSE
296 utilities.assert_equals( expect=main.TRUE,
297 actual=currentHostsResult,
298 onpass="ONOS" + controllerStr +
GlennRC68449942015-10-16 16:03:12 -0700299 " hosts exist in Mininet",
GlennRC1704d072015-10-07 18:40:45 -0700300 onfail="ONOS" + controllerStr +
Jon Hallfc951072017-05-24 15:55:34 -0700301 " hosts don't match Mininet" )
GlennRC68449942015-10-16 16:03:12 -0700302
Jon Hall892818c2015-10-20 17:58:34 -0700303 def CASE66( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -0700304 """
Jon Hall892818c2015-10-20 17:58:34 -0700305 Testing scapy
Jon Hallfc951072017-05-24 15:55:34 -0700306 """
Jon Hall892818c2015-10-20 17:58:34 -0700307 main.case( "Testing scapy" )
308 main.step( "Creating Host1 component" )
Jon Halla510a8a2016-05-04 15:09:28 -0700309 main.Scapy.createHostComponent( "h1" )
310 main.Scapy.createHostComponent( "h2" )
alisone14d7b02016-07-06 10:31:51 -0700311 hosts = [ main.h1, main.h2 ]
Jon Hall892818c2015-10-20 17:58:34 -0700312 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700313 host.startHostCli()
314 host.startScapy()
315 host.updateSelf()
Jon Hall892818c2015-10-20 17:58:34 -0700316 main.log.debug( host.name )
317 main.log.debug( host.hostIp )
318 main.log.debug( host.hostMac )
319
320 main.step( "Sending/Receiving Test packet - Filter doesn't match" )
Jon Halla510a8a2016-05-04 15:09:28 -0700321 main.log.info( "Starting Filter..." )
Jon Hallfc951072017-05-24 15:55:34 -0700322 main.h2.startFilter()
Jon Halla510a8a2016-05-04 15:09:28 -0700323 main.log.info( "Building Ether frame..." )
Jon Hall892818c2015-10-20 17:58:34 -0700324 main.h1.buildEther( dst=main.h2.hostMac )
Jon Halla510a8a2016-05-04 15:09:28 -0700325 main.log.info( "Sending Packet..." )
Jon Hallfc951072017-05-24 15:55:34 -0700326 main.h1.sendPacket()
Jon Halla510a8a2016-05-04 15:09:28 -0700327 main.log.info( "Checking Filter..." )
Jon Hallfc951072017-05-24 15:55:34 -0700328 finished = main.h2.checkFilter()
Jon Halla510a8a2016-05-04 15:09:28 -0700329 main.log.debug( finished )
Jon Hall892818c2015-10-20 17:58:34 -0700330 i = ""
331 if finished:
Jon Hallfc951072017-05-24 15:55:34 -0700332 a = main.h2.readPackets()
333 for i in a.splitlines():
Jon Hall892818c2015-10-20 17:58:34 -0700334 main.log.info( i )
335 else:
Jon Hallfc951072017-05-24 15:55:34 -0700336 kill = main.h2.killFilter()
Jon Hall892818c2015-10-20 17:58:34 -0700337 main.log.debug( kill )
338 main.h2.handle.sendline( "" )
339 main.h2.handle.expect( main.h2.scapyPrompt )
340 main.log.debug( main.h2.handle.before )
341 utilities.assert_equals( expect=True,
342 actual="dst=00:00:00:00:00:02 src=00:00:00:00:00:01" in i,
343 onpass="Pass",
344 onfail="Fail" )
345
346 main.step( "Sending/Receiving Test packet - Filter matches" )
Jon Hallfc951072017-05-24 15:55:34 -0700347 main.h2.startFilter()
Jon Hall892818c2015-10-20 17:58:34 -0700348 main.h1.buildEther( dst=main.h2.hostMac )
349 main.h1.buildIP( dst=main.h2.hostIp )
Jon Hallfc951072017-05-24 15:55:34 -0700350 main.h1.sendPacket()
351 finished = main.h2.checkFilter()
Jon Hall892818c2015-10-20 17:58:34 -0700352 i = ""
353 if finished:
Jon Hallfc951072017-05-24 15:55:34 -0700354 a = main.h2.readPackets()
355 for i in a.splitlines():
Jon Hall892818c2015-10-20 17:58:34 -0700356 main.log.info( i )
357 else:
Jon Hallfc951072017-05-24 15:55:34 -0700358 kill = main.h2.killFilter()
Jon Hall892818c2015-10-20 17:58:34 -0700359 main.log.debug( kill )
360 main.h2.handle.sendline( "" )
361 main.h2.handle.expect( main.h2.scapyPrompt )
362 main.log.debug( main.h2.handle.before )
363 utilities.assert_equals( expect=True,
364 actual="dst=00:00:00:00:00:02 src=00:00:00:00:00:01" in i,
365 onpass="Pass",
366 onfail="Fail" )
367
Jon Hall892818c2015-10-20 17:58:34 -0700368 main.step( "Clean up host components" )
369 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700370 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -0700371 main.Mininet1.removeHostComponent( "h1" )
372 main.Mininet1.removeHostComponent( "h2" )
Jon Hall892818c2015-10-20 17:58:34 -0700373
GlennRC68449942015-10-16 16:03:12 -0700374 def CASE1000( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -0700375 """
GlennRC073e8bc2015-10-27 17:11:28 -0700376 Add flows with MAC selectors and verify the flows
Jon Hallfc951072017-05-24 15:55:34 -0700377 """
GlennRC073e8bc2015-10-27 17:11:28 -0700378 import json
379 import time
GlennRC68449942015-10-16 16:03:12 -0700380
GlennRC073e8bc2015-10-27 17:11:28 -0700381 main.case( "Verify flow MAC selectors are correctly compiled" )
382 main.caseExplanation = "Install two flows with only MAC selectors " +\
Jon Hallfc951072017-05-24 15:55:34 -0700383 "specified, then verify flows are added in ONOS, finally " +\
GlennRC073e8bc2015-10-27 17:11:28 -0700384 "send a packet that only specifies the MAC src and dst."
GlennRC68449942015-10-16 16:03:12 -0700385
GlennRC073e8bc2015-10-27 17:11:28 -0700386 main.step( "Add flows with MAC addresses as the only selectors" )
GlennRC68449942015-10-16 16:03:12 -0700387
GlennRC073e8bc2015-10-27 17:11:28 -0700388 main.log.info( "Creating host components" )
Jon Halla510a8a2016-05-04 15:09:28 -0700389 main.Scapy.createHostComponent( "h1" )
390 main.Scapy.createHostComponent( "h2" )
alisone14d7b02016-07-06 10:31:51 -0700391 hosts = [ main.h1, main.h2 ]
GlennRC073e8bc2015-10-27 17:11:28 -0700392 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700393 host.startHostCli()
394 host.startScapy()
395 host.updateSelf()
GlennRC68449942015-10-16 16:03:12 -0700396
GlennRC073e8bc2015-10-27 17:11:28 -0700397 # Add a flow that connects host1 on port1 to host2 on port2
398 # send output on port2
399 # recieve input on port1
400 egress = 2
401 ingress = 1
402
403 # Add flows that sends packets from port1 to port2 with correct
404 # MAC src and dst addresses
405 main.log.info( "Adding flow with MAC selectors" )
406 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
407 egressPort=egress,
408 ingressPort=ingress,
409 ethSrc=main.h1.hostMac,
410 ethDst=main.h2.hostMac,
GlennRC956ea742015-11-05 16:14:15 -0800411 debug=main.debug )
GlennRC68449942015-10-16 16:03:12 -0700412
GlennRCa5391372015-10-14 17:28:15 -0700413 utilities.assert_equals( expect=main.TRUE,
414 actual=stepResult,
GlennRC68449942015-10-16 16:03:12 -0700415 onpass="Successfully added flows",
416 onfail="Failed add flows" )
GlennRCa5391372015-10-14 17:28:15 -0700417
GlennRC073e8bc2015-10-27 17:11:28 -0700418 # Giving ONOS time to add the flows
419 time.sleep( main.addFlowSleep )
GlennRC5147a422015-10-06 17:26:17 -0700420
GlennRC073e8bc2015-10-27 17:11:28 -0700421 main.step( "Check flows are in the ADDED state" )
422
GlennRC073e8bc2015-10-27 17:11:28 -0700423 main.log.info( "Get the flows from ONOS" )
Jeremy86160992016-04-11 10:05:53 -0700424 try:
Jon Hallfc951072017-05-24 15:55:34 -0700425 flows = json.loads( main.ONOSrest.flows() )
GlennRC68449942015-10-16 16:03:12 -0700426
Jeremy86160992016-04-11 10:05:53 -0700427 stepResult = main.TRUE
428 for f in flows:
alisone14d7b02016-07-06 10:31:51 -0700429 if "rest" in f.get( "appId" ):
430 if "ADDED" not in f.get( "state" ):
Jeremy86160992016-04-11 10:05:53 -0700431 stepResult = main.FALSE
alisone14d7b02016-07-06 10:31:51 -0700432 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
Jeremy86160992016-04-11 10:05:53 -0700433 except TypeError:
434 main.log.error( "No Flows found by the REST API" )
435 stepResult = main.FALSE
436 except ValueError:
437 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -0700438 main.cleanup()
439 main.exit()
GlennRC68449942015-10-16 16:03:12 -0700440
441 utilities.assert_equals( expect=main.TRUE,
442 actual=stepResult,
443 onpass="All flows are in the ADDED state",
GlennRC073e8bc2015-10-27 17:11:28 -0700444 onfail="All flows are NOT in the ADDED state" )
GlennRC68449942015-10-16 16:03:12 -0700445
GlennRC956ea742015-11-05 16:14:15 -0800446 main.step( "Check flows are in Mininet's flow table" )
447
448 # get the flow IDs that were added through rest
449 main.log.info( "Getting the flow IDs from ONOS" )
alisone14d7b02016-07-06 10:31:51 -0700450 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
GlennRC956ea742015-11-05 16:14:15 -0800451 # convert the flowIDs to ints then hex and finally back to strings
alisone14d7b02016-07-06 10:31:51 -0700452 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
453 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
GlennRC956ea742015-11-05 16:14:15 -0800454
455 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
456
457 utilities.assert_equals( expect=main.TRUE,
458 actual=stepResult,
459 onpass="All flows are in mininet",
460 onfail="All flows are NOT in mininet" )
461
GlennRC073e8bc2015-10-27 17:11:28 -0700462 main.step( "Send a packet to verify the flows are correct" )
463
464 # Specify the src and dst MAC addr
465 main.log.info( "Constructing packet" )
466 main.h1.buildEther( src=main.h1.hostMac, dst=main.h2.hostMac )
467
468 # Filter for packets with the correct host name. Otherwise,
469 # the filter we catch any packet that is sent to host2
470 # NOTE: I believe it doesn't matter which host name it is,
GlennRC956ea742015-11-05 16:14:15 -0800471 # as long as the src and dst are both specified
GlennRC073e8bc2015-10-27 17:11:28 -0700472 main.log.info( "Starting filter on host2" )
alisone14d7b02016-07-06 10:31:51 -0700473 main.h2.startFilter( pktFilter="ether host %s" % main.h1.hostMac )
GlennRC073e8bc2015-10-27 17:11:28 -0700474
475 main.log.info( "Sending packet to host2" )
476 main.h1.sendPacket()
477
478 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -0700479 stepResult = main.h2.checkFilter()
GlennRC073e8bc2015-10-27 17:11:28 -0700480 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -0700481 main.log.info( "Packet: %s" % main.h2.readPackets() )
alisone14d7b02016-07-06 10:31:51 -0700482 else:
Jon Hallfc951072017-05-24 15:55:34 -0700483 main.h2.killFilter()
GlennRC073e8bc2015-10-27 17:11:28 -0700484
485 main.log.info( "Clean up host components" )
486 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700487 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -0700488 main.Mininet1.removeHostComponent( "h1" )
489 main.Mininet1.removeHostComponent( "h2" )
GlennRC073e8bc2015-10-27 17:11:28 -0700490
491 utilities.assert_equals( expect=main.TRUE,
492 actual=stepResult,
493 onpass="Successfully sent a packet",
494 onfail="Failed to send a packet" )
495
alisone14d7b02016-07-06 10:31:51 -0700496 def CASE1400( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -0700497 """
GlennRC073e8bc2015-10-27 17:11:28 -0700498 Add flows with IPv4 selectors and verify the flows
Jon Hallfc951072017-05-24 15:55:34 -0700499 """
GlennRC68449942015-10-16 16:03:12 -0700500 import json
GlennRC073e8bc2015-10-27 17:11:28 -0700501 import time
GlennRC68449942015-10-16 16:03:12 -0700502
GlennRC073e8bc2015-10-27 17:11:28 -0700503 main.case( "Verify flow IP selectors are correctly compiled" )
504 main.caseExplanation = "Install two flows with only IP selectors " +\
alisone14d7b02016-07-06 10:31:51 -0700505 "specified, then verify flows are added in ONOS, finally " +\
GlennRC073e8bc2015-10-27 17:11:28 -0700506 "send a packet that only specifies the IP src and dst."
507
508 main.step( "Add flows with IPv4 addresses as the only selectors" )
509
510 main.log.info( "Creating host components" )
Jon Halla510a8a2016-05-04 15:09:28 -0700511 main.Scapy.createHostComponent( "h1" )
512 main.Scapy.createHostComponent( "h2" )
alisone14d7b02016-07-06 10:31:51 -0700513 hosts = [ main.h1, main.h2 ]
GlennRC073e8bc2015-10-27 17:11:28 -0700514 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700515 host.startHostCli()
516 host.startScapy()
517 host.updateSelf()
GlennRC073e8bc2015-10-27 17:11:28 -0700518
519 # Add a flow that connects host1 on port1 to host2 on port2
520 # send output on port2
521 # recieve input on port1
522 egress = 2
523 ingress = 1
524 # IPv4 etherType = 0x800
alisone14d7b02016-07-06 10:31:51 -0700525 ethType = main.params[ 'TEST' ][ 'ip4Type' ]
GlennRC073e8bc2015-10-27 17:11:28 -0700526
527 # Add flows that connects host1 to host2
528 main.log.info( "Add flow with port ingress 1 to port egress 2" )
529 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
530 egressPort=egress,
531 ingressPort=ingress,
alisone14d7b02016-07-06 10:31:51 -0700532 ethType=ethType,
Jon Hallfc951072017-05-24 15:55:34 -0700533 ipSrc=( "IPV4_SRC", main.h1.hostIp + "/32" ),
534 ipDst=( "IPV4_DST", main.h2.hostIp + "/32" ),
GlennRC956ea742015-11-05 16:14:15 -0800535 debug=main.debug )
GlennRC073e8bc2015-10-27 17:11:28 -0700536
537 utilities.assert_equals( expect=main.TRUE,
538 actual=stepResult,
539 onpass="Successfully added flows",
540 onfail="Failed add flows" )
541
542 # Giving ONOS time to add the flow
543 time.sleep( main.addFlowSleep )
544
545 main.step( "Check flow is in the ADDED state" )
546
547 main.log.info( "Get the flows from ONOS" )
Jeremy86160992016-04-11 10:05:53 -0700548 try:
Jon Hallfc951072017-05-24 15:55:34 -0700549 flows = json.loads( main.ONOSrest.flows() )
GlennRC68449942015-10-16 16:03:12 -0700550
Jeremy86160992016-04-11 10:05:53 -0700551 stepResult = main.TRUE
552 for f in flows:
alisone14d7b02016-07-06 10:31:51 -0700553 if "rest" in f.get( "appId" ):
554 if "ADDED" not in f.get( "state" ):
Jeremy86160992016-04-11 10:05:53 -0700555 stepResult = main.FALSE
alisone14d7b02016-07-06 10:31:51 -0700556 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
Jeremy86160992016-04-11 10:05:53 -0700557 except TypeError:
558 main.log.error( "No Flows found by the REST API" )
559 stepResult = main.FALSE
560 except ValueError:
561 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -0700562 main.cleanup()
563 main.exit()
GlennRC68449942015-10-16 16:03:12 -0700564
565 utilities.assert_equals( expect=main.TRUE,
566 actual=stepResult,
GlennRC073e8bc2015-10-27 17:11:28 -0700567 onpass="All flows are in the ADDED state",
568 onfail="All flows are NOT in the ADDED state" )
569
GlennRC956ea742015-11-05 16:14:15 -0800570 main.step( "Check flows are in Mininet's flow table" )
571
572 # get the flow IDs that were added through rest
573 main.log.info( "Getting the flow IDs from ONOS" )
alisone14d7b02016-07-06 10:31:51 -0700574 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
GlennRC956ea742015-11-05 16:14:15 -0800575 # convert the flowIDs to ints then hex and finally back to strings
alisone14d7b02016-07-06 10:31:51 -0700576 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
577 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
GlennRC956ea742015-11-05 16:14:15 -0800578
579 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
580
581 utilities.assert_equals( expect=main.TRUE,
582 actual=stepResult,
583 onpass="All flows are in mininet",
584 onfail="All flows are NOT in mininet" )
585
GlennRC073e8bc2015-10-27 17:11:28 -0700586 main.step( "Send a packet to verify the flow is correct" )
587
588 main.log.info( "Constructing packet" )
589 # No need for the MAC src dst
590 main.h1.buildEther( dst=main.h2.hostMac )
591 main.h1.buildIP( src=main.h1.hostIp, dst=main.h2.hostIp )
592
593 main.log.info( "Starting filter on host2" )
594 # Defaults to ip
Jon Hallfc951072017-05-24 15:55:34 -0700595 main.h2.startFilter()
GlennRC073e8bc2015-10-27 17:11:28 -0700596
597 main.log.info( "Sending packet to host2" )
Jon Hallfc951072017-05-24 15:55:34 -0700598 main.h1.sendPacket()
GlennRC073e8bc2015-10-27 17:11:28 -0700599
600 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -0700601 stepResult = main.h2.checkFilter()
GlennRC073e8bc2015-10-27 17:11:28 -0700602 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -0700603 main.log.info( "Packet: %s" % main.h2.readPackets() )
604 else:
605 main.h2.killFilter()
GlennRC073e8bc2015-10-27 17:11:28 -0700606
607 main.log.info( "Clean up host components" )
608 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700609 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -0700610 main.Mininet1.removeHostComponent( "h1" )
611 main.Mininet1.removeHostComponent( "h2" )
GlennRC073e8bc2015-10-27 17:11:28 -0700612
613 utilities.assert_equals( expect=main.TRUE,
614 actual=stepResult,
615 onpass="Successfully sent a packet",
616 onfail="Failed to send a packet" )
617
Jon Hallfc951072017-05-24 15:55:34 -0700618 def CASE1500( self, main ):
alisone14d7b02016-07-06 10:31:51 -0700619 """
620 Add flow with IPv6 selector and verify the flow
621 """
622 import json
623 import time
624 main.case( "Verify IPv6 selector is correctly compiled" )
625 main.caseExplanation = "Install two flows with only IP selectors " + \
626 "specified, then verify flows are added in ONOS, finally " + \
627 "send a packet that only specifies the IP src and dst."
628
629 main.step( "Add flows with IPv6 addresses as the only selectors" )
630
631 main.log.info( "Creating host components" )
632 main.Scapy.createHostComponent( "h5" )
633 main.Scapy.createHostComponent( "h6" )
634 hosts = [ main.h5, main.h6 ]
635
636 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700637 host.startHostCli()
638 host.startScapy()
alisone14d7b02016-07-06 10:31:51 -0700639 host.updateSelf( IPv6=True )
640
641 # Add a flow that connects host1 on port1 to host2 on port2
642 # send output on port2
643 # recieve input on port1
644 egress = 6
645 ingress = 5
646 # IPv6 etherType = 0x86DD
647 ethType = main.params[ 'TEST' ][ 'ip6Type' ]
648
649 # Add flows that connects host1 to host2
650 main.log.info( "Add flow with port ingress 5 to port egress 6" )
651 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
652 egressPort=egress,
653 ingressPort=ingress,
654 ethType=ethType,
655 ipSrc=( "IPV6_SRC", main.h5.hostIp + "/128" ),
656 ipDst=( "IPV6_DST", main.h6.hostIp + "/128" ),
657 debug=main.debug )
658
659 utilities.assert_equals( expect=main.TRUE,
660 actual=stepResult,
661 onpass="Successfully added flows",
662 onfail="Failed add flows" )
663
664 # Giving ONOS time to add the flow
665 time.sleep( main.addFlowSleep )
666
667 main.step( "Check flow is in the ADDED state" )
668
669 main.log.info( "Get the flows from ONOS" )
670 try:
Jon Hallfc951072017-05-24 15:55:34 -0700671 flows = json.loads( main.ONOSrest.flows() )
alisone14d7b02016-07-06 10:31:51 -0700672
673 stepResult = main.TRUE
674 for f in flows:
675 if "rest" in f.get( "appId" ):
676 if "ADDED" not in f.get( "state" ):
677 stepResult = main.FALSE
678 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
679 except TypeError:
680 main.log.error( "No Flows found by the REST API" )
681 stepResult = main.FALSE
682 except ValueError:
683 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -0700684 main.cleanup()
685 main.exit()
alisone14d7b02016-07-06 10:31:51 -0700686
687 utilities.assert_equals( expect=main.TRUE,
688 actual=stepResult,
689 onpass="All flows are in the ADDED state",
690 onfail="All flows are NOT in the ADDED state" )
691
692 main.step( "Check flows are in Mininet's flow table" )
693
694 # get the flow IDs that were added through rest
695 main.log.info( "Getting the flow IDs from ONOS" )
696 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
697 # convert the flowIDs to ints then hex and finally back to strings
698 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
699 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
700
701 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
702
703 utilities.assert_equals( expect=main.TRUE,
704 actual=stepResult,
705 onpass="All flows are in mininet",
706 onfail="All flows are NOT in mininet" )
707
708 main.step( "Send a packet to verify the flow is correct" )
709
710 main.log.info( "Constructing packet" )
711 # No need for the MAC src dst
712 main.h5.buildEther( dst=main.h6.hostMac )
713 main.h5.buildIPv6( src=main.h5.hostIp, dst=main.h6.hostIp )
714
715 main.log.info( "Starting filter on host6" )
716 # Defaults to ip
717 main.h6.startFilter( pktFilter="ip6" )
718 main.log.info( "Sending packet to host6" )
Jon Hallfc951072017-05-24 15:55:34 -0700719 main.h5.sendPacket()
alisone14d7b02016-07-06 10:31:51 -0700720
721 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -0700722 stepResult = main.h6.checkFilter()
alisone14d7b02016-07-06 10:31:51 -0700723 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -0700724 main.log.info( "Packet: %s" % main.h6.readPackets() )
alisone14d7b02016-07-06 10:31:51 -0700725 else:
Jon Hallfc951072017-05-24 15:55:34 -0700726 main.h6.killFilter()
alisone14d7b02016-07-06 10:31:51 -0700727
728 main.log.info( "Clean up host components" )
729 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700730 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -0700731 main.Mininet1.removeHostComponent( "h5" )
732 main.Mininet1.removeHostComponent( "h6" )
733
734 utilities.assert_equals( expect=main.TRUE,
735 actual=stepResult,
736 onpass="Successfully sent a packet",
737 onfail="Failed to send a packet" )
738
alisone14d7b02016-07-06 10:31:51 -0700739 def CASE1100( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -0700740 """
GlennRC073e8bc2015-10-27 17:11:28 -0700741 Add flow with VLAN selector and verify the flow
Jon Hallfc951072017-05-24 15:55:34 -0700742 """
GlennRC073e8bc2015-10-27 17:11:28 -0700743 import json
744 import time
745
746 main.case( "Verify VLAN selector is correctly compiled" )
747 main.caseExplanation = "Install one flow with only the VLAN selector " +\
Jon Hallfc951072017-05-24 15:55:34 -0700748 "specified, then verify the flow is added in ONOS, and finally " +\
GlennRC073e8bc2015-10-27 17:11:28 -0700749 "broadcast a packet with the correct VLAN tag."
750
751 # We do this here to utilize the hosts information
752 main.log.info( "Creating host components" )
Jon Halla510a8a2016-05-04 15:09:28 -0700753 main.Scapy.createHostComponent( "h3" )
754 main.Scapy.createHostComponent( "h4" )
alisone14d7b02016-07-06 10:31:51 -0700755 hosts = [ main.h3, main.h4 ]
GlennRC073e8bc2015-10-27 17:11:28 -0700756 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700757 host.startHostCli()
758 host.startScapy()
759 host.updateSelf()
GlennRC073e8bc2015-10-27 17:11:28 -0700760
761 main.step( "Add a flow with the VLAN tag as the only selector" )
762
763 # Add flows that connects the two vlan hosts h3 and h4
764 # Host 3 is on port 3 and host 4 is on port 4
765 vlan = main.params[ 'TEST' ][ 'vlan' ]
766 egress = 4
767 ingress = 3
768 # VLAN ethType = 0x8100
alisone14d7b02016-07-06 10:31:51 -0700769 ethType = main.params[ 'TEST' ][ 'vlanType' ]
GlennRC073e8bc2015-10-27 17:11:28 -0700770
771 # Add only one flow because we don't need a response
772 main.log.info( "Add flow with port ingress 1 to port egress 2" )
773 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
774 egressPort=egress,
775 ingressPort=ingress,
776 ethType=ethType,
777 vlan=vlan,
GlennRC956ea742015-11-05 16:14:15 -0800778 debug=main.debug )
GlennRC073e8bc2015-10-27 17:11:28 -0700779
GlennRC073e8bc2015-10-27 17:11:28 -0700780 utilities.assert_equals( expect=main.TRUE,
781 actual=stepResult,
782 onpass="Successfully added flow",
783 onfail="Failed add flows" )
784
785 # Giving ONOS time to add the flows
786 time.sleep( main.addFlowSleep )
787
788 main.step( "Check flows are in the ADDED state" )
789
790 main.log.info( "Get the flows from ONOS" )
Jeremy86160992016-04-11 10:05:53 -0700791 try:
Jon Hallfc951072017-05-24 15:55:34 -0700792 flows = json.loads( main.ONOSrest.flows() )
GlennRC073e8bc2015-10-27 17:11:28 -0700793
Jeremy86160992016-04-11 10:05:53 -0700794 stepResult = main.TRUE
795 for f in flows:
alisone14d7b02016-07-06 10:31:51 -0700796 if "rest" in f.get( "appId" ):
797 if "ADDED" not in f.get( "state" ):
Jeremy86160992016-04-11 10:05:53 -0700798 stepResult = main.FALSE
alisone14d7b02016-07-06 10:31:51 -0700799 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
Jeremy86160992016-04-11 10:05:53 -0700800 except TypeError:
801 main.log.error( "No Flows found by the REST API" )
802 stepResult = main.FALSE
803 except ValueError:
804 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -0700805 main.cleanup()
806 main.exit()
GlennRC073e8bc2015-10-27 17:11:28 -0700807
808 utilities.assert_equals( expect=main.TRUE,
809 actual=stepResult,
810 onpass="All flows are in the ADDED state",
811 onfail="All flows are NOT in the ADDED state" )
812
GlennRC956ea742015-11-05 16:14:15 -0800813 main.step( "Check flows are in Mininet's flow table" )
814
815 # get the flow IDs that were added through rest
816 main.log.info( "Getting the flow IDs from ONOS" )
alisone14d7b02016-07-06 10:31:51 -0700817 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
GlennRC956ea742015-11-05 16:14:15 -0800818 # convert the flowIDs to ints then hex and finally back to strings
alisone14d7b02016-07-06 10:31:51 -0700819 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
820 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
GlennRC956ea742015-11-05 16:14:15 -0800821
822 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
823
824 utilities.assert_equals( expect=main.TRUE,
825 actual=stepResult,
826 onpass="All flows are in mininet",
827 onfail="All flows are NOT in mininet" )
828
GlennRC073e8bc2015-10-27 17:11:28 -0700829 main.step( "Send a packet to verify the flow are correct" )
830
831 # The receiving interface
alisone14d7b02016-07-06 10:31:51 -0700832 recIface = "{}-eth0.{}".format( main.h4.name, vlan )
GlennRC073e8bc2015-10-27 17:11:28 -0700833 main.log.info( "Starting filter on host2" )
834 # Filter is setup to catch any packet on the vlan interface with the correct vlan tag
Jon Hallfc951072017-05-24 15:55:34 -0700835 main.h4.startFilter( ifaceName=recIface, pktFilter="" )
GlennRC073e8bc2015-10-27 17:11:28 -0700836
837 # Broadcast the packet on the vlan interface. We only care if the flow forwards
838 # the packet with the correct vlan tag, not if the mac addr is correct
alisone14d7b02016-07-06 10:31:51 -0700839 sendIface = "{}-eth0.{}".format( main.h3.name, vlan )
GlennRC073e8bc2015-10-27 17:11:28 -0700840 main.log.info( "Broadcasting the packet with a vlan tag" )
GlennRC956ea742015-11-05 16:14:15 -0800841 main.h3.sendPacket( iface=sendIface,
alisone14d7b02016-07-06 10:31:51 -0700842 packet="Ether()/Dot1Q(vlan={})".format( vlan ) )
GlennRC073e8bc2015-10-27 17:11:28 -0700843
844 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -0700845 stepResult = main.h4.checkFilter()
GlennRC073e8bc2015-10-27 17:11:28 -0700846 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -0700847 main.log.info( "Packet: %s" % main.h4.readPackets() )
848 else:
849 main.h4.killFilter()
GlennRC073e8bc2015-10-27 17:11:28 -0700850
851 main.log.info( "Clean up host components" )
852 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700853 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -0700854 main.Mininet1.removeHostComponent( "h3" )
855 main.Mininet1.removeHostComponent( "h4" )
GlennRC073e8bc2015-10-27 17:11:28 -0700856
857 utilities.assert_equals( expect=main.TRUE,
858 actual=stepResult,
859 onpass="Successfully sent a packet",
860 onfail="Failed to send a packet" )
GlennRC68449942015-10-16 16:03:12 -0700861
GlennRC956ea742015-11-05 16:14:15 -0800862 def CASE1300( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -0700863 """
GlennRC956ea742015-11-05 16:14:15 -0800864 Add flows with MPLS selector and verify the flows
Jon Hallfc951072017-05-24 15:55:34 -0700865 """
GlennRC956ea742015-11-05 16:14:15 -0800866 import json
867 import time
868
869 main.case( "Verify the MPLS selector is correctly compiled on the flow." )
870 main.caseExplanation = "Install one flow with an MPLS selector, " +\
alisone14d7b02016-07-06 10:31:51 -0700871 "verify the flow is added in ONOS, and finally " +\
GlennRC956ea742015-11-05 16:14:15 -0800872 "send a packet via scapy that has a MPLS label."
873
874 main.step( "Add a flow with a MPLS selector" )
875
876 main.log.info( "Creating host components" )
Jon Halla510a8a2016-05-04 15:09:28 -0700877 main.Scapy.createHostComponent( "h1" )
878 main.Scapy.createHostComponent( "h2" )
alisone14d7b02016-07-06 10:31:51 -0700879 hosts = [ main.h1, main.h2 ]
GlennRC956ea742015-11-05 16:14:15 -0800880 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700881 host.startHostCli()
GlennRC956ea742015-11-05 16:14:15 -0800882 host.startScapy( main.dependencyPath )
Jon Hallfc951072017-05-24 15:55:34 -0700883 host.updateSelf()
GlennRC956ea742015-11-05 16:14:15 -0800884
885 # ports
886 egress = 2
887 ingress = 1
888 # MPLS etherType
889 ethType = main.params[ 'TEST' ][ 'mplsType' ]
890 # MPLS label
891 mplsLabel = main.params[ 'TEST' ][ 'mpls' ]
892
893 # Add a flow that connects host1 on port1 to host2 on port2
894 main.log.info( "Adding flow with MPLS selector" )
895 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
896 egressPort=egress,
897 ingressPort=ingress,
898 ethType=ethType,
899 mpls=mplsLabel,
900 debug=main.debug )
901
902 utilities.assert_equals( expect=main.TRUE,
903 actual=stepResult,
904 onpass="Successfully added flow",
905 onfail="Failed add flow" )
906
907 # Giving ONOS time to add the flow
908 time.sleep( main.addFlowSleep )
909
910 main.step( "Check flow is in the ADDED state" )
911
912 main.log.info( "Get the flows from ONOS" )
Jeremy86160992016-04-11 10:05:53 -0700913 try:
Jon Hallfc951072017-05-24 15:55:34 -0700914 flows = json.loads( main.ONOSrest.flows() )
GlennRC956ea742015-11-05 16:14:15 -0800915
Jeremy86160992016-04-11 10:05:53 -0700916 stepResult = main.TRUE
917 for f in flows:
alisone14d7b02016-07-06 10:31:51 -0700918 if "rest" in f.get( "appId" ):
919 if "ADDED" not in f.get( "state" ):
Jeremy86160992016-04-11 10:05:53 -0700920 stepResult = main.FALSE
alisone14d7b02016-07-06 10:31:51 -0700921 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
Jeremy86160992016-04-11 10:05:53 -0700922 except TypeError:
923 main.log.error( "No Flows found by the REST API" )
924 stepResult = main.FALSE
925 except ValueError:
926 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -0700927 main.cleanup()
928 main.exit()
GlennRC956ea742015-11-05 16:14:15 -0800929
930 utilities.assert_equals( expect=main.TRUE,
931 actual=stepResult,
932 onpass="All flows are in the ADDED state",
933 onfail="All flows are NOT in the ADDED state" )
934
935 main.step( "Check flows are in Mininet's flow table" )
936
937 # get the flow IDs that were added through rest
938 main.log.info( "Getting the flow IDs from ONOS" )
alisone14d7b02016-07-06 10:31:51 -0700939 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
GlennRC956ea742015-11-05 16:14:15 -0800940 # convert the flowIDs to ints then hex and finally back to strings
alisone14d7b02016-07-06 10:31:51 -0700941 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
942 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
GlennRC956ea742015-11-05 16:14:15 -0800943
944 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=True )
945
946 utilities.assert_equals( expect=main.TRUE,
947 actual=stepResult,
948 onpass="All flows are in mininet",
949 onfail="All flows are NOT in mininet" )
950
951 main.step( "Send a packet to verify the flow is correct" )
952
953 main.log.info( "Starting filter on host2" )
954 main.h2.startFilter( pktFilter="mpls" )
955
956 main.log.info( "Constructing packet" )
957 main.log.info( "Sending packet to host2" )
alisone14d7b02016-07-06 10:31:51 -0700958 main.h1.sendPacket( packet='Ether()/MPLS(label={})'.format( mplsLabel ) )
GlennRC956ea742015-11-05 16:14:15 -0800959
960 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -0700961 stepResult = main.h2.checkFilter()
GlennRC956ea742015-11-05 16:14:15 -0800962 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -0700963 main.log.info( "Packet: %s" % main.h2.readPackets() )
964 else:
965 main.h2.killFilter()
GlennRC956ea742015-11-05 16:14:15 -0800966
967 main.log.info( "Clean up host components" )
968 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700969 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -0700970 main.Mininet1.removeHostComponent( "h1" )
971 main.Mininet1.removeHostComponent( "h2" )
GlennRC956ea742015-11-05 16:14:15 -0800972
973 utilities.assert_equals( expect=main.TRUE,
974 actual=stepResult,
975 onpass="Successfully sent a packet",
976 onfail="Failed to send a packet" )
977
alisone14d7b02016-07-06 10:31:51 -0700978 def CASE1700( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -0700979 """
GlennRC956ea742015-11-05 16:14:15 -0800980 Add flows with a TCP selector and verify the flow
Jon Hallfc951072017-05-24 15:55:34 -0700981 """
GlennRC956ea742015-11-05 16:14:15 -0800982 import json
983 import time
984
985 main.case( "Verify the TCP selector is correctly compiled on the flow" )
986 main.caseExplanation = "Install a flow with only the TCP selector " +\
alisone14d7b02016-07-06 10:31:51 -0700987 "specified, verify the flow is added in ONOS, and finally " +\
GlennRC956ea742015-11-05 16:14:15 -0800988 "send a TCP packet to verify the TCP selector is compiled correctly."
989
990 main.step( "Add a flow with a TCP selector" )
991
992 main.log.info( "Creating host components" )
Jon Halla510a8a2016-05-04 15:09:28 -0700993 main.Scapy.createHostComponent( "h1" )
994 main.Scapy.createHostComponent( "h2" )
alisone14d7b02016-07-06 10:31:51 -0700995 hosts = [ main.h1, main.h2 ]
GlennRC956ea742015-11-05 16:14:15 -0800996 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -0700997 host.startHostCli()
998 host.startScapy()
999 host.updateSelf()
GlennRC956ea742015-11-05 16:14:15 -08001000
1001 # Add a flow that connects host1 on port1 to host2 on port2
1002 egress = 2
1003 ingress = 1
1004 # IPv4 etherType
1005 ethType = main.params[ 'TEST' ][ 'ip4Type' ]
1006 # IP protocol
1007 ipProto = main.params[ 'TEST' ][ 'tcpProto' ]
1008 # TCP port destination
1009 tcpDst = main.params[ 'TEST' ][ 'tcpDst' ]
1010
1011 main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
1012 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
1013 egressPort=egress,
1014 ingressPort=ingress,
1015 ethType=ethType,
1016 ipProto=ipProto,
1017 tcpDst=tcpDst,
1018 debug=main.debug )
1019
1020 utilities.assert_equals( expect=main.TRUE,
1021 actual=stepResult,
1022 onpass="Successfully added flows",
1023 onfail="Failed add flows" )
1024
1025 # Giving ONOS time to add the flow
1026 time.sleep( main.addFlowSleep )
1027
1028 main.step( "Check flow is in the ADDED state" )
1029
1030 main.log.info( "Get the flows from ONOS" )
Jeremy86160992016-04-11 10:05:53 -07001031 try:
Jon Hallfc951072017-05-24 15:55:34 -07001032 flows = json.loads( main.ONOSrest.flows() )
GlennRC956ea742015-11-05 16:14:15 -08001033
Jeremy86160992016-04-11 10:05:53 -07001034 stepResult = main.TRUE
1035 for f in flows:
alisone14d7b02016-07-06 10:31:51 -07001036 if "rest" in f.get( "appId" ):
1037 if "ADDED" not in f.get( "state" ):
Jeremy86160992016-04-11 10:05:53 -07001038 stepResult = main.FALSE
alisone14d7b02016-07-06 10:31:51 -07001039 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
Jeremy86160992016-04-11 10:05:53 -07001040 except TypeError:
1041 main.log.error( "No Flows found by the REST API" )
1042 stepResult = main.FALSE
1043 except ValueError:
1044 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -07001045 main.cleanup()
1046 main.exit()
GlennRC956ea742015-11-05 16:14:15 -08001047
1048 utilities.assert_equals( expect=main.TRUE,
1049 actual=stepResult,
1050 onpass="All flows are in the ADDED state",
1051 onfail="All flows are NOT in the ADDED state" )
1052
1053 main.step( "Check flows are in Mininet's flow table" )
1054
1055 # get the flow IDs that were added through rest
1056 main.log.info( "Getting the flow IDs from ONOS" )
alisone14d7b02016-07-06 10:31:51 -07001057 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
GlennRC956ea742015-11-05 16:14:15 -08001058 # convert the flowIDs to ints then hex and finally back to strings
alisone14d7b02016-07-06 10:31:51 -07001059 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
1060 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
GlennRC956ea742015-11-05 16:14:15 -08001061
1062 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
1063
1064 utilities.assert_equals( expect=main.TRUE,
1065 actual=stepResult,
1066 onpass="All flows are in mininet",
1067 onfail="All flows are NOT in mininet" )
1068
1069 main.step( "Send a packet to verify the flow is correct" )
1070
1071 main.log.info( "Constructing packet" )
1072 # No need for the MAC src dst
1073 main.h1.buildEther( dst=main.h2.hostMac )
1074 main.h1.buildIP( dst=main.h2.hostIp )
1075 main.h1.buildTCP( dport=tcpDst )
1076
1077 main.log.info( "Starting filter on host2" )
1078 # Defaults to ip
1079 main.h2.startFilter( pktFilter="tcp" )
1080
1081 main.log.info( "Sending packet to host2" )
Jon Hallfc951072017-05-24 15:55:34 -07001082 main.h1.sendPacket()
GlennRC956ea742015-11-05 16:14:15 -08001083
1084 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -07001085 stepResult = main.h2.checkFilter()
GlennRC956ea742015-11-05 16:14:15 -08001086 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -07001087 main.log.info( "Packet: %s" % main.h2.readPackets() )
1088 else:
1089 main.h2.killFilter()
GlennRC956ea742015-11-05 16:14:15 -08001090
1091 main.log.info( "Clean up host components" )
1092 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001093 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -07001094 main.Mininet1.removeHostComponent( "h1" )
1095 main.Mininet1.removeHostComponent( "h2" )
GlennRC956ea742015-11-05 16:14:15 -08001096
1097 utilities.assert_equals( expect=main.TRUE,
1098 actual=stepResult,
1099 onpass="Successfully sent a packet",
1100 onfail="Failed to send a packet" )
1101
alisone14d7b02016-07-06 10:31:51 -07001102 def CASE1600( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -07001103 """
GlennRC956ea742015-11-05 16:14:15 -08001104 Add flows with a UDP selector and verify the flow
Jon Hallfc951072017-05-24 15:55:34 -07001105 """
GlennRC956ea742015-11-05 16:14:15 -08001106 import json
1107 import time
1108
1109 main.case( "Verify the UDP selector is correctly compiled on the flow" )
1110 main.caseExplanation = "Install a flow with only the UDP selector " +\
alisone14d7b02016-07-06 10:31:51 -07001111 "specified, verify the flow is added in ONOS, and finally " +\
GlennRC956ea742015-11-05 16:14:15 -08001112 "send a UDP packet to verify the UDP selector is compiled correctly."
1113
1114 main.step( "Add a flow with a UDP selector" )
1115
1116 main.log.info( "Creating host components" )
Jon Halla510a8a2016-05-04 15:09:28 -07001117 main.Scapy.createHostComponent( "h1" )
1118 main.Scapy.createHostComponent( "h2" )
alisone14d7b02016-07-06 10:31:51 -07001119 hosts = [ main.h1, main.h2 ]
GlennRC956ea742015-11-05 16:14:15 -08001120 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001121 host.startHostCli()
1122 host.startScapy()
1123 host.updateSelf()
GlennRC956ea742015-11-05 16:14:15 -08001124
1125 # Add a flow that connects host1 on port1 to host2 on port2
1126 egress = 2
1127 ingress = 1
1128 # IPv4 etherType
1129 ethType = main.params[ 'TEST' ][ 'ip4Type' ]
1130 # IP protocol
1131 ipProto = main.params[ 'TEST' ][ 'udpProto' ]
1132 # UDP port destination
1133 udpDst = main.params[ 'TEST' ][ 'udpDst' ]
1134
1135 main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
1136 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
1137 egressPort=egress,
1138 ingressPort=ingress,
1139 ethType=ethType,
1140 ipProto=ipProto,
1141 udpDst=udpDst,
1142 debug=main.debug )
1143
1144 utilities.assert_equals( expect=main.TRUE,
1145 actual=stepResult,
1146 onpass="Successfully added flows",
1147 onfail="Failed add flows" )
1148
1149 # Giving ONOS time to add the flow
1150 time.sleep( main.addFlowSleep )
1151
1152 main.step( "Check flow is in the ADDED state" )
1153
1154 main.log.info( "Get the flows from ONOS" )
Jeremy86160992016-04-11 10:05:53 -07001155 try:
Jon Hallfc951072017-05-24 15:55:34 -07001156 flows = json.loads( main.ONOSrest.flows() )
GlennRC956ea742015-11-05 16:14:15 -08001157
Jeremy86160992016-04-11 10:05:53 -07001158 stepResult = main.TRUE
1159 for f in flows:
alisone14d7b02016-07-06 10:31:51 -07001160 if "rest" in f.get( "appId" ):
1161 if "ADDED" not in f.get( "state" ):
Jeremy86160992016-04-11 10:05:53 -07001162 stepResult = main.FALSE
alisone14d7b02016-07-06 10:31:51 -07001163 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
Jeremy86160992016-04-11 10:05:53 -07001164 except TypeError:
1165 main.log.error( "No Flows found by the REST API" )
1166 stepResult = main.FALSE
1167 except ValueError:
1168 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -07001169 main.cleanup()
1170 main.exit()
GlennRC956ea742015-11-05 16:14:15 -08001171
1172 utilities.assert_equals( expect=main.TRUE,
1173 actual=stepResult,
1174 onpass="All flows are in the ADDED state",
1175 onfail="All flows are NOT in the ADDED state" )
1176
1177 main.step( "Check flows are in Mininet's flow table" )
1178
1179 # get the flow IDs that were added through rest
1180 main.log.info( "Getting the flow IDs from ONOS" )
alisone14d7b02016-07-06 10:31:51 -07001181 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
GlennRC956ea742015-11-05 16:14:15 -08001182 # convert the flowIDs to ints then hex and finally back to strings
alisone14d7b02016-07-06 10:31:51 -07001183 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
1184 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
GlennRC956ea742015-11-05 16:14:15 -08001185
1186 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
1187
1188 utilities.assert_equals( expect=main.TRUE,
1189 actual=stepResult,
1190 onpass="All flows are in mininet",
1191 onfail="All flows are NOT in mininet" )
1192
1193 main.step( "Send a packet to verify the flow is correct" )
1194
1195 main.log.info( "Constructing packet" )
1196 # No need for the MAC src dst
1197 main.h1.buildEther( dst=main.h2.hostMac )
1198 main.h1.buildIP( dst=main.h2.hostIp )
1199 main.h1.buildUDP( dport=udpDst )
1200
1201 main.log.info( "Starting filter on host2" )
1202 # Defaults to ip
1203 main.h2.startFilter( pktFilter="udp" )
1204
1205 main.log.info( "Sending packet to host2" )
Jon Hallfc951072017-05-24 15:55:34 -07001206 main.h1.sendPacket()
GlennRC956ea742015-11-05 16:14:15 -08001207
1208 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -07001209 stepResult = main.h2.checkFilter()
GlennRC956ea742015-11-05 16:14:15 -08001210 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -07001211 main.log.info( "Packet: %s" % main.h2.readPackets() )
1212 else:
1213 main.h2.killFilter()
GlennRC956ea742015-11-05 16:14:15 -08001214
1215 main.log.info( "Clean up host components" )
1216 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001217 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -07001218 main.Mininet1.removeHostComponent( "h1" )
1219 main.Mininet1.removeHostComponent( "h2" )
GlennRC956ea742015-11-05 16:14:15 -08001220
1221 utilities.assert_equals( expect=main.TRUE,
1222 actual=stepResult,
1223 onpass="Successfully sent a packet",
1224 onfail="Failed to send a packet" )
1225
alisone14d7b02016-07-06 10:31:51 -07001226 def CASE1900( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -07001227 """
alisone14d7b02016-07-06 10:31:51 -07001228 Add flows with a ICMPv4 selector and verify the flow
Jon Hallfc951072017-05-24 15:55:34 -07001229 """
GlennRC956ea742015-11-05 16:14:15 -08001230 import json
alisone14d7b02016-07-06 10:31:51 -07001231 import time
GlennRC956ea742015-11-05 16:14:15 -08001232
alisone14d7b02016-07-06 10:31:51 -07001233 main.case( "Verify the ICMPv4 selector is correctly compiled on the flow" )
1234 main.caseExplanation = "Install a flow with only the ICMPv4 selector " +\
1235 "specified, verify the flow is added in ONOS, and finally " +\
1236 "send a IMCPv4 packet to verify the ICMPv4 selector is compiled correctly."
GlennRC956ea742015-11-05 16:14:15 -08001237
alisone14d7b02016-07-06 10:31:51 -07001238 main.step( "Add a flow with a ICMPv4 selector" )
1239
1240 main.log.info( "Creating host components" )
1241 main.Scapy.createHostComponent( "h1" )
1242 main.Scapy.createHostComponent( "h2" )
1243 hosts = [ main.h1, main.h2 ]
1244 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001245 host.startHostCli()
1246 host.startScapy()
1247 host.updateSelf()
alisone14d7b02016-07-06 10:31:51 -07001248
1249 # Add a flow that connects host1 on port1 to host2 on port2
1250 egress = 2
1251 ingress = 1
1252 # IPv4 etherType
1253 ethType = main.params[ 'TEST' ][ 'ip4Type' ]
1254 # IP protocol
1255 ipProto = main.params[ 'TEST' ][ 'icmpProto' ]
1256
1257 main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
1258 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
1259 egressPort=egress,
1260 ingressPort=ingress,
1261 ethType=ethType,
1262 ipProto=ipProto,
1263 debug=main.debug )
1264
1265 utilities.assert_equals( expect=main.TRUE,
1266 actual=stepResult,
1267 onpass="Successfully added flows",
1268 onfail="Failed add flows" )
1269
1270 # Giving ONOS time to add the flow
1271 time.sleep( main.addFlowSleep )
1272
1273 main.step( "Check flow is in the ADDED state" )
1274
1275 main.log.info( "Get the flows from ONOS" )
Jeremy86160992016-04-11 10:05:53 -07001276 try:
Jon Hallfc951072017-05-24 15:55:34 -07001277 flows = json.loads( main.ONOSrest.flows() )
GlennRC956ea742015-11-05 16:14:15 -08001278
Jeremy86160992016-04-11 10:05:53 -07001279 stepResult = main.TRUE
1280 for f in flows:
alisone14d7b02016-07-06 10:31:51 -07001281 if "rest" in f.get( "appId" ):
1282 if "ADDED" not in f.get( "state" ):
1283 stepResult = main.FALSE
1284 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
Jeremy86160992016-04-11 10:05:53 -07001285 except TypeError:
1286 main.log.error( "No Flows found by the REST API" )
1287 stepResult = main.FALSE
1288 except ValueError:
1289 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -07001290 main.cleanup()
1291 main.exit()
alisone14d7b02016-07-06 10:31:51 -07001292
1293 utilities.assert_equals( expect=main.TRUE,
1294 actual=stepResult,
1295 onpass="All flows are in the ADDED state",
1296 onfail="All flows are NOT in the ADDED state" )
1297
1298 main.step( "Check flows are in Mininet's flow table" )
1299
1300 # get the flow IDs that were added through rest
1301 main.log.info( "Getting the flow IDs from ONOS" )
1302 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
1303 # convert the flowIDs to ints then hex and finally back to strings
1304 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
1305 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
1306
1307 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
1308
1309 utilities.assert_equals( expect=main.TRUE,
1310 actual=stepResult,
1311 onpass="All flows are in mininet",
1312 onfail="All flows are NOT in mininet" )
1313
1314 main.step( "Send a packet to verify the flow is correct" )
1315
1316 main.log.info( "Constructing packet" )
1317 # No need for the MAC src dst
1318 main.h1.buildEther( dst=main.h2.hostMac )
1319 main.h1.buildIP( dst=main.h2.hostIp )
Jon Hallfc951072017-05-24 15:55:34 -07001320 main.h1.buildICMP()
alisone14d7b02016-07-06 10:31:51 -07001321
1322 main.log.info( "Starting filter on host2" )
1323 # Defaults to ip
1324 main.h2.startFilter( pktFilter="icmp" )
1325
1326 main.log.info( "Sending packet to host2" )
Jon Hallfc951072017-05-24 15:55:34 -07001327 main.h1.sendPacket()
alisone14d7b02016-07-06 10:31:51 -07001328
1329 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -07001330 stepResult = main.h2.checkFilter()
alisone14d7b02016-07-06 10:31:51 -07001331 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -07001332 main.log.info( "Packet: %s" % main.h2.readPackets() )
1333 else:
1334 main.h2.killFilter()
alisone14d7b02016-07-06 10:31:51 -07001335
1336 main.log.info( "Clean up host components" )
1337 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001338 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -07001339 main.Mininet1.removeHostComponent( "h1" )
1340 main.Mininet1.removeHostComponent( "h2" )
1341
1342 utilities.assert_equals( expect=main.TRUE,
1343 actual=stepResult,
1344 onpass="Successfully sent a packet",
1345 onfail="Failed to send a packet" )
1346
1347 def CASE2000( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -07001348 """
alisone14d7b02016-07-06 10:31:51 -07001349 Add flows with a ICMPv6 selector and verify the flow
Jon Hallfc951072017-05-24 15:55:34 -07001350 """
alisone14d7b02016-07-06 10:31:51 -07001351 import json
1352 import time
1353
1354 main.case( "Verify the ICMPv6 selector is correctly compiled on the flow" )
1355 main.caseExplanation = "Install a flow with only the ICMPv6 selector " +\
1356 "specified, verify the flow is added in ONOS, and finally " +\
1357 "send a IMCPv6 packet to verify the ICMPv6 selector is compiled correctly."
1358
1359 main.step( "Add a flow with a ICMPv6 selector" )
1360
1361 main.log.info( "Creating host components" )
1362 main.Scapy.createHostComponent( "h5" )
1363 main.Scapy.createHostComponent( "h6" )
Jon Hallfc951072017-05-24 15:55:34 -07001364 hosts = [ main.h5, main.h6 ]
alisone14d7b02016-07-06 10:31:51 -07001365 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001366 host.startHostCli()
1367 host.startScapy()
alisone14d7b02016-07-06 10:31:51 -07001368 host.updateSelf( IPv6=True )
1369
1370 # Add a flow that connects host1 on port1 to host2 on port2
Jon Hallfc951072017-05-24 15:55:34 -07001371 egress = 6
1372 ingress = 5
alisone14d7b02016-07-06 10:31:51 -07001373 # IPv6 etherType
1374 ethType = main.params[ 'TEST' ][ 'ip6Type' ]
1375 # IP protocol
1376 ipProto = main.params[ 'TEST' ][ 'icmp6Proto' ]
1377
1378 main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
1379 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
1380 egressPort=egress,
1381 ingressPort=ingress,
1382 ethType=ethType,
1383 ipProto=ipProto,
1384 debug=main.debug )
1385
1386 utilities.assert_equals( expect=main.TRUE,
1387 actual=stepResult,
1388 onpass="Successfully added flows",
1389 onfail="Failed add flows" )
1390
1391 # Giving ONOS time to add the flow
1392 time.sleep( main.addFlowSleep )
1393
1394 main.step( "Check flow is in the ADDED state" )
1395
1396 main.log.info( "Get the flows from ONOS" )
1397 try:
Jon Hallfc951072017-05-24 15:55:34 -07001398 flows = json.loads( main.ONOSrest.flows() )
alisone14d7b02016-07-06 10:31:51 -07001399
1400 stepResult = main.TRUE
1401 for f in flows:
1402 if "rest" in f.get( "appId" ):
1403 if "ADDED" not in f.get( "state" ):
1404 stepResult = main.FALSE
1405 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
1406 except TypeError:
1407 main.log.error( "No Flows found by the REST API" )
1408 stepResult = main.FALSE
1409 except ValueError:
1410 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -07001411 main.cleanup()
1412 main.exit()
alisone14d7b02016-07-06 10:31:51 -07001413
1414 utilities.assert_equals( expect=main.TRUE,
1415 actual=stepResult,
1416 onpass="All flows are in the ADDED state",
1417 onfail="All flows are NOT in the ADDED state" )
1418
1419 main.step( "Check flows are in Mininet's flow table" )
1420
1421 # get the flow IDs that were added through rest
1422 main.log.info( "Getting the flow IDs from ONOS" )
1423 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
1424 # convert the flowIDs to ints then hex and finally back to strings
1425 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
1426 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
1427
1428 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
1429
1430 utilities.assert_equals( expect=main.TRUE,
1431 actual=stepResult,
1432 onpass="All flows are in mininet",
1433 onfail="All flows are NOT in mininet" )
1434
1435 main.step( "Send a packet to verify the flow is correct" )
1436
1437 main.log.info( "Constructing packet" )
1438 # No need for the MAC src dst
1439 main.h5.buildEther( dst=main.h6.hostMac )
1440 main.h5.buildIPv6( dst=main.h6.hostIp )
1441 main.h5.buildICMP( ipVersion=6 )
1442
1443 main.log.info( "Starting filter on host2" )
1444 # Defaults to ip
1445 main.h6.startFilter( pktFilter="icmp6" )
1446
1447 main.log.info( "Sending packet to host2" )
Jon Hallfc951072017-05-24 15:55:34 -07001448 main.h5.sendPacket()
alisone14d7b02016-07-06 10:31:51 -07001449
1450 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -07001451 stepResult = main.h6.checkFilter()
alisone14d7b02016-07-06 10:31:51 -07001452 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -07001453 main.log.info( "Packet: %s" % main.h6.readPackets() )
1454 else:
1455 main.h6.killFilter()
alisone14d7b02016-07-06 10:31:51 -07001456
1457 main.log.info( "Clean up host components" )
1458 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001459 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -07001460 main.Mininet1.removeHostComponent( "h5" )
1461 main.Mininet1.removeHostComponent( "h6" )
1462
1463 utilities.assert_equals( expect=main.TRUE,
1464 actual=stepResult,
1465 onpass="Successfully sent a packet",
1466 onfail="Failed to send a packet" )
1467
1468 def CASE3000( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -07001469 """
alisone14d7b02016-07-06 10:31:51 -07001470 Delete flow
Jon Hallfc951072017-05-24 15:55:34 -07001471 """
alisone14d7b02016-07-06 10:31:51 -07001472 import json
1473
1474 main.case( "Delete flows that were added through rest" )
1475 main.step( "Deleting flows" )
1476
1477 main.log.info( "Getting flows" )
1478 try:
Jon Hallfc951072017-05-24 15:55:34 -07001479 flows = json.loads( main.ONOSrest.flows() )
alisone14d7b02016-07-06 10:31:51 -07001480
1481 stepResult = main.TRUE
1482 for f in flows:
1483 if "rest" in f.get( "appId" ):
Jon Hallfc951072017-05-24 15:55:34 -07001484 if main.debug:
1485 main.log.debug( "Flow to be deleted:\n{}".format( main.ONOSrest.pprint( f ) ) )
alisone14d7b02016-07-06 10:31:51 -07001486 stepResult = stepResult and main.ONOSrest.removeFlow( f.get( "deviceId" ), f.get( "id" ) )
1487 except TypeError:
1488 main.log.error( "No Flows found by the REST API" )
1489 stepResult = main.FALSE
1490 except ValueError:
1491 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -07001492 main.cleanup()
1493 main.exit()
GlennRC956ea742015-11-05 16:14:15 -08001494
1495 utilities.assert_equals( expect=main.TRUE,
1496 actual=stepResult,
1497 onpass="Successfully deleting flows",
1498 onfail="Failed to delete flows" )
1499
1500 time.sleep( main.delFlowSleep )
1501
Jon Hallfc951072017-05-24 15:55:34 -07001502 def CASE1200( self, main ):
1503 """
alisone14d7b02016-07-06 10:31:51 -07001504 Add flows with a ARP selector and verify the flow
Jon Hallfc951072017-05-24 15:55:34 -07001505 """
alisone14d7b02016-07-06 10:31:51 -07001506 import json
1507 import time
1508
1509 main.case( "Verify flow IP selectors are correctly compiled" )
1510 main.caseExplanation = "Install two flows with only IP selectors " + \
1511 "specified, then verify flows are added in ONOS, finally " + \
1512 "send a packet that only specifies the IP src and dst."
1513
1514 main.step( "Add flows with ARP addresses as the only selectors" )
1515
1516 main.log.info( "Creating host components" )
1517 main.Scapy.createHostComponent( "h1" )
1518 main.Scapy.createHostComponent( "h2" )
1519 hosts = [ main.h1, main.h2 ]
1520 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001521 host.startHostCli()
1522 host.startScapy()
1523 host.updateSelf()
alisone14d7b02016-07-06 10:31:51 -07001524
1525 # Add a flow that connects host1 on port1 to host2 on port2
1526 # send output on port2
1527 # recieve input on port1
1528 egress = 2
1529 ingress = 1
1530 # ARP etherType = 0x0806
1531 ethType = main.params[ 'TEST' ][ 'arpType' ]
1532
1533 # Add flows that connects host1 to host2
1534 main.log.info( "Add flow with port ingress 1 to port egress 2" )
Jon Hallfc951072017-05-24 15:55:34 -07001535 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
1536 egressPort=egress,
1537 ingressPort=ingress,
1538 ethType=ethType,
1539 priority=40001,
1540 debug=main.debug )
alisone14d7b02016-07-06 10:31:51 -07001541
1542 utilities.assert_equals( expect=main.TRUE,
1543 actual=stepResult,
1544 onpass="Successfully added flows",
1545 onfail="Failed add flows" )
1546
1547 # Giving ONOS time to add the flow
1548 time.sleep( main.addFlowSleep )
1549
1550 main.step( "Check flow is in the ADDED state" )
1551
1552 main.log.info( "Get the flows from ONOS" )
1553 try:
Jon Hallfc951072017-05-24 15:55:34 -07001554 flows = json.loads( main.ONOSrest.flows() )
alisone14d7b02016-07-06 10:31:51 -07001555
1556 stepResult = main.TRUE
1557 for f in flows:
1558 if "rest" in f.get( "appId" ):
1559 if "ADDED" not in f.get( "state" ):
1560 stepResult = main.FALSE
Jon Hallfc951072017-05-24 15:55:34 -07001561 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
alisone14d7b02016-07-06 10:31:51 -07001562 except TypeError:
1563 main.log.error( "No Flows found by the REST API" )
1564 stepResult = main.FALSE
1565 except ValueError:
1566 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -07001567 main.cleanup()
1568 main.exit()
alisone14d7b02016-07-06 10:31:51 -07001569
1570 utilities.assert_equals( expect=main.TRUE,
1571 actual=stepResult,
1572 onpass="All flows are in the ADDED state",
1573 onfail="All flows are NOT in the ADDED state" )
1574
1575 main.step( "Check flows are in Mininet's flow table" )
1576
1577 # get the flow IDs that were added through rest
1578 main.log.info( "Getting the flow IDs from ONOS" )
Jon Hallfc951072017-05-24 15:55:34 -07001579 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
alisone14d7b02016-07-06 10:31:51 -07001580 # convert the flowIDs to ints then hex and finally back to strings
1581 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
Jon Hallfc951072017-05-24 15:55:34 -07001582 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
alisone14d7b02016-07-06 10:31:51 -07001583
1584 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
1585
1586 utilities.assert_equals( expect=main.TRUE,
1587 actual=stepResult,
1588 onpass="All flows are in mininet",
1589 onfail="All flows are NOT in mininet" )
1590
1591 main.step( "Send a packet to verify the flow is correct" )
1592
1593 main.log.info( "Constructing packet" )
1594 # No need for the MAC src dst
1595 main.h1.buildEther( src=main.h1.hostMac, dst=main.h2.hostMac )
1596 main.h1.buildARP( pdst=main.h2.hostIp )
1597
1598 main.log.info( "Starting filter on host2" )
1599 # Defaults to ip
1600 main.h2.startFilter( pktFilter="arp" )
1601
1602 main.log.info( "Sending packet to host2" )
Jon Hallfc951072017-05-24 15:55:34 -07001603 main.h1.sendPacket()
alisone14d7b02016-07-06 10:31:51 -07001604
1605 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -07001606 stepResult = main.h2.checkFilter()
alisone14d7b02016-07-06 10:31:51 -07001607 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -07001608 main.log.info( "Packet: %s" % main.h2.readPackets() )
alisone14d7b02016-07-06 10:31:51 -07001609 else:
Jon Hallfc951072017-05-24 15:55:34 -07001610 main.h2.killFilter()
alisone14d7b02016-07-06 10:31:51 -07001611
1612 main.log.info( "Clean up host components" )
1613 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001614 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -07001615 main.Mininet1.removeHostComponent( "h1" )
1616 main.Mininet1.removeHostComponent( "h2" )
1617
1618 utilities.assert_equals( expect=main.TRUE,
1619 actual=stepResult,
1620 onpass="Successfully sent a packet",
1621 onfail="Failed to send a packet" )
1622
1623 def CASE1800( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -07001624 """
alisone14d7b02016-07-06 10:31:51 -07001625 Add flows with a SCTP selector and verify the flow
Jon Hallfc951072017-05-24 15:55:34 -07001626 """
alisone14d7b02016-07-06 10:31:51 -07001627 import json
1628 import time
1629
1630 main.case( "Verify the UDP selector is correctly compiled on the flow" )
1631 main.caseExplanation = "Install a flow with only the UDP selector " + \
1632 "specified, verify the flow is added in ONOS, and finally " + \
1633 "send a UDP packet to verify the UDP selector is compiled correctly."
1634
1635 main.step( "Add a flow with a SCTP selector" )
1636
1637 main.log.info( "Creating host components" )
1638 main.Scapy.createHostComponent( "h1" )
1639 main.Scapy.createHostComponent( "h2" )
1640 hosts = [ main.h1, main.h2 ]
1641 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001642 host.startHostCli()
1643 host.startScapy()
1644 host.updateSelf()
alisone14d7b02016-07-06 10:31:51 -07001645
1646 # Add a flow that connects host1 on port1 to host2 on port2
1647 egress = 2
1648 ingress = 1
1649 # IPv4 etherType
1650 ethType = main.params[ 'TEST' ][ 'ip4Type' ]
1651 # IP protocol
1652 ipProto = main.params[ 'TEST' ][ 'sctpProto' ]
1653
Jon Hallfc951072017-05-24 15:55:34 -07001654 main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
alisone14d7b02016-07-06 10:31:51 -07001655 stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
1656 egressPort=egress,
1657 ingressPort=ingress,
1658 ethType=ethType,
1659 ipProto=ipProto,
1660 debug=main.debug )
1661
1662 utilities.assert_equals( expect=main.TRUE,
1663 actual=stepResult,
1664 onpass="Successfully added flows",
1665 onfail="Failed add flows" )
1666
1667 # Giving ONOS time to add the flow
1668 time.sleep( main.addFlowSleep )
1669
1670 main.step( "Check flow is in the ADDED state" )
1671
1672 main.log.info( "Get the flows from ONOS" )
1673 try:
Jon Hallfc951072017-05-24 15:55:34 -07001674 flows = json.loads( main.ONOSrest.flows() )
alisone14d7b02016-07-06 10:31:51 -07001675
1676 stepResult = main.TRUE
1677 for f in flows:
1678 if "rest" in f.get( "appId" ):
1679 if "ADDED" not in f.get( "state" ):
1680 stepResult = main.FALSE
Jon Hallfc951072017-05-24 15:55:34 -07001681 main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
alisone14d7b02016-07-06 10:31:51 -07001682 except TypeError:
1683 main.log.error( "No Flows found by the REST API" )
1684 stepResult = main.FALSE
1685 except ValueError:
1686 main.log.error( "Problem getting Flows state from REST API. Exiting test" )
Jon Hallfc951072017-05-24 15:55:34 -07001687 main.cleanup()
1688 main.exit()
alisone14d7b02016-07-06 10:31:51 -07001689
1690 utilities.assert_equals( expect=main.TRUE,
1691 actual=stepResult,
1692 onpass="All flows are in the ADDED state",
1693 onfail="All flows are NOT in the ADDED state" )
1694
1695 main.step( "Check flows are in Mininet's flow table" )
1696
1697 # get the flow IDs that were added through rest
1698 main.log.info( "Getting the flow IDs from ONOS" )
1699 flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
1700 # convert the flowIDs to ints then hex and finally back to strings
1701 flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
1702 main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
1703
1704 stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
1705
1706 utilities.assert_equals( expect=main.TRUE,
1707 actual=stepResult,
1708 onpass="All flows are in mininet",
1709 onfail="All flows are NOT in mininet" )
1710
1711 main.step( "Send a packet to verify the flow is correct" )
1712
1713 main.log.info( "Constructing packet" )
1714 # No need for the MAC src dst
1715 main.h1.buildEther( dst=main.h2.hostMac )
1716 main.h1.buildIP( dst=main.h2.hostIp )
Jon Hallfc951072017-05-24 15:55:34 -07001717 main.h1.buildSCTP()
alisone14d7b02016-07-06 10:31:51 -07001718
1719 main.log.info( "Starting filter on host2" )
1720 # Defaults to ip
1721 main.h2.startFilter( pktFilter="sctp" )
1722
1723 main.log.info( "Sending packet to host2" )
Jon Hallfc951072017-05-24 15:55:34 -07001724 main.h1.sendPacket()
alisone14d7b02016-07-06 10:31:51 -07001725
1726 main.log.info( "Checking filter for our packet" )
Jon Hallfc951072017-05-24 15:55:34 -07001727 stepResult = main.h2.checkFilter()
alisone14d7b02016-07-06 10:31:51 -07001728 if stepResult:
Jon Hallfc951072017-05-24 15:55:34 -07001729 main.log.info( "Packet: %s" % main.h2.readPackets() )
alisone14d7b02016-07-06 10:31:51 -07001730 else:
Jon Hallfc951072017-05-24 15:55:34 -07001731 main.h2.killFilter()
alisone14d7b02016-07-06 10:31:51 -07001732
1733 main.log.info( "Clean up host components" )
1734 for host in hosts:
Jon Hallfc951072017-05-24 15:55:34 -07001735 host.stopScapy()
alisone14d7b02016-07-06 10:31:51 -07001736 main.Mininet1.removeHostComponent( "h1" )
1737 main.Mininet1.removeHostComponent( "h2" )
1738
1739 utilities.assert_equals( expect=main.TRUE,
1740 actual=stepResult,
1741 onpass="Successfully sent a packet",
1742 onfail="Failed to send a packet" )
1743
GlennRC68449942015-10-16 16:03:12 -07001744 def CASE100( self, main ):
Jon Hallfc951072017-05-24 15:55:34 -07001745 """
GlennRC5147a422015-10-06 17:26:17 -07001746 Report errors/warnings/exceptions
Jon Hallfc951072017-05-24 15:55:34 -07001747 """
alisone14d7b02016-07-06 10:31:51 -07001748 main.log.info( "Error report: \n" )
GlennRC5147a422015-10-06 17:26:17 -07001749 main.ONOSbench.logReport( main.ONOSip[ 0 ],
1750 [ "INFO",
1751 "FOLLOWER",
1752 "WARN",
1753 "flow",
1754 "ERROR",
1755 "Except" ],
GlennRC68449942015-10-16 16:03:12 -07001756 "s" )