blob: 3686ca5ec3240fcbb7d79e2157b95a10180962da [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
2Copyright 2015 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
kelvin-onlabd48a68c2015-07-13 16:01:36 -070022# Testing the basic intent functionality of ONOS
23
Jon Hall78be4962017-05-23 14:53:53 -070024
kelvin-onlabd48a68c2015-07-13 16:01:36 -070025class FUNCintent:
26
27 def __init__( self ):
28 self.default = ''
29
30 def CASE1( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -070031 import imp
Jon Hallf632d202015-07-30 15:45:11 -070032 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070033 """
34 - Construct tests variables
35 - GIT ( optional )
36 - Checkout ONOS master branch
37 - Pull latest ONOS code
38 - Building ONOS ( optional )
39 - Install ONOS package
40 - Build ONOS package
41 """
Devin Lim58046fa2017-07-05 16:55:00 -070042
43 try:
44 from tests.dependencies.ONOSSetup import ONOSSetup
45 main.testSetUp = ONOSSetup()
46 except ImportError:
47 main.log.error( "ONOSSetup not found. exiting the test" )
48 main.exit()
49 main.testSetUp.envSetupDescription()
kelvin-onlabd48a68c2015-07-13 16:01:36 -070050 stepResult = main.FALSE
51
52 # Test variables
Jon Halla3e02432015-07-24 15:55:42 -070053 try:
Jon Halla3e02432015-07-24 15:55:42 -070054 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
Jon Halla3e02432015-07-24 15:55:42 -070055 main.dependencyPath = main.testOnDirectory + \
56 main.params[ 'DEPENDENCY' ][ 'path' ]
57 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
58 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070059
Jon Halla3e02432015-07-24 15:55:42 -070060 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
61 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
62 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
63 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
64 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
acsmarscfa52272015-08-06 15:21:45 -070065 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
Jon Halla3e02432015-07-24 15:55:42 -070066 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
67 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
Shreyaca8990f2017-03-16 11:43:11 -070068 main.checkConnectionSleep = int( main.params[ 'SLEEP' ][ 'checkConnection' ] )
69 main.checkFlowCountSleep = int( main.params[ 'SLEEP' ][ 'checkFlowCount' ] )
70 main.checkIntentHostSleep = int( main.params[ 'SLEEP' ][ 'checkIntentHost' ] )
71 main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] )
acsmars59a4c552015-09-10 18:11:19 -070072 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
Jeremy Songster306ed7a2016-07-19 10:59:07 -070073 main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
Jon Halla3e02432015-07-24 15:55:42 -070074 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
75 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
Jon Halla3e02432015-07-24 15:55:42 -070076 main.hostsData = {}
Jeremy Songster1f39bf02016-01-20 17:17:25 -080077 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
78 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070079 main.assertReturnString = '' # Assembled assert return string
Jon Hall78be4962017-05-23 14:53:53 -070080 main.cycle = 0 # How many times FUNCintent has run through its tests
kelvin-onlabd48a68c2015-07-13 16:01:36 -070081
Jon Halla3e02432015-07-24 15:55:42 -070082 # -- INIT SECTION, ONLY RUNS ONCE -- #
kelvin-onlabd48a68c2015-07-13 16:01:36 -070083
Jon Hall78be4962017-05-23 14:53:53 -070084 main.intents = imp.load_source( wrapperFile2,
Jon Halla3e02432015-07-24 15:55:42 -070085 main.dependencyPath +
86 wrapperFile2 +
87 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070088
kelvin-onlabd9e23de2015-08-06 10:34:44 -070089 copyResult1 = main.ONOSbench.scp( main.Mininet1,
90 main.dependencyPath +
91 main.topology,
Jeremy Songster1f39bf02016-01-20 17:17:25 -080092 main.Mininet1.home + "custom/",
kelvin-onlabd9e23de2015-08-06 10:34:44 -070093 direction="to" )
Devin Lim58046fa2017-07-05 16:55:00 -070094
Devin Lim142b5342017-07-20 15:22:39 -070095 stepResult = main.testSetUp.envSetup()
Jon Halla3e02432015-07-24 15:55:42 -070096 except Exception as e:
Devin Lim58046fa2017-07-05 16:55:00 -070097 main.testSetUp.envSetupException( e )
98 main.testSetUp.evnSetupConclusion( stepResult )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070099
100 def CASE2( self, main ):
101 """
102 - Set up cell
103 - Create cell file
104 - Set cell file
105 - Verify cell file
106 - Kill ONOS process
107 - Uninstall ONOS cluster
108 - Verify ONOS start up
109 - Install ONOS cluster
110 - Connect to cli
111 """
Jeremy Songster17147f22016-05-31 18:30:52 -0700112
Jeremycd872222016-03-29 10:08:34 -0700113 main.flowCompiler = "Flow Rules"
Devin Lim142b5342017-07-20 15:22:39 -0700114 main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True )
Jon Hall78be4962017-05-23 14:53:53 -0700115 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700116
Jon Halla3e02432015-07-24 15:55:42 -0700117 def CASE8( self, main ):
118 """
acsmars59a4c552015-09-10 18:11:19 -0700119 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700120 """
Devin Lim58046fa2017-07-05 16:55:00 -0700121 import time
122 try:
123 from tests.dependencies.topology import Topology
124 except ImportError:
125 main.log.error( "Topology not found exiting the test" )
126 main.exit()
127 try:
128 main.topoRelated
129 except ( NameError, AttributeError ):
130 main.topoRelated = Topology()
131 main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700132 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700133 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700134 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700135 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700136 if main.initialized == main.FALSE:
137 main.log.error( "Test components did not start correctly, skipping further tests" )
138 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700139 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700140 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700141 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700142 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700143 "switches to test intents, exits out if " +\
144 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700145
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700146 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700147 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700148 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700149 main.topology,
150 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700151 stepResult = topoResult
152 utilities.assert_equals( expect=main.TRUE,
153 actual=stepResult,
154 onpass="Successfully loaded topology",
155 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700156
157 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700158 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700159 main.initialized = main.FALSE
160 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700161
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700162 def CASE11( self, main ):
163 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700164 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700165 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700166 if main.initialized == main.FALSE:
167 main.log.error( "Test components did not start correctly, skipping further tests" )
168 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700169 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700170 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700171 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700172 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700173 "switches to test intents, exits out if " +\
174 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700175
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700176 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700177 args = "--switch ovs,protocols=OpenFlow13"
178 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
179 main.topology,
180 args=args )
181 stepResult = topoResult
182 utilities.assert_equals( expect=main.TRUE,
183 actual=stepResult,
184 onpass="Successfully loaded topology",
185 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700186 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700187 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700188 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700189
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700190 def CASE12( self, main ):
191 """
192 Assign mastership to controllers
193 """
194 import re
195
Jeremyd9e4eb12016-04-13 12:09:06 -0700196 if main.initialized == main.FALSE:
197 main.log.error( "Test components did not start correctly, skipping further tests" )
198 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700199 main.case( "Assign switches to controllers" )
200 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700201 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700202 " switches to ONOS nodes"
203
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700204 switchList = []
205
206 # Creates a list switch name, use getSwitch() function later...
207 for i in range( 1, ( main.numSwitch + 1 ) ):
208 switchList.append( 's' + str( i ) )
209
Devin Lim142b5342017-07-20 15:22:39 -0700210 tempONOSip = main.Cluster.getIps()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700211
212 assignResult = main.Mininet1.assignSwController( sw=switchList,
213 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700214 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700215 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700216 main.log.error( "Problem assigning mastership of switches" )
217 main.initialized = main.FALSE
218 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700219
220 for i in range( 1, ( main.numSwitch + 1 ) ):
221 response = main.Mininet1.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700222 main.log.debug( "Response is " + str( response ) )
Devin Lim142b5342017-07-20 15:22:39 -0700223 if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700224 assignResult = assignResult and main.TRUE
225 else:
226 assignResult = main.FALSE
227 stepResult = assignResult
228 utilities.assert_equals( expect=main.TRUE,
229 actual=stepResult,
230 onpass="Successfully assigned switches" +
231 "to controller",
232 onfail="Failed to assign switches to " +
233 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700234 if not stepResult:
235 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700236
Jon Hall78be4962017-05-23 14:53:53 -0700237 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700238 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800239 Create Scapy components
240 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700241 if main.initialized == main.FALSE:
242 main.log.error( "Test components did not start correctly, skipping further tests" )
243 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800244 main.case( "Create scapy components" )
245 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800246 scapyResult = main.TRUE
247 for hostName in main.scapyHostNames:
248 main.Scapy1.createHostComponent( hostName )
249 main.scapyHosts.append( getattr( main, hostName ) )
250
251 main.step( "Start scapy components" )
252 for host in main.scapyHosts:
253 host.startHostCli()
254 host.startScapy()
255 host.updateSelf()
256 main.log.debug( host.name )
257 main.log.debug( host.hostIp )
258 main.log.debug( host.hostMac )
259
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800260 utilities.assert_equals( expect=main.TRUE,
261 actual=scapyResult,
262 onpass="Successfully created Scapy Components",
263 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700264 if not scapyResult:
265 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800266
267 def CASE14( self, main ):
268 """
269 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700270 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700271 if main.initialized == main.FALSE:
272 main.log.error( "Test components did not start correctly, skipping further tests" )
273 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700274 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800275 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700276 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700277
Jon Hall78be4962017-05-23 14:53:53 -0700278 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
279 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700280 utilities.assert_equals( expect=main.TRUE,
281 actual=stepResult,
282 onpass="Successfully discovered hosts",
283 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700284 if not stepResult:
285 main.initialized = main.FALSE
286 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700287
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800288 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700289 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700290 utilities.assert_equals( expect=main.TRUE,
291 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800292 onpass="Successfully populated hostsData",
293 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700294 if not stepResult:
295 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800296
297 def CASE15( self, main ):
298 """
299 Discover all hosts with scapy arp packets and store its data to a dictionary
300 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700301 if main.initialized == main.FALSE:
302 main.log.error( "Test components did not start correctly, skipping further tests" )
303 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800304 main.case( "Discover all hosts using scapy" )
305 main.step( "Send packets from each host to the first host and confirm onos discovery" )
306
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800307 if len( main.scapyHosts ) < 1:
308 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700309 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800310 main.skipCase()
311
312 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700313 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800314
Jon Hall78be4962017-05-23 14:53:53 -0700315 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800316 retValue=main.FALSE, args=[ main ],
317 attempts=main.checkTopoAttempts, sleep=2 )
318
319 utilities.assert_equals( expect=main.TRUE,
320 actual=stepResult,
321 onpass="ONOS correctly discovered all hosts",
322 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700323 if not stepResult:
324 main.initialized = main.FALSE
325 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800326
327 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700328 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800329 utilities.assert_equals( expect=main.TRUE,
330 actual=stepResult,
331 onpass="Successfully populated hostsData",
332 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700333 if not stepResult:
334 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800335
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800336 def CASE16( self, main ):
337 """
Jeremy42df2e72016-02-23 16:37:46 -0800338 Balance Masters
339 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700340 if main.initialized == main.FALSE:
341 main.log.error( "Test components did not start correctly, skipping further tests" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700342 main.stop()
Jeremyd9e4eb12016-04-13 12:09:06 -0700343 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800344 main.case( "Balance mastership of switches" )
345 main.step( "Balancing mastership of switches" )
346
Devin Lim142b5342017-07-20 15:22:39 -0700347 balanceResult = utilities.retry( f=main.Cluster.active( 0 ).CLI.balanceMasters, retValue=main.FALSE, args=[] )
Jeremy42df2e72016-02-23 16:37:46 -0800348
349 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700350 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800351 onpass="Successfully balanced mastership of switches",
352 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700353 if not balanceResult:
354 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800355
356 def CASE17( self, main ):
357 """
Jeremy6e9748f2016-03-25 15:03:39 -0700358 Use Flow Objectives
359 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700360 if main.initialized == main.FALSE:
361 main.log.error( "Test components did not start correctly, skipping further tests" )
362 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700363 main.case( "Enable intent compilation using Flow Objectives" )
364 main.step( "Enabling Flow Objectives" )
365
366 main.flowCompiler = "Flow Objectives"
367
368 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
369
Devin Lim142b5342017-07-20 15:22:39 -0700370 stepResult = main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
Jeremy6e9748f2016-03-25 15:03:39 -0700371 propName="useFlowObjectives", value="true" )
Devin Lim142b5342017-07-20 15:22:39 -0700372 stepResult &= main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
You Wang106d0fa2017-05-15 17:22:15 -0700373 propName="defaultFlowObjectiveCompiler",
Jon Hall78be4962017-05-23 14:53:53 -0700374 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700375
376 utilities.assert_equals( expect=main.TRUE,
377 actual=stepResult,
378 onpass="Successfully activated Flow Objectives",
379 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700380 if not balanceResult:
381 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700382
383 def CASE18( self, main ):
384 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800385 Stop mininet and remove scapy host
386 """
Devin Lim58046fa2017-07-05 16:55:00 -0700387 try:
388 from tests.dependencies.utils import Utils
389 except ImportError:
390 main.log.error( "Utils not found exiting the test" )
391 main.exit()
392 try:
393 main.Utils
394 except ( NameError, AttributeError ):
395 main.Utils = Utils()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800396 main.log.report( "Stop Mininet and Scapy" )
397 main.case( "Stop Mininet and Scapy" )
398 main.caseExplanation = "Stopping the current mininet topology " +\
399 "to start up fresh"
400 main.step( "Stopping and Removing Scapy Host Components" )
401 scapyResult = main.TRUE
402 for host in main.scapyHosts:
403 scapyResult = scapyResult and host.stopScapy()
404 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
405
406 for host in main.scapyHosts:
407 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
408 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
409
410 main.scapyHosts = []
411 main.scapyHostIPs = []
412
413 utilities.assert_equals( expect=main.TRUE,
414 actual=scapyResult,
415 onpass="Successfully stopped scapy and removed host components",
416 onfail="Failed to stop mininet and scapy" )
417
Devin Lim58046fa2017-07-05 16:55:00 -0700418 mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700419 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800420 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700421 main.cleanup()
422 main.exit()
423
Jeremy Songster17147f22016-05-31 18:30:52 -0700424 def CASE19( self, main ):
425 """
426 Copy the karaf.log files after each testcase cycle
427 """
Devin Lim58046fa2017-07-05 16:55:00 -0700428 try:
429 from tests.dependencies.utils import Utils
430 except ImportError:
431 main.log.error( "Utils not found exiting the test" )
432 main.exit()
433 try:
434 main.Utils
435 except ( NameError, AttributeError ):
436 main.Utils = Utils()
Devin Lim142b5342017-07-20 15:22:39 -0700437 main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
kelvin-onlabb769f562015-07-15 17:05:10 -0700438 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700439 """
440 Add host intents between 2 host:
441 - Discover hosts
442 - Add host intents
443 - Check intents
444 - Verify flows
445 - Ping hosts
446 - Reroute
447 - Link down
448 - Verify flows
449 - Check topology
450 - Ping hosts
451 - Link up
452 - Verify flows
453 - Check topology
454 - Ping hosts
455 - Remove intents
456 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700457 if main.initialized == main.FALSE:
458 main.log.error( "Test components did not start correctly, skipping further tests" )
459 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700460 # Assert variables - These variable's name|format must be followed
461 # if you want to use the wrapper function
462 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700463 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700464 assert main.Mininet1
465 except AssertionError:
466 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
467 main.initialized = main.FALSE
468 main.skipCase()
469 try:
470 assert main.numSwitch
471 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700472 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700473 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700474 main.initialized = main.FALSE
475 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700476
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800477 # Save leader candidates
Devin Lim142b5342017-07-20 15:22:39 -0700478 intentLeadersOld = main.Cluster.active( 0 ).CLI.leaderCandidates()
acsmarse6b410f2015-07-17 14:39:34 -0700479
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700480 main.testName = "Host Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700481 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700482 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700483 main.caseExplanation = "This test case tests Host intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -0700484 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700485 "Different type of hosts will be tested in " +\
486 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700487 "etc;\nThe test will use OF " + main.OFProtocol +\
488 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700489 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700490
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700491 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700492 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700493 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
494 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800495 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700496 installResult = main.intents.installHostIntent( main,
497 name="IPV4",
498 onosNode=0,
499 host1=host1,
500 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800501 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700502 testResult = main.intents.testHostIntent( main,
503 name="IPV4",
504 intentId=installResult,
505 onosNode=0,
506 host1=host1,
507 host2=host2,
508 sw1="s5",
509 sw2="s2",
510 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800511 else:
Devin Lim142b5342017-07-20 15:22:39 -0700512 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800513
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700514 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800515 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700516 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700517 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700518
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700519 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700520 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700521 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700522 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800523 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700524 installResult = main.intents.installHostIntent( main,
525 name="DUALSTACK",
526 onosNode=0,
527 host1=host1,
528 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800529
530 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700531 testResult = main.intents.testHostIntent( main,
532 name="DUALSTACK",
533 intentId=installResult,
534 onosNode=0,
535 host1=host1,
536 host2=host2,
537 sw1="s5",
538 sw2="s2",
539 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700540
541 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800542 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700543 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700544 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700545
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700546 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700547 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700548 host1 = { "name": "h1" }
549 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800550 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700551 installResult = main.intents.installHostIntent( main,
552 name="DUALSTACK2",
553 onosNode=0,
554 host1=host1,
555 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800556
557 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700558 testResult = main.intents.testHostIntent( main,
559 name="DUALSTACK2",
560 intentId=installResult,
561 onosNode=0,
562 host1=host1,
563 host2=host2,
564 sw1="s5",
565 sw2="s2",
566 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800567 else:
Devin Lim142b5342017-07-20 15:22:39 -0700568 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700569
570 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800571 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700572 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700573 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700574
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700575 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700576 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700577 host1 = { "name": "h1" }
578 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800579 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700580 installResult = main.intents.installHostIntent( main,
581 name="1HOP",
582 onosNode=0,
583 host1=host1,
584 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800585
586 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700587 testResult = main.intents.testHostIntent( main,
588 name="1HOP",
589 intentId=installResult,
590 onosNode=0,
591 host1=host1,
592 host2=host2,
593 sw1="s5",
594 sw2="s2",
595 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800596 else:
Devin Lim142b5342017-07-20 15:22:39 -0700597 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700598
599 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800600 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700601 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700602 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700603
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700604 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700605 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700606 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
607 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800608 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700609 installResult = main.intents.installHostIntent( main,
610 name="VLAN1",
611 onosNode=0,
612 host1=host1,
613 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800614 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700615 testResult = main.intents.testHostIntent( main,
616 name="VLAN1",
617 intentId=installResult,
618 onosNode=0,
619 host1=host1,
620 host2=host2,
621 sw1="s5",
622 sw2="s2",
623 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800624 else:
Devin Lim142b5342017-07-20 15:22:39 -0700625 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700626
627 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800628 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700629 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700630 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700631
Jeremy Songsterff553672016-05-12 17:06:23 -0700632 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
633 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700634 host1 = { "name": "h5", "vlan": "200" }
635 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700636 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700637 installResult = main.intents.installHostIntent( main,
638 name="VLAN2",
639 onosNode=0,
640 host1=host1,
641 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700642
643 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700644 testResult = main.intents.testHostIntent( main,
645 name="VLAN2",
646 intentId=installResult,
647 onosNode=0,
648 host1=host1,
649 host2=host2,
650 sw1="s5",
651 sw2="s2",
652 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700653 else:
Devin Lim142b5342017-07-20 15:22:39 -0700654 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -0700655
656 utilities.assert_equals( expect=main.TRUE,
657 actual=testResult,
658 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700659 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700660
Jeremy Songsterc032f162016-08-04 17:14:49 -0700661 main.step( "Encapsulation: Add host intents between h1 and h9" )
662 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700663 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
664 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700665 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700666 installResult = main.intents.installHostIntent( main,
667 name="ENCAPSULATION",
668 onosNode=0,
669 host1=host1,
670 host2=host2,
671 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700672 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700673 testResult = main.intents.testHostIntent( main,
674 name="ENCAPSULATION",
675 intentId=installResult,
676 onosNode=0,
677 host1=host1,
678 host2=host2,
679 sw1="s5",
680 sw2="s2",
681 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700682 else:
Devin Lim142b5342017-07-20 15:22:39 -0700683 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700684
685 utilities.assert_equals( expect=main.TRUE,
686 actual=testResult,
687 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700688 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700689
Jon Hall78be4962017-05-23 14:53:53 -0700690 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700691 # main.step( "Encapsulation: Add host intents between h1 and h9" )
692 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
693 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
694 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
695 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700696 # installResult = main.intents.installHostIntent( main,
697 # name="ENCAPSULATION",
698 # onosNode=0,
699 # host1=host1,
700 # host2=host2,
701 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700702 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700703 # testResult = main.intents.testHostIntent( main,
704 # name="ENCAPSULATION",
705 # intentId=installResult,
706 # onosNode=0,
707 # host1=host1,
708 # host2=host2,
709 # sw1="s5",
710 # sw2="s2",
711 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700712 # else:
Devin Lim142b5342017-07-20 15:22:39 -0700713 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -0700714 #
715 # utilities.assert_equals( expect=main.TRUE,
716 # actual=testResult,
717 # onpass=main.assertReturnString,
718 # onfail=main.assertReturnString )
719
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700720 main.step( "Confirm that ONOS leadership is unchanged" )
Devin Lim142b5342017-07-20 15:22:39 -0700721 intentLeadersNew = main.Cluster.active( 0 ).CLI.leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700722 testResult = main.intents.checkLeaderChange( intentLeadersOld,
723 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700724
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800725 utilities.assert_equals( expect=main.TRUE,
726 actual=testResult,
727 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700728 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800729
Jon Hall78be4962017-05-23 14:53:53 -0700730 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700731
kelvin-onlabb769f562015-07-15 17:05:10 -0700732 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700733 """
734 Add point intents between 2 hosts:
735 - Get device ids | ports
736 - Add point intents
737 - Check intents
738 - Verify flows
739 - Ping hosts
740 - Reroute
741 - Link down
742 - Verify flows
743 - Check topology
744 - Ping hosts
745 - Link up
746 - Verify flows
747 - Check topology
748 - Ping hosts
749 - Remove intents
750 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700751 if main.initialized == main.FALSE:
752 main.log.error( "Test components did not start correctly, skipping further tests" )
753 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700754 # Assert variables - These variable's name|format must be followed
755 # if you want to use the wrapper function
756 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700757 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700758 assert main.Mininet1
759 except AssertionError:
760 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
761 main.initialized = main.FALSE
762 main.skipCase()
763 try:
764 assert main.numSwitch
765 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700766 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700767 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700768 main.initialized = main.FALSE
769 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700770
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700771 main.testName = "Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700772 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700773 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700774 main.caseExplanation = "This test case will test point to point" +\
Devin Lim142b5342017-07-20 15:22:39 -0700775 " intents using " + str( main.Cluster.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700776 " node(s) cluster;\n" +\
777 "Different type of hosts will be tested in " +\
778 "each step such as IPV4, Dual stack, VLAN etc" +\
779 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700780 " OVS running in Mininet and compile intents" +\
781 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700782
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700783 # No option point intents
784 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700785 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800786 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700787 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800788 ]
789 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700790 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800791 ]
Jeremy42df2e72016-02-23 16:37:46 -0800792 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700793 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700794 main,
795 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800796 senders=senders,
797 recipients=recipients )
798
799 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700800 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800801 main,
802 intentId=installResult,
803 name="NOOPTION",
804 senders=senders,
805 recipients=recipients,
806 sw1="s5",
807 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700808 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800809 else:
Devin Lim142b5342017-07-20 15:22:39 -0700810 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700811
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700812 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800813 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700814 onpass=main.assertReturnString,
815 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700816
kelvin-onlabb769f562015-07-15 17:05:10 -0700817 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700818 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800819 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700820 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800821 ]
822 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700823 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800824 ]
Jeremy42df2e72016-02-23 16:37:46 -0800825 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700826 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700827 main,
828 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800829 senders=senders,
830 recipients=recipients,
831 ethType="IPV4" )
832
833 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700834 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800835 main,
836 intentId=installResult,
837 name="IPV4",
838 senders=senders,
839 recipients=recipients,
840 sw1="s5",
841 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700842 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800843 else:
Devin Lim142b5342017-07-20 15:22:39 -0700844 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700845
846 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800847 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700848 onpass=main.assertReturnString,
849 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800850
Jon Hall78be4962017-05-23 14:53:53 -0700851 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800852 main.assertReturnString = "Assertion Result for protected point intent\n"
853 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700854 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800855 ]
856 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700857 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800858 ]
859 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700860 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800861 main,
862 name="Protected",
863 senders=senders,
864 recipients=recipients,
865 protected=True )
866
867 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700868 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800869 main,
870 name="Protected",
871 intentId=installResult,
872 senders=senders,
873 recipients=recipients,
874 sw1="s5",
875 sw2="s2",
876 protected=True,
877 expectedLink=18 )
878 else:
Devin Lim142b5342017-07-20 15:22:39 -0700879 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alisonda157272016-12-22 01:13:21 -0800880
881 utilities.assert_equals( expect=main.TRUE,
882 actual=testResult,
883 onpass=main.assertReturnString,
884 onfail=main.assertReturnString )
885
kelvin-onlabb769f562015-07-15 17:05:10 -0700886 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700887 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800888 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700889 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800890 ]
891 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700892 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800893 ]
Jeremy42df2e72016-02-23 16:37:46 -0800894 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700895 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700896 main,
897 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800898 senders=senders,
899 recipients=recipients,
900 ethType="IPV4" )
901
902 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700903 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800904 main,
905 intentId=installResult,
906 name="IPV4_2",
907 senders=senders,
908 recipients=recipients,
909 sw1="s5",
910 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700911 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800912 else:
Devin Lim142b5342017-07-20 15:22:39 -0700913 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700914
915 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800916 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700917 onpass=main.assertReturnString,
918 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700919
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700920 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700921 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800922 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700923 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -0800924 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800925 ]
926 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700927 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -0800928 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800929 ]
Jeremy6f000c62016-02-25 17:02:28 -0800930 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700931 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800932 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
933 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800934 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700935 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800936 main,
937 name="SDNIP-ICMP",
938 senders=senders,
939 recipients=recipients,
940 ethType="IPV4",
941 ipProto=ipProto,
942 tcpSrc=tcpSrc,
943 tcpDst=tcpDst )
944
945 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700946 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800947 main,
948 intentId=installResult,
949 name="SDNIP_ICMP",
950 senders=senders,
951 recipients=recipients,
952 sw1="s5",
953 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700954 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700955 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800956 else:
Devin Lim142b5342017-07-20 15:22:39 -0700957 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700958
959 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800960 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700961 onpass=main.assertReturnString,
962 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700963
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700964 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700965 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700966 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
967 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700968 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
969 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700970 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
971 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
972 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
973
Jon Hall78be4962017-05-23 14:53:53 -0700974 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700975 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700976 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700977 host1="h1",
978 host2="h9",
979 deviceId1="of:0000000000000005/1",
980 deviceId2="of:0000000000000006/1",
981 mac1=mac1,
982 mac2=mac2,
983 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700984 ipProto=ipProto,
985 ip1=ip1,
986 ip2=ip2,
987 tcp1=tcp1,
988 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -0700989
990 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -0800991 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -0700992 onpass=main.assertReturnString,
993 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700994
acsmars5d8cc862015-09-25 09:44:50 -0700995 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
996 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800997 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700998 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800999 ]
1000 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001001 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001002 ]
Jeremy42df2e72016-02-23 16:37:46 -08001003 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001004 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001005 main,
1006 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001007 senders=senders,
1008 recipients=recipients,
1009 ethType="IPV4" )
1010
1011 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001012 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001013 main,
1014 intentId=installResult,
1015 name="DUALSTACK1",
1016 senders=senders,
1017 recipients=recipients,
1018 sw1="s5",
1019 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001020 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001021 else:
Devin Lim142b5342017-07-20 15:22:39 -07001022 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001023
1024 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001025 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001026 onpass=main.assertReturnString,
1027 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001028
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001029 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001030 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001031 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001032 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001033 ]
1034 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001035 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001036 ]
Jeremy42df2e72016-02-23 16:37:46 -08001037 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001038 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001039 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001040 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001041 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001042 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001043
1044 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001045 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001046 main,
1047 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001048 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001049 senders=senders,
1050 recipients=recipients,
1051 sw1="s5",
1052 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001053 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001054
1055 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001056 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001057 onpass=main.assertReturnString,
1058 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001059
Jeremy Songsterff553672016-05-12 17:06:23 -07001060 main.step( "VLAN: Add point intents between h5 and h21" )
1061 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1062 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001063 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001064 ]
1065 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001066 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001067 ]
1068 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001069 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001070 main,
1071 name="VLAN2",
1072 senders=senders,
1073 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001074 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001075
1076 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001077 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001078 main,
1079 intentId=installResult,
1080 name="VLAN2",
1081 senders=senders,
1082 recipients=recipients,
1083 sw1="s5",
1084 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001085 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001086
1087 utilities.assert_equals( expect=main.TRUE,
1088 actual=testResult,
1089 onpass=main.assertReturnString,
1090 onfail=main.assertReturnString )
1091
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001092 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001093 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001094 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001095 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001096 ]
1097 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001098 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001099 ]
Jeremy42df2e72016-02-23 16:37:46 -08001100 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001101 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001102 main,
1103 name="1HOP IPV4",
1104 senders=senders,
1105 recipients=recipients,
1106 ethType="IPV4" )
1107
1108 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001109 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001110 main,
1111 intentId=installResult,
1112 name="1HOP IPV4",
1113 senders=senders,
1114 recipients=recipients,
1115 sw1="s5",
1116 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001117 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001118 else:
Devin Lim142b5342017-07-20 15:22:39 -07001119 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001120
1121 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001122 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001123 onpass=main.assertReturnString,
1124 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001125
Jeremy Songsterc032f162016-08-04 17:14:49 -07001126 main.step( "Add point to point intents using VLAN Encapsulation" )
1127 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1128 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001129 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001130 ]
1131 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001132 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001133 ]
1134 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001135 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001136 main,
1137 name="ENCAPSULATION",
1138 senders=senders,
1139 recipients=recipients,
1140 encap="VLAN" )
1141
1142 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001143 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001144 main,
1145 intentId=installResult,
1146 name="ENCAPSULATION",
1147 senders=senders,
1148 recipients=recipients,
1149 sw1="s5",
1150 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001151 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001152 else:
Devin Lim142b5342017-07-20 15:22:39 -07001153 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001154
1155 utilities.assert_equals( expect=main.TRUE,
1156 actual=testResult,
1157 onpass=main.assertReturnString,
1158 onfail=main.assertReturnString )
1159
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001160 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1161 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1162 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001163 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001164 ]
1165 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001166 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001167 ]
1168 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001169 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001170 main,
1171 name="NOOPTION",
1172 senders=senders,
1173 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001174 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001175
1176 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001177 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001178 main,
1179 intentId=installResult,
1180 name="NOOPTION",
1181 senders=senders,
1182 recipients=recipients,
1183 sw1="s5",
1184 sw2="s2",
1185 expectedLink=18 )
1186 else:
Devin Lim142b5342017-07-20 15:22:39 -07001187 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001188
1189 utilities.assert_equals( expect=main.TRUE,
1190 actual=testResult,
1191 onpass=main.assertReturnString,
1192 onfail=main.assertReturnString )
1193
Jon Hall78be4962017-05-23 14:53:53 -07001194 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001195 # main.step( "Add point to point intents using MPLS Encapsulation" )
1196 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1197 # senders = [
1198 # { "name": "h1", "device": "of:0000000000000005/1" }
1199 # ]
1200 # recipients = [
1201 # { "name": "h9", "device": "of:0000000000000006/1" }
1202 # ]
1203 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001204 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001205 # main,
1206 # name="ENCAPSULATION",
1207 # senders=senders,
1208 # recipients=recipients,
1209 # encap="MPLS" )
1210 #
1211 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001212 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001213 # main,
1214 # intentId=installResult,
1215 # name="ENCAPSULATION",
1216 # senders=senders,
1217 # recipients=recipients,
1218 # sw1="s5",
1219 # sw2="s2",
1220 # expectedLink=18 )
1221 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001222 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001223 #
1224 # utilities.assert_equals( expect=main.TRUE,
1225 # actual=testResult,
1226 # onpass=main.assertReturnString,
1227 # onfail=main.assertReturnString )
1228
Jon Hall78be4962017-05-23 14:53:53 -07001229 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001230
kelvin-onlabb769f562015-07-15 17:05:10 -07001231 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001232 """
1233 Add single point to multi point intents
1234 - Get device ids
1235 - Add single point to multi point intents
1236 - Check intents
1237 - Verify flows
1238 - Ping hosts
1239 - Reroute
1240 - Link down
1241 - Verify flows
1242 - Check topology
1243 - Ping hosts
1244 - Link up
1245 - Verify flows
1246 - Check topology
1247 - Ping hosts
1248 - Remove intents
1249 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001250 if main.initialized == main.FALSE:
1251 main.log.error( "Test components did not start correctly, skipping further tests" )
1252 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001253 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001254 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001255 assert main.Mininet1
1256 except AssertionError:
1257 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1258 main.initialized = main.FALSE
1259 main.skipCase()
1260 try:
1261 assert main.numSwitch
1262 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001263 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001264 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001265 main.initialized = main.FALSE
1266 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001267
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001268 main.testName = "Single to Multi Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001269 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001270 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001271 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001272 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001273 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001274 "Different type of hosts will be tested in " +\
1275 "each step such as IPV4, Dual stack, VLAN etc" +\
1276 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001277 " OVS running in Mininet and compile intents" +\
1278 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001279
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001280 main.step( "NOOPTION: Install and test single point to multi point intents" )
1281 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1282 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001283 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001284 ]
1285 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001286 { "name": "h16", "device": "of:0000000000000006/8" },
1287 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001288 ]
Jon Hall9c888672017-05-15 18:03:54 -07001289 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1290 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001291 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001292 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001293 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001294 name="NOOPTION",
1295 senders=senders,
1296 recipients=recipients,
1297 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001298 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001299
1300 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001301 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001302 main,
1303 intentId=installResult,
1304 name="NOOPTION",
1305 senders=senders,
1306 recipients=recipients,
1307 badSenders=badSenders,
1308 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001309 sw1="s5",
1310 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001311 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001312 else:
Devin Lim142b5342017-07-20 15:22:39 -07001313 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001314
1315 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001316 actual=testResult,
1317 onpass=main.assertReturnString,
1318 onfail=main.assertReturnString )
1319
1320 main.step( "IPV4: Install and test single point to multi point intents" )
1321 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1322 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001323 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001324 ]
1325 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001326 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1327 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001328 ]
Jon Hall9c888672017-05-15 18:03:54 -07001329 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1330 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001331 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001332 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001333 main,
1334 name="IPV4",
1335 senders=senders,
1336 recipients=recipients,
1337 ethType="IPV4",
1338 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001339 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001340
1341 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001342 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001343 main,
1344 intentId=installResult,
1345 name="IPV4",
1346 senders=senders,
1347 recipients=recipients,
1348 badSenders=badSenders,
1349 badRecipients=badRecipients,
1350 sw1="s5",
1351 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001352 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001353 else:
Devin Lim142b5342017-07-20 15:22:39 -07001354 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001355
1356 utilities.assert_equals( expect=main.TRUE,
1357 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001358 onpass=main.assertReturnString,
1359 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001360
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001361 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001362 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 -08001363 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001364 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001365 ]
1366 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001367 { "name": "h16", "device": "of:0000000000000006/8" },
1368 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001369 ]
Jon Hall9c888672017-05-15 18:03:54 -07001370 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1371 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001372 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001373 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001374 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001375 name="IPV4_2",
1376 senders=senders,
1377 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001378 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001379 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001380 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001381
1382 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001383 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001384 main,
1385 intentId=installResult,
1386 name="IPV4_2",
1387 senders=senders,
1388 recipients=recipients,
1389 badSenders=badSenders,
1390 badRecipients=badRecipients,
1391 sw1="s5",
1392 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001393 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001394 else:
Devin Lim142b5342017-07-20 15:22:39 -07001395 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001396
1397 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001398 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001399 onpass=main.assertReturnString,
1400 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001401
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001402 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001403 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 -08001404 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001405 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001406 ]
1407 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001408 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1409 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001410 ]
Jon Hall9c888672017-05-15 18:03:54 -07001411 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1412 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001413 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001414 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001415 main,
alison52b25892016-09-19 10:53:48 -07001416 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001417 senders=senders,
1418 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001419 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001420 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001421
1422 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001423 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001424 main,
1425 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001426 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001427 senders=senders,
1428 recipients=recipients,
1429 badSenders=badSenders,
1430 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001431 sw1="s5",
1432 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001433 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001434 else:
Devin Lim142b5342017-07-20 15:22:39 -07001435 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001436
1437 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001438 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001439 onpass=main.assertReturnString,
1440 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001441
Jeremy Songsterff553672016-05-12 17:06:23 -07001442 main.step( "VLAN: Add single point to multi point intents" )
1443 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1444 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001445 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001446 ]
1447 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001448 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1449 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001450 ]
Jon Hall9c888672017-05-15 18:03:54 -07001451 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1452 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001453 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001454 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001455 main,
1456 name="VLAN2",
1457 senders=senders,
1458 recipients=recipients,
1459 sw1="s5",
1460 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001461 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001462
1463 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001464 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001465 main,
1466 intentId=installResult,
1467 name="VLAN2",
1468 senders=senders,
1469 recipients=recipients,
1470 badSenders=badSenders,
1471 badRecipients=badRecipients,
1472 sw1="s5",
1473 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001474 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001475 else:
Devin Lim142b5342017-07-20 15:22:39 -07001476 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001477
1478 utilities.assert_equals( expect=main.TRUE,
1479 actual=testResult,
1480 onpass=main.assertReturnString,
1481 onfail=main.assertReturnString )
1482
alison52b25892016-09-19 10:53:48 -07001483 # Does not support Single point to multi point encapsulation
1484 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1485 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1486 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001487 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001488 # ]
1489 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001490 # { "name": "h16", "device": "of:0000000000000006/8" },
1491 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001492 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001493 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1494 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001495 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001496 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001497 # main,
1498 # name="ENCAPSULATION",
1499 # senders=senders,
1500 # recipients=recipients,
1501 # sw1="s5",
1502 # sw2="s2",
1503 # encap="VLAN" )
1504 #
1505 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001506 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001507 # main,
1508 # intentId=installResult,
1509 # name="ENCAPSULATION",
1510 # senders=senders,
1511 # recipients=recipients,
1512 # badSenders=badSenders,
1513 # badRecipients=badRecipients,
1514 # sw1="s5",
1515 # sw2="s2",
1516 # expectedLink=18 )
1517 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001518 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001519 #
1520 # utilities.assert_equals( expect=main.TRUE,
1521 # actual=testResult,
1522 # onpass=main.assertReturnString,
1523 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001524
Jon Hall78be4962017-05-23 14:53:53 -07001525 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001526
kelvin-onlabb769f562015-07-15 17:05:10 -07001527 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001528 """
1529 Add multi point to single point intents
1530 - Get device ids
1531 - Add multi point to single point intents
1532 - Check intents
1533 - Verify flows
1534 - Ping hosts
1535 - Reroute
1536 - Link down
1537 - Verify flows
1538 - Check topology
1539 - Ping hosts
1540 - Link up
1541 - Verify flows
1542 - Check topology
1543 - Ping hosts
1544 - Remove intents
1545 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001546 if main.initialized == main.FALSE:
1547 main.log.error( "Test components did not start correctly, skipping further tests" )
1548 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001549 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001550 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001551 assert main.Mininet1
1552 except AssertionError:
1553 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1554 main.initialized = main.FALSE
1555 main.skipCase()
1556 try:
1557 assert main.numSwitch
1558 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001559 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001560 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001561 main.initialized = main.FALSE
1562 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001563
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001564 main.testName = "Multi To Single Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001565 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001566 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001567 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001568 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001569 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001570 "Different type of hosts will be tested in " +\
1571 "each step such as IPV4, Dual stack, VLAN etc" +\
1572 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001573 " OVS running in Mininet and compile intents" +\
1574 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001575
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001576 main.step( "NOOPTION: Add multi point to single point intents" )
1577 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1578 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001579 { "name": "h16", "device": "of:0000000000000006/8" },
1580 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001581 ]
1582 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001583 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001584 ]
Jon Hall9c888672017-05-15 18:03:54 -07001585 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1586 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001587 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001588 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001589 main,
1590 name="NOOPTION",
1591 senders=senders,
1592 recipients=recipients,
1593 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001594 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001595
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001596 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001597 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001598 main,
1599 intentId=installResult,
1600 name="NOOPTION",
1601 senders=senders,
1602 recipients=recipients,
1603 badSenders=badSenders,
1604 badRecipients=badRecipients,
1605 sw1="s5",
1606 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001607 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001608 else:
Devin Lim142b5342017-07-20 15:22:39 -07001609 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001610
1611 utilities.assert_equals( expect=main.TRUE,
1612 actual=testResult,
1613 onpass=main.assertReturnString,
1614 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001615
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001616 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001617 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 -08001618 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001619 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1620 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001621 ]
1622 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001623 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001624 ]
Jon Hall9c888672017-05-15 18:03:54 -07001625 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1626 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001627 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001628 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001629 main,
1630 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001631 senders=senders,
1632 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001633 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001634 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001635 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001636
1637 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001638 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001639 main,
1640 intentId=installResult,
1641 name="IPV4",
1642 senders=senders,
1643 recipients=recipients,
1644 badSenders=badSenders,
1645 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001646 sw1="s5",
1647 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001648 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001649 else:
Devin Lim142b5342017-07-20 15:22:39 -07001650 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001651
1652 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001653 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001654 onpass=main.assertReturnString,
1655 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001656
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001657 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001658 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 -08001659 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001660 { "name": "h16", "device": "of:0000000000000006/8" },
1661 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001662 ]
1663 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001664 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001665 ]
Jon Hall9c888672017-05-15 18:03:54 -07001666 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1667 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001668 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001669 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001670 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001671 name="IPV4_2",
1672 senders=senders,
1673 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001674 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001675 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001676 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001677
1678 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001679 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001680 main,
1681 intentId=installResult,
1682 name="IPV4_2",
1683 senders=senders,
1684 recipients=recipients,
1685 badSenders=badSenders,
1686 badRecipients=badRecipients,
1687 sw1="s5",
1688 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001689 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001690 else:
Devin Lim142b5342017-07-20 15:22:39 -07001691 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001692
1693 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001694 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001695 onpass=main.assertReturnString,
1696 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001697
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001698 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001699 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 -08001700 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001701 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1702 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001703 ]
1704 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001705 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001706 ]
Jon Hall9c888672017-05-15 18:03:54 -07001707 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1708 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001709 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001710 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001711 main,
1712 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001713 senders=senders,
1714 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001715 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001716 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001717
1718 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001719 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001720 main,
1721 intentId=installResult,
1722 name="VLAN",
1723 senders=senders,
1724 recipients=recipients,
1725 badSenders=badSenders,
1726 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001727 sw1="s5",
1728 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001729 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001730 else:
Devin Lim142b5342017-07-20 15:22:39 -07001731 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001732
1733 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001734 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001735 onpass=main.assertReturnString,
1736 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001737
Jeremy Songsterff553672016-05-12 17:06:23 -07001738 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1739 main.step( "VLAN: Add multi point to single point intents" )
1740 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1741 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001742 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1743 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001744 ]
1745 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001746 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001747 ]
Jon Hall9c888672017-05-15 18:03:54 -07001748 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1749 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001750 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001751 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001752 main,
1753 name="VLAN2",
1754 senders=senders,
1755 recipients=recipients,
1756 sw1="s5",
1757 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001758 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001759
1760 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001761 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001762 main,
1763 intentId=installResult,
1764 name="VLAN2",
1765 senders=senders,
1766 recipients=recipients,
1767 badSenders=badSenders,
1768 badRecipients=badRecipients,
1769 sw1="s5",
1770 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001771 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001772 else:
Devin Lim142b5342017-07-20 15:22:39 -07001773 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001774
1775 utilities.assert_equals( expect=main.TRUE,
1776 actual=testResult,
1777 onpass=main.assertReturnString,
1778 onfail=main.assertReturnString )
1779
Jeremy Songsterc032f162016-08-04 17:14:49 -07001780 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1781 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1782 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001783 { "name": "h16", "device": "of:0000000000000006/8" },
1784 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001785 ]
1786 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001787 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001788 ]
Jon Hall9c888672017-05-15 18:03:54 -07001789 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1790 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001791 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001792 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001793 main,
1794 name="ENCAPSULATION",
1795 senders=senders,
1796 recipients=recipients,
1797 sw1="s5",
1798 sw2="s2",
1799 encap="VLAN" )
1800
1801 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001802 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001803 main,
1804 intentId=installResult,
1805 name="ENCAPSULATION",
1806 senders=senders,
1807 recipients=recipients,
1808 badSenders=badSenders,
1809 badRecipients=badRecipients,
1810 sw1="s5",
1811 sw2="s2",
1812 expectedLink=18 )
1813 else:
Devin Lim142b5342017-07-20 15:22:39 -07001814 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001815
1816 utilities.assert_equals( expect=main.TRUE,
1817 actual=testResult,
1818 onpass=main.assertReturnString,
1819 onfail=main.assertReturnString )
1820
Jon Hall78be4962017-05-23 14:53:53 -07001821 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07001822 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
1823 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1824 #senders = [
1825 # { "name": "h16", "device": "of:0000000000000006/8" },
1826 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001827 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001828 #recipients = [
1829 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001830 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001831 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07001832 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07001833 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001834 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001835 # main,
1836 # name="ENCAPSULATION",
1837 # senders=senders,
1838 # recipients=recipients,
1839 # sw1="s5",
1840 # sw2="s2",
1841 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07001842 #
Shreyaca8990f2017-03-16 11:43:11 -07001843 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001844 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001845 # main,
1846 # intentId=installResult,
1847 # name="ENCAPSULATION",
1848 # senders=senders,
1849 # recipients=recipients,
1850 # badSenders=badSenders,
1851 # badRecipients=badRecipients,
1852 # sw1="s5",
1853 # sw2="s2",
1854 # expectedLink=18 )
1855 #else:
Devin Lim142b5342017-07-20 15:22:39 -07001856 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001857 #
Shreyaca8990f2017-03-16 11:43:11 -07001858 #utilities.assert_equals( expect=main.TRUE,
1859 # actual=testResult,
1860 # onpass=main.assertReturnString,
1861 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07001862
Jon Hall78be4962017-05-23 14:53:53 -07001863 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001864
acsmars1ff5e052015-07-23 11:27:48 -07001865 def CASE5000( self, main ):
1866 """
acsmars5d8cc862015-09-25 09:44:50 -07001867 Tests Host Mobility
1868 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001869 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001870 if main.initialized == main.FALSE:
1871 main.log.error( "Test components did not start correctly, skipping further tests" )
1872 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001873 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001874 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001875 assert main.Mininet1
1876 except AssertionError:
1877 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1878 main.initialized = main.FALSE
1879 main.skipCase()
1880 try:
1881 assert main.numSwitch
1882 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001883 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001884 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001885 main.initialized = main.FALSE
1886 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001887 main.case( "Test host mobility with host intents " + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001888 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001889 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001890
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001891 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07001892 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001893
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001894 # Send discovery ping from moved host
1895 # Moving the host brings down the default interfaces and creates a new one.
1896 # Scapy is restarted on this host to detect the new interface
1897 main.h1.stopScapy()
1898 main.h1.startScapy()
1899
1900 # Discover new host location in ONOS and populate host data.
1901 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001902 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1903 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001904
acsmars1ff5e052015-07-23 11:27:48 -07001905 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1906
1907 utilities.assert_equals( expect="of:0000000000000006",
1908 actual=h1PostMove,
1909 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001910 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001911 " to single point intents" +
1912 " with IPV4 type and MAC addresses" +
1913 " in the same VLAN" )
1914
1915 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001916 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001917 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1918 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001919 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001920 installResult = main.intents.installHostIntent( main,
1921 name="IPV4 Mobility IPV4",
1922 onosNode=0,
1923 host1=host1,
1924 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001925 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001926 testResult = main.intents.testHostIntent( main,
1927 name="Host Mobility IPV4",
1928 intentId=installResult,
1929 onosNode=0,
1930 host1=host1,
1931 host2=host2,
1932 sw1="s6",
1933 sw2="s2",
1934 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001935 else:
Devin Lim142b5342017-07-20 15:22:39 -07001936 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001937
1938 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001939 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001940 onpass=main.assertReturnString,
1941 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001942
Jon Hall78be4962017-05-23 14:53:53 -07001943 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001944
1945 def CASE6000( self, main ):
1946 """
1947 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1948 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001949 # At some later point discussion on this behavior in MPSP and SPMP intents
1950 # will be reoppened and this test case may need to be updated to reflect
1951 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001952 if main.initialized == main.FALSE:
1953 main.log.error( "Test components did not start correctly, skipping further tests" )
1954 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001955 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001956 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001957 assert main.Mininet1
1958 except AssertionError:
1959 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1960 main.initialized = main.FALSE
1961 main.skipCase()
1962 try:
1963 assert main.numSwitch
1964 except AssertionError:
alison52b25892016-09-19 10:53:48 -07001965 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001966 main.initialized = main.FALSE
1967 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001968 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001969 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07001970 main.step( "Installing Multi to Single Point intents with no options set" )
1971 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1972 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08001973 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001974 { "name": "h16", "device": "of:0000000000000006/8" },
1975 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001976 ]
1977 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001978 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001979 ]
1980 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001981 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001982 ]
1983 isolatedRecipients = []
1984 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001985 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08001986 main,
1987 name="NOOPTION",
1988 senders=senders,
1989 recipients=recipients,
1990 sw1="s5",
1991 sw2="s2" )
1992
1993 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001994 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08001995 main,
1996 intentId=installResult,
1997 name="NOOPTION",
1998 senders=senders,
1999 recipients=recipients,
2000 isolatedSenders=isolatedSenders,
2001 isolatedRecipients=isolatedRecipients,
2002 sw1="s6",
2003 sw2="s2",
2004 sw3="s4",
2005 sw4="s1",
2006 sw5="s3",
2007 expectedLink1=16,
2008 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002009 else:
Devin Lim142b5342017-07-20 15:22:39 -07002010 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002011
2012 utilities.assert_equals( expect=main.TRUE,
2013 actual=testResult,
2014 onpass=main.assertReturnString,
2015 onfail=main.assertReturnString )
2016
Jeremy Songster9385d412016-06-02 17:57:36 -07002017 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2018
2019 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2020 "with partial failures allowed\n"
2021 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002022 { "name": "h16", "device": "of:0000000000000006/8" },
2023 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002024 ]
2025 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002026 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002027 ]
2028 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002029 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002030 ]
2031 isolatedRecipients = []
2032 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002033 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002034 main,
2035 name="NOOPTION",
2036 senders=senders,
2037 recipients=recipients,
2038 sw1="s5",
2039 sw2="s2",
2040 partial=True )
2041
2042 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002043 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002044 main,
2045 intentId=installResult,
2046 name="NOOPTION",
2047 senders=senders,
2048 recipients=recipients,
2049 isolatedSenders=isolatedSenders,
2050 isolatedRecipients=isolatedRecipients,
2051 sw1="s6",
2052 sw2="s2",
2053 sw3="s4",
2054 sw4="s1",
2055 sw5="s3",
2056 expectedLink1=16,
2057 expectedLink2=14,
2058 partial=True )
2059 else:
Devin Lim142b5342017-07-20 15:22:39 -07002060 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002061
2062 utilities.assert_equals( expect=main.TRUE,
2063 actual=testResult,
2064 onpass=main.assertReturnString,
2065 onfail=main.assertReturnString )
2066
Jeremye0cb5eb2016-01-27 17:39:09 -08002067 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002068 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2069 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002070 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002071 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002072 ]
2073 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002074 { "name": "h16", "device": "of:0000000000000006/8" },
2075 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002076 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002077 isolatedSenders = []
2078 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002079 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002080 ]
2081 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002082 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002083 main,
2084 name="NOOPTION",
2085 senders=senders,
2086 recipients=recipients,
2087 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002088 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002089
2090 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002091 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002092 main,
2093 intentId=installResult,
2094 name="NOOPTION",
2095 senders=senders,
2096 recipients=recipients,
2097 isolatedSenders=isolatedSenders,
2098 isolatedRecipients=isolatedRecipients,
2099 sw1="s6",
2100 sw2="s2",
2101 sw3="s4",
2102 sw4="s1",
2103 sw5="s3",
2104 expectedLink1=16,
2105 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002106 else:
Devin Lim142b5342017-07-20 15:22:39 -07002107 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002108
2109 utilities.assert_equals( expect=main.TRUE,
2110 actual=testResult,
2111 onpass=main.assertReturnString,
2112 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002113 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002114 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002115 "intents with partial failures allowed" )
2116 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2117 "point intent with partial failures allowed\n"
2118 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002119 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002120 ]
2121 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002122 { "name": "h16", "device": "of:0000000000000006/8" },
2123 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002124 ]
2125 isolatedSenders = []
2126 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002127 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002128 ]
2129 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002130 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002131 main,
2132 name="NOOPTION",
2133 senders=senders,
2134 recipients=recipients,
2135 sw1="s5",
2136 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002137 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002138
2139 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002140 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002141 main,
2142 intentId=installResult,
2143 name="NOOPTION",
2144 senders=senders,
2145 recipients=recipients,
2146 isolatedSenders=isolatedSenders,
2147 isolatedRecipients=isolatedRecipients,
2148 sw1="s6",
2149 sw2="s2",
2150 sw3="s4",
2151 sw4="s1",
2152 sw5="s3",
2153 expectedLink1=16,
2154 expectedLink2=14,
2155 partial=True )
2156 else:
Devin Lim142b5342017-07-20 15:22:39 -07002157 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002158
2159 utilities.assert_equals( expect=main.TRUE,
2160 actual=testResult,
2161 onpass=main.assertReturnString,
2162 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002163
Jon Hall78be4962017-05-23 14:53:53 -07002164 main.intents.report( main )