blob: 9de5740854e4a40423453d764712c5998417983b [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
2Copyright 2015 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
kelvin-onlabd48a68c2015-07-13 16:01:36 -070022# Testing the basic intent functionality of ONOS
23
Jon Hall78be4962017-05-23 14:53:53 -070024
kelvin-onlabd48a68c2015-07-13 16:01:36 -070025class FUNCintent:
26
27 def __init__( self ):
28 self.default = ''
29
30 def CASE1( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -070031 import imp
Jon Hallf632d202015-07-30 15:45:11 -070032 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070033 """
34 - Construct tests variables
35 - GIT ( optional )
36 - Checkout ONOS master branch
37 - Pull latest ONOS code
38 - Building ONOS ( optional )
39 - Install ONOS package
40 - Build ONOS package
41 """
Devin Lim58046fa2017-07-05 16:55:00 -070042
43 try:
44 from tests.dependencies.ONOSSetup import ONOSSetup
45 main.testSetUp = ONOSSetup()
46 except ImportError:
47 main.log.error( "ONOSSetup not found. exiting the test" )
48 main.exit()
49 main.testSetUp.envSetupDescription()
kelvin-onlabd48a68c2015-07-13 16:01:36 -070050 stepResult = main.FALSE
51
52 # Test variables
Jon Halla3e02432015-07-24 15:55:42 -070053 try:
Jon Halla3e02432015-07-24 15:55:42 -070054 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
Jon Halla3e02432015-07-24 15:55:42 -070055 main.dependencyPath = main.testOnDirectory + \
56 main.params[ 'DEPENDENCY' ][ 'path' ]
57 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
58 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070059
Jon Halla3e02432015-07-24 15:55:42 -070060 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
61 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
62 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
63 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
64 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
acsmarscfa52272015-08-06 15:21:45 -070065 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
Jon Halla3e02432015-07-24 15:55:42 -070066 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
67 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
Shreyaca8990f2017-03-16 11:43:11 -070068 main.checkConnectionSleep = int( main.params[ 'SLEEP' ][ 'checkConnection' ] )
69 main.checkFlowCountSleep = int( main.params[ 'SLEEP' ][ 'checkFlowCount' ] )
70 main.checkIntentHostSleep = int( main.params[ 'SLEEP' ][ 'checkIntentHost' ] )
71 main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] )
acsmars59a4c552015-09-10 18:11:19 -070072 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
Jeremy Songster306ed7a2016-07-19 10:59:07 -070073 main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
Jon Halla3e02432015-07-24 15:55:42 -070074 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
75 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
Jon Halla3e02432015-07-24 15:55:42 -070076 main.hostsData = {}
Jeremy Songster1f39bf02016-01-20 17:17:25 -080077 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
78 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070079 main.assertReturnString = '' # Assembled assert return string
Jon Hall78be4962017-05-23 14:53:53 -070080 main.cycle = 0 # How many times FUNCintent has run through its tests
kelvin-onlabd48a68c2015-07-13 16:01:36 -070081
Jon Halla3e02432015-07-24 15:55:42 -070082 # -- INIT SECTION, ONLY RUNS ONCE -- #
kelvin-onlabd48a68c2015-07-13 16:01:36 -070083
Jon Hall78be4962017-05-23 14:53:53 -070084 main.intents = imp.load_source( wrapperFile2,
Jon Halla3e02432015-07-24 15:55:42 -070085 main.dependencyPath +
86 wrapperFile2 +
87 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070088
kelvin-onlabd9e23de2015-08-06 10:34:44 -070089 copyResult1 = main.ONOSbench.scp( main.Mininet1,
90 main.dependencyPath +
91 main.topology,
Jeremy Songster1f39bf02016-01-20 17:17:25 -080092 main.Mininet1.home + "custom/",
kelvin-onlabd9e23de2015-08-06 10:34:44 -070093 direction="to" )
Devin Lim58046fa2017-07-05 16:55:00 -070094
Devin Lim142b5342017-07-20 15:22:39 -070095 stepResult = main.testSetUp.envSetup()
Jon Halla3e02432015-07-24 15:55:42 -070096 except Exception as e:
Devin Lim58046fa2017-07-05 16:55:00 -070097 main.testSetUp.envSetupException( e )
98 main.testSetUp.evnSetupConclusion( stepResult )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070099
100 def CASE2( self, main ):
101 """
102 - Set up cell
103 - Create cell file
104 - Set cell file
105 - Verify cell file
106 - Kill ONOS process
107 - Uninstall ONOS cluster
108 - Verify ONOS start up
109 - Install ONOS cluster
110 - Connect to cli
111 """
Jeremy Songster17147f22016-05-31 18:30:52 -0700112
Jeremycd872222016-03-29 10:08:34 -0700113 main.flowCompiler = "Flow Rules"
Devin Lim142b5342017-07-20 15:22:39 -0700114 main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True )
Jon Hall78be4962017-05-23 14:53:53 -0700115 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700116
Jon Halla3e02432015-07-24 15:55:42 -0700117 def CASE8( self, main ):
118 """
acsmars59a4c552015-09-10 18:11:19 -0700119 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700120 """
Devin Lim58046fa2017-07-05 16:55:00 -0700121 import time
122 try:
123 from tests.dependencies.topology import Topology
124 except ImportError:
125 main.log.error( "Topology not found exiting the test" )
126 main.exit()
127 try:
128 main.topoRelated
129 except ( NameError, AttributeError ):
130 main.topoRelated = Topology()
131 main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700132 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700133 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700134 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700135 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700136 if main.initialized == main.FALSE:
137 main.log.error( "Test components did not start correctly, skipping further tests" )
138 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700139 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700140 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700141 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700142 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700143 "switches to test intents, exits out if " +\
144 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700145
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700146 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700147 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700148 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700149 main.topology,
150 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700151 stepResult = topoResult
152 utilities.assert_equals( expect=main.TRUE,
153 actual=stepResult,
154 onpass="Successfully loaded topology",
155 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700156
157 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700158 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700159 main.initialized = main.FALSE
160 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700161
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700162 def CASE11( self, main ):
163 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700164 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700165 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700166 if main.initialized == main.FALSE:
167 main.log.error( "Test components did not start correctly, skipping further tests" )
168 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700169 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700170 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700171 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700172 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700173 "switches to test intents, exits out if " +\
174 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700175
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700176 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700177 args = "--switch ovs,protocols=OpenFlow13"
178 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
179 main.topology,
180 args=args )
181 stepResult = topoResult
182 utilities.assert_equals( expect=main.TRUE,
183 actual=stepResult,
184 onpass="Successfully loaded topology",
185 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700186 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700187 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700188 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700189
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700190 def CASE12( self, main ):
191 """
192 Assign mastership to controllers
193 """
194 import re
195
Jeremyd9e4eb12016-04-13 12:09:06 -0700196 if main.initialized == main.FALSE:
197 main.log.error( "Test components did not start correctly, skipping further tests" )
198 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700199 main.case( "Assign switches to controllers" )
200 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700201 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700202 " switches to ONOS nodes"
203
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700204 switchList = []
205
206 # Creates a list switch name, use getSwitch() function later...
207 for i in range( 1, ( main.numSwitch + 1 ) ):
208 switchList.append( 's' + str( i ) )
209
Devin Lim142b5342017-07-20 15:22:39 -0700210 tempONOSip = main.Cluster.getIps()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700211
212 assignResult = main.Mininet1.assignSwController( sw=switchList,
213 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700214 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700215 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700216 main.log.error( "Problem assigning mastership of switches" )
217 main.initialized = main.FALSE
218 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700219
220 for i in range( 1, ( main.numSwitch + 1 ) ):
221 response = main.Mininet1.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700222 main.log.debug( "Response is " + str( response ) )
Devin Lim142b5342017-07-20 15:22:39 -0700223 if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700224 assignResult = assignResult and main.TRUE
225 else:
226 assignResult = main.FALSE
227 stepResult = assignResult
228 utilities.assert_equals( expect=main.TRUE,
229 actual=stepResult,
230 onpass="Successfully assigned switches" +
231 "to controller",
232 onfail="Failed to assign switches to " +
233 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700234 if not stepResult:
235 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700236
Jon Hall78be4962017-05-23 14:53:53 -0700237 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700238 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800239 Create Scapy components
240 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700241 if main.initialized == main.FALSE:
242 main.log.error( "Test components did not start correctly, skipping further tests" )
243 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800244 main.case( "Create scapy components" )
245 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800246 scapyResult = main.TRUE
247 for hostName in main.scapyHostNames:
248 main.Scapy1.createHostComponent( hostName )
249 main.scapyHosts.append( getattr( main, hostName ) )
250
251 main.step( "Start scapy components" )
252 for host in main.scapyHosts:
253 host.startHostCli()
254 host.startScapy()
255 host.updateSelf()
256 main.log.debug( host.name )
257 main.log.debug( host.hostIp )
258 main.log.debug( host.hostMac )
259
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800260 utilities.assert_equals( expect=main.TRUE,
261 actual=scapyResult,
262 onpass="Successfully created Scapy Components",
263 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700264 if not scapyResult:
265 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800266
267 def CASE14( self, main ):
268 """
269 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700270 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700271 if main.initialized == main.FALSE:
272 main.log.error( "Test components did not start correctly, skipping further tests" )
273 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700274 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800275 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700276 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700277
Jon Hall78be4962017-05-23 14:53:53 -0700278 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
279 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700280 utilities.assert_equals( expect=main.TRUE,
281 actual=stepResult,
282 onpass="Successfully discovered hosts",
283 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700284 if not stepResult:
285 main.initialized = main.FALSE
286 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700287
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800288 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700289 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700290 utilities.assert_equals( expect=main.TRUE,
291 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800292 onpass="Successfully populated hostsData",
293 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700294 if not stepResult:
295 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800296
297 def CASE15( self, main ):
298 """
299 Discover all hosts with scapy arp packets and store its data to a dictionary
300 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700301 if main.initialized == main.FALSE:
302 main.log.error( "Test components did not start correctly, skipping further tests" )
303 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800304 main.case( "Discover all hosts using scapy" )
305 main.step( "Send packets from each host to the first host and confirm onos discovery" )
306
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800307 if len( main.scapyHosts ) < 1:
308 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700309 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800310 main.skipCase()
311
312 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700313 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800314
Jon Hall78be4962017-05-23 14:53:53 -0700315 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800316 retValue=main.FALSE, args=[ main ],
317 attempts=main.checkTopoAttempts, sleep=2 )
318
319 utilities.assert_equals( expect=main.TRUE,
320 actual=stepResult,
321 onpass="ONOS correctly discovered all hosts",
322 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700323 if not stepResult:
324 main.initialized = main.FALSE
325 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800326
327 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700328 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800329 utilities.assert_equals( expect=main.TRUE,
330 actual=stepResult,
331 onpass="Successfully populated hostsData",
332 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700333 if not stepResult:
334 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800335
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800336 def CASE16( self, main ):
337 """
Jeremy42df2e72016-02-23 16:37:46 -0800338 Balance Masters
339 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700340 if main.initialized == main.FALSE:
341 main.log.error( "Test components did not start correctly, skipping further tests" )
342 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800343 main.case( "Balance mastership of switches" )
344 main.step( "Balancing mastership of switches" )
345
Devin Lim142b5342017-07-20 15:22:39 -0700346 balanceResult = utilities.retry( f=main.Cluster.active( 0 ).CLI.balanceMasters, retValue=main.FALSE, args=[] )
Jeremy42df2e72016-02-23 16:37:46 -0800347
348 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700349 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800350 onpass="Successfully balanced mastership of switches",
351 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700352 if not balanceResult:
353 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800354
355 def CASE17( self, main ):
356 """
Jeremy6e9748f2016-03-25 15:03:39 -0700357 Use Flow Objectives
358 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700359 if main.initialized == main.FALSE:
360 main.log.error( "Test components did not start correctly, skipping further tests" )
361 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700362 main.case( "Enable intent compilation using Flow Objectives" )
363 main.step( "Enabling Flow Objectives" )
364
365 main.flowCompiler = "Flow Objectives"
366
367 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
368
Devin Lim142b5342017-07-20 15:22:39 -0700369 stepResult = main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
Jeremy6e9748f2016-03-25 15:03:39 -0700370 propName="useFlowObjectives", value="true" )
Devin Lim142b5342017-07-20 15:22:39 -0700371 stepResult &= main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
You Wang106d0fa2017-05-15 17:22:15 -0700372 propName="defaultFlowObjectiveCompiler",
Jon Hall78be4962017-05-23 14:53:53 -0700373 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700374
375 utilities.assert_equals( expect=main.TRUE,
376 actual=stepResult,
377 onpass="Successfully activated Flow Objectives",
378 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700379 if not balanceResult:
380 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700381
382 def CASE18( self, main ):
383 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800384 Stop mininet and remove scapy host
385 """
Devin Lim58046fa2017-07-05 16:55:00 -0700386 try:
387 from tests.dependencies.utils import Utils
388 except ImportError:
389 main.log.error( "Utils not found exiting the test" )
390 main.exit()
391 try:
392 main.Utils
393 except ( NameError, AttributeError ):
394 main.Utils = Utils()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800395 main.log.report( "Stop Mininet and Scapy" )
396 main.case( "Stop Mininet and Scapy" )
397 main.caseExplanation = "Stopping the current mininet topology " +\
398 "to start up fresh"
399 main.step( "Stopping and Removing Scapy Host Components" )
400 scapyResult = main.TRUE
401 for host in main.scapyHosts:
402 scapyResult = scapyResult and host.stopScapy()
403 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
404
405 for host in main.scapyHosts:
406 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
407 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
408
409 main.scapyHosts = []
410 main.scapyHostIPs = []
411
412 utilities.assert_equals( expect=main.TRUE,
413 actual=scapyResult,
414 onpass="Successfully stopped scapy and removed host components",
415 onfail="Failed to stop mininet and scapy" )
416
Devin Lim58046fa2017-07-05 16:55:00 -0700417 mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700418 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800419 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700420 main.cleanup()
421 main.exit()
422
Jeremy Songster17147f22016-05-31 18:30:52 -0700423 def CASE19( self, main ):
424 """
425 Copy the karaf.log files after each testcase cycle
426 """
Devin Lim58046fa2017-07-05 16:55:00 -0700427 try:
428 from tests.dependencies.utils import Utils
429 except ImportError:
430 main.log.error( "Utils not found exiting the test" )
431 main.exit()
432 try:
433 main.Utils
434 except ( NameError, AttributeError ):
435 main.Utils = Utils()
Devin Lim142b5342017-07-20 15:22:39 -0700436 main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
kelvin-onlabb769f562015-07-15 17:05:10 -0700437 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700438 """
439 Add host intents between 2 host:
440 - Discover hosts
441 - Add host intents
442 - Check intents
443 - Verify flows
444 - Ping hosts
445 - Reroute
446 - Link down
447 - Verify flows
448 - Check topology
449 - Ping hosts
450 - Link up
451 - Verify flows
452 - Check topology
453 - Ping hosts
454 - Remove intents
455 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700456 if main.initialized == main.FALSE:
457 main.log.error( "Test components did not start correctly, skipping further tests" )
458 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700459 # Assert variables - These variable's name|format must be followed
460 # if you want to use the wrapper function
461 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700462 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700463 assert main.Mininet1
464 except AssertionError:
465 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
466 main.initialized = main.FALSE
467 main.skipCase()
468 try:
469 assert main.numSwitch
470 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700471 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700472 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700473 main.initialized = main.FALSE
474 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700475
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800476 # Save leader candidates
Devin Lim142b5342017-07-20 15:22:39 -0700477 intentLeadersOld = main.Cluster.active( 0 ).CLI.leaderCandidates()
acsmarse6b410f2015-07-17 14:39:34 -0700478
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700479 main.testName = "Host Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700480 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700481 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700482 main.caseExplanation = "This test case tests Host intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -0700483 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700484 "Different type of hosts will be tested in " +\
485 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700486 "etc;\nThe test will use OF " + main.OFProtocol +\
487 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700488 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700489
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700490 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700491 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700492 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
493 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800494 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700495 installResult = main.intents.installHostIntent( main,
496 name="IPV4",
497 onosNode=0,
498 host1=host1,
499 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800500 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700501 testResult = main.intents.testHostIntent( main,
502 name="IPV4",
503 intentId=installResult,
504 onosNode=0,
505 host1=host1,
506 host2=host2,
507 sw1="s5",
508 sw2="s2",
509 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800510 else:
Devin Lim142b5342017-07-20 15:22:39 -0700511 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800512
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700513 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800514 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700515 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700516 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700517
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700518 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700519 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700520 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700521 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800522 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700523 installResult = main.intents.installHostIntent( main,
524 name="DUALSTACK",
525 onosNode=0,
526 host1=host1,
527 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800528
529 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700530 testResult = main.intents.testHostIntent( main,
531 name="DUALSTACK",
532 intentId=installResult,
533 onosNode=0,
534 host1=host1,
535 host2=host2,
536 sw1="s5",
537 sw2="s2",
538 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700539
540 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800541 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700542 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700543 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700544
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700545 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700546 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700547 host1 = { "name": "h1" }
548 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800549 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700550 installResult = main.intents.installHostIntent( main,
551 name="DUALSTACK2",
552 onosNode=0,
553 host1=host1,
554 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800555
556 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700557 testResult = main.intents.testHostIntent( main,
558 name="DUALSTACK2",
559 intentId=installResult,
560 onosNode=0,
561 host1=host1,
562 host2=host2,
563 sw1="s5",
564 sw2="s2",
565 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800566 else:
Devin Lim142b5342017-07-20 15:22:39 -0700567 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700568
569 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800570 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700571 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700572 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700573
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700574 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700575 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700576 host1 = { "name": "h1" }
577 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800578 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700579 installResult = main.intents.installHostIntent( main,
580 name="1HOP",
581 onosNode=0,
582 host1=host1,
583 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800584
585 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700586 testResult = main.intents.testHostIntent( main,
587 name="1HOP",
588 intentId=installResult,
589 onosNode=0,
590 host1=host1,
591 host2=host2,
592 sw1="s5",
593 sw2="s2",
594 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800595 else:
Devin Lim142b5342017-07-20 15:22:39 -0700596 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700597
598 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800599 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700600 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700601 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700602
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700603 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700604 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700605 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
606 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800607 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700608 installResult = main.intents.installHostIntent( main,
609 name="VLAN1",
610 onosNode=0,
611 host1=host1,
612 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800613 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700614 testResult = main.intents.testHostIntent( main,
615 name="VLAN1",
616 intentId=installResult,
617 onosNode=0,
618 host1=host1,
619 host2=host2,
620 sw1="s5",
621 sw2="s2",
622 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800623 else:
Devin Lim142b5342017-07-20 15:22:39 -0700624 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700625
626 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800627 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700628 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700629 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700630
Jeremy Songsterff553672016-05-12 17:06:23 -0700631 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
632 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700633 host1 = { "name": "h5", "vlan": "200" }
634 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700635 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700636 installResult = main.intents.installHostIntent( main,
637 name="VLAN2",
638 onosNode=0,
639 host1=host1,
640 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700641
642 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700643 testResult = main.intents.testHostIntent( main,
644 name="VLAN2",
645 intentId=installResult,
646 onosNode=0,
647 host1=host1,
648 host2=host2,
649 sw1="s5",
650 sw2="s2",
651 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700652 else:
Devin Lim142b5342017-07-20 15:22:39 -0700653 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -0700654
655 utilities.assert_equals( expect=main.TRUE,
656 actual=testResult,
657 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700658 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700659
Jeremy Songsterc032f162016-08-04 17:14:49 -0700660 main.step( "Encapsulation: Add host intents between h1 and h9" )
661 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700662 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
663 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700664 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700665 installResult = main.intents.installHostIntent( main,
666 name="ENCAPSULATION",
667 onosNode=0,
668 host1=host1,
669 host2=host2,
670 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700671 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700672 testResult = main.intents.testHostIntent( main,
673 name="ENCAPSULATION",
674 intentId=installResult,
675 onosNode=0,
676 host1=host1,
677 host2=host2,
678 sw1="s5",
679 sw2="s2",
680 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700681 else:
Devin Lim142b5342017-07-20 15:22:39 -0700682 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700683
684 utilities.assert_equals( expect=main.TRUE,
685 actual=testResult,
686 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700687 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700688
Jon Hall78be4962017-05-23 14:53:53 -0700689 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700690 # main.step( "Encapsulation: Add host intents between h1 and h9" )
691 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
692 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
693 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
694 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700695 # installResult = main.intents.installHostIntent( main,
696 # name="ENCAPSULATION",
697 # onosNode=0,
698 # host1=host1,
699 # host2=host2,
700 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700701 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700702 # testResult = main.intents.testHostIntent( main,
703 # name="ENCAPSULATION",
704 # intentId=installResult,
705 # onosNode=0,
706 # host1=host1,
707 # host2=host2,
708 # sw1="s5",
709 # sw2="s2",
710 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700711 # else:
Devin Lim142b5342017-07-20 15:22:39 -0700712 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -0700713 #
714 # utilities.assert_equals( expect=main.TRUE,
715 # actual=testResult,
716 # onpass=main.assertReturnString,
717 # onfail=main.assertReturnString )
718
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700719 main.step( "Confirm that ONOS leadership is unchanged" )
Devin Lim142b5342017-07-20 15:22:39 -0700720 intentLeadersNew = main.Cluster.active( 0 ).CLI.leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700721 testResult = main.intents.checkLeaderChange( intentLeadersOld,
722 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700723
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800724 utilities.assert_equals( expect=main.TRUE,
725 actual=testResult,
726 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700727 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800728
Jon Hall78be4962017-05-23 14:53:53 -0700729 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700730
kelvin-onlabb769f562015-07-15 17:05:10 -0700731 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700732 """
733 Add point intents between 2 hosts:
734 - Get device ids | ports
735 - Add point intents
736 - Check intents
737 - Verify flows
738 - Ping hosts
739 - Reroute
740 - Link down
741 - Verify flows
742 - Check topology
743 - Ping hosts
744 - Link up
745 - Verify flows
746 - Check topology
747 - Ping hosts
748 - Remove intents
749 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700750 if main.initialized == main.FALSE:
751 main.log.error( "Test components did not start correctly, skipping further tests" )
752 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700753 # Assert variables - These variable's name|format must be followed
754 # if you want to use the wrapper function
755 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700756 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700757 assert main.Mininet1
758 except AssertionError:
759 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
760 main.initialized = main.FALSE
761 main.skipCase()
762 try:
763 assert main.numSwitch
764 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700765 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700766 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700767 main.initialized = main.FALSE
768 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700769
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700770 main.testName = "Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700771 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700772 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700773 main.caseExplanation = "This test case will test point to point" +\
Devin Lim142b5342017-07-20 15:22:39 -0700774 " intents using " + str( main.Cluster.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700775 " node(s) cluster;\n" +\
776 "Different type of hosts will be tested in " +\
777 "each step such as IPV4, Dual stack, VLAN etc" +\
778 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700779 " OVS running in Mininet and compile intents" +\
780 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700781
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700782 # No option point intents
783 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700784 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800785 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700786 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800787 ]
788 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700789 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800790 ]
Jeremy42df2e72016-02-23 16:37:46 -0800791 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700792 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700793 main,
794 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800795 senders=senders,
796 recipients=recipients )
797
798 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700799 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800800 main,
801 intentId=installResult,
802 name="NOOPTION",
803 senders=senders,
804 recipients=recipients,
805 sw1="s5",
806 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700807 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800808 else:
Devin Lim142b5342017-07-20 15:22:39 -0700809 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700810
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700811 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800812 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700813 onpass=main.assertReturnString,
814 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700815
kelvin-onlabb769f562015-07-15 17:05:10 -0700816 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700817 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800818 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700819 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800820 ]
821 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700822 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800823 ]
Jeremy42df2e72016-02-23 16:37:46 -0800824 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700825 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700826 main,
827 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800828 senders=senders,
829 recipients=recipients,
830 ethType="IPV4" )
831
832 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700833 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800834 main,
835 intentId=installResult,
836 name="IPV4",
837 senders=senders,
838 recipients=recipients,
839 sw1="s5",
840 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700841 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800842 else:
Devin Lim142b5342017-07-20 15:22:39 -0700843 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700844
845 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800846 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700847 onpass=main.assertReturnString,
848 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800849
Jon Hall78be4962017-05-23 14:53:53 -0700850 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800851 main.assertReturnString = "Assertion Result for protected point intent\n"
852 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700853 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800854 ]
855 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700856 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800857 ]
858 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700859 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800860 main,
861 name="Protected",
862 senders=senders,
863 recipients=recipients,
864 protected=True )
865
866 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700867 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800868 main,
869 name="Protected",
870 intentId=installResult,
871 senders=senders,
872 recipients=recipients,
873 sw1="s5",
874 sw2="s2",
875 protected=True,
876 expectedLink=18 )
877 else:
Devin Lim142b5342017-07-20 15:22:39 -0700878 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alisonda157272016-12-22 01:13:21 -0800879
880 utilities.assert_equals( expect=main.TRUE,
881 actual=testResult,
882 onpass=main.assertReturnString,
883 onfail=main.assertReturnString )
884
kelvin-onlabb769f562015-07-15 17:05:10 -0700885 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700886 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800887 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700888 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800889 ]
890 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700891 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800892 ]
Jeremy42df2e72016-02-23 16:37:46 -0800893 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700894 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700895 main,
896 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800897 senders=senders,
898 recipients=recipients,
899 ethType="IPV4" )
900
901 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700902 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800903 main,
904 intentId=installResult,
905 name="IPV4_2",
906 senders=senders,
907 recipients=recipients,
908 sw1="s5",
909 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700910 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800911 else:
Devin Lim142b5342017-07-20 15:22:39 -0700912 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700913
914 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800915 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700916 onpass=main.assertReturnString,
917 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700918
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700919 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700920 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800921 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700922 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -0800923 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800924 ]
925 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700926 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -0800927 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800928 ]
Jeremy6f000c62016-02-25 17:02:28 -0800929 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700930 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800931 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
932 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800933 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700934 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800935 main,
936 name="SDNIP-ICMP",
937 senders=senders,
938 recipients=recipients,
939 ethType="IPV4",
940 ipProto=ipProto,
941 tcpSrc=tcpSrc,
942 tcpDst=tcpDst )
943
944 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700945 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800946 main,
947 intentId=installResult,
948 name="SDNIP_ICMP",
949 senders=senders,
950 recipients=recipients,
951 sw1="s5",
952 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700953 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700954 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800955 else:
Devin Lim142b5342017-07-20 15:22:39 -0700956 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700957
958 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800959 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700960 onpass=main.assertReturnString,
961 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700962
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700963 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700964 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700965 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
966 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700967 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
968 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700969 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
970 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
971 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
972
Jon Hall78be4962017-05-23 14:53:53 -0700973 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700974 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700975 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700976 host1="h1",
977 host2="h9",
978 deviceId1="of:0000000000000005/1",
979 deviceId2="of:0000000000000006/1",
980 mac1=mac1,
981 mac2=mac2,
982 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700983 ipProto=ipProto,
984 ip1=ip1,
985 ip2=ip2,
986 tcp1=tcp1,
987 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -0700988
989 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -0800990 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -0700991 onpass=main.assertReturnString,
992 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700993
acsmars5d8cc862015-09-25 09:44:50 -0700994 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
995 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800996 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700997 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800998 ]
999 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001000 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001001 ]
Jeremy42df2e72016-02-23 16:37:46 -08001002 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001003 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001004 main,
1005 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001006 senders=senders,
1007 recipients=recipients,
1008 ethType="IPV4" )
1009
1010 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001011 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001012 main,
1013 intentId=installResult,
1014 name="DUALSTACK1",
1015 senders=senders,
1016 recipients=recipients,
1017 sw1="s5",
1018 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001019 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001020 else:
Devin Lim142b5342017-07-20 15:22:39 -07001021 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001022
1023 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001024 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001025 onpass=main.assertReturnString,
1026 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001027
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001028 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001029 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001030 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001031 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001032 ]
1033 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001034 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001035 ]
Jeremy42df2e72016-02-23 16:37:46 -08001036 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001037 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001038 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001039 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001040 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001041 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001042
1043 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001044 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001045 main,
1046 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001047 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001048 senders=senders,
1049 recipients=recipients,
1050 sw1="s5",
1051 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001052 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001053
1054 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001055 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001056 onpass=main.assertReturnString,
1057 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001058
Jeremy Songsterff553672016-05-12 17:06:23 -07001059 main.step( "VLAN: Add point intents between h5 and h21" )
1060 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1061 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001062 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001063 ]
1064 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001065 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001066 ]
1067 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001068 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001069 main,
1070 name="VLAN2",
1071 senders=senders,
1072 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001073 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001074
1075 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001076 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001077 main,
1078 intentId=installResult,
1079 name="VLAN2",
1080 senders=senders,
1081 recipients=recipients,
1082 sw1="s5",
1083 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001084 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001085
1086 utilities.assert_equals( expect=main.TRUE,
1087 actual=testResult,
1088 onpass=main.assertReturnString,
1089 onfail=main.assertReturnString )
1090
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001091 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001092 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001093 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001094 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001095 ]
1096 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001097 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001098 ]
Jeremy42df2e72016-02-23 16:37:46 -08001099 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001100 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001101 main,
1102 name="1HOP IPV4",
1103 senders=senders,
1104 recipients=recipients,
1105 ethType="IPV4" )
1106
1107 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001108 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001109 main,
1110 intentId=installResult,
1111 name="1HOP IPV4",
1112 senders=senders,
1113 recipients=recipients,
1114 sw1="s5",
1115 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001116 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001117 else:
Devin Lim142b5342017-07-20 15:22:39 -07001118 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001119
1120 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001121 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001122 onpass=main.assertReturnString,
1123 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001124
Jeremy Songsterc032f162016-08-04 17:14:49 -07001125 main.step( "Add point to point intents using VLAN Encapsulation" )
1126 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1127 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001128 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001129 ]
1130 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001131 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001132 ]
1133 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001134 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001135 main,
1136 name="ENCAPSULATION",
1137 senders=senders,
1138 recipients=recipients,
1139 encap="VLAN" )
1140
1141 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001142 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001143 main,
1144 intentId=installResult,
1145 name="ENCAPSULATION",
1146 senders=senders,
1147 recipients=recipients,
1148 sw1="s5",
1149 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001150 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001151 else:
Devin Lim142b5342017-07-20 15:22:39 -07001152 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001153
1154 utilities.assert_equals( expect=main.TRUE,
1155 actual=testResult,
1156 onpass=main.assertReturnString,
1157 onfail=main.assertReturnString )
1158
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001159 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1160 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1161 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001162 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001163 ]
1164 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001165 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001166 ]
1167 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001168 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001169 main,
1170 name="NOOPTION",
1171 senders=senders,
1172 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001173 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001174
1175 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001176 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001177 main,
1178 intentId=installResult,
1179 name="NOOPTION",
1180 senders=senders,
1181 recipients=recipients,
1182 sw1="s5",
1183 sw2="s2",
1184 expectedLink=18 )
1185 else:
Devin Lim142b5342017-07-20 15:22:39 -07001186 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001187
1188 utilities.assert_equals( expect=main.TRUE,
1189 actual=testResult,
1190 onpass=main.assertReturnString,
1191 onfail=main.assertReturnString )
1192
Jon Hall78be4962017-05-23 14:53:53 -07001193 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001194 # main.step( "Add point to point intents using MPLS Encapsulation" )
1195 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1196 # senders = [
1197 # { "name": "h1", "device": "of:0000000000000005/1" }
1198 # ]
1199 # recipients = [
1200 # { "name": "h9", "device": "of:0000000000000006/1" }
1201 # ]
1202 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001203 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001204 # main,
1205 # name="ENCAPSULATION",
1206 # senders=senders,
1207 # recipients=recipients,
1208 # encap="MPLS" )
1209 #
1210 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001211 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001212 # main,
1213 # intentId=installResult,
1214 # name="ENCAPSULATION",
1215 # senders=senders,
1216 # recipients=recipients,
1217 # sw1="s5",
1218 # sw2="s2",
1219 # expectedLink=18 )
1220 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001221 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001222 #
1223 # utilities.assert_equals( expect=main.TRUE,
1224 # actual=testResult,
1225 # onpass=main.assertReturnString,
1226 # onfail=main.assertReturnString )
1227
Jon Hall78be4962017-05-23 14:53:53 -07001228 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001229
kelvin-onlabb769f562015-07-15 17:05:10 -07001230 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001231 """
1232 Add single point to multi point intents
1233 - Get device ids
1234 - Add single point to multi point intents
1235 - Check intents
1236 - Verify flows
1237 - Ping hosts
1238 - Reroute
1239 - Link down
1240 - Verify flows
1241 - Check topology
1242 - Ping hosts
1243 - Link up
1244 - Verify flows
1245 - Check topology
1246 - Ping hosts
1247 - Remove intents
1248 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001249 if main.initialized == main.FALSE:
1250 main.log.error( "Test components did not start correctly, skipping further tests" )
1251 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001252 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001253 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001254 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"
Devin Lim142b5342017-07-20 15:22:39 -07001268 main.case( main.testName + " Test - " + str( main.Cluster.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 " +\
Devin Lim142b5342017-07-20 15:22:39 -07001272 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001273 "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:
Devin Lim142b5342017-07-20 15:22:39 -07001312 main.Cluster.active( 0 ).CLI.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:
Devin Lim142b5342017-07-20 15:22:39 -07001353 main.Cluster.active( 0 ).CLI.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:
Devin Lim142b5342017-07-20 15:22:39 -07001394 main.Cluster.active( 0 ).CLI.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:
Devin Lim142b5342017-07-20 15:22:39 -07001434 main.Cluster.active( 0 ).CLI.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:
Devin Lim142b5342017-07-20 15:22:39 -07001475 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001476
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:
Devin Lim142b5342017-07-20 15:22:39 -07001517 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001518 #
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:
Jeremyd9e4eb12016-04-13 12:09:06 -07001550 assert main.Mininet1
1551 except AssertionError:
1552 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1553 main.initialized = main.FALSE
1554 main.skipCase()
1555 try:
1556 assert main.numSwitch
1557 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001558 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001559 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001560 main.initialized = main.FALSE
1561 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001562
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001563 main.testName = "Multi To Single Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001564 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001565 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001566 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001567 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001568 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001569 "Different type of hosts will be tested in " +\
1570 "each step such as IPV4, Dual stack, VLAN etc" +\
1571 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001572 " OVS running in Mininet and compile intents" +\
1573 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001574
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001575 main.step( "NOOPTION: Add multi point to single point intents" )
1576 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1577 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001578 { "name": "h16", "device": "of:0000000000000006/8" },
1579 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001580 ]
1581 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001582 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001583 ]
Jon Hall9c888672017-05-15 18:03:54 -07001584 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1585 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001586 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001587 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001588 main,
1589 name="NOOPTION",
1590 senders=senders,
1591 recipients=recipients,
1592 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001593 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001594
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001595 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001596 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001597 main,
1598 intentId=installResult,
1599 name="NOOPTION",
1600 senders=senders,
1601 recipients=recipients,
1602 badSenders=badSenders,
1603 badRecipients=badRecipients,
1604 sw1="s5",
1605 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001606 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001607 else:
Devin Lim142b5342017-07-20 15:22:39 -07001608 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001609
1610 utilities.assert_equals( expect=main.TRUE,
1611 actual=testResult,
1612 onpass=main.assertReturnString,
1613 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001614
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001615 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001616 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 -08001617 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001618 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1619 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001620 ]
1621 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001622 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001623 ]
Jon Hall9c888672017-05-15 18:03:54 -07001624 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1625 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001626 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001627 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001628 main,
1629 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001630 senders=senders,
1631 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001632 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001633 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001634 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001635
1636 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001637 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001638 main,
1639 intentId=installResult,
1640 name="IPV4",
1641 senders=senders,
1642 recipients=recipients,
1643 badSenders=badSenders,
1644 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001645 sw1="s5",
1646 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001647 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001648 else:
Devin Lim142b5342017-07-20 15:22:39 -07001649 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001650
1651 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001652 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001653 onpass=main.assertReturnString,
1654 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001655
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001656 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001657 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 -08001658 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001659 { "name": "h16", "device": "of:0000000000000006/8" },
1660 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001661 ]
1662 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001663 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001664 ]
Jon Hall9c888672017-05-15 18:03:54 -07001665 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1666 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001667 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001668 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001669 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001670 name="IPV4_2",
1671 senders=senders,
1672 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001673 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001674 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001675 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001676
1677 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001678 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001679 main,
1680 intentId=installResult,
1681 name="IPV4_2",
1682 senders=senders,
1683 recipients=recipients,
1684 badSenders=badSenders,
1685 badRecipients=badRecipients,
1686 sw1="s5",
1687 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001688 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001689 else:
Devin Lim142b5342017-07-20 15:22:39 -07001690 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001691
1692 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001693 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001694 onpass=main.assertReturnString,
1695 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001696
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001697 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001698 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 -08001699 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001700 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1701 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001702 ]
1703 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001704 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001705 ]
Jon Hall9c888672017-05-15 18:03:54 -07001706 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1707 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001708 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001709 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001710 main,
1711 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001712 senders=senders,
1713 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001714 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001715 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001716
1717 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001718 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001719 main,
1720 intentId=installResult,
1721 name="VLAN",
1722 senders=senders,
1723 recipients=recipients,
1724 badSenders=badSenders,
1725 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001726 sw1="s5",
1727 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001728 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001729 else:
Devin Lim142b5342017-07-20 15:22:39 -07001730 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001731
1732 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001733 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001734 onpass=main.assertReturnString,
1735 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001736
Jeremy Songsterff553672016-05-12 17:06:23 -07001737 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1738 main.step( "VLAN: Add multi point to single point intents" )
1739 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1740 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001741 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1742 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001743 ]
1744 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001745 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001746 ]
Jon Hall9c888672017-05-15 18:03:54 -07001747 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1748 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001749 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001750 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001751 main,
1752 name="VLAN2",
1753 senders=senders,
1754 recipients=recipients,
1755 sw1="s5",
1756 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001757 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001758
1759 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001760 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001761 main,
1762 intentId=installResult,
1763 name="VLAN2",
1764 senders=senders,
1765 recipients=recipients,
1766 badSenders=badSenders,
1767 badRecipients=badRecipients,
1768 sw1="s5",
1769 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001770 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001771 else:
Devin Lim142b5342017-07-20 15:22:39 -07001772 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001773
1774 utilities.assert_equals( expect=main.TRUE,
1775 actual=testResult,
1776 onpass=main.assertReturnString,
1777 onfail=main.assertReturnString )
1778
Jeremy Songsterc032f162016-08-04 17:14:49 -07001779 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1780 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1781 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001782 { "name": "h16", "device": "of:0000000000000006/8" },
1783 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001784 ]
1785 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001786 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001787 ]
Jon Hall9c888672017-05-15 18:03:54 -07001788 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1789 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001790 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001791 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001792 main,
1793 name="ENCAPSULATION",
1794 senders=senders,
1795 recipients=recipients,
1796 sw1="s5",
1797 sw2="s2",
1798 encap="VLAN" )
1799
1800 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001801 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001802 main,
1803 intentId=installResult,
1804 name="ENCAPSULATION",
1805 senders=senders,
1806 recipients=recipients,
1807 badSenders=badSenders,
1808 badRecipients=badRecipients,
1809 sw1="s5",
1810 sw2="s2",
1811 expectedLink=18 )
1812 else:
Devin Lim142b5342017-07-20 15:22:39 -07001813 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001814
1815 utilities.assert_equals( expect=main.TRUE,
1816 actual=testResult,
1817 onpass=main.assertReturnString,
1818 onfail=main.assertReturnString )
1819
Jon Hall78be4962017-05-23 14:53:53 -07001820 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07001821 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
1822 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1823 #senders = [
1824 # { "name": "h16", "device": "of:0000000000000006/8" },
1825 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001826 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001827 #recipients = [
1828 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001829 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001830 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07001831 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07001832 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001833 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001834 # main,
1835 # name="ENCAPSULATION",
1836 # senders=senders,
1837 # recipients=recipients,
1838 # sw1="s5",
1839 # sw2="s2",
1840 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07001841 #
Shreyaca8990f2017-03-16 11:43:11 -07001842 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001843 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001844 # main,
1845 # intentId=installResult,
1846 # name="ENCAPSULATION",
1847 # senders=senders,
1848 # recipients=recipients,
1849 # badSenders=badSenders,
1850 # badRecipients=badRecipients,
1851 # sw1="s5",
1852 # sw2="s2",
1853 # expectedLink=18 )
1854 #else:
Devin Lim142b5342017-07-20 15:22:39 -07001855 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001856 #
Shreyaca8990f2017-03-16 11:43:11 -07001857 #utilities.assert_equals( expect=main.TRUE,
1858 # actual=testResult,
1859 # onpass=main.assertReturnString,
1860 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07001861
Jon Hall78be4962017-05-23 14:53:53 -07001862 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001863
acsmars1ff5e052015-07-23 11:27:48 -07001864 def CASE5000( self, main ):
1865 """
acsmars5d8cc862015-09-25 09:44:50 -07001866 Tests Host Mobility
1867 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001868 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001869 if main.initialized == main.FALSE:
1870 main.log.error( "Test components did not start correctly, skipping further tests" )
1871 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001872 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001873 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001874 assert main.Mininet1
1875 except AssertionError:
1876 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1877 main.initialized = main.FALSE
1878 main.skipCase()
1879 try:
1880 assert main.numSwitch
1881 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001882 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001883 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001884 main.initialized = main.FALSE
1885 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001886 main.case( "Test host mobility with host intents " + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001887 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001888 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001889
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001890 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07001891 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001892
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001893 # Send discovery ping from moved host
1894 # Moving the host brings down the default interfaces and creates a new one.
1895 # Scapy is restarted on this host to detect the new interface
1896 main.h1.stopScapy()
1897 main.h1.startScapy()
1898
1899 # Discover new host location in ONOS and populate host data.
1900 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001901 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1902 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001903
acsmars1ff5e052015-07-23 11:27:48 -07001904 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1905
1906 utilities.assert_equals( expect="of:0000000000000006",
1907 actual=h1PostMove,
1908 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001909 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001910 " to single point intents" +
1911 " with IPV4 type and MAC addresses" +
1912 " in the same VLAN" )
1913
1914 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001915 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001916 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1917 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001918 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001919 installResult = main.intents.installHostIntent( main,
1920 name="IPV4 Mobility IPV4",
1921 onosNode=0,
1922 host1=host1,
1923 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001924 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001925 testResult = main.intents.testHostIntent( main,
1926 name="Host Mobility IPV4",
1927 intentId=installResult,
1928 onosNode=0,
1929 host1=host1,
1930 host2=host2,
1931 sw1="s6",
1932 sw2="s2",
1933 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001934 else:
Devin Lim142b5342017-07-20 15:22:39 -07001935 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001936
1937 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001938 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001939 onpass=main.assertReturnString,
1940 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001941
Jon Hall78be4962017-05-23 14:53:53 -07001942 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001943
1944 def CASE6000( self, main ):
1945 """
1946 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1947 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001948 # At some later point discussion on this behavior in MPSP and SPMP intents
1949 # will be reoppened and this test case may need to be updated to reflect
1950 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001951 if main.initialized == main.FALSE:
1952 main.log.error( "Test components did not start correctly, skipping further tests" )
1953 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001954 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001955 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001956 assert main.Mininet1
1957 except AssertionError:
1958 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1959 main.initialized = main.FALSE
1960 main.skipCase()
1961 try:
1962 assert main.numSwitch
1963 except AssertionError:
alison52b25892016-09-19 10:53:48 -07001964 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001965 main.initialized = main.FALSE
1966 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001967 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001968 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07001969 main.step( "Installing Multi to Single Point intents with no options set" )
1970 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1971 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08001972 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001973 { "name": "h16", "device": "of:0000000000000006/8" },
1974 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001975 ]
1976 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001977 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001978 ]
1979 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001980 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001981 ]
1982 isolatedRecipients = []
1983 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001984 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08001985 main,
1986 name="NOOPTION",
1987 senders=senders,
1988 recipients=recipients,
1989 sw1="s5",
1990 sw2="s2" )
1991
1992 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001993 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08001994 main,
1995 intentId=installResult,
1996 name="NOOPTION",
1997 senders=senders,
1998 recipients=recipients,
1999 isolatedSenders=isolatedSenders,
2000 isolatedRecipients=isolatedRecipients,
2001 sw1="s6",
2002 sw2="s2",
2003 sw3="s4",
2004 sw4="s1",
2005 sw5="s3",
2006 expectedLink1=16,
2007 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002008 else:
Devin Lim142b5342017-07-20 15:22:39 -07002009 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002010
2011 utilities.assert_equals( expect=main.TRUE,
2012 actual=testResult,
2013 onpass=main.assertReturnString,
2014 onfail=main.assertReturnString )
2015
Jeremy Songster9385d412016-06-02 17:57:36 -07002016 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2017
2018 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2019 "with partial failures allowed\n"
2020 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002021 { "name": "h16", "device": "of:0000000000000006/8" },
2022 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002023 ]
2024 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002025 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002026 ]
2027 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002028 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002029 ]
2030 isolatedRecipients = []
2031 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002032 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002033 main,
2034 name="NOOPTION",
2035 senders=senders,
2036 recipients=recipients,
2037 sw1="s5",
2038 sw2="s2",
2039 partial=True )
2040
2041 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002042 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002043 main,
2044 intentId=installResult,
2045 name="NOOPTION",
2046 senders=senders,
2047 recipients=recipients,
2048 isolatedSenders=isolatedSenders,
2049 isolatedRecipients=isolatedRecipients,
2050 sw1="s6",
2051 sw2="s2",
2052 sw3="s4",
2053 sw4="s1",
2054 sw5="s3",
2055 expectedLink1=16,
2056 expectedLink2=14,
2057 partial=True )
2058 else:
Devin Lim142b5342017-07-20 15:22:39 -07002059 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002060
2061 utilities.assert_equals( expect=main.TRUE,
2062 actual=testResult,
2063 onpass=main.assertReturnString,
2064 onfail=main.assertReturnString )
2065
Jeremye0cb5eb2016-01-27 17:39:09 -08002066 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002067 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2068 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002069 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002070 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002071 ]
2072 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002073 { "name": "h16", "device": "of:0000000000000006/8" },
2074 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002075 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002076 isolatedSenders = []
2077 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002078 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002079 ]
2080 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002081 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002082 main,
2083 name="NOOPTION",
2084 senders=senders,
2085 recipients=recipients,
2086 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002087 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002088
2089 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002090 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002091 main,
2092 intentId=installResult,
2093 name="NOOPTION",
2094 senders=senders,
2095 recipients=recipients,
2096 isolatedSenders=isolatedSenders,
2097 isolatedRecipients=isolatedRecipients,
2098 sw1="s6",
2099 sw2="s2",
2100 sw3="s4",
2101 sw4="s1",
2102 sw5="s3",
2103 expectedLink1=16,
2104 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002105 else:
Devin Lim142b5342017-07-20 15:22:39 -07002106 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002107
2108 utilities.assert_equals( expect=main.TRUE,
2109 actual=testResult,
2110 onpass=main.assertReturnString,
2111 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002112 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002113 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002114 "intents with partial failures allowed" )
2115 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2116 "point intent with partial failures allowed\n"
2117 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002118 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002119 ]
2120 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002121 { "name": "h16", "device": "of:0000000000000006/8" },
2122 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002123 ]
2124 isolatedSenders = []
2125 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002126 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002127 ]
2128 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002129 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002130 main,
2131 name="NOOPTION",
2132 senders=senders,
2133 recipients=recipients,
2134 sw1="s5",
2135 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002136 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002137
2138 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002139 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002140 main,
2141 intentId=installResult,
2142 name="NOOPTION",
2143 senders=senders,
2144 recipients=recipients,
2145 isolatedSenders=isolatedSenders,
2146 isolatedRecipients=isolatedRecipients,
2147 sw1="s6",
2148 sw2="s2",
2149 sw3="s4",
2150 sw4="s1",
2151 sw5="s3",
2152 expectedLink1=16,
2153 expectedLink2=14,
2154 partial=True )
2155 else:
Devin Lim142b5342017-07-20 15:22:39 -07002156 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002157
2158 utilities.assert_equals( expect=main.TRUE,
2159 actual=testResult,
2160 onpass=main.assertReturnString,
2161 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002162
Jon Hall78be4962017-05-23 14:53:53 -07002163 main.intents.report( main )