blob: 9c4928364e8379465f9f29b423b562f516a8bc3c [file] [log] [blame]
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -08001# Testing the basic intent for ipv6 functionality of ONOS
2
3class FUNCipv6Intent:
4
5 def __init__( self ):
6 self.default = ''
7
8 def CASE1( self, main ):
9 import time
10 import imp
11 import re
12
13 """
14 - Construct tests variables
15 - GIT ( optional )
16 - Checkout ONOS master branch
17 - Pull latest ONOS code
18 - Building ONOS ( optional )
19 - Install ONOS package
20 - Build ONOS package
21 """
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080022 main.case( "Constructing test variables and building ONOS package" )
23 main.step( "Constructing test variables" )
24 main.caseExplanation = "This test case is mainly for loading " +\
25 "from params file, and pull and build the " +\
26 " latest ONOS package"
27 stepResult = main.FALSE
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080028 # Test variables
29 try:
30 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
31 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
32 gitBranch = main.params[ 'GIT' ][ 'branch' ]
33 main.dependencyPath = main.testOnDirectory + \
34 main.params[ 'DEPENDENCY' ][ 'path' ]
35 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
36 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
37 if main.ONOSbench.maxNodes:
38 main.maxNodes = int( main.ONOSbench.maxNodes )
39 else:
40 main.maxNodes = 0
41 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
42 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
43 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
44 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
45 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
46 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
47 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
48 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
49 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
50 gitPull = main.params[ 'GIT' ][ 'pull' ]
51 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
52 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
53 main.cellData = {} # for creating cell file
54 main.hostsData = {}
55 main.CLIs = []
56 main.ONOSip = []
57 main.assertReturnString = '' # Assembled assert return string
58
59 main.ONOSip = main.ONOSbench.getOnosIps()
60 print main.ONOSip
61
62 # Assigning ONOS cli handles to a list
63 for i in range( 1, main.maxNodes + 1 ):
64 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
65
66 # -- INIT SECTION, ONLY RUNS ONCE -- #
67 main.startUp = imp.load_source( wrapperFile1,
68 main.dependencyPath +
69 wrapperFile1 +
70 ".py" )
71
72 main.intentFunction = imp.load_source( wrapperFile2,
73 main.dependencyPath +
74 wrapperFile2 +
75 ".py" )
76
77 main.topo = imp.load_source( wrapperFile3,
78 main.dependencyPath +
79 wrapperFile3 +
80 ".py" )
81
82 copyResult1 = main.ONOSbench.scp( main.Mininet1,
83 main.dependencyPath +
84 main.topology,
85 main.Mininet1.home,
86 direction="to" )
87 if main.CLIs:
88 stepResult = main.TRUE
89 else:
90 main.log.error( "Did not properly created list of ONOS CLI handle" )
91 stepResult = main.FALSE
92 except Exception as e:
93 main.log.exception(e)
94 main.cleanup()
95 main.exit()
96
97 utilities.assert_equals( expect=main.TRUE,
98 actual=stepResult,
99 onpass="Successfully construct " +
100 "test variables ",
101 onfail="Failed to construct test variables" )
102
103 if gitPull == 'True':
104 main.step( "Building ONOS in " + gitBranch + " branch" )
105 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
106 stepResult = onosBuildResult
107 utilities.assert_equals( expect=main.TRUE,
108 actual=stepResult,
109 onpass="Successfully compiled " +
110 "latest ONOS",
111 onfail="Failed to compile " +
112 "latest ONOS" )
113 else:
114 main.log.warn( "Did not pull new code so skipping mvn " +
115 "clean install" )
116 main.ONOSbench.getVersion( report=True )
117
118 def CASE2( self, main ):
119 """
120 - Set up cell
121 - Create cell file
122 - Set cell file
123 - Verify cell file
124 - Kill ONOS process
125 - Uninstall ONOS cluster
126 - Verify ONOS start up
127 - Install ONOS cluster
128 - Connect to cli
129 """
130
131 # main.scale[ 0 ] determines the current number of ONOS controller
132 main.numCtrls = int( main.scale[ 0 ] )
133
134 main.case( "Starting up " + str( main.numCtrls ) +
135 " node(s) ONOS cluster" )
136 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
137 " node(s) ONOS cluster"
138
139
140
141 #kill off all onos processes
142 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800143 " before initiating environment setup" )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800144
145 for i in range( main.maxNodes ):
146 main.ONOSbench.onosDie( main.ONOSip[ i ] )
147
148 print "NODE COUNT = ", main.numCtrls
149
150 tempOnosIp = []
151 for i in range( main.numCtrls ):
152 tempOnosIp.append( main.ONOSip[i] )
153
154 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
155 "temp", main.Mininet1.ip_address,
156 main.apps, tempOnosIp )
157
158 main.step( "Apply cell to environment" )
159 cellResult = main.ONOSbench.setCell( "temp" )
160 verifyResult = main.ONOSbench.verifyCell()
161 stepResult = cellResult and verifyResult
162 utilities.assert_equals( expect=main.TRUE,
163 actual=stepResult,
164 onpass="Successfully applied cell to " + \
165 "environment",
166 onfail="Failed to apply cell to environment " )
Jon Hall439c8912016-04-15 02:22:03 -0700167
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800168 main.step( "Creating ONOS package" )
169 packageResult = main.ONOSbench.onosPackage()
170 stepResult = packageResult
171 utilities.assert_equals( expect=main.TRUE,
172 actual=stepResult,
173 onpass="Successfully created ONOS package",
174 onfail="Failed to create ONOS package" )
175
176 time.sleep( main.startUpSleep )
177 main.step( "Uninstalling ONOS package" )
178 onosUninstallResult = main.TRUE
179 for ip in main.ONOSip:
180 onosUninstallResult = onosUninstallResult and \
181 main.ONOSbench.onosUninstall( nodeIp=ip )
182 stepResult = onosUninstallResult
183 utilities.assert_equals( expect=main.TRUE,
184 actual=stepResult,
185 onpass="Successfully uninstalled ONOS package",
186 onfail="Failed to uninstall ONOS package" )
187
188 time.sleep( main.startUpSleep )
189 main.step( "Installing ONOS package" )
190 onosInstallResult = main.TRUE
191 for i in range( main.numCtrls ):
192 onosInstallResult = onosInstallResult and \
193 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
194 stepResult = onosInstallResult
195 utilities.assert_equals( expect=main.TRUE,
196 actual=stepResult,
197 onpass="Successfully installed ONOS package",
198 onfail="Failed to install ONOS package" )
199
200 time.sleep( main.startUpSleep )
201 main.step( "Starting ONOS service" )
202 stopResult = main.TRUE
203 startResult = main.TRUE
204 onosIsUp = main.TRUE
205
206 for i in range( main.numCtrls ):
207 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
208 if onosIsUp == main.TRUE:
209 main.log.report( "ONOS instance is up and ready" )
210 else:
211 main.log.report( "ONOS instance may not be up, stop and " +
212 "start ONOS again " )
213
214 for i in range( main.numCtrls ):
215 stopResult = stopResult and \
216 main.ONOSbench.onosStop( main.ONOSip[ i ] )
217 for i in range( main.numCtrls ):
218 startResult = startResult and \
219 main.ONOSbench.onosStart( main.ONOSip[ i ] )
220 stepResult = onosIsUp and stopResult and startResult
221 utilities.assert_equals( expect=main.TRUE,
222 actual=stepResult,
223 onpass="ONOS service is ready",
224 onfail="ONOS service did not start properly" )
225
226 main.step( "Start ONOS cli" )
227 cliResult = main.TRUE
228 for i in range( main.numCtrls ):
229 cliResult = cliResult and \
230 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
231 stepResult = cliResult
232 utilities.assert_equals( expect=main.TRUE,
233 actual=stepResult,
234 onpass="Successfully start ONOS cli",
235 onfail="Failed to start ONOS cli" )
236
Jon Hall11845ed2016-02-11 11:25:31 -0800237 main.step( "Checking that ONOS is ready" )
sathishmad953462015-12-03 17:42:07 +0530238 for i in range( 3 ):
Jon Hall11845ed2016-02-11 11:25:31 -0800239 ready = True
Jeremy5f820072016-02-11 13:50:35 -0800240 for i in range( int( main.scale[ 0 ] ) ):
241 output = main.CLIs[ i ].summary()
Jon Hall11845ed2016-02-11 11:25:31 -0800242 if not output:
243 ready = False
244 time.sleep( 30 )
245 utilities.assert_equals( expect=True, actual=ready,
246 onpass="ONOS summary command succeded",
247 onfail="ONOS summary command failed" )
248 if not ready:
249 main.cleanup()
250 main.exit()
251
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530252 main.step( "setup the ipv6NeighbourDiscovery" )
253 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
254 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
255 cfgResult = cfgResult1 and cfgResult2
256 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
257 onpass="ipv6NeighborDiscovery cfg is set to true",
258 onfail="Failed to cfg set ipv6NeighborDiscovery" )
259
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800260 # Remove the first element in main.scale list
261 main.scale.remove( main.scale[ 0 ] )
262
263 main.intentFunction.report( main )
264
265 def CASE11( self, main ):
266 """
267 Start Mininet topology with OF 1.3 switches
268 """
269 main.OFProtocol = "1.3"
270 main.log.report( "Start Mininet topology with OF 1.3 switches" )
271 main.case( "Start Mininet topology with OF 1.3 switches" )
272 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
273 "switches to test intents, exits out if " +\
274 "topology did not start correctly"
275
276 main.step( "Starting Mininet topology with OF 1.3 switches" )
277 args = "--switch ovs,protocols=OpenFlow13"
278 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
279 main.topology,
280 args=args )
281 stepResult = topoResult
282 utilities.assert_equals( expect=main.TRUE,
283 actual=stepResult,
284 onpass="Successfully loaded topology",
285 onfail="Failed to load topology" )
286 # Exit if topology did not load properly
287 if not topoResult:
288 main.cleanup()
289 main.exit()
290
291 def CASE12( self, main ):
292 """
293 Assign mastership to controllers
294 """
295 import re
296
297 main.case( "Assign switches to controllers" )
298 main.step( "Assigning switches to controllers" )
299 main.caseExplanation = "Assign OF " + main.OFProtocol +\
300 " switches to ONOS nodes"
301
302 assignResult = main.TRUE
303 switchList = []
304
305 # Creates a list switch name, use getSwitch() function later...
306 for i in range( 1, ( main.numSwitch + 1 ) ):
307 switchList.append( 's' + str( i ) )
308
309 tempONOSip = []
310 for i in range( main.numCtrls ):
311 tempONOSip.append( main.ONOSip[ i ] )
312
313 assignResult = main.Mininet1.assignSwController( sw=switchList,
314 ip=tempONOSip,
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530315 port='6633' )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800316 if not assignResult:
317 main.cleanup()
318 main.exit()
319
320 for i in range( 1, ( main.numSwitch + 1 ) ):
321 response = main.Mininet1.getSwController( "s" + str( i ) )
322 print( "Response is " + str( response ) )
323 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
324 assignResult = assignResult and main.TRUE
325 else:
326 assignResult = main.FALSE
327 stepResult = assignResult
328 utilities.assert_equals( expect=main.TRUE,
329 actual=stepResult,
330 onpass="Successfully assigned switches" +
331 "to controller",
332 onfail="Failed to assign switches to " +
333 "controller" )
334
sathishmad953462015-12-03 17:42:07 +0530335 def CASE13( self, main ):
336 """
337 Discover all hosts and store its data to a dictionary
338 """
339 main.case( "Discover all hosts" )
340
341 stepResult = main.TRUE
342 main.step( "Discover all hosts using pingall " )
343 stepResult = main.intentFunction.getHostsData( main )
344 utilities.assert_equals( expect=main.TRUE,
345 actual=stepResult,
346 onpass="Successfully discovered hosts",
347 onfail="Failed to discover hosts" )
348
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800349 def CASE14( self, main ):
350 """
351 Stop mininet
352 """
353 main.log.report( "Stop Mininet topology" )
354 main.case( "Stop Mininet topology" )
355 main.caseExplanation = "Stopping the current mininet topology " +\
356 "to start up fresh"
357
358 main.step( "Stopping Mininet Topology" )
359 topoResult = main.Mininet1.stopNet( )
360 stepResult = topoResult
361 utilities.assert_equals( expect=main.TRUE,
362 actual=stepResult,
363 onpass="Successfully stop mininet",
364 onfail="Failed to stop mininet" )
365 # Exit if topology did not load properly
366 if not topoResult:
367 main.cleanup()
368 main.exit()
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530369
370 def CASE2000( self, main ):
371 """
372 add point intents between 2 hosts:
373 - Get device ids | ports
374 - Add point intents
375 - Check intents
376 - Verify flows
377 - Ping hosts
378 - Reroute
379 - Link down
380 - Verify flows
381 - Check topology
382 - Ping hosts
383 - Link up
384 - Verify flows
385 - Check topology
386 - Ping hosts
387 - Remove intents
388 """
389 import time
390 import json
391 import re
392
393 # Assert variables - These variable's name|format must be followed
394 # if you want to use the wrapper function
395 assert main, "There is no main"
396 assert main.CLIs, "There is no main.CLIs"
397 assert main.Mininet1, "Mininet handle should be named Mininet1"
398 assert main.numSwitch, "Placed the total number of switch topology in \
399 main.numSwitch"
400
401 main.testName = "Point Intents"
402 main.case( main.testName + " Test - " + str( main.numCtrls ) +
403 " NODE(S) - OF " + main.OFProtocol )
404 main.caseExplanation = "This test case will test point to point" +\
405 " intents using " + str( main.numCtrls ) +\
406 " node(s) cluster;\n" +\
407 "Different type of hosts will be tested in " +\
Jon Hall439c8912016-04-15 02:22:03 -0700408 "each step such as IPV6, Dual stack, VLAN etc" +\
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530409 ";\nThe test will use OF " + main.OFProtocol +\
410 " OVS running in Mininet"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530411 # No option point intents
412 main.step( "NOOPTION: Add point intents between h1 and h9, ipv6 hosts" )
413 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
414 stepResult = main.TRUE
415 stepResult = main.intentFunction.pointIntent(
416 main,
417 name="NOOPTION",
418 host1="h1",
419 host2="h9",
420 deviceId1="of:0000000000000005/1",
421 deviceId2="of:0000000000000006/1")
422
423 utilities.assert_equals( expect=main.TRUE,
424 actual=stepResult,
425 onpass=main.assertReturnString,
426 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530427 stepResult = main.TRUE
428 main.step( "IPV6: Add point intents between h1 and h9" )
429 main.assertReturnString = "Assertion Result for IPV6 point intent\n"
430 stepResult = main.intentFunction.pointIntent(
431 main,
432 name="IPV6",
433 host1="h1",
434 host2="h9",
435 deviceId1="of:0000000000000005/1",
436 deviceId2="of:0000000000000006/1",
437 port1="",
438 port2="",
439 ethType="IPV6",
440 mac1="00:00:00:00:00:01",
441 mac2="00:00:00:00:00:09",
442 bandwidth="",
443 lambdaAlloc=False,
444 ipProto="",
445 ip1="",
446 ip2="",
447 tcp1="",
448 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700449 sw1="s5",
450 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530451 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530452 utilities.assert_equals( expect=main.TRUE,
453 actual=stepResult,
454 onpass=main.assertReturnString,
455 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530456 main.step( "IPV6_2: Add point intents between h1 and h9" )
457 main.assertReturnString = "Assertion Result for IPV6 no mac address point intents\n"
458 stepResult = main.intentFunction.pointIntent(
459 main,
460 name="IPV6_2",
461 host1="h1",
462 host2="h9",
463 deviceId1="of:0000000000000005/1",
464 deviceId2="of:0000000000000006/1",
465 ipProto="",
466 ip1="",
467 ip2="",
468 tcp1="",
469 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700470 expectedLink="")
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530471 utilities.assert_equals( expect=main.TRUE,
472 actual=stepResult,
473 onpass=main.assertReturnString,
474 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530475 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
sathishmad953462015-12-03 17:42:07 +0530476 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV6 using ICMP point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530477 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
478 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
sathishmad953462015-12-03 17:42:07 +0530479 main.log.debug(mac2)
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530480 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
sathishmad953462015-12-03 17:42:07 +0530481 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
482 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530483 stepResult = main.intentFunction.pointIntent(
484 main,
485 name="SDNIP-ICMP",
486 host1="h1",
487 host2="h9",
488 deviceId1="of:0000000000000005/1",
489 deviceId2="of:0000000000000006/1",
490 mac1=mac1,
491 mac2=mac2,
492 ethType="IPV6",
493 ipProto=ipProto,
494 ip1=ip1,
495 ip2=ip2 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530496 utilities.assert_equals( expect=main.TRUE,
497 actual=stepResult,
498 onpass=main.assertReturnString,
499 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530500 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
sathishmad953462015-12-03 17:42:07 +0530501 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV6 using TCP point intents\n"
Jon Hall439c8912016-04-15 02:22:03 -0700502 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
503 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
504 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
505 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530506 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
507 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
508 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530509 stepResult = main.intentFunction.pointIntentTcp(
510 main,
511 name="SDNIP-TCP",
Jon Hall439c8912016-04-15 02:22:03 -0700512 host1="h1",
513 host2="h9",
514 deviceId1="of:0000000000000005/1",
515 deviceId2="of:0000000000000006/1",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530516 mac1=mac1,
517 mac2=mac2,
Jon Hall439c8912016-04-15 02:22:03 -0700518 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530519 ipProto=ipProto,
520 ip1=ip1,
521 ip2=ip2,
522 tcp1=tcp1,
Jon Hall439c8912016-04-15 02:22:03 -0700523 tcp2=tcp2,
524 sw1="",
525 sw2="",
526 expectedLink="" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530527 utilities.assert_equals( expect=main.TRUE,
sathishmad953462015-12-03 17:42:07 +0530528 actual=stepResult,
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530529 onpass=main.assertReturnString,
530 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530531 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
sathishmad953462015-12-03 17:42:07 +0530532 main.assertReturnString = "Assertion Result for Dualstack1 IPV6 with mac address point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530533 stepResult = main.intentFunction.pointIntent(
534 main,
535 name="DUALSTACK1",
536 host1="h3",
537 host2="h11",
sathishmad953462015-12-03 17:42:07 +0530538 deviceId1="of:0000000000000005/3",
539 deviceId2="of:0000000000000006/3",
540 port1="",
541 port2="",
542 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530543 mac1="00:00:00:00:00:03",
544 mac2="00:00:00:00:00:0B",
545 bandwidth="",
546 lambdaAlloc=False,
547 ipProto="",
548 ip1="",
549 ip2="",
550 tcp1="",
551 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700552 sw1="s5",
553 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530554 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530555 utilities.assert_equals( expect=main.TRUE,
556 actual=stepResult,
557 onpass=main.assertReturnString,
558 onfail=main.assertReturnString )
sathishmad953462015-12-03 17:42:07 +0530559 main.step( "VLAN: Add point intents between h5 and h24" )
560 main.assertReturnString = "Assertion Result for VLAN IPV6 with mac address point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530561 stepResult = main.intentFunction.pointIntent(
562 main,
563 name="VLAN",
564 host1="h5",
sathishmad953462015-12-03 17:42:07 +0530565 host2="h24",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530566 deviceId1="of:0000000000000005/5",
sathishmad953462015-12-03 17:42:07 +0530567 deviceId2="of:0000000000000007/8",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530568 port1="",
569 port2="",
sathishmad953462015-12-03 17:42:07 +0530570 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530571 mac1="00:00:00:00:00:05",
sathishmad953462015-12-03 17:42:07 +0530572 mac2="00:00:00:00:00:18",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530573 bandwidth="",
574 lambdaAlloc=False,
575 ipProto="",
576 ip1="",
577 ip2="",
578 tcp1="",
579 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700580 sw1="s5",
581 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530582 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530583 utilities.assert_equals( expect=main.TRUE,
584 actual=stepResult,
585 onpass=main.assertReturnString,
586 onfail=main.assertReturnString )
sathishmad953462015-12-03 17:42:07 +0530587 main.step( "1HOP: Add point intents between h1 and h9" )
588 main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530589 stepResult = main.intentFunction.hostIntent( main,
590 name='1HOP',
591 host1='h1',
592 host2='h9',
593 host1Id='00:00:00:00:00:01/-1',
594 host2Id='00:00:00:00:00:09/-1')
Jon Hall439c8912016-04-15 02:22:03 -0700595 utilities.assert_equals( expect=main.TRUE,
596 actual=stepResult,
597 onpass=main.assertReturnString,
598 onfail=main.assertReturnString )
599 main.intentFunction.report( main )
600
601 def CASE3000( self, main ):
602 """
603 Add single point to multi point intents
604 - Get device ids
605 - Add single point to multi point intents
606 - Check intents
607 - Verify flows
608 - Ping hosts
609 - Reroute
610 - Link down
611 - Verify flows
612 - Check topology
613 - Ping hosts
614 - Link up
615 - Verify flows
616 - Check topology
617 - Ping hosts
618 - Remove intents
619 """
620 import time
621 import json
622 import re
623 assert main, "There is no main"
624 assert main.CLIs, "There is no main.CLIs"
625 assert main.Mininet1, "Mininet handle should be named Mininet1"
626 assert main.numSwitch, "Placed the total number of switch topology in \
627 main.numSwitch"
628 main.testName = "Single to Multi Point Intents"
629 main.case( main.testName + " Test - " + str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol )
630 main.caseExplanation = "This test case will test single point to" +\
631 " multi point intents using " +\
632 str( main.numCtrls ) + " node(s) cluster;\n" +\
633 "Different type of hosts will be tested in " +\
634 "each step such as IPV6, Dual stack, VLAN etc" +\
635 ";\nThe test will use OF " + main.OFProtocol +\
636 " OVS running in Mininet "
637 main.step( "NOOPTION: Add single point to multi point intents" )
638 hostNames = [ 'h1', 'h9', 'h17' ]
639 devices = [ 'of:0000000000000005/1','of:0000000000000006/1', 'of:0000000000000007/1' ]
640 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with no options set\n"
641 stepResult = main.TRUE
642 stepResult = main.intentFunction.singleToMultiIntent(
643 main,
644 name="NOOPTION",
645 hostNames=hostNames,
646 devices=devices,
647 sw1="s5",
648 sw2="s2",
649 expectedLink=18)
650 utilities.assert_equals( expect=main.TRUE,
651 actual=stepResult,
652 onpass=main.assertReturnString,
653 onfail=main.assertReturnString )
654 main.step( "IPV6: Add single point to multi point intents" )
655 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses\n"
656 hostNames = [ 'h1', 'h9', 'h17' ]
657 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
658 macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
659 stepResult = main.TRUE
660 stepResult = main.intentFunction.singleToMultiIntent(
661 main,
662 name="IPV6",
663 hostNames=hostNames,
664 devices=devices,
665 macs=macs,
666 ethType="IPV6",
667 sw1="",
668 sw2="")
669 utilities.assert_equals( expect=main.TRUE,
670 actual=stepResult,
671 onpass=main.assertReturnString,
672 onfail=main.assertReturnString )
673 main.step( "IPV6_2: Add single point to multi point intents" )
674 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and no MAC addresses\n"
675 hostNames = [ 'h1', 'h9', 'h17' ]
676 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
677 stepResult = main.TRUE
678 stepResult = main.intentFunction.singleToMultiIntent(
679 main,
680 name="IPV6_2",
681 hostNames=hostNames,
682 devices=devices,
683 ethType="IPV6",
684 sw1="",
685 sw2="")
686 utilities.assert_equals( expect=main.TRUE,
687 actual=stepResult,
688 onpass=main.assertReturnString,
689 onfail=main.assertReturnString )
690 main.step( "VLAN: Add single point to multi point intents" )
691 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses in the same VLAN\n"
692 hostNames = [ 'h5', 'h24' ]
693 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
694 macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
695 stepResult = main.TRUE
696 stepResult = main.intentFunction.singleToMultiIntent(
697 main,
698 name="IPV6",
699 hostNames=hostNames,
700 devices=devices,
701 macs=macs,
702 ethType="IPV6",
703 sw1="",
704 sw2="")
705 utilities.assert_equals( expect=main.TRUE,
706 actual=stepResult,
707 onpass=main.assertReturnString,
708 onfail=main.assertReturnString )
709 main.intentFunction.report( main )
710
711 def CASE4000( self, main ):
712 """
713 Add multi point to single point intents
714 - Get device ids
715 - Add multi point to single point intents
716 - Check intents
717 - Verify flows
718 - Ping hosts
719 - Reroute
720 - Link down
721 - Verify flows
722 - Check topology
723 - Ping hosts
724 - Link up
725 - Verify flows
726 - Check topology
727 - Ping hosts
728 - Remove intents
729 """
730 assert main, "There is no main"
731 assert main.CLIs, "There is no main.CLIs"
732 assert main.Mininet1, "Mininet handle should be named Mininet1"
733 assert main.numSwitch, "Placed the total number of switch topology in \
734 main.numSwitch"
735
736 main.testName = "Multi To Single Point Intents"
737 main.case( main.testName + " Test - " + str( main.numCtrls ) +
738 " NODE(S) - OF " + main.OFProtocol )
739 main.caseExplanation = "This test case will test single point to" +\
740 " multi point intents using " +\
741 str( main.numCtrls ) + " node(s) cluster;\n" +\
742 "Different type of hosts will be tested in " +\
743 "each step such as IPV6, Dual stack, VLAN etc" +\
744 ";\nThe test will use OF " + main.OFProtocol +\
745 " OVS running in Mininet"
746
747 main.step( "NOOPTION: Add multi point to single point intents" )
748 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
749 stepResult = main.TRUE
750 hostNames = [ 'h17', 'h9' ]
751 devices = ['of:0000000000000007/1', 'of:0000000000000006/1' ]
752 stepResult = main.intentFunction.multiToSingleIntent(
753 main,
754 name="NOOPTION",
755 hostNames=hostNames,
756 devices=devices,
757 sw1="s6",
758 sw2="s2",
759 expectedLink=18 )
760 utilities.assert_equals( expect=main.TRUE,
761 actual=stepResult,
762 onpass=main.assertReturnString,
763 onfail=main.assertReturnString )
764 main.step( "IPV6: Add multi point to single point intents" )
765 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and MAC addresses\n"
766 hostNames = [ 'h1', 'h9', 'h17' ]
767 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
768 macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
769 stepResult = main.TRUE
770 installResult = main.intentFunction.multiToSingleIntent(
771 main,
772 name="IPV6",
773 hostNames=hostNames,
774 devices=devices,
775 macs=macs,
776 ethType="IPV6",
777 sw1="",
778 sw2="",
779 expectedLink="" )
780 utilities.assert_equals( expect=main.TRUE,
781 actual=stepResult,
782 onpass=main.assertReturnString,
783 onfail=main.assertReturnString )
784 main.step( "IPV6_2: Add multi point to single point intents" )
785 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses\n"
786 hostNames = [ 'h1', 'h9' ]
787 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1' ]
788 stepResult = main.TRUE
789 stepResult = main.intentFunction.multiToSingleIntent(
790 main,
791 name="IPV6_2",
792 hostNames=hostNames,
793 devices=devices,
794 ethType="IPV6",
795 sw1="",
796 sw2="",
797 expectedLink="")
798 utilities.assert_equals( expect=main.TRUE,
799 actual=stepResult,
800 onpass=main.assertReturnString,
801 onfail=main.assertReturnString )
802
803 main.step( "VLAN: Add multi point to single point intents" )
804 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses in the same VLAN\n"
805 hostNames = [ 'h5', 'h24' ]
806 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
807 macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
808 stepResult = main.TRUE
809 stepResult = main.intentFunction.multiToSingleIntent(
810 main,
811 name="VLAN",
812 hostNames=hostNames,
813 devices=devices,
814 macs=macs,
815 ethType="IPV6",
816 sw1="",
817 sw2="",
818 expectedLink="")
819 utilities.assert_equals( expect=main.TRUE,
820 actual=stepResult,
821 onpass=main.assertReturnString,
822 onfail=main.assertReturnString )
823 main.intentFunction.report( main )
824
825 def CASE5000( self, main ):
826 """
827 Tests Host Mobility
828 Modifies the topology location of h1
829 """
830 assert main, "There is no main"
831 assert main.CLIs, "There is no main.CLIs"
832 assert main.Mininet1, "Mininet handle should be named Mininet1"
833 assert main.numSwitch, "Placed the total number of switch topology in \
834 main.numSwitch"
835 main.case( "Test host mobility with host intents " )
836 main.step( "Testing host mobility by moving h1 from s5 to s6" )
837 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
838
839 main.log.info( "Moving h1 from s5 to s6")
840 main.Mininet1.moveHostv6( "h1","s5","s6" )
841 main.intentFunction.getHostsData( main )
842 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
843
844 utilities.assert_equals( expect="of:0000000000000006",
845 actual=h1PostMove,
846 onpass="Mobility: Successfully moved h1 to s6",
847 onfail="Mobility: Failed to move h1 to s6" +
848 " to single point intents" +
849 " with IPV6 type and MAC addresses" +
850 " in the same VLAN" )
851 main.step( "IPV6: Add host intents between h1 and h9" )
852 main.assertReturnString = "Assert result for IPV6 host intent between h1, moved, and h9\n"
853 stepResult = main.TRUE
854 stepResult = main.intentFunction.hostIntent( main,
855 name='IPV6 Mobility IPV6',
856 host1='h1',
857 host2='h9',
858 host1Id='00:00:00:00:00:01/-1',
859 host2Id='00:00:00:00:00:09/-1')
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530860
861 utilities.assert_equals( expect=main.TRUE,
862 actual=stepResult,
863 onpass=main.assertReturnString,
864 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530865 main.intentFunction.report( main )