blob: 77ad5f9fdfb81c653e47dc962449076031e76364 [file] [log] [blame]
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001# Testing the basic intent functionality of ONOS
2
Jon Hall78be4962017-05-23 14:53:53 -07003
kelvin-onlabd48a68c2015-07-13 16:01:36 -07004class FUNCintent:
5
6 def __init__( self ):
7 self.default = ''
8
9 def CASE1( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -070010 import imp
Jon Hallf632d202015-07-30 15:45:11 -070011 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070012 """
13 - Construct tests variables
14 - GIT ( optional )
15 - Checkout ONOS master branch
16 - Pull latest ONOS code
17 - Building ONOS ( optional )
18 - Install ONOS package
19 - Build ONOS package
20 """
Devin Lim58046fa2017-07-05 16:55:00 -070021
22 try:
23 from tests.dependencies.ONOSSetup import ONOSSetup
24 main.testSetUp = ONOSSetup()
25 except ImportError:
26 main.log.error( "ONOSSetup not found. exiting the test" )
27 main.exit()
28 main.testSetUp.envSetupDescription()
kelvin-onlabd48a68c2015-07-13 16:01:36 -070029 stepResult = main.FALSE
30
31 # Test variables
Jon Halla3e02432015-07-24 15:55:42 -070032 try:
Jon Halla3e02432015-07-24 15:55:42 -070033 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
Jon Halla3e02432015-07-24 15:55:42 -070034 main.dependencyPath = main.testOnDirectory + \
35 main.params[ 'DEPENDENCY' ][ 'path' ]
36 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
37 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070038
Jon Halla3e02432015-07-24 15:55:42 -070039 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
40 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
41 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
42 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
43 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
acsmarscfa52272015-08-06 15:21:45 -070044 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
Jon Halla3e02432015-07-24 15:55:42 -070045 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
46 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
Shreyaca8990f2017-03-16 11:43:11 -070047 main.checkConnectionSleep = int( main.params[ 'SLEEP' ][ 'checkConnection' ] )
48 main.checkFlowCountSleep = int( main.params[ 'SLEEP' ][ 'checkFlowCount' ] )
49 main.checkIntentHostSleep = int( main.params[ 'SLEEP' ][ 'checkIntentHost' ] )
50 main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] )
acsmars59a4c552015-09-10 18:11:19 -070051 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
Jeremy Songster306ed7a2016-07-19 10:59:07 -070052 main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
Jon Halla3e02432015-07-24 15:55:42 -070053 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
54 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
Jon Halla3e02432015-07-24 15:55:42 -070055 main.hostsData = {}
Jeremy Songster1f39bf02016-01-20 17:17:25 -080056 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
57 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070058 main.assertReturnString = '' # Assembled assert return string
Jon Hall78be4962017-05-23 14:53:53 -070059 main.cycle = 0 # How many times FUNCintent has run through its tests
kelvin-onlabd48a68c2015-07-13 16:01:36 -070060
Jon Halla3e02432015-07-24 15:55:42 -070061 # -- INIT SECTION, ONLY RUNS ONCE -- #
kelvin-onlabd48a68c2015-07-13 16:01:36 -070062
Jon Hall78be4962017-05-23 14:53:53 -070063 main.intents = imp.load_source( wrapperFile2,
Jon Halla3e02432015-07-24 15:55:42 -070064 main.dependencyPath +
65 wrapperFile2 +
66 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070067
kelvin-onlabd9e23de2015-08-06 10:34:44 -070068 copyResult1 = main.ONOSbench.scp( main.Mininet1,
69 main.dependencyPath +
70 main.topology,
Jeremy Songster1f39bf02016-01-20 17:17:25 -080071 main.Mininet1.home + "custom/",
kelvin-onlabd9e23de2015-08-06 10:34:44 -070072 direction="to" )
Devin Lim58046fa2017-07-05 16:55:00 -070073
74 stepResult = main.testSetUp.envSetup( True )
Jon Halla3e02432015-07-24 15:55:42 -070075 except Exception as e:
Devin Lim58046fa2017-07-05 16:55:00 -070076 main.testSetUp.envSetupException( e )
77 main.testSetUp.evnSetupConclusion( stepResult )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070078
79 def CASE2( self, main ):
80 """
81 - Set up cell
82 - Create cell file
83 - Set cell file
84 - Verify cell file
85 - Kill ONOS process
86 - Uninstall ONOS cluster
87 - Verify ONOS start up
88 - Install ONOS cluster
89 - Connect to cli
90 """
Jeremy Songster17147f22016-05-31 18:30:52 -070091
Jeremycd872222016-03-29 10:08:34 -070092 main.flowCompiler = "Flow Rules"
Devin Lim58046fa2017-07-05 16:55:00 -070093 main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, True )
Jon Hall78be4962017-05-23 14:53:53 -070094 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -070095
Jon Halla3e02432015-07-24 15:55:42 -070096 def CASE8( self, main ):
97 """
acsmars59a4c552015-09-10 18:11:19 -070098 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -070099 """
Devin Lim58046fa2017-07-05 16:55:00 -0700100 import time
101 try:
102 from tests.dependencies.topology import Topology
103 except ImportError:
104 main.log.error( "Topology not found exiting the test" )
105 main.exit()
106 try:
107 main.topoRelated
108 except ( NameError, AttributeError ):
109 main.topoRelated = Topology()
110 main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700111 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700112 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700113 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700114 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700115 if main.initialized == main.FALSE:
116 main.log.error( "Test components did not start correctly, skipping further tests" )
117 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700118 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700119 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700120 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700121 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700122 "switches to test intents, exits out if " +\
123 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700124
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700125 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700126 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700127 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700128 main.topology,
129 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700130 stepResult = topoResult
131 utilities.assert_equals( expect=main.TRUE,
132 actual=stepResult,
133 onpass="Successfully loaded topology",
134 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700135
136 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700137 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700138 main.initialized = main.FALSE
139 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700140
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700141 def CASE11( self, main ):
142 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700143 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700144 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700145 if main.initialized == main.FALSE:
146 main.log.error( "Test components did not start correctly, skipping further tests" )
147 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700148 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700149 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700150 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700151 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700152 "switches to test intents, exits out if " +\
153 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700154
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700155 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700156 args = "--switch ovs,protocols=OpenFlow13"
157 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
158 main.topology,
159 args=args )
160 stepResult = topoResult
161 utilities.assert_equals( expect=main.TRUE,
162 actual=stepResult,
163 onpass="Successfully loaded topology",
164 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700165 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700166 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700167 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700168
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700169 def CASE12( self, main ):
170 """
171 Assign mastership to controllers
172 """
173 import re
174
Jeremyd9e4eb12016-04-13 12:09:06 -0700175 if main.initialized == main.FALSE:
176 main.log.error( "Test components did not start correctly, skipping further tests" )
177 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700178 main.case( "Assign switches to controllers" )
179 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700180 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700181 " switches to ONOS nodes"
182
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700183 switchList = []
184
185 # Creates a list switch name, use getSwitch() function later...
186 for i in range( 1, ( main.numSwitch + 1 ) ):
187 switchList.append( 's' + str( i ) )
188
189 tempONOSip = []
190 for i in range( main.numCtrls ):
191 tempONOSip.append( main.ONOSip[ i ] )
192
193 assignResult = main.Mininet1.assignSwController( sw=switchList,
194 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700195 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700196 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700197 main.log.error( "Problem assigning mastership of switches" )
198 main.initialized = main.FALSE
199 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700200
201 for i in range( 1, ( main.numSwitch + 1 ) ):
202 response = main.Mininet1.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700203 main.log.debug( "Response is " + str( response ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700204 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
205 assignResult = assignResult and main.TRUE
206 else:
207 assignResult = main.FALSE
208 stepResult = assignResult
209 utilities.assert_equals( expect=main.TRUE,
210 actual=stepResult,
211 onpass="Successfully assigned switches" +
212 "to controller",
213 onfail="Failed to assign switches to " +
214 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700215 if not stepResult:
216 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700217
Jon Hall78be4962017-05-23 14:53:53 -0700218 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700219 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800220 Create Scapy components
221 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700222 if main.initialized == main.FALSE:
223 main.log.error( "Test components did not start correctly, skipping further tests" )
224 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800225 main.case( "Create scapy components" )
226 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800227 scapyResult = main.TRUE
228 for hostName in main.scapyHostNames:
229 main.Scapy1.createHostComponent( hostName )
230 main.scapyHosts.append( getattr( main, hostName ) )
231
232 main.step( "Start scapy components" )
233 for host in main.scapyHosts:
234 host.startHostCli()
235 host.startScapy()
236 host.updateSelf()
237 main.log.debug( host.name )
238 main.log.debug( host.hostIp )
239 main.log.debug( host.hostMac )
240
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800241 utilities.assert_equals( expect=main.TRUE,
242 actual=scapyResult,
243 onpass="Successfully created Scapy Components",
244 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700245 if not scapyResult:
246 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800247
248 def CASE14( self, main ):
249 """
250 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700251 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700252 if main.initialized == main.FALSE:
253 main.log.error( "Test components did not start correctly, skipping further tests" )
254 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700255 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800256 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700257 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700258
Jon Hall78be4962017-05-23 14:53:53 -0700259 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
260 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700261 utilities.assert_equals( expect=main.TRUE,
262 actual=stepResult,
263 onpass="Successfully discovered hosts",
264 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700265 if not stepResult:
266 main.initialized = main.FALSE
267 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700268
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800269 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700270 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700271 utilities.assert_equals( expect=main.TRUE,
272 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800273 onpass="Successfully populated hostsData",
274 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700275 if not stepResult:
276 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800277
278 def CASE15( self, main ):
279 """
280 Discover all hosts with scapy arp packets and store its data to a dictionary
281 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700282 if main.initialized == main.FALSE:
283 main.log.error( "Test components did not start correctly, skipping further tests" )
284 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800285 main.case( "Discover all hosts using scapy" )
286 main.step( "Send packets from each host to the first host and confirm onos discovery" )
287
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800288 if len( main.scapyHosts ) < 1:
289 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700290 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800291 main.skipCase()
292
293 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700294 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800295
Jon Hall78be4962017-05-23 14:53:53 -0700296 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800297 retValue=main.FALSE, args=[ main ],
298 attempts=main.checkTopoAttempts, sleep=2 )
299
300 utilities.assert_equals( expect=main.TRUE,
301 actual=stepResult,
302 onpass="ONOS correctly discovered all hosts",
303 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700304 if not stepResult:
305 main.initialized = main.FALSE
306 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800307
308 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700309 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800310 utilities.assert_equals( expect=main.TRUE,
311 actual=stepResult,
312 onpass="Successfully populated hostsData",
313 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700314 if not stepResult:
315 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800316
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800317 def CASE16( self, main ):
318 """
Jeremy42df2e72016-02-23 16:37:46 -0800319 Balance Masters
320 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700321 if main.initialized == main.FALSE:
322 main.log.error( "Test components did not start correctly, skipping further tests" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700323 main.stop()
Jeremyd9e4eb12016-04-13 12:09:06 -0700324 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800325 main.case( "Balance mastership of switches" )
326 main.step( "Balancing mastership of switches" )
327
Jeremy42df2e72016-02-23 16:37:46 -0800328 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
329
330 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700331 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800332 onpass="Successfully balanced mastership of switches",
333 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700334 if not balanceResult:
335 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800336
337 def CASE17( self, main ):
338 """
Jeremy6e9748f2016-03-25 15:03:39 -0700339 Use Flow Objectives
340 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700341 if main.initialized == main.FALSE:
342 main.log.error( "Test components did not start correctly, skipping further tests" )
343 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700344 main.case( "Enable intent compilation using Flow Objectives" )
345 main.step( "Enabling Flow Objectives" )
346
347 main.flowCompiler = "Flow Objectives"
348
349 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
350
351 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
352 propName="useFlowObjectives", value="true" )
You Wang106d0fa2017-05-15 17:22:15 -0700353 stepResult &= main.CLIs[ 0 ].setCfg( component=cmd,
354 propName="defaultFlowObjectiveCompiler",
Jon Hall78be4962017-05-23 14:53:53 -0700355 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700356
357 utilities.assert_equals( expect=main.TRUE,
358 actual=stepResult,
359 onpass="Successfully activated Flow Objectives",
360 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700361 if not balanceResult:
362 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700363
364 def CASE18( self, main ):
365 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800366 Stop mininet and remove scapy host
367 """
Devin Lim58046fa2017-07-05 16:55:00 -0700368 try:
369 from tests.dependencies.utils import Utils
370 except ImportError:
371 main.log.error( "Utils not found exiting the test" )
372 main.exit()
373 try:
374 main.Utils
375 except ( NameError, AttributeError ):
376 main.Utils = Utils()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800377 main.log.report( "Stop Mininet and Scapy" )
378 main.case( "Stop Mininet and Scapy" )
379 main.caseExplanation = "Stopping the current mininet topology " +\
380 "to start up fresh"
381 main.step( "Stopping and Removing Scapy Host Components" )
382 scapyResult = main.TRUE
383 for host in main.scapyHosts:
384 scapyResult = scapyResult and host.stopScapy()
385 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
386
387 for host in main.scapyHosts:
388 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
389 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
390
391 main.scapyHosts = []
392 main.scapyHostIPs = []
393
394 utilities.assert_equals( expect=main.TRUE,
395 actual=scapyResult,
396 onpass="Successfully stopped scapy and removed host components",
397 onfail="Failed to stop mininet and scapy" )
398
Devin Lim58046fa2017-07-05 16:55:00 -0700399 mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700400 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800401 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700402 main.cleanup()
403 main.exit()
404
Jeremy Songster17147f22016-05-31 18:30:52 -0700405 def CASE19( self, main ):
406 """
407 Copy the karaf.log files after each testcase cycle
408 """
Devin Lim58046fa2017-07-05 16:55:00 -0700409 try:
410 from tests.dependencies.utils import Utils
411 except ImportError:
412 main.log.error( "Utils not found exiting the test" )
413 main.exit()
414 try:
415 main.Utils
416 except ( NameError, AttributeError ):
417 main.Utils = Utils()
418 main.Utils.copyKarafLog()
kelvin-onlabb769f562015-07-15 17:05:10 -0700419 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700420 """
421 Add host intents between 2 host:
422 - Discover hosts
423 - Add host intents
424 - Check intents
425 - Verify flows
426 - Ping hosts
427 - Reroute
428 - Link down
429 - Verify flows
430 - Check topology
431 - Ping hosts
432 - Link up
433 - Verify flows
434 - Check topology
435 - Ping hosts
436 - Remove intents
437 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700438 if main.initialized == main.FALSE:
439 main.log.error( "Test components did not start correctly, skipping further tests" )
440 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700441 # Assert variables - These variable's name|format must be followed
442 # if you want to use the wrapper function
443 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700444 try:
445 assert main.CLIs
446 except AssertionError:
447 main.log.error( "There is no main.CLIs, skipping test cases" )
448 main.initialized = main.FALSE
449 main.skipCase()
450 try:
451 assert main.Mininet1
452 except AssertionError:
453 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
454 main.initialized = main.FALSE
455 main.skipCase()
456 try:
457 assert main.numSwitch
458 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700459 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700460 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700461 main.initialized = main.FALSE
462 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700463
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800464 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700465 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
466
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700467 main.testName = "Host Intents"
468 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700469 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700470 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700471 str( main.numCtrls ) + " node(s) cluster;\n" +\
472 "Different type of hosts will be tested in " +\
473 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700474 "etc;\nThe test will use OF " + main.OFProtocol +\
475 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700476 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700477
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700478 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700479 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700480 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
481 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800482 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700483 installResult = main.intents.installHostIntent( main,
484 name="IPV4",
485 onosNode=0,
486 host1=host1,
487 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800488 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700489 testResult = main.intents.testHostIntent( main,
490 name="IPV4",
491 intentId=installResult,
492 onosNode=0,
493 host1=host1,
494 host2=host2,
495 sw1="s5",
496 sw2="s2",
497 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800498 else:
499 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800500
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700501 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800502 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700503 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700504 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700505
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700506 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700507 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700508 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700509 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800510 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700511 installResult = main.intents.installHostIntent( main,
512 name="DUALSTACK",
513 onosNode=0,
514 host1=host1,
515 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800516
517 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700518 testResult = main.intents.testHostIntent( main,
519 name="DUALSTACK",
520 intentId=installResult,
521 onosNode=0,
522 host1=host1,
523 host2=host2,
524 sw1="s5",
525 sw2="s2",
526 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700527
528 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800529 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700530 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700531 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700532
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700533 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700534 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700535 host1 = { "name": "h1" }
536 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800537 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700538 installResult = main.intents.installHostIntent( main,
539 name="DUALSTACK2",
540 onosNode=0,
541 host1=host1,
542 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800543
544 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700545 testResult = main.intents.testHostIntent( main,
546 name="DUALSTACK2",
547 intentId=installResult,
548 onosNode=0,
549 host1=host1,
550 host2=host2,
551 sw1="s5",
552 sw2="s2",
553 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800554 else:
555 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700556
557 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800558 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700559 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700560 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700561
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700562 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700563 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700564 host1 = { "name": "h1" }
565 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800566 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700567 installResult = main.intents.installHostIntent( main,
568 name="1HOP",
569 onosNode=0,
570 host1=host1,
571 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800572
573 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700574 testResult = main.intents.testHostIntent( main,
575 name="1HOP",
576 intentId=installResult,
577 onosNode=0,
578 host1=host1,
579 host2=host2,
580 sw1="s5",
581 sw2="s2",
582 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800583 else:
584 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700585
586 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800587 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700588 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700589 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700590
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700591 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700592 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700593 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
594 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800595 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700596 installResult = main.intents.installHostIntent( main,
597 name="VLAN1",
598 onosNode=0,
599 host1=host1,
600 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800601 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700602 testResult = main.intents.testHostIntent( main,
603 name="VLAN1",
604 intentId=installResult,
605 onosNode=0,
606 host1=host1,
607 host2=host2,
608 sw1="s5",
609 sw2="s2",
610 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800611 else:
612 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700613
614 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800615 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700616 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700617 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700618
Jeremy Songsterff553672016-05-12 17:06:23 -0700619 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
620 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700621 host1 = { "name": "h5", "vlan": "200" }
622 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700623 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700624 installResult = main.intents.installHostIntent( main,
625 name="VLAN2",
626 onosNode=0,
627 host1=host1,
628 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700629
630 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700631 testResult = main.intents.testHostIntent( main,
632 name="VLAN2",
633 intentId=installResult,
634 onosNode=0,
635 host1=host1,
636 host2=host2,
637 sw1="s5",
638 sw2="s2",
639 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700640 else:
641 main.CLIs[ 0 ].removeAllIntents( purge=True )
642
643 utilities.assert_equals( expect=main.TRUE,
644 actual=testResult,
645 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700646 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700647
Jeremy Songsterc032f162016-08-04 17:14:49 -0700648 main.step( "Encapsulation: Add host intents between h1 and h9" )
649 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700650 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
651 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700652 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700653 installResult = main.intents.installHostIntent( main,
654 name="ENCAPSULATION",
655 onosNode=0,
656 host1=host1,
657 host2=host2,
658 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700659 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700660 testResult = main.intents.testHostIntent( main,
661 name="ENCAPSULATION",
662 intentId=installResult,
663 onosNode=0,
664 host1=host1,
665 host2=host2,
666 sw1="s5",
667 sw2="s2",
668 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700669 else:
670 main.CLIs[ 0 ].removeAllIntents( purge=True )
671
672 utilities.assert_equals( expect=main.TRUE,
673 actual=testResult,
674 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700675 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700676
Jon Hall78be4962017-05-23 14:53:53 -0700677 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700678 # main.step( "Encapsulation: Add host intents between h1 and h9" )
679 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
680 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
681 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
682 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700683 # installResult = main.intents.installHostIntent( main,
684 # name="ENCAPSULATION",
685 # onosNode=0,
686 # host1=host1,
687 # host2=host2,
688 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700689 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700690 # testResult = main.intents.testHostIntent( main,
691 # name="ENCAPSULATION",
692 # intentId=installResult,
693 # onosNode=0,
694 # host1=host1,
695 # host2=host2,
696 # sw1="s5",
697 # sw2="s2",
698 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700699 # else:
700 # main.CLIs[ 0 ].removeAllIntents( purge=True )
701 #
702 # utilities.assert_equals( expect=main.TRUE,
703 # actual=testResult,
704 # onpass=main.assertReturnString,
705 # onfail=main.assertReturnString )
706
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700707 main.step( "Confirm that ONOS leadership is unchanged" )
acsmarse6b410f2015-07-17 14:39:34 -0700708 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700709 testResult = main.intents.checkLeaderChange( intentLeadersOld,
710 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700711
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800712 utilities.assert_equals( expect=main.TRUE,
713 actual=testResult,
714 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700715 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800716
Jon Hall78be4962017-05-23 14:53:53 -0700717 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700718
kelvin-onlabb769f562015-07-15 17:05:10 -0700719 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700720 """
721 Add point intents between 2 hosts:
722 - Get device ids | ports
723 - Add point intents
724 - Check intents
725 - Verify flows
726 - Ping hosts
727 - Reroute
728 - Link down
729 - Verify flows
730 - Check topology
731 - Ping hosts
732 - Link up
733 - Verify flows
734 - Check topology
735 - Ping hosts
736 - Remove intents
737 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700738 if main.initialized == main.FALSE:
739 main.log.error( "Test components did not start correctly, skipping further tests" )
740 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700741 # Assert variables - These variable's name|format must be followed
742 # if you want to use the wrapper function
743 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700744 try:
745 assert main.CLIs
746 except AssertionError:
747 main.log.error( "There is no main.CLIs, skipping test cases" )
748 main.initialized = main.FALSE
749 main.skipCase()
750 try:
751 assert main.Mininet1
752 except AssertionError:
753 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
754 main.initialized = main.FALSE
755 main.skipCase()
756 try:
757 assert main.numSwitch
758 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700759 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700760 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700761 main.initialized = main.FALSE
762 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700763
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700764 main.testName = "Point Intents"
765 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700766 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700767 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700768 " intents using " + str( main.numCtrls ) +\
769 " node(s) cluster;\n" +\
770 "Different type of hosts will be tested in " +\
771 "each step such as IPV4, Dual stack, VLAN etc" +\
772 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700773 " OVS running in Mininet and compile intents" +\
774 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700775
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700776 # No option point intents
777 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700778 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800779 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700780 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800781 ]
782 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700783 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800784 ]
Jeremy42df2e72016-02-23 16:37:46 -0800785 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700786 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700787 main,
788 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800789 senders=senders,
790 recipients=recipients )
791
792 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700793 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800794 main,
795 intentId=installResult,
796 name="NOOPTION",
797 senders=senders,
798 recipients=recipients,
799 sw1="s5",
800 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700801 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800802 else:
803 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700804
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700805 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800806 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700807 onpass=main.assertReturnString,
808 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700809
kelvin-onlabb769f562015-07-15 17:05:10 -0700810 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700811 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800812 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700813 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800814 ]
815 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700816 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800817 ]
Jeremy42df2e72016-02-23 16:37:46 -0800818 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700819 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700820 main,
821 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800822 senders=senders,
823 recipients=recipients,
824 ethType="IPV4" )
825
826 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700827 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800828 main,
829 intentId=installResult,
830 name="IPV4",
831 senders=senders,
832 recipients=recipients,
833 sw1="s5",
834 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700835 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800836 else:
837 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700838
839 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800840 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700841 onpass=main.assertReturnString,
842 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800843
Jon Hall78be4962017-05-23 14:53:53 -0700844 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800845 main.assertReturnString = "Assertion Result for protected point intent\n"
846 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700847 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800848 ]
849 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700850 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800851 ]
852 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700853 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800854 main,
855 name="Protected",
856 senders=senders,
857 recipients=recipients,
858 protected=True )
859
860 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700861 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800862 main,
863 name="Protected",
864 intentId=installResult,
865 senders=senders,
866 recipients=recipients,
867 sw1="s5",
868 sw2="s2",
869 protected=True,
870 expectedLink=18 )
871 else:
872 main.CLIs[ 0 ].removeAllIntents( purge=True )
873
874 utilities.assert_equals( expect=main.TRUE,
875 actual=testResult,
876 onpass=main.assertReturnString,
877 onfail=main.assertReturnString )
878
kelvin-onlabb769f562015-07-15 17:05:10 -0700879 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700880 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800881 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700882 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800883 ]
884 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700885 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800886 ]
Jeremy42df2e72016-02-23 16:37:46 -0800887 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700888 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700889 main,
890 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800891 senders=senders,
892 recipients=recipients,
893 ethType="IPV4" )
894
895 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700896 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800897 main,
898 intentId=installResult,
899 name="IPV4_2",
900 senders=senders,
901 recipients=recipients,
902 sw1="s5",
903 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700904 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800905 else:
906 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700907
908 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800909 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700910 onpass=main.assertReturnString,
911 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700912
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700913 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700914 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800915 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700916 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -0800917 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800918 ]
919 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700920 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -0800921 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800922 ]
Jeremy6f000c62016-02-25 17:02:28 -0800923 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700924 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800925 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
926 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800927 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700928 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800929 main,
930 name="SDNIP-ICMP",
931 senders=senders,
932 recipients=recipients,
933 ethType="IPV4",
934 ipProto=ipProto,
935 tcpSrc=tcpSrc,
936 tcpDst=tcpDst )
937
938 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700939 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800940 main,
941 intentId=installResult,
942 name="SDNIP_ICMP",
943 senders=senders,
944 recipients=recipients,
945 sw1="s5",
946 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700947 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700948 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800949 else:
950 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700951
952 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800953 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700954 onpass=main.assertReturnString,
955 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700956
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700957 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700958 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700959 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
960 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700961 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
962 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700963 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
964 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
965 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
966
Jon Hall78be4962017-05-23 14:53:53 -0700967 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700968 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700969 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700970 host1="h1",
971 host2="h9",
972 deviceId1="of:0000000000000005/1",
973 deviceId2="of:0000000000000006/1",
974 mac1=mac1,
975 mac2=mac2,
976 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700977 ipProto=ipProto,
978 ip1=ip1,
979 ip2=ip2,
980 tcp1=tcp1,
981 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -0700982
983 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -0800984 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -0700985 onpass=main.assertReturnString,
986 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700987
acsmars5d8cc862015-09-25 09:44:50 -0700988 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
989 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800990 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700991 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800992 ]
993 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700994 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800995 ]
Jeremy42df2e72016-02-23 16:37:46 -0800996 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700997 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700998 main,
999 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001000 senders=senders,
1001 recipients=recipients,
1002 ethType="IPV4" )
1003
1004 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001005 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001006 main,
1007 intentId=installResult,
1008 name="DUALSTACK1",
1009 senders=senders,
1010 recipients=recipients,
1011 sw1="s5",
1012 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001013 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001014 else:
1015 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001016
1017 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001018 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001019 onpass=main.assertReturnString,
1020 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001021
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001022 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001023 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001024 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001025 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001026 ]
1027 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001028 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001029 ]
Jeremy42df2e72016-02-23 16:37:46 -08001030 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001031 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001032 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001033 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001034 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001035 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001036
1037 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001038 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001039 main,
1040 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001041 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001042 senders=senders,
1043 recipients=recipients,
1044 sw1="s5",
1045 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001046 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001047
1048 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001049 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001050 onpass=main.assertReturnString,
1051 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001052
Jeremy Songsterff553672016-05-12 17:06:23 -07001053 main.step( "VLAN: Add point intents between h5 and h21" )
1054 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1055 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001056 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001057 ]
1058 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001059 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001060 ]
1061 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001062 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001063 main,
1064 name="VLAN2",
1065 senders=senders,
1066 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001067 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001068
1069 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001070 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001071 main,
1072 intentId=installResult,
1073 name="VLAN2",
1074 senders=senders,
1075 recipients=recipients,
1076 sw1="s5",
1077 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001078 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001079
1080 utilities.assert_equals( expect=main.TRUE,
1081 actual=testResult,
1082 onpass=main.assertReturnString,
1083 onfail=main.assertReturnString )
1084
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001085 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001086 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001087 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001088 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001089 ]
1090 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001091 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001092 ]
Jeremy42df2e72016-02-23 16:37:46 -08001093 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001094 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001095 main,
1096 name="1HOP IPV4",
1097 senders=senders,
1098 recipients=recipients,
1099 ethType="IPV4" )
1100
1101 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001102 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001103 main,
1104 intentId=installResult,
1105 name="1HOP IPV4",
1106 senders=senders,
1107 recipients=recipients,
1108 sw1="s5",
1109 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001110 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001111 else:
1112 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001113
1114 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001115 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001116 onpass=main.assertReturnString,
1117 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001118
Jeremy Songsterc032f162016-08-04 17:14:49 -07001119 main.step( "Add point to point intents using VLAN Encapsulation" )
1120 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1121 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001122 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001123 ]
1124 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001125 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001126 ]
1127 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001128 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001129 main,
1130 name="ENCAPSULATION",
1131 senders=senders,
1132 recipients=recipients,
1133 encap="VLAN" )
1134
1135 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001136 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001137 main,
1138 intentId=installResult,
1139 name="ENCAPSULATION",
1140 senders=senders,
1141 recipients=recipients,
1142 sw1="s5",
1143 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001144 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001145 else:
1146 main.CLIs[ 0 ].removeAllIntents( purge=True )
1147
1148 utilities.assert_equals( expect=main.TRUE,
1149 actual=testResult,
1150 onpass=main.assertReturnString,
1151 onfail=main.assertReturnString )
1152
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001153 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1154 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1155 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001156 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001157 ]
1158 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001159 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001160 ]
1161 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001162 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001163 main,
1164 name="NOOPTION",
1165 senders=senders,
1166 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001167 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001168
1169 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001170 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001171 main,
1172 intentId=installResult,
1173 name="NOOPTION",
1174 senders=senders,
1175 recipients=recipients,
1176 sw1="s5",
1177 sw2="s2",
1178 expectedLink=18 )
1179 else:
1180 main.CLIs[ 0 ].removeAllIntents( purge=True )
1181
1182 utilities.assert_equals( expect=main.TRUE,
1183 actual=testResult,
1184 onpass=main.assertReturnString,
1185 onfail=main.assertReturnString )
1186
Jon Hall78be4962017-05-23 14:53:53 -07001187 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001188 # main.step( "Add point to point intents using MPLS Encapsulation" )
1189 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1190 # senders = [
1191 # { "name": "h1", "device": "of:0000000000000005/1" }
1192 # ]
1193 # recipients = [
1194 # { "name": "h9", "device": "of:0000000000000006/1" }
1195 # ]
1196 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001197 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001198 # main,
1199 # name="ENCAPSULATION",
1200 # senders=senders,
1201 # recipients=recipients,
1202 # encap="MPLS" )
1203 #
1204 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001205 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001206 # main,
1207 # intentId=installResult,
1208 # name="ENCAPSULATION",
1209 # senders=senders,
1210 # recipients=recipients,
1211 # sw1="s5",
1212 # sw2="s2",
1213 # expectedLink=18 )
1214 # else:
1215 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1216 #
1217 # utilities.assert_equals( expect=main.TRUE,
1218 # actual=testResult,
1219 # onpass=main.assertReturnString,
1220 # onfail=main.assertReturnString )
1221
Jon Hall78be4962017-05-23 14:53:53 -07001222 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001223
kelvin-onlabb769f562015-07-15 17:05:10 -07001224 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001225 """
1226 Add single point to multi point intents
1227 - Get device ids
1228 - Add single point to multi point intents
1229 - Check intents
1230 - Verify flows
1231 - Ping hosts
1232 - Reroute
1233 - Link down
1234 - Verify flows
1235 - Check topology
1236 - Ping hosts
1237 - Link up
1238 - Verify flows
1239 - Check topology
1240 - Ping hosts
1241 - Remove intents
1242 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001243 if main.initialized == main.FALSE:
1244 main.log.error( "Test components did not start correctly, skipping further tests" )
1245 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001246 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001247 try:
1248 assert main.CLIs
1249 except AssertionError:
1250 main.log.error( "There is no main.CLIs, skipping test cases" )
1251 main.initialized = main.FALSE
1252 main.skipCase()
1253 try:
1254 assert main.Mininet1
1255 except AssertionError:
1256 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1257 main.initialized = main.FALSE
1258 main.skipCase()
1259 try:
1260 assert main.numSwitch
1261 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001262 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001263 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001264 main.initialized = main.FALSE
1265 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001266
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001267 main.testName = "Single to Multi Point Intents"
1268 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001269 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001270 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001271 " multi point intents using " +\
1272 str( main.numCtrls ) + " node(s) cluster;\n" +\
1273 "Different type of hosts will be tested in " +\
1274 "each step such as IPV4, Dual stack, VLAN etc" +\
1275 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001276 " OVS running in Mininet and compile intents" +\
1277 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001278
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001279 main.step( "NOOPTION: Install and test single point to multi point intents" )
1280 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1281 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001282 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001283 ]
1284 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001285 { "name": "h16", "device": "of:0000000000000006/8" },
1286 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001287 ]
Jon Hall9c888672017-05-15 18:03:54 -07001288 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1289 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001290 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001291 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001292 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001293 name="NOOPTION",
1294 senders=senders,
1295 recipients=recipients,
1296 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001297 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001298
1299 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001300 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001301 main,
1302 intentId=installResult,
1303 name="NOOPTION",
1304 senders=senders,
1305 recipients=recipients,
1306 badSenders=badSenders,
1307 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001308 sw1="s5",
1309 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001310 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001311 else:
1312 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001313
1314 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001315 actual=testResult,
1316 onpass=main.assertReturnString,
1317 onfail=main.assertReturnString )
1318
1319 main.step( "IPV4: Install and test single point to multi point intents" )
1320 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1321 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001322 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001323 ]
1324 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001325 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1326 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001327 ]
Jon Hall9c888672017-05-15 18:03:54 -07001328 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1329 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001330 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001331 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001332 main,
1333 name="IPV4",
1334 senders=senders,
1335 recipients=recipients,
1336 ethType="IPV4",
1337 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001338 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001339
1340 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001341 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001342 main,
1343 intentId=installResult,
1344 name="IPV4",
1345 senders=senders,
1346 recipients=recipients,
1347 badSenders=badSenders,
1348 badRecipients=badRecipients,
1349 sw1="s5",
1350 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001351 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001352 else:
1353 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001354
1355 utilities.assert_equals( expect=main.TRUE,
1356 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001357 onpass=main.assertReturnString,
1358 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001359
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001360 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001361 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and no MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001362 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001363 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001364 ]
1365 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001366 { "name": "h16", "device": "of:0000000000000006/8" },
1367 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001368 ]
Jon Hall9c888672017-05-15 18:03:54 -07001369 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1370 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001371 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001372 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001373 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001374 name="IPV4_2",
1375 senders=senders,
1376 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001377 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001378 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001379 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001380
1381 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001382 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001383 main,
1384 intentId=installResult,
1385 name="IPV4_2",
1386 senders=senders,
1387 recipients=recipients,
1388 badSenders=badSenders,
1389 badRecipients=badRecipients,
1390 sw1="s5",
1391 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001392 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001393 else:
1394 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001395
1396 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001397 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001398 onpass=main.assertReturnString,
1399 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001400
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001401 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001402 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses in the same VLAN\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001403 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001404 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001405 ]
1406 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001407 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1408 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001409 ]
Jon Hall9c888672017-05-15 18:03:54 -07001410 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1411 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001412 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001413 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001414 main,
alison52b25892016-09-19 10:53:48 -07001415 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001416 senders=senders,
1417 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001418 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001419 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001420
1421 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001422 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001423 main,
1424 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001425 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001426 senders=senders,
1427 recipients=recipients,
1428 badSenders=badSenders,
1429 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001430 sw1="s5",
1431 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001432 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001433 else:
1434 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001435
1436 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001437 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001438 onpass=main.assertReturnString,
1439 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001440
Jeremy Songsterff553672016-05-12 17:06:23 -07001441 main.step( "VLAN: Add single point to multi point intents" )
1442 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1443 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001444 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001445 ]
1446 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001447 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1448 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001449 ]
Jon Hall9c888672017-05-15 18:03:54 -07001450 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1451 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001452 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001453 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001454 main,
1455 name="VLAN2",
1456 senders=senders,
1457 recipients=recipients,
1458 sw1="s5",
1459 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001460 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001461
1462 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001463 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001464 main,
1465 intentId=installResult,
1466 name="VLAN2",
1467 senders=senders,
1468 recipients=recipients,
1469 badSenders=badSenders,
1470 badRecipients=badRecipients,
1471 sw1="s5",
1472 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001473 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001474 else:
1475 main.CLIs[ 0 ].removeAllIntents( purge=True )
1476
1477 utilities.assert_equals( expect=main.TRUE,
1478 actual=testResult,
1479 onpass=main.assertReturnString,
1480 onfail=main.assertReturnString )
1481
alison52b25892016-09-19 10:53:48 -07001482 # Does not support Single point to multi point encapsulation
1483 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1484 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1485 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001486 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001487 # ]
1488 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001489 # { "name": "h16", "device": "of:0000000000000006/8" },
1490 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001491 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001492 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1493 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001494 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001495 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001496 # main,
1497 # name="ENCAPSULATION",
1498 # senders=senders,
1499 # recipients=recipients,
1500 # sw1="s5",
1501 # sw2="s2",
1502 # encap="VLAN" )
1503 #
1504 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001505 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001506 # main,
1507 # intentId=installResult,
1508 # name="ENCAPSULATION",
1509 # senders=senders,
1510 # recipients=recipients,
1511 # badSenders=badSenders,
1512 # badRecipients=badRecipients,
1513 # sw1="s5",
1514 # sw2="s2",
1515 # expectedLink=18 )
1516 # else:
1517 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1518 #
1519 # utilities.assert_equals( expect=main.TRUE,
1520 # actual=testResult,
1521 # onpass=main.assertReturnString,
1522 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001523
Jon Hall78be4962017-05-23 14:53:53 -07001524 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001525
kelvin-onlabb769f562015-07-15 17:05:10 -07001526 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001527 """
1528 Add multi point to single point intents
1529 - Get device ids
1530 - Add multi point to single point intents
1531 - Check intents
1532 - Verify flows
1533 - Ping hosts
1534 - Reroute
1535 - Link down
1536 - Verify flows
1537 - Check topology
1538 - Ping hosts
1539 - Link up
1540 - Verify flows
1541 - Check topology
1542 - Ping hosts
1543 - Remove intents
1544 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001545 if main.initialized == main.FALSE:
1546 main.log.error( "Test components did not start correctly, skipping further tests" )
1547 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001548 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001549 try:
1550 assert main.CLIs
1551 except AssertionError:
1552 main.log.error( "There is no main.CLIs, skipping test cases" )
1553 main.initialized = main.FALSE
1554 main.skipCase()
1555 try:
1556 assert main.Mininet1
1557 except AssertionError:
1558 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1559 main.initialized = main.FALSE
1560 main.skipCase()
1561 try:
1562 assert main.numSwitch
1563 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001564 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001565 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001566 main.initialized = main.FALSE
1567 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001568
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001569 main.testName = "Multi To Single Point Intents"
1570 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001571 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001572 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001573 " multi point intents using " +\
1574 str( main.numCtrls ) + " node(s) cluster;\n" +\
1575 "Different type of hosts will be tested in " +\
1576 "each step such as IPV4, Dual stack, VLAN etc" +\
1577 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001578 " OVS running in Mininet and compile intents" +\
1579 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001580
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001581 main.step( "NOOPTION: Add multi point to single point intents" )
1582 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1583 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001584 { "name": "h16", "device": "of:0000000000000006/8" },
1585 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001586 ]
1587 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001588 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001589 ]
Jon Hall9c888672017-05-15 18:03:54 -07001590 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1591 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001592 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001593 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001594 main,
1595 name="NOOPTION",
1596 senders=senders,
1597 recipients=recipients,
1598 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001599 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001600
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001601 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001602 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001603 main,
1604 intentId=installResult,
1605 name="NOOPTION",
1606 senders=senders,
1607 recipients=recipients,
1608 badSenders=badSenders,
1609 badRecipients=badRecipients,
1610 sw1="s5",
1611 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001612 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001613 else:
1614 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001615
1616 utilities.assert_equals( expect=main.TRUE,
1617 actual=testResult,
1618 onpass=main.assertReturnString,
1619 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001620
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001621 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001622 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001623 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001624 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1625 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001626 ]
1627 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001628 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001629 ]
Jon Hall9c888672017-05-15 18:03:54 -07001630 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1631 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001632 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001633 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001634 main,
1635 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001636 senders=senders,
1637 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001638 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001639 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001640 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001641
1642 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001643 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001644 main,
1645 intentId=installResult,
1646 name="IPV4",
1647 senders=senders,
1648 recipients=recipients,
1649 badSenders=badSenders,
1650 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001651 sw1="s5",
1652 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001653 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001654 else:
1655 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001656
1657 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001658 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001659 onpass=main.assertReturnString,
1660 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001661
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001662 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001663 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001664 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001665 { "name": "h16", "device": "of:0000000000000006/8" },
1666 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001667 ]
1668 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001669 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001670 ]
Jon Hall9c888672017-05-15 18:03:54 -07001671 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1672 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001673 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001674 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001675 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001676 name="IPV4_2",
1677 senders=senders,
1678 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001679 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001680 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001681 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001682
1683 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001684 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001685 main,
1686 intentId=installResult,
1687 name="IPV4_2",
1688 senders=senders,
1689 recipients=recipients,
1690 badSenders=badSenders,
1691 badRecipients=badRecipients,
1692 sw1="s5",
1693 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001694 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001695 else:
1696 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001697
1698 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001699 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001700 onpass=main.assertReturnString,
1701 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001702
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001703 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001704 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses in the same VLAN\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001705 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001706 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1707 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001708 ]
1709 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001710 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001711 ]
Jon Hall9c888672017-05-15 18:03:54 -07001712 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1713 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001714 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001715 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001716 main,
1717 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001718 senders=senders,
1719 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001720 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001721 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001722
1723 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001724 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001725 main,
1726 intentId=installResult,
1727 name="VLAN",
1728 senders=senders,
1729 recipients=recipients,
1730 badSenders=badSenders,
1731 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001732 sw1="s5",
1733 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001734 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001735 else:
1736 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001737
1738 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001739 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001740 onpass=main.assertReturnString,
1741 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001742
Jeremy Songsterff553672016-05-12 17:06:23 -07001743 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1744 main.step( "VLAN: Add multi point to single point intents" )
1745 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1746 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001747 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1748 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001749 ]
1750 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001751 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001752 ]
Jon Hall9c888672017-05-15 18:03:54 -07001753 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1754 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001755 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001756 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001757 main,
1758 name="VLAN2",
1759 senders=senders,
1760 recipients=recipients,
1761 sw1="s5",
1762 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001763 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001764
1765 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001766 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001767 main,
1768 intentId=installResult,
1769 name="VLAN2",
1770 senders=senders,
1771 recipients=recipients,
1772 badSenders=badSenders,
1773 badRecipients=badRecipients,
1774 sw1="s5",
1775 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001776 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001777 else:
1778 main.CLIs[ 0 ].removeAllIntents( purge=True )
1779
1780 utilities.assert_equals( expect=main.TRUE,
1781 actual=testResult,
1782 onpass=main.assertReturnString,
1783 onfail=main.assertReturnString )
1784
Jeremy Songsterc032f162016-08-04 17:14:49 -07001785 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1786 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1787 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001788 { "name": "h16", "device": "of:0000000000000006/8" },
1789 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001790 ]
1791 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001792 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001793 ]
Jon Hall9c888672017-05-15 18:03:54 -07001794 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1795 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001796 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001797 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001798 main,
1799 name="ENCAPSULATION",
1800 senders=senders,
1801 recipients=recipients,
1802 sw1="s5",
1803 sw2="s2",
1804 encap="VLAN" )
1805
1806 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001807 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001808 main,
1809 intentId=installResult,
1810 name="ENCAPSULATION",
1811 senders=senders,
1812 recipients=recipients,
1813 badSenders=badSenders,
1814 badRecipients=badRecipients,
1815 sw1="s5",
1816 sw2="s2",
1817 expectedLink=18 )
1818 else:
1819 main.CLIs[ 0 ].removeAllIntents( purge=True )
1820
1821 utilities.assert_equals( expect=main.TRUE,
1822 actual=testResult,
1823 onpass=main.assertReturnString,
1824 onfail=main.assertReturnString )
1825
Jon Hall78be4962017-05-23 14:53:53 -07001826 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07001827 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
1828 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1829 #senders = [
1830 # { "name": "h16", "device": "of:0000000000000006/8" },
1831 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001832 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001833 #recipients = [
1834 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001835 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001836 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07001837 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07001838 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001839 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001840 # main,
1841 # name="ENCAPSULATION",
1842 # senders=senders,
1843 # recipients=recipients,
1844 # sw1="s5",
1845 # sw2="s2",
1846 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07001847 #
Shreyaca8990f2017-03-16 11:43:11 -07001848 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001849 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001850 # main,
1851 # intentId=installResult,
1852 # name="ENCAPSULATION",
1853 # senders=senders,
1854 # recipients=recipients,
1855 # badSenders=badSenders,
1856 # badRecipients=badRecipients,
1857 # sw1="s5",
1858 # sw2="s2",
1859 # expectedLink=18 )
1860 #else:
1861 # main.CLIs[ 0 ].removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001862 #
Shreyaca8990f2017-03-16 11:43:11 -07001863 #utilities.assert_equals( expect=main.TRUE,
1864 # actual=testResult,
1865 # onpass=main.assertReturnString,
1866 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07001867
Jon Hall78be4962017-05-23 14:53:53 -07001868 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001869
acsmars1ff5e052015-07-23 11:27:48 -07001870 def CASE5000( self, main ):
1871 """
acsmars5d8cc862015-09-25 09:44:50 -07001872 Tests Host Mobility
1873 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001874 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001875 if main.initialized == main.FALSE:
1876 main.log.error( "Test components did not start correctly, skipping further tests" )
1877 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001878 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001879 try:
1880 assert main.CLIs
1881 except AssertionError:
1882 main.log.error( "There is no main.CLIs, skipping test cases" )
1883 main.initialized = main.FALSE
1884 main.skipCase()
1885 try:
1886 assert main.Mininet1
1887 except AssertionError:
1888 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1889 main.initialized = main.FALSE
1890 main.skipCase()
1891 try:
1892 assert main.numSwitch
1893 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001894 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001895 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001896 main.initialized = main.FALSE
1897 main.skipCase()
alison52b25892016-09-19 10:53:48 -07001898 main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
1899 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001900 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001901
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001902 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07001903 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001904
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001905 # Send discovery ping from moved host
1906 # Moving the host brings down the default interfaces and creates a new one.
1907 # Scapy is restarted on this host to detect the new interface
1908 main.h1.stopScapy()
1909 main.h1.startScapy()
1910
1911 # Discover new host location in ONOS and populate host data.
1912 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001913 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1914 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001915
acsmars1ff5e052015-07-23 11:27:48 -07001916 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1917
1918 utilities.assert_equals( expect="of:0000000000000006",
1919 actual=h1PostMove,
1920 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001921 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001922 " to single point intents" +
1923 " with IPV4 type and MAC addresses" +
1924 " in the same VLAN" )
1925
1926 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001927 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001928 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1929 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001930 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001931 installResult = main.intents.installHostIntent( main,
1932 name="IPV4 Mobility IPV4",
1933 onosNode=0,
1934 host1=host1,
1935 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001936 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001937 testResult = main.intents.testHostIntent( main,
1938 name="Host Mobility IPV4",
1939 intentId=installResult,
1940 onosNode=0,
1941 host1=host1,
1942 host2=host2,
1943 sw1="s6",
1944 sw2="s2",
1945 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001946 else:
1947 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001948
1949 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001950 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001951 onpass=main.assertReturnString,
1952 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001953
Jon Hall78be4962017-05-23 14:53:53 -07001954 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001955
1956 def CASE6000( self, main ):
1957 """
1958 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1959 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001960 # At some later point discussion on this behavior in MPSP and SPMP intents
1961 # will be reoppened and this test case may need to be updated to reflect
1962 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001963 if main.initialized == main.FALSE:
1964 main.log.error( "Test components did not start correctly, skipping further tests" )
1965 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001966 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001967 try:
1968 assert main.CLIs
1969 except AssertionError:
1970 main.log.error( "There is no main.CLIs, skipping test cases" )
1971 main.initialized = main.FALSE
1972 main.skipCase()
1973 try:
1974 assert main.Mininet1
1975 except AssertionError:
1976 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1977 main.initialized = main.FALSE
1978 main.skipCase()
1979 try:
1980 assert main.numSwitch
1981 except AssertionError:
alison52b25892016-09-19 10:53:48 -07001982 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001983 main.initialized = main.FALSE
1984 main.skipCase()
alison52b25892016-09-19 10:53:48 -07001985 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
1986 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07001987 main.step( "Installing Multi to Single Point intents with no options set" )
1988 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1989 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08001990 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001991 { "name": "h16", "device": "of:0000000000000006/8" },
1992 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001993 ]
1994 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001995 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001996 ]
1997 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001998 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001999 ]
2000 isolatedRecipients = []
2001 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002002 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002003 main,
2004 name="NOOPTION",
2005 senders=senders,
2006 recipients=recipients,
2007 sw1="s5",
2008 sw2="s2" )
2009
2010 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002011 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002012 main,
2013 intentId=installResult,
2014 name="NOOPTION",
2015 senders=senders,
2016 recipients=recipients,
2017 isolatedSenders=isolatedSenders,
2018 isolatedRecipients=isolatedRecipients,
2019 sw1="s6",
2020 sw2="s2",
2021 sw3="s4",
2022 sw4="s1",
2023 sw5="s3",
2024 expectedLink1=16,
2025 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002026 else:
2027 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002028
2029 utilities.assert_equals( expect=main.TRUE,
2030 actual=testResult,
2031 onpass=main.assertReturnString,
2032 onfail=main.assertReturnString )
2033
Jeremy Songster9385d412016-06-02 17:57:36 -07002034 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2035
2036 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2037 "with partial failures allowed\n"
2038 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002039 { "name": "h16", "device": "of:0000000000000006/8" },
2040 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002041 ]
2042 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002043 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002044 ]
2045 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002046 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002047 ]
2048 isolatedRecipients = []
2049 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002050 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002051 main,
2052 name="NOOPTION",
2053 senders=senders,
2054 recipients=recipients,
2055 sw1="s5",
2056 sw2="s2",
2057 partial=True )
2058
2059 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002060 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002061 main,
2062 intentId=installResult,
2063 name="NOOPTION",
2064 senders=senders,
2065 recipients=recipients,
2066 isolatedSenders=isolatedSenders,
2067 isolatedRecipients=isolatedRecipients,
2068 sw1="s6",
2069 sw2="s2",
2070 sw3="s4",
2071 sw4="s1",
2072 sw5="s3",
2073 expectedLink1=16,
2074 expectedLink2=14,
2075 partial=True )
2076 else:
2077 main.CLIs[ 0 ].removeAllIntents( purge=True )
2078
2079 utilities.assert_equals( expect=main.TRUE,
2080 actual=testResult,
2081 onpass=main.assertReturnString,
2082 onfail=main.assertReturnString )
2083
Jeremye0cb5eb2016-01-27 17:39:09 -08002084 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002085 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2086 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002087 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002088 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002089 ]
2090 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002091 { "name": "h16", "device": "of:0000000000000006/8" },
2092 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002093 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002094 isolatedSenders = []
2095 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002096 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002097 ]
2098 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002099 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002100 main,
2101 name="NOOPTION",
2102 senders=senders,
2103 recipients=recipients,
2104 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002105 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002106
2107 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002108 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002109 main,
2110 intentId=installResult,
2111 name="NOOPTION",
2112 senders=senders,
2113 recipients=recipients,
2114 isolatedSenders=isolatedSenders,
2115 isolatedRecipients=isolatedRecipients,
2116 sw1="s6",
2117 sw2="s2",
2118 sw3="s4",
2119 sw4="s1",
2120 sw5="s3",
2121 expectedLink1=16,
2122 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002123 else:
2124 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002125
2126 utilities.assert_equals( expect=main.TRUE,
2127 actual=testResult,
2128 onpass=main.assertReturnString,
2129 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002130 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002131 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002132 "intents with partial failures allowed" )
2133 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2134 "point intent with partial failures allowed\n"
2135 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002136 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002137 ]
2138 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002139 { "name": "h16", "device": "of:0000000000000006/8" },
2140 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002141 ]
2142 isolatedSenders = []
2143 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002144 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002145 ]
2146 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002147 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002148 main,
2149 name="NOOPTION",
2150 senders=senders,
2151 recipients=recipients,
2152 sw1="s5",
2153 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002154 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002155
2156 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002157 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002158 main,
2159 intentId=installResult,
2160 name="NOOPTION",
2161 senders=senders,
2162 recipients=recipients,
2163 isolatedSenders=isolatedSenders,
2164 isolatedRecipients=isolatedRecipients,
2165 sw1="s6",
2166 sw2="s2",
2167 sw3="s4",
2168 sw4="s1",
2169 sw5="s3",
2170 expectedLink1=16,
2171 expectedLink2=14,
2172 partial=True )
2173 else:
2174 main.CLIs[ 0 ].removeAllIntents( purge=True )
2175
2176 utilities.assert_equals( expect=main.TRUE,
2177 actual=testResult,
2178 onpass=main.assertReturnString,
2179 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002180
Jon Hall78be4962017-05-23 14:53:53 -07002181 main.intents.report( main )