blob: 2b85fc26ffab52903f3bf769049271041a196375 [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" )
Devin Lim44075962017-08-11 10:56:37 -070048 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -070049 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" )
Devin Lim44075962017-08-11 10:56:37 -0700126 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700127 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" )
Devin Lim44075962017-08-11 10:56:37 -0700390 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700391 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 ):
Devin Lim44075962017-08-11 10:56:37 -0700420 main.cleanAndExit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700421
Jeremy Songster17147f22016-05-31 18:30:52 -0700422 def CASE19( self, main ):
423 """
424 Copy the karaf.log files after each testcase cycle
425 """
Devin Lim58046fa2017-07-05 16:55:00 -0700426 try:
427 from tests.dependencies.utils import Utils
428 except ImportError:
429 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700430 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700431 try:
432 main.Utils
433 except ( NameError, AttributeError ):
434 main.Utils = Utils()
Devin Lim142b5342017-07-20 15:22:39 -0700435 main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
kelvin-onlabb769f562015-07-15 17:05:10 -0700436 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700437 """
438 Add host intents between 2 host:
439 - Discover hosts
440 - Add host intents
441 - Check intents
442 - Verify flows
443 - Ping hosts
444 - Reroute
445 - Link down
446 - Verify flows
447 - Check topology
448 - Ping hosts
449 - Link up
450 - Verify flows
451 - Check topology
452 - Ping hosts
453 - Remove intents
454 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700455 if main.initialized == main.FALSE:
456 main.log.error( "Test components did not start correctly, skipping further tests" )
457 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700458 # Assert variables - These variable's name|format must be followed
459 # if you want to use the wrapper function
460 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700461 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700462 assert main.Mininet1
463 except AssertionError:
464 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
465 main.initialized = main.FALSE
466 main.skipCase()
467 try:
468 assert main.numSwitch
469 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700470 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700471 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700472 main.initialized = main.FALSE
473 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700474
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800475 # Save leader candidates
Devin Lim142b5342017-07-20 15:22:39 -0700476 intentLeadersOld = main.Cluster.active( 0 ).CLI.leaderCandidates()
acsmarse6b410f2015-07-17 14:39:34 -0700477
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700478 main.testName = "Host Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700479 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700480 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700481 main.caseExplanation = "This test case tests Host intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -0700482 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700483 "Different type of hosts will be tested in " +\
484 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700485 "etc;\nThe test will use OF " + main.OFProtocol +\
486 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700487 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700488
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700489 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700490 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700491 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
492 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800493 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700494 installResult = main.intents.installHostIntent( main,
495 name="IPV4",
496 onosNode=0,
497 host1=host1,
498 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800499 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700500 testResult = main.intents.testHostIntent( main,
501 name="IPV4",
502 intentId=installResult,
503 onosNode=0,
504 host1=host1,
505 host2=host2,
506 sw1="s5",
507 sw2="s2",
508 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800509 else:
Devin Lim142b5342017-07-20 15:22:39 -0700510 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800511
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700512 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800513 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700514 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700515 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700516
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700517 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700518 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700519 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700520 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800521 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700522 installResult = main.intents.installHostIntent( main,
523 name="DUALSTACK",
524 onosNode=0,
525 host1=host1,
526 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800527
528 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700529 testResult = main.intents.testHostIntent( main,
530 name="DUALSTACK",
531 intentId=installResult,
532 onosNode=0,
533 host1=host1,
534 host2=host2,
535 sw1="s5",
536 sw2="s2",
537 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700538
539 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800540 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700541 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700542 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700543
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700544 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700545 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700546 host1 = { "name": "h1" }
547 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800548 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700549 installResult = main.intents.installHostIntent( main,
550 name="DUALSTACK2",
551 onosNode=0,
552 host1=host1,
553 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800554
555 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700556 testResult = main.intents.testHostIntent( main,
557 name="DUALSTACK2",
558 intentId=installResult,
559 onosNode=0,
560 host1=host1,
561 host2=host2,
562 sw1="s5",
563 sw2="s2",
564 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800565 else:
Devin Lim142b5342017-07-20 15:22:39 -0700566 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700567
568 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800569 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700570 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700571 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700572
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700573 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700574 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700575 host1 = { "name": "h1" }
576 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800577 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700578 installResult = main.intents.installHostIntent( main,
579 name="1HOP",
580 onosNode=0,
581 host1=host1,
582 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800583
584 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700585 testResult = main.intents.testHostIntent( main,
586 name="1HOP",
587 intentId=installResult,
588 onosNode=0,
589 host1=host1,
590 host2=host2,
591 sw1="s5",
592 sw2="s2",
593 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800594 else:
Devin Lim142b5342017-07-20 15:22:39 -0700595 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700596
597 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800598 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700599 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700600 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700601
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700602 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700603 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700604 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
605 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800606 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700607 installResult = main.intents.installHostIntent( main,
608 name="VLAN1",
609 onosNode=0,
610 host1=host1,
611 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800612 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700613 testResult = main.intents.testHostIntent( main,
614 name="VLAN1",
615 intentId=installResult,
616 onosNode=0,
617 host1=host1,
618 host2=host2,
619 sw1="s5",
620 sw2="s2",
621 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800622 else:
Devin Lim142b5342017-07-20 15:22:39 -0700623 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700624
625 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800626 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700627 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700628 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700629
Jeremy Songsterff553672016-05-12 17:06:23 -0700630 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
631 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700632 host1 = { "name": "h5", "vlan": "200" }
633 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700634 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700635 installResult = main.intents.installHostIntent( main,
636 name="VLAN2",
637 onosNode=0,
638 host1=host1,
639 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700640
641 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700642 testResult = main.intents.testHostIntent( main,
643 name="VLAN2",
644 intentId=installResult,
645 onosNode=0,
646 host1=host1,
647 host2=host2,
648 sw1="s5",
649 sw2="s2",
650 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700651 else:
Devin Lim142b5342017-07-20 15:22:39 -0700652 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -0700653
654 utilities.assert_equals( expect=main.TRUE,
655 actual=testResult,
656 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700657 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700658
Jeremy Songsterc032f162016-08-04 17:14:49 -0700659 main.step( "Encapsulation: Add host intents between h1 and h9" )
660 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700661 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
662 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700663 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700664 installResult = main.intents.installHostIntent( main,
665 name="ENCAPSULATION",
666 onosNode=0,
667 host1=host1,
668 host2=host2,
669 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700670 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700671 testResult = main.intents.testHostIntent( main,
672 name="ENCAPSULATION",
673 intentId=installResult,
674 onosNode=0,
675 host1=host1,
676 host2=host2,
677 sw1="s5",
678 sw2="s2",
679 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700680 else:
Devin Lim142b5342017-07-20 15:22:39 -0700681 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700682
683 utilities.assert_equals( expect=main.TRUE,
684 actual=testResult,
685 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700686 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700687
Jon Hall78be4962017-05-23 14:53:53 -0700688 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700689 # main.step( "Encapsulation: Add host intents between h1 and h9" )
690 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
691 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
692 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
693 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700694 # installResult = main.intents.installHostIntent( main,
695 # name="ENCAPSULATION",
696 # onosNode=0,
697 # host1=host1,
698 # host2=host2,
699 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700700 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700701 # testResult = main.intents.testHostIntent( main,
702 # name="ENCAPSULATION",
703 # intentId=installResult,
704 # onosNode=0,
705 # host1=host1,
706 # host2=host2,
707 # sw1="s5",
708 # sw2="s2",
709 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700710 # else:
Devin Lim142b5342017-07-20 15:22:39 -0700711 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -0700712 #
713 # utilities.assert_equals( expect=main.TRUE,
714 # actual=testResult,
715 # onpass=main.assertReturnString,
716 # onfail=main.assertReturnString )
717
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700718 main.step( "Confirm that ONOS leadership is unchanged" )
Devin Lim142b5342017-07-20 15:22:39 -0700719 intentLeadersNew = main.Cluster.active( 0 ).CLI.leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700720 testResult = main.intents.checkLeaderChange( intentLeadersOld,
721 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700722
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800723 utilities.assert_equals( expect=main.TRUE,
724 actual=testResult,
725 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700726 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800727
Jon Hall78be4962017-05-23 14:53:53 -0700728 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700729
kelvin-onlabb769f562015-07-15 17:05:10 -0700730 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700731 """
732 Add point intents between 2 hosts:
733 - Get device ids | ports
734 - Add point intents
735 - Check intents
736 - Verify flows
737 - Ping hosts
738 - Reroute
739 - Link down
740 - Verify flows
741 - Check topology
742 - Ping hosts
743 - Link up
744 - Verify flows
745 - Check topology
746 - Ping hosts
747 - Remove intents
748 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700749 if main.initialized == main.FALSE:
750 main.log.error( "Test components did not start correctly, skipping further tests" )
751 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700752 # Assert variables - These variable's name|format must be followed
753 # if you want to use the wrapper function
754 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700755 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700756 assert main.Mininet1
757 except AssertionError:
758 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
759 main.initialized = main.FALSE
760 main.skipCase()
761 try:
762 assert main.numSwitch
763 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700764 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700765 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700766 main.initialized = main.FALSE
767 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700768
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700769 main.testName = "Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700770 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700771 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700772 main.caseExplanation = "This test case will test point to point" +\
Devin Lim142b5342017-07-20 15:22:39 -0700773 " intents using " + str( main.Cluster.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700774 " node(s) cluster;\n" +\
775 "Different type of hosts will be tested in " +\
776 "each step such as IPV4, Dual stack, VLAN etc" +\
777 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700778 " OVS running in Mininet and compile intents" +\
779 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700780
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700781 # No option point intents
782 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700783 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800784 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700785 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800786 ]
787 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700788 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800789 ]
Jeremy42df2e72016-02-23 16:37:46 -0800790 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700791 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700792 main,
793 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800794 senders=senders,
795 recipients=recipients )
796
797 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700798 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800799 main,
800 intentId=installResult,
801 name="NOOPTION",
802 senders=senders,
803 recipients=recipients,
804 sw1="s5",
805 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700806 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800807 else:
Devin Lim142b5342017-07-20 15:22:39 -0700808 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700809
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700810 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800811 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700812 onpass=main.assertReturnString,
813 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700814
kelvin-onlabb769f562015-07-15 17:05:10 -0700815 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700816 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800817 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700818 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800819 ]
820 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700821 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800822 ]
Jeremy42df2e72016-02-23 16:37:46 -0800823 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700824 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700825 main,
826 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800827 senders=senders,
828 recipients=recipients,
829 ethType="IPV4" )
830
831 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700832 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800833 main,
834 intentId=installResult,
835 name="IPV4",
836 senders=senders,
837 recipients=recipients,
838 sw1="s5",
839 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700840 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800841 else:
Devin Lim142b5342017-07-20 15:22:39 -0700842 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700843
844 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800845 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700846 onpass=main.assertReturnString,
847 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800848
Jon Hall78be4962017-05-23 14:53:53 -0700849 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800850 main.assertReturnString = "Assertion Result for protected point intent\n"
851 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700852 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800853 ]
854 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700855 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800856 ]
857 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700858 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800859 main,
860 name="Protected",
861 senders=senders,
862 recipients=recipients,
863 protected=True )
864
865 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700866 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800867 main,
868 name="Protected",
869 intentId=installResult,
870 senders=senders,
871 recipients=recipients,
872 sw1="s5",
873 sw2="s2",
874 protected=True,
875 expectedLink=18 )
876 else:
Devin Lim142b5342017-07-20 15:22:39 -0700877 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alisonda157272016-12-22 01:13:21 -0800878
879 utilities.assert_equals( expect=main.TRUE,
880 actual=testResult,
881 onpass=main.assertReturnString,
882 onfail=main.assertReturnString )
883
kelvin-onlabb769f562015-07-15 17:05:10 -0700884 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700885 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800886 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700887 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800888 ]
889 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700890 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800891 ]
Jeremy42df2e72016-02-23 16:37:46 -0800892 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700893 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700894 main,
895 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800896 senders=senders,
897 recipients=recipients,
898 ethType="IPV4" )
899
900 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700901 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800902 main,
903 intentId=installResult,
904 name="IPV4_2",
905 senders=senders,
906 recipients=recipients,
907 sw1="s5",
908 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700909 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800910 else:
Devin Lim142b5342017-07-20 15:22:39 -0700911 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700912
913 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800914 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700915 onpass=main.assertReturnString,
916 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700917
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700918 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700919 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800920 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700921 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -0800922 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800923 ]
924 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700925 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -0800926 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800927 ]
Jeremy6f000c62016-02-25 17:02:28 -0800928 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700929 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800930 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
931 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800932 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700933 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800934 main,
935 name="SDNIP-ICMP",
936 senders=senders,
937 recipients=recipients,
938 ethType="IPV4",
939 ipProto=ipProto,
940 tcpSrc=tcpSrc,
941 tcpDst=tcpDst )
942
943 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700944 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800945 main,
946 intentId=installResult,
947 name="SDNIP_ICMP",
948 senders=senders,
949 recipients=recipients,
950 sw1="s5",
951 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700952 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700953 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800954 else:
Devin Lim142b5342017-07-20 15:22:39 -0700955 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700956
957 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800958 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700959 onpass=main.assertReturnString,
960 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700961
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700962 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700963 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700964 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
965 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700966 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
967 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700968 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
969 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
970 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
971
Jon Hall78be4962017-05-23 14:53:53 -0700972 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700973 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700974 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700975 host1="h1",
976 host2="h9",
977 deviceId1="of:0000000000000005/1",
978 deviceId2="of:0000000000000006/1",
979 mac1=mac1,
980 mac2=mac2,
981 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700982 ipProto=ipProto,
983 ip1=ip1,
984 ip2=ip2,
985 tcp1=tcp1,
986 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -0700987
988 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -0800989 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -0700990 onpass=main.assertReturnString,
991 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700992
acsmars5d8cc862015-09-25 09:44:50 -0700993 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
994 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800995 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700996 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800997 ]
998 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700999 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001000 ]
Jeremy42df2e72016-02-23 16:37:46 -08001001 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001002 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001003 main,
1004 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001005 senders=senders,
1006 recipients=recipients,
1007 ethType="IPV4" )
1008
1009 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001010 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001011 main,
1012 intentId=installResult,
1013 name="DUALSTACK1",
1014 senders=senders,
1015 recipients=recipients,
1016 sw1="s5",
1017 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001018 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001019 else:
Devin Lim142b5342017-07-20 15:22:39 -07001020 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001021
1022 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001023 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001024 onpass=main.assertReturnString,
1025 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001026
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001027 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001028 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001029 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001030 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001031 ]
1032 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001033 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001034 ]
Jeremy42df2e72016-02-23 16:37:46 -08001035 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001036 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001037 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001038 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001039 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001040 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001041
1042 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001043 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001044 main,
1045 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001046 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001047 senders=senders,
1048 recipients=recipients,
1049 sw1="s5",
1050 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001051 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001052
1053 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001054 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001055 onpass=main.assertReturnString,
1056 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001057
Jeremy Songsterff553672016-05-12 17:06:23 -07001058 main.step( "VLAN: Add point intents between h5 and h21" )
1059 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1060 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001061 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001062 ]
1063 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001064 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001065 ]
1066 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001067 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001068 main,
1069 name="VLAN2",
1070 senders=senders,
1071 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001072 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001073
1074 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001075 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001076 main,
1077 intentId=installResult,
1078 name="VLAN2",
1079 senders=senders,
1080 recipients=recipients,
1081 sw1="s5",
1082 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001083 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001084
1085 utilities.assert_equals( expect=main.TRUE,
1086 actual=testResult,
1087 onpass=main.assertReturnString,
1088 onfail=main.assertReturnString )
1089
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001090 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001091 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001092 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001093 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001094 ]
1095 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001096 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001097 ]
Jeremy42df2e72016-02-23 16:37:46 -08001098 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001099 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001100 main,
1101 name="1HOP IPV4",
1102 senders=senders,
1103 recipients=recipients,
1104 ethType="IPV4" )
1105
1106 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001107 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001108 main,
1109 intentId=installResult,
1110 name="1HOP IPV4",
1111 senders=senders,
1112 recipients=recipients,
1113 sw1="s5",
1114 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001115 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001116 else:
Devin Lim142b5342017-07-20 15:22:39 -07001117 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001118
1119 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001120 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001121 onpass=main.assertReturnString,
1122 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001123
Jeremy Songsterc032f162016-08-04 17:14:49 -07001124 main.step( "Add point to point intents using VLAN Encapsulation" )
1125 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1126 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001127 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001128 ]
1129 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001130 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001131 ]
1132 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001133 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001134 main,
1135 name="ENCAPSULATION",
1136 senders=senders,
1137 recipients=recipients,
1138 encap="VLAN" )
1139
1140 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001141 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001142 main,
1143 intentId=installResult,
1144 name="ENCAPSULATION",
1145 senders=senders,
1146 recipients=recipients,
1147 sw1="s5",
1148 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001149 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001150 else:
Devin Lim142b5342017-07-20 15:22:39 -07001151 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001152
1153 utilities.assert_equals( expect=main.TRUE,
1154 actual=testResult,
1155 onpass=main.assertReturnString,
1156 onfail=main.assertReturnString )
1157
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001158 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1159 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1160 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001161 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001162 ]
1163 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001164 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001165 ]
1166 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001167 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001168 main,
1169 name="NOOPTION",
1170 senders=senders,
1171 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001172 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001173
1174 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001175 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001176 main,
1177 intentId=installResult,
1178 name="NOOPTION",
1179 senders=senders,
1180 recipients=recipients,
1181 sw1="s5",
1182 sw2="s2",
1183 expectedLink=18 )
1184 else:
Devin Lim142b5342017-07-20 15:22:39 -07001185 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001186
1187 utilities.assert_equals( expect=main.TRUE,
1188 actual=testResult,
1189 onpass=main.assertReturnString,
1190 onfail=main.assertReturnString )
1191
Jon Hall78be4962017-05-23 14:53:53 -07001192 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001193 # main.step( "Add point to point intents using MPLS Encapsulation" )
1194 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1195 # senders = [
1196 # { "name": "h1", "device": "of:0000000000000005/1" }
1197 # ]
1198 # recipients = [
1199 # { "name": "h9", "device": "of:0000000000000006/1" }
1200 # ]
1201 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001202 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001203 # main,
1204 # name="ENCAPSULATION",
1205 # senders=senders,
1206 # recipients=recipients,
1207 # encap="MPLS" )
1208 #
1209 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001210 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001211 # main,
1212 # intentId=installResult,
1213 # name="ENCAPSULATION",
1214 # senders=senders,
1215 # recipients=recipients,
1216 # sw1="s5",
1217 # sw2="s2",
1218 # expectedLink=18 )
1219 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001220 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001221 #
1222 # utilities.assert_equals( expect=main.TRUE,
1223 # actual=testResult,
1224 # onpass=main.assertReturnString,
1225 # onfail=main.assertReturnString )
1226
Jon Hall78be4962017-05-23 14:53:53 -07001227 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001228
kelvin-onlabb769f562015-07-15 17:05:10 -07001229 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001230 """
1231 Add single point to multi point intents
1232 - Get device ids
1233 - Add single point to multi point intents
1234 - Check intents
1235 - Verify flows
1236 - Ping hosts
1237 - Reroute
1238 - Link down
1239 - Verify flows
1240 - Check topology
1241 - Ping hosts
1242 - Link up
1243 - Verify flows
1244 - Check topology
1245 - Ping hosts
1246 - Remove intents
1247 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001248 if main.initialized == main.FALSE:
1249 main.log.error( "Test components did not start correctly, skipping further tests" )
1250 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001251 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001252 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001253 assert main.Mininet1
1254 except AssertionError:
1255 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1256 main.initialized = main.FALSE
1257 main.skipCase()
1258 try:
1259 assert main.numSwitch
1260 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001261 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001262 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001263 main.initialized = main.FALSE
1264 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001265
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001266 main.testName = "Single to Multi Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001267 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001268 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001269 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001270 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001271 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001272 "Different type of hosts will be tested in " +\
1273 "each step such as IPV4, Dual stack, VLAN etc" +\
1274 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001275 " OVS running in Mininet and compile intents" +\
1276 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001277
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001278 main.step( "NOOPTION: Install and test single point to multi point intents" )
1279 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1280 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001281 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001282 ]
1283 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001284 { "name": "h16", "device": "of:0000000000000006/8" },
1285 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001286 ]
Jon Hall9c888672017-05-15 18:03:54 -07001287 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1288 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001289 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001290 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001291 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001292 name="NOOPTION",
1293 senders=senders,
1294 recipients=recipients,
1295 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001296 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001297
1298 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001299 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001300 main,
1301 intentId=installResult,
1302 name="NOOPTION",
1303 senders=senders,
1304 recipients=recipients,
1305 badSenders=badSenders,
1306 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001307 sw1="s5",
1308 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001309 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001310 else:
Devin Lim142b5342017-07-20 15:22:39 -07001311 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001312
1313 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001314 actual=testResult,
1315 onpass=main.assertReturnString,
1316 onfail=main.assertReturnString )
1317
1318 main.step( "IPV4: Install and test single point to multi point intents" )
1319 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1320 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001321 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001322 ]
1323 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001324 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1325 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001326 ]
Jon Hall9c888672017-05-15 18:03:54 -07001327 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1328 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001329 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001330 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001331 main,
1332 name="IPV4",
1333 senders=senders,
1334 recipients=recipients,
1335 ethType="IPV4",
1336 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001337 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001338
1339 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001340 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001341 main,
1342 intentId=installResult,
1343 name="IPV4",
1344 senders=senders,
1345 recipients=recipients,
1346 badSenders=badSenders,
1347 badRecipients=badRecipients,
1348 sw1="s5",
1349 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001350 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001351 else:
Devin Lim142b5342017-07-20 15:22:39 -07001352 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001353
1354 utilities.assert_equals( expect=main.TRUE,
1355 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001356 onpass=main.assertReturnString,
1357 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001358
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001359 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001360 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 -08001361 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001362 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001363 ]
1364 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001365 { "name": "h16", "device": "of:0000000000000006/8" },
1366 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001367 ]
Jon Hall9c888672017-05-15 18:03:54 -07001368 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1369 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001370 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001371 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001372 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001373 name="IPV4_2",
1374 senders=senders,
1375 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001376 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001377 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001378 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001379
1380 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001381 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001382 main,
1383 intentId=installResult,
1384 name="IPV4_2",
1385 senders=senders,
1386 recipients=recipients,
1387 badSenders=badSenders,
1388 badRecipients=badRecipients,
1389 sw1="s5",
1390 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001391 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001392 else:
Devin Lim142b5342017-07-20 15:22:39 -07001393 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001394
1395 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001396 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001397 onpass=main.assertReturnString,
1398 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001399
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001400 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001401 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 -08001402 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001403 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001404 ]
1405 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001406 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1407 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001408 ]
Jon Hall9c888672017-05-15 18:03:54 -07001409 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1410 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001411 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001412 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001413 main,
alison52b25892016-09-19 10:53:48 -07001414 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001415 senders=senders,
1416 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001417 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001418 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001419
1420 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001421 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001422 main,
1423 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001424 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001425 senders=senders,
1426 recipients=recipients,
1427 badSenders=badSenders,
1428 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001429 sw1="s5",
1430 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001431 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001432 else:
Devin Lim142b5342017-07-20 15:22:39 -07001433 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001434
1435 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001436 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001437 onpass=main.assertReturnString,
1438 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001439
Jeremy Songsterff553672016-05-12 17:06:23 -07001440 main.step( "VLAN: Add single point to multi point intents" )
1441 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1442 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001443 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001444 ]
1445 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001446 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1447 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001448 ]
Jon Hall9c888672017-05-15 18:03:54 -07001449 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1450 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001451 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001452 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001453 main,
1454 name="VLAN2",
1455 senders=senders,
1456 recipients=recipients,
1457 sw1="s5",
1458 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001459 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001460
1461 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001462 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001463 main,
1464 intentId=installResult,
1465 name="VLAN2",
1466 senders=senders,
1467 recipients=recipients,
1468 badSenders=badSenders,
1469 badRecipients=badRecipients,
1470 sw1="s5",
1471 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001472 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001473 else:
Devin Lim142b5342017-07-20 15:22:39 -07001474 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001475
1476 utilities.assert_equals( expect=main.TRUE,
1477 actual=testResult,
1478 onpass=main.assertReturnString,
1479 onfail=main.assertReturnString )
1480
alison52b25892016-09-19 10:53:48 -07001481 # Does not support Single point to multi point encapsulation
1482 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1483 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1484 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001485 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001486 # ]
1487 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001488 # { "name": "h16", "device": "of:0000000000000006/8" },
1489 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001490 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001491 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1492 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001493 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001494 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001495 # main,
1496 # name="ENCAPSULATION",
1497 # senders=senders,
1498 # recipients=recipients,
1499 # sw1="s5",
1500 # sw2="s2",
1501 # encap="VLAN" )
1502 #
1503 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001504 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001505 # main,
1506 # intentId=installResult,
1507 # name="ENCAPSULATION",
1508 # senders=senders,
1509 # recipients=recipients,
1510 # badSenders=badSenders,
1511 # badRecipients=badRecipients,
1512 # sw1="s5",
1513 # sw2="s2",
1514 # expectedLink=18 )
1515 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001516 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001517 #
1518 # utilities.assert_equals( expect=main.TRUE,
1519 # actual=testResult,
1520 # onpass=main.assertReturnString,
1521 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001522
Jon Hall78be4962017-05-23 14:53:53 -07001523 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001524
kelvin-onlabb769f562015-07-15 17:05:10 -07001525 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001526 """
1527 Add multi point to single point intents
1528 - Get device ids
1529 - Add multi point to single point intents
1530 - Check intents
1531 - Verify flows
1532 - Ping hosts
1533 - Reroute
1534 - Link down
1535 - Verify flows
1536 - Check topology
1537 - Ping hosts
1538 - Link up
1539 - Verify flows
1540 - Check topology
1541 - Ping hosts
1542 - Remove intents
1543 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001544 if main.initialized == main.FALSE:
1545 main.log.error( "Test components did not start correctly, skipping further tests" )
1546 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001547 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001548 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001549 assert main.Mininet1
1550 except AssertionError:
1551 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1552 main.initialized = main.FALSE
1553 main.skipCase()
1554 try:
1555 assert main.numSwitch
1556 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001557 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001558 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001559 main.initialized = main.FALSE
1560 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001561
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001562 main.testName = "Multi To Single Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001563 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001564 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001565 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001566 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001567 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001568 "Different type of hosts will be tested in " +\
1569 "each step such as IPV4, Dual stack, VLAN etc" +\
1570 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001571 " OVS running in Mininet and compile intents" +\
1572 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001573
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001574 main.step( "NOOPTION: Add multi point to single point intents" )
1575 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1576 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001577 { "name": "h16", "device": "of:0000000000000006/8" },
1578 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001579 ]
1580 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001581 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001582 ]
Jon Hall9c888672017-05-15 18:03:54 -07001583 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1584 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001585 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001586 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001587 main,
1588 name="NOOPTION",
1589 senders=senders,
1590 recipients=recipients,
1591 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001592 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001593
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001594 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001595 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001596 main,
1597 intentId=installResult,
1598 name="NOOPTION",
1599 senders=senders,
1600 recipients=recipients,
1601 badSenders=badSenders,
1602 badRecipients=badRecipients,
1603 sw1="s5",
1604 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001605 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001606 else:
Devin Lim142b5342017-07-20 15:22:39 -07001607 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001608
1609 utilities.assert_equals( expect=main.TRUE,
1610 actual=testResult,
1611 onpass=main.assertReturnString,
1612 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001613
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001614 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001615 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 -08001616 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001617 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1618 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001619 ]
1620 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001621 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001622 ]
Jon Hall9c888672017-05-15 18:03:54 -07001623 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1624 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001625 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001626 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001627 main,
1628 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001629 senders=senders,
1630 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001631 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001632 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001633 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001634
1635 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001636 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001637 main,
1638 intentId=installResult,
1639 name="IPV4",
1640 senders=senders,
1641 recipients=recipients,
1642 badSenders=badSenders,
1643 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001644 sw1="s5",
1645 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001646 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001647 else:
Devin Lim142b5342017-07-20 15:22:39 -07001648 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001649
1650 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001651 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001652 onpass=main.assertReturnString,
1653 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001654
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001655 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001656 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 -08001657 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001658 { "name": "h16", "device": "of:0000000000000006/8" },
1659 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001660 ]
1661 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001662 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001663 ]
Jon Hall9c888672017-05-15 18:03:54 -07001664 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1665 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001666 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001667 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001668 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001669 name="IPV4_2",
1670 senders=senders,
1671 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001672 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001673 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001674 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001675
1676 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001677 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001678 main,
1679 intentId=installResult,
1680 name="IPV4_2",
1681 senders=senders,
1682 recipients=recipients,
1683 badSenders=badSenders,
1684 badRecipients=badRecipients,
1685 sw1="s5",
1686 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001687 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001688 else:
Devin Lim142b5342017-07-20 15:22:39 -07001689 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001690
1691 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001692 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001693 onpass=main.assertReturnString,
1694 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001695
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001696 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001697 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 -08001698 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001699 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1700 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001701 ]
1702 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001703 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001704 ]
Jon Hall9c888672017-05-15 18:03:54 -07001705 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1706 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001707 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001708 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001709 main,
1710 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001711 senders=senders,
1712 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001713 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001714 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001715
1716 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001717 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001718 main,
1719 intentId=installResult,
1720 name="VLAN",
1721 senders=senders,
1722 recipients=recipients,
1723 badSenders=badSenders,
1724 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001725 sw1="s5",
1726 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001727 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001728 else:
Devin Lim142b5342017-07-20 15:22:39 -07001729 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001730
1731 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001732 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001733 onpass=main.assertReturnString,
1734 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001735
Jeremy Songsterff553672016-05-12 17:06:23 -07001736 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1737 main.step( "VLAN: Add multi point to single point intents" )
1738 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1739 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001740 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1741 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001742 ]
1743 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001744 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001745 ]
Jon Hall9c888672017-05-15 18:03:54 -07001746 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1747 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001748 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001749 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001750 main,
1751 name="VLAN2",
1752 senders=senders,
1753 recipients=recipients,
1754 sw1="s5",
1755 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001756 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001757
1758 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001759 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001760 main,
1761 intentId=installResult,
1762 name="VLAN2",
1763 senders=senders,
1764 recipients=recipients,
1765 badSenders=badSenders,
1766 badRecipients=badRecipients,
1767 sw1="s5",
1768 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001769 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001770 else:
Devin Lim142b5342017-07-20 15:22:39 -07001771 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001772
1773 utilities.assert_equals( expect=main.TRUE,
1774 actual=testResult,
1775 onpass=main.assertReturnString,
1776 onfail=main.assertReturnString )
1777
Jeremy Songsterc032f162016-08-04 17:14:49 -07001778 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1779 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1780 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001781 { "name": "h16", "device": "of:0000000000000006/8" },
1782 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001783 ]
1784 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001785 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001786 ]
Jon Hall9c888672017-05-15 18:03:54 -07001787 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1788 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001789 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001790 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001791 main,
1792 name="ENCAPSULATION",
1793 senders=senders,
1794 recipients=recipients,
1795 sw1="s5",
1796 sw2="s2",
1797 encap="VLAN" )
1798
1799 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001800 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001801 main,
1802 intentId=installResult,
1803 name="ENCAPSULATION",
1804 senders=senders,
1805 recipients=recipients,
1806 badSenders=badSenders,
1807 badRecipients=badRecipients,
1808 sw1="s5",
1809 sw2="s2",
1810 expectedLink=18 )
1811 else:
Devin Lim142b5342017-07-20 15:22:39 -07001812 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001813
1814 utilities.assert_equals( expect=main.TRUE,
1815 actual=testResult,
1816 onpass=main.assertReturnString,
1817 onfail=main.assertReturnString )
1818
Jon Hall78be4962017-05-23 14:53:53 -07001819 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07001820 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
1821 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1822 #senders = [
1823 # { "name": "h16", "device": "of:0000000000000006/8" },
1824 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001825 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001826 #recipients = [
1827 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001828 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001829 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07001830 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07001831 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001832 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001833 # main,
1834 # name="ENCAPSULATION",
1835 # senders=senders,
1836 # recipients=recipients,
1837 # sw1="s5",
1838 # sw2="s2",
1839 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07001840 #
Shreyaca8990f2017-03-16 11:43:11 -07001841 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001842 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001843 # main,
1844 # intentId=installResult,
1845 # name="ENCAPSULATION",
1846 # senders=senders,
1847 # recipients=recipients,
1848 # badSenders=badSenders,
1849 # badRecipients=badRecipients,
1850 # sw1="s5",
1851 # sw2="s2",
1852 # expectedLink=18 )
1853 #else:
Devin Lim142b5342017-07-20 15:22:39 -07001854 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001855 #
Shreyaca8990f2017-03-16 11:43:11 -07001856 #utilities.assert_equals( expect=main.TRUE,
1857 # actual=testResult,
1858 # onpass=main.assertReturnString,
1859 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07001860
Jon Hall78be4962017-05-23 14:53:53 -07001861 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001862
acsmars1ff5e052015-07-23 11:27:48 -07001863 def CASE5000( self, main ):
1864 """
acsmars5d8cc862015-09-25 09:44:50 -07001865 Tests Host Mobility
1866 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001867 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001868 if main.initialized == main.FALSE:
1869 main.log.error( "Test components did not start correctly, skipping further tests" )
1870 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001871 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001872 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001873 assert main.Mininet1
1874 except AssertionError:
1875 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1876 main.initialized = main.FALSE
1877 main.skipCase()
1878 try:
1879 assert main.numSwitch
1880 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001881 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001882 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001883 main.initialized = main.FALSE
1884 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001885 main.case( "Test host mobility with host intents " + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001886 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001887 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001888
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001889 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07001890 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001891
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001892 # Send discovery ping from moved host
1893 # Moving the host brings down the default interfaces and creates a new one.
1894 # Scapy is restarted on this host to detect the new interface
1895 main.h1.stopScapy()
1896 main.h1.startScapy()
1897
1898 # Discover new host location in ONOS and populate host data.
1899 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001900 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1901 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001902
acsmars1ff5e052015-07-23 11:27:48 -07001903 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1904
1905 utilities.assert_equals( expect="of:0000000000000006",
1906 actual=h1PostMove,
1907 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001908 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001909 " to single point intents" +
1910 " with IPV4 type and MAC addresses" +
1911 " in the same VLAN" )
1912
1913 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001914 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001915 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1916 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001917 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001918 installResult = main.intents.installHostIntent( main,
1919 name="IPV4 Mobility IPV4",
1920 onosNode=0,
1921 host1=host1,
1922 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001923 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001924 testResult = main.intents.testHostIntent( main,
1925 name="Host Mobility IPV4",
1926 intentId=installResult,
1927 onosNode=0,
1928 host1=host1,
1929 host2=host2,
1930 sw1="s6",
1931 sw2="s2",
1932 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001933 else:
Devin Lim142b5342017-07-20 15:22:39 -07001934 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001935
1936 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001937 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001938 onpass=main.assertReturnString,
1939 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001940
Jon Hall78be4962017-05-23 14:53:53 -07001941 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001942
1943 def CASE6000( self, main ):
1944 """
1945 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1946 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001947 # At some later point discussion on this behavior in MPSP and SPMP intents
1948 # will be reoppened and this test case may need to be updated to reflect
1949 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001950 if main.initialized == main.FALSE:
1951 main.log.error( "Test components did not start correctly, skipping further tests" )
1952 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001953 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001954 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001955 assert main.Mininet1
1956 except AssertionError:
1957 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1958 main.initialized = main.FALSE
1959 main.skipCase()
1960 try:
1961 assert main.numSwitch
1962 except AssertionError:
alison52b25892016-09-19 10:53:48 -07001963 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001964 main.initialized = main.FALSE
1965 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001966 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001967 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07001968 main.step( "Installing Multi to Single Point intents with no options set" )
1969 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1970 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08001971 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001972 { "name": "h16", "device": "of:0000000000000006/8" },
1973 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001974 ]
1975 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001976 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001977 ]
1978 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001979 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001980 ]
1981 isolatedRecipients = []
1982 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001983 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08001984 main,
1985 name="NOOPTION",
1986 senders=senders,
1987 recipients=recipients,
1988 sw1="s5",
1989 sw2="s2" )
1990
1991 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001992 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08001993 main,
1994 intentId=installResult,
1995 name="NOOPTION",
1996 senders=senders,
1997 recipients=recipients,
1998 isolatedSenders=isolatedSenders,
1999 isolatedRecipients=isolatedRecipients,
2000 sw1="s6",
2001 sw2="s2",
2002 sw3="s4",
2003 sw4="s1",
2004 sw5="s3",
2005 expectedLink1=16,
2006 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002007 else:
Devin Lim142b5342017-07-20 15:22:39 -07002008 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002009
2010 utilities.assert_equals( expect=main.TRUE,
2011 actual=testResult,
2012 onpass=main.assertReturnString,
2013 onfail=main.assertReturnString )
2014
Jeremy Songster9385d412016-06-02 17:57:36 -07002015 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2016
2017 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2018 "with partial failures allowed\n"
2019 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002020 { "name": "h16", "device": "of:0000000000000006/8" },
2021 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002022 ]
2023 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002024 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002025 ]
2026 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002027 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002028 ]
2029 isolatedRecipients = []
2030 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002031 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002032 main,
2033 name="NOOPTION",
2034 senders=senders,
2035 recipients=recipients,
2036 sw1="s5",
2037 sw2="s2",
2038 partial=True )
2039
2040 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002041 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002042 main,
2043 intentId=installResult,
2044 name="NOOPTION",
2045 senders=senders,
2046 recipients=recipients,
2047 isolatedSenders=isolatedSenders,
2048 isolatedRecipients=isolatedRecipients,
2049 sw1="s6",
2050 sw2="s2",
2051 sw3="s4",
2052 sw4="s1",
2053 sw5="s3",
2054 expectedLink1=16,
2055 expectedLink2=14,
2056 partial=True )
2057 else:
Devin Lim142b5342017-07-20 15:22:39 -07002058 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002059
2060 utilities.assert_equals( expect=main.TRUE,
2061 actual=testResult,
2062 onpass=main.assertReturnString,
2063 onfail=main.assertReturnString )
2064
Jeremye0cb5eb2016-01-27 17:39:09 -08002065 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002066 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2067 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002068 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002069 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002070 ]
2071 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002072 { "name": "h16", "device": "of:0000000000000006/8" },
2073 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002074 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002075 isolatedSenders = []
2076 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002077 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002078 ]
2079 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002080 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002081 main,
2082 name="NOOPTION",
2083 senders=senders,
2084 recipients=recipients,
2085 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002086 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002087
2088 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002089 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002090 main,
2091 intentId=installResult,
2092 name="NOOPTION",
2093 senders=senders,
2094 recipients=recipients,
2095 isolatedSenders=isolatedSenders,
2096 isolatedRecipients=isolatedRecipients,
2097 sw1="s6",
2098 sw2="s2",
2099 sw3="s4",
2100 sw4="s1",
2101 sw5="s3",
2102 expectedLink1=16,
2103 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002104 else:
Devin Lim142b5342017-07-20 15:22:39 -07002105 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002106
2107 utilities.assert_equals( expect=main.TRUE,
2108 actual=testResult,
2109 onpass=main.assertReturnString,
2110 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002111 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002112 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002113 "intents with partial failures allowed" )
2114 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2115 "point intent with partial failures allowed\n"
2116 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002117 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002118 ]
2119 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002120 { "name": "h16", "device": "of:0000000000000006/8" },
2121 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002122 ]
2123 isolatedSenders = []
2124 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002125 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002126 ]
2127 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002128 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002129 main,
2130 name="NOOPTION",
2131 senders=senders,
2132 recipients=recipients,
2133 sw1="s5",
2134 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002135 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002136
2137 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002138 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002139 main,
2140 intentId=installResult,
2141 name="NOOPTION",
2142 senders=senders,
2143 recipients=recipients,
2144 isolatedSenders=isolatedSenders,
2145 isolatedRecipients=isolatedRecipients,
2146 sw1="s6",
2147 sw2="s2",
2148 sw3="s4",
2149 sw4="s1",
2150 sw5="s3",
2151 expectedLink1=16,
2152 expectedLink2=14,
2153 partial=True )
2154 else:
Devin Lim142b5342017-07-20 15:22:39 -07002155 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002156
2157 utilities.assert_equals( expect=main.TRUE,
2158 actual=testResult,
2159 onpass=main.assertReturnString,
2160 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002161
Jon Hall78be4962017-05-23 14:53:53 -07002162 main.intents.report( main )