blob: 15868727b3d5ceadf084dbd4035910145e632924 [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
95 stepResult = main.testSetUp.envSetup( True )
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 Lim58046fa2017-07-05 16:55:00 -0700114 main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, 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
210 tempONOSip = []
211 for i in range( main.numCtrls ):
212 tempONOSip.append( main.ONOSip[ i ] )
213
214 assignResult = main.Mininet1.assignSwController( sw=switchList,
215 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700216 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700217 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700218 main.log.error( "Problem assigning mastership of switches" )
219 main.initialized = main.FALSE
220 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700221
222 for i in range( 1, ( main.numSwitch + 1 ) ):
223 response = main.Mininet1.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700224 main.log.debug( "Response is " + str( response ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700225 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
226 assignResult = assignResult and main.TRUE
227 else:
228 assignResult = main.FALSE
229 stepResult = assignResult
230 utilities.assert_equals( expect=main.TRUE,
231 actual=stepResult,
232 onpass="Successfully assigned switches" +
233 "to controller",
234 onfail="Failed to assign switches to " +
235 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700236 if not stepResult:
237 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700238
Jon Hall78be4962017-05-23 14:53:53 -0700239 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700240 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800241 Create Scapy components
242 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700243 if main.initialized == main.FALSE:
244 main.log.error( "Test components did not start correctly, skipping further tests" )
245 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800246 main.case( "Create scapy components" )
247 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800248 scapyResult = main.TRUE
249 for hostName in main.scapyHostNames:
250 main.Scapy1.createHostComponent( hostName )
251 main.scapyHosts.append( getattr( main, hostName ) )
252
253 main.step( "Start scapy components" )
254 for host in main.scapyHosts:
255 host.startHostCli()
256 host.startScapy()
257 host.updateSelf()
258 main.log.debug( host.name )
259 main.log.debug( host.hostIp )
260 main.log.debug( host.hostMac )
261
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800262 utilities.assert_equals( expect=main.TRUE,
263 actual=scapyResult,
264 onpass="Successfully created Scapy Components",
265 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700266 if not scapyResult:
267 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800268
269 def CASE14( self, main ):
270 """
271 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700272 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700273 if main.initialized == main.FALSE:
274 main.log.error( "Test components did not start correctly, skipping further tests" )
275 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700276 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800277 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700278 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700279
Jon Hall78be4962017-05-23 14:53:53 -0700280 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
281 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700282 utilities.assert_equals( expect=main.TRUE,
283 actual=stepResult,
284 onpass="Successfully discovered hosts",
285 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700286 if not stepResult:
287 main.initialized = main.FALSE
288 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700289
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800290 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700291 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700292 utilities.assert_equals( expect=main.TRUE,
293 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800294 onpass="Successfully populated hostsData",
295 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700296 if not stepResult:
297 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800298
299 def CASE15( self, main ):
300 """
301 Discover all hosts with scapy arp packets and store its data to a dictionary
302 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700303 if main.initialized == main.FALSE:
304 main.log.error( "Test components did not start correctly, skipping further tests" )
305 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800306 main.case( "Discover all hosts using scapy" )
307 main.step( "Send packets from each host to the first host and confirm onos discovery" )
308
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800309 if len( main.scapyHosts ) < 1:
310 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700311 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800312 main.skipCase()
313
314 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700315 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800316
Jon Hall78be4962017-05-23 14:53:53 -0700317 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800318 retValue=main.FALSE, args=[ main ],
319 attempts=main.checkTopoAttempts, sleep=2 )
320
321 utilities.assert_equals( expect=main.TRUE,
322 actual=stepResult,
323 onpass="ONOS correctly discovered all hosts",
324 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700325 if not stepResult:
326 main.initialized = main.FALSE
327 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800328
329 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700330 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800331 utilities.assert_equals( expect=main.TRUE,
332 actual=stepResult,
333 onpass="Successfully populated hostsData",
334 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700335 if not stepResult:
336 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800337
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800338 def CASE16( self, main ):
339 """
Jeremy42df2e72016-02-23 16:37:46 -0800340 Balance Masters
341 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700342 if main.initialized == main.FALSE:
343 main.log.error( "Test components did not start correctly, skipping further tests" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700344 main.stop()
Jeremyd9e4eb12016-04-13 12:09:06 -0700345 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800346 main.case( "Balance mastership of switches" )
347 main.step( "Balancing mastership of switches" )
348
Jeremy42df2e72016-02-23 16:37:46 -0800349 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
350
351 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700352 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800353 onpass="Successfully balanced mastership of switches",
354 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700355 if not balanceResult:
356 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800357
358 def CASE17( self, main ):
359 """
Jeremy6e9748f2016-03-25 15:03:39 -0700360 Use Flow Objectives
361 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700362 if main.initialized == main.FALSE:
363 main.log.error( "Test components did not start correctly, skipping further tests" )
364 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700365 main.case( "Enable intent compilation using Flow Objectives" )
366 main.step( "Enabling Flow Objectives" )
367
368 main.flowCompiler = "Flow Objectives"
369
370 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
371
372 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
373 propName="useFlowObjectives", value="true" )
You Wang106d0fa2017-05-15 17:22:15 -0700374 stepResult &= main.CLIs[ 0 ].setCfg( component=cmd,
375 propName="defaultFlowObjectiveCompiler",
Jon Hall78be4962017-05-23 14:53:53 -0700376 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700377
378 utilities.assert_equals( expect=main.TRUE,
379 actual=stepResult,
380 onpass="Successfully activated Flow Objectives",
381 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700382 if not balanceResult:
383 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700384
385 def CASE18( self, main ):
386 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800387 Stop mininet and remove scapy host
388 """
Devin Lim58046fa2017-07-05 16:55:00 -0700389 try:
390 from tests.dependencies.utils import Utils
391 except ImportError:
392 main.log.error( "Utils not found exiting the test" )
393 main.exit()
394 try:
395 main.Utils
396 except ( NameError, AttributeError ):
397 main.Utils = Utils()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800398 main.log.report( "Stop Mininet and Scapy" )
399 main.case( "Stop Mininet and Scapy" )
400 main.caseExplanation = "Stopping the current mininet topology " +\
401 "to start up fresh"
402 main.step( "Stopping and Removing Scapy Host Components" )
403 scapyResult = main.TRUE
404 for host in main.scapyHosts:
405 scapyResult = scapyResult and host.stopScapy()
406 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
407
408 for host in main.scapyHosts:
409 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
410 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
411
412 main.scapyHosts = []
413 main.scapyHostIPs = []
414
415 utilities.assert_equals( expect=main.TRUE,
416 actual=scapyResult,
417 onpass="Successfully stopped scapy and removed host components",
418 onfail="Failed to stop mininet and scapy" )
419
Devin Lim58046fa2017-07-05 16:55:00 -0700420 mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700421 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800422 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700423 main.cleanup()
424 main.exit()
425
Jeremy Songster17147f22016-05-31 18:30:52 -0700426 def CASE19( self, main ):
427 """
428 Copy the karaf.log files after each testcase cycle
429 """
Devin Lim58046fa2017-07-05 16:55:00 -0700430 try:
431 from tests.dependencies.utils import Utils
432 except ImportError:
433 main.log.error( "Utils not found exiting the test" )
434 main.exit()
435 try:
436 main.Utils
437 except ( NameError, AttributeError ):
438 main.Utils = Utils()
439 main.Utils.copyKarafLog()
kelvin-onlabb769f562015-07-15 17:05:10 -0700440 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700441 """
442 Add host intents between 2 host:
443 - Discover hosts
444 - Add host intents
445 - Check intents
446 - Verify flows
447 - Ping hosts
448 - Reroute
449 - Link down
450 - Verify flows
451 - Check topology
452 - Ping hosts
453 - Link up
454 - Verify flows
455 - Check topology
456 - Ping hosts
457 - Remove intents
458 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700459 if main.initialized == main.FALSE:
460 main.log.error( "Test components did not start correctly, skipping further tests" )
461 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700462 # Assert variables - These variable's name|format must be followed
463 # if you want to use the wrapper function
464 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700465 try:
466 assert main.CLIs
467 except AssertionError:
468 main.log.error( "There is no main.CLIs, skipping test cases" )
469 main.initialized = main.FALSE
470 main.skipCase()
471 try:
472 assert main.Mininet1
473 except AssertionError:
474 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
475 main.initialized = main.FALSE
476 main.skipCase()
477 try:
478 assert main.numSwitch
479 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700480 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700481 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700482 main.initialized = main.FALSE
483 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700484
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800485 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700486 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
487
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700488 main.testName = "Host Intents"
489 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700490 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700491 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700492 str( main.numCtrls ) + " node(s) cluster;\n" +\
493 "Different type of hosts will be tested in " +\
494 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700495 "etc;\nThe test will use OF " + main.OFProtocol +\
496 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700497 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700498
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700499 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700500 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700501 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
502 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800503 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700504 installResult = main.intents.installHostIntent( main,
505 name="IPV4",
506 onosNode=0,
507 host1=host1,
508 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800509 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700510 testResult = main.intents.testHostIntent( main,
511 name="IPV4",
512 intentId=installResult,
513 onosNode=0,
514 host1=host1,
515 host2=host2,
516 sw1="s5",
517 sw2="s2",
518 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800519 else:
520 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800521
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700522 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800523 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700524 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700525 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700526
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700527 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700528 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700529 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700530 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800531 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700532 installResult = main.intents.installHostIntent( main,
533 name="DUALSTACK",
534 onosNode=0,
535 host1=host1,
536 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800537
538 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700539 testResult = main.intents.testHostIntent( main,
540 name="DUALSTACK",
541 intentId=installResult,
542 onosNode=0,
543 host1=host1,
544 host2=host2,
545 sw1="s5",
546 sw2="s2",
547 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700548
549 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800550 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700551 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700552 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700553
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700554 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700555 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700556 host1 = { "name": "h1" }
557 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800558 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700559 installResult = main.intents.installHostIntent( main,
560 name="DUALSTACK2",
561 onosNode=0,
562 host1=host1,
563 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800564
565 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700566 testResult = main.intents.testHostIntent( main,
567 name="DUALSTACK2",
568 intentId=installResult,
569 onosNode=0,
570 host1=host1,
571 host2=host2,
572 sw1="s5",
573 sw2="s2",
574 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800575 else:
576 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700577
578 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800579 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700580 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700581 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700582
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700583 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700584 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700585 host1 = { "name": "h1" }
586 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800587 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700588 installResult = main.intents.installHostIntent( main,
589 name="1HOP",
590 onosNode=0,
591 host1=host1,
592 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800593
594 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700595 testResult = main.intents.testHostIntent( main,
596 name="1HOP",
597 intentId=installResult,
598 onosNode=0,
599 host1=host1,
600 host2=host2,
601 sw1="s5",
602 sw2="s2",
603 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800604 else:
605 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700606
607 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800608 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700609 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700610 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700611
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700612 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700613 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700614 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
615 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800616 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700617 installResult = main.intents.installHostIntent( main,
618 name="VLAN1",
619 onosNode=0,
620 host1=host1,
621 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800622 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700623 testResult = main.intents.testHostIntent( main,
624 name="VLAN1",
625 intentId=installResult,
626 onosNode=0,
627 host1=host1,
628 host2=host2,
629 sw1="s5",
630 sw2="s2",
631 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800632 else:
633 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700634
635 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800636 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700637 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700638 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700639
Jeremy Songsterff553672016-05-12 17:06:23 -0700640 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
641 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700642 host1 = { "name": "h5", "vlan": "200" }
643 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700644 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700645 installResult = main.intents.installHostIntent( main,
646 name="VLAN2",
647 onosNode=0,
648 host1=host1,
649 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700650
651 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700652 testResult = main.intents.testHostIntent( main,
653 name="VLAN2",
654 intentId=installResult,
655 onosNode=0,
656 host1=host1,
657 host2=host2,
658 sw1="s5",
659 sw2="s2",
660 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700661 else:
662 main.CLIs[ 0 ].removeAllIntents( purge=True )
663
664 utilities.assert_equals( expect=main.TRUE,
665 actual=testResult,
666 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700667 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700668
Jeremy Songsterc032f162016-08-04 17:14:49 -0700669 main.step( "Encapsulation: Add host intents between h1 and h9" )
670 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700671 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
672 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700673 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700674 installResult = main.intents.installHostIntent( main,
675 name="ENCAPSULATION",
676 onosNode=0,
677 host1=host1,
678 host2=host2,
679 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700680 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700681 testResult = main.intents.testHostIntent( main,
682 name="ENCAPSULATION",
683 intentId=installResult,
684 onosNode=0,
685 host1=host1,
686 host2=host2,
687 sw1="s5",
688 sw2="s2",
689 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700690 else:
691 main.CLIs[ 0 ].removeAllIntents( purge=True )
692
693 utilities.assert_equals( expect=main.TRUE,
694 actual=testResult,
695 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700696 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700697
Jon Hall78be4962017-05-23 14:53:53 -0700698 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700699 # main.step( "Encapsulation: Add host intents between h1 and h9" )
700 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
701 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
702 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
703 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700704 # installResult = main.intents.installHostIntent( main,
705 # name="ENCAPSULATION",
706 # onosNode=0,
707 # host1=host1,
708 # host2=host2,
709 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700710 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700711 # testResult = main.intents.testHostIntent( main,
712 # name="ENCAPSULATION",
713 # intentId=installResult,
714 # onosNode=0,
715 # host1=host1,
716 # host2=host2,
717 # sw1="s5",
718 # sw2="s2",
719 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700720 # else:
721 # main.CLIs[ 0 ].removeAllIntents( purge=True )
722 #
723 # utilities.assert_equals( expect=main.TRUE,
724 # actual=testResult,
725 # onpass=main.assertReturnString,
726 # onfail=main.assertReturnString )
727
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700728 main.step( "Confirm that ONOS leadership is unchanged" )
acsmarse6b410f2015-07-17 14:39:34 -0700729 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700730 testResult = main.intents.checkLeaderChange( intentLeadersOld,
731 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700732
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800733 utilities.assert_equals( expect=main.TRUE,
734 actual=testResult,
735 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700736 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800737
Jon Hall78be4962017-05-23 14:53:53 -0700738 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700739
kelvin-onlabb769f562015-07-15 17:05:10 -0700740 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700741 """
742 Add point intents between 2 hosts:
743 - Get device ids | ports
744 - Add point intents
745 - Check intents
746 - Verify flows
747 - Ping hosts
748 - Reroute
749 - Link down
750 - Verify flows
751 - Check topology
752 - Ping hosts
753 - Link up
754 - Verify flows
755 - Check topology
756 - Ping hosts
757 - Remove intents
758 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700759 if main.initialized == main.FALSE:
760 main.log.error( "Test components did not start correctly, skipping further tests" )
761 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700762 # Assert variables - These variable's name|format must be followed
763 # if you want to use the wrapper function
764 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700765 try:
766 assert main.CLIs
767 except AssertionError:
768 main.log.error( "There is no main.CLIs, skipping test cases" )
769 main.initialized = main.FALSE
770 main.skipCase()
771 try:
772 assert main.Mininet1
773 except AssertionError:
774 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
775 main.initialized = main.FALSE
776 main.skipCase()
777 try:
778 assert main.numSwitch
779 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700780 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700781 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700782 main.initialized = main.FALSE
783 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700784
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700785 main.testName = "Point Intents"
786 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700787 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700788 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700789 " intents using " + str( main.numCtrls ) +\
790 " node(s) cluster;\n" +\
791 "Different type of hosts will be tested in " +\
792 "each step such as IPV4, Dual stack, VLAN etc" +\
793 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700794 " OVS running in Mininet and compile intents" +\
795 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700796
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700797 # No option point intents
798 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700799 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800800 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700801 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800802 ]
803 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700804 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800805 ]
Jeremy42df2e72016-02-23 16:37:46 -0800806 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700807 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700808 main,
809 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800810 senders=senders,
811 recipients=recipients )
812
813 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700814 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800815 main,
816 intentId=installResult,
817 name="NOOPTION",
818 senders=senders,
819 recipients=recipients,
820 sw1="s5",
821 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700822 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800823 else:
824 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700825
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700826 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800827 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700828 onpass=main.assertReturnString,
829 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700830
kelvin-onlabb769f562015-07-15 17:05:10 -0700831 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700832 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800833 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700834 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800835 ]
836 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700837 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800838 ]
Jeremy42df2e72016-02-23 16:37:46 -0800839 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700840 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700841 main,
842 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800843 senders=senders,
844 recipients=recipients,
845 ethType="IPV4" )
846
847 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700848 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800849 main,
850 intentId=installResult,
851 name="IPV4",
852 senders=senders,
853 recipients=recipients,
854 sw1="s5",
855 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700856 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800857 else:
858 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700859
860 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800861 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700862 onpass=main.assertReturnString,
863 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800864
Jon Hall78be4962017-05-23 14:53:53 -0700865 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800866 main.assertReturnString = "Assertion Result for protected point intent\n"
867 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700868 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800869 ]
870 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700871 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800872 ]
873 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700874 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800875 main,
876 name="Protected",
877 senders=senders,
878 recipients=recipients,
879 protected=True )
880
881 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700882 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800883 main,
884 name="Protected",
885 intentId=installResult,
886 senders=senders,
887 recipients=recipients,
888 sw1="s5",
889 sw2="s2",
890 protected=True,
891 expectedLink=18 )
892 else:
893 main.CLIs[ 0 ].removeAllIntents( purge=True )
894
895 utilities.assert_equals( expect=main.TRUE,
896 actual=testResult,
897 onpass=main.assertReturnString,
898 onfail=main.assertReturnString )
899
kelvin-onlabb769f562015-07-15 17:05:10 -0700900 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700901 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800902 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700903 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800904 ]
905 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700906 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800907 ]
Jeremy42df2e72016-02-23 16:37:46 -0800908 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700909 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700910 main,
911 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800912 senders=senders,
913 recipients=recipients,
914 ethType="IPV4" )
915
916 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700917 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800918 main,
919 intentId=installResult,
920 name="IPV4_2",
921 senders=senders,
922 recipients=recipients,
923 sw1="s5",
924 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700925 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800926 else:
927 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700928
929 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800930 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700931 onpass=main.assertReturnString,
932 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700933
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700934 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700935 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800936 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700937 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -0800938 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800939 ]
940 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700941 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -0800942 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800943 ]
Jeremy6f000c62016-02-25 17:02:28 -0800944 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700945 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800946 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
947 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800948 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700949 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800950 main,
951 name="SDNIP-ICMP",
952 senders=senders,
953 recipients=recipients,
954 ethType="IPV4",
955 ipProto=ipProto,
956 tcpSrc=tcpSrc,
957 tcpDst=tcpDst )
958
959 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700960 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800961 main,
962 intentId=installResult,
963 name="SDNIP_ICMP",
964 senders=senders,
965 recipients=recipients,
966 sw1="s5",
967 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700968 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700969 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800970 else:
971 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700972
973 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800974 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700975 onpass=main.assertReturnString,
976 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700977
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700978 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700979 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700980 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
981 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700982 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
983 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700984 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
985 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
986 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
987
Jon Hall78be4962017-05-23 14:53:53 -0700988 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700989 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700990 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700991 host1="h1",
992 host2="h9",
993 deviceId1="of:0000000000000005/1",
994 deviceId2="of:0000000000000006/1",
995 mac1=mac1,
996 mac2=mac2,
997 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700998 ipProto=ipProto,
999 ip1=ip1,
1000 ip2=ip2,
1001 tcp1=tcp1,
1002 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001003
1004 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001005 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001006 onpass=main.assertReturnString,
1007 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001008
acsmars5d8cc862015-09-25 09:44:50 -07001009 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1010 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001011 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001012 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001013 ]
1014 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001015 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001016 ]
Jeremy42df2e72016-02-23 16:37:46 -08001017 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001018 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001019 main,
1020 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001021 senders=senders,
1022 recipients=recipients,
1023 ethType="IPV4" )
1024
1025 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001026 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001027 main,
1028 intentId=installResult,
1029 name="DUALSTACK1",
1030 senders=senders,
1031 recipients=recipients,
1032 sw1="s5",
1033 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001034 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001035 else:
1036 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001037
1038 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001039 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001040 onpass=main.assertReturnString,
1041 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001042
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001043 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001044 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001045 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001046 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001047 ]
1048 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001049 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001050 ]
Jeremy42df2e72016-02-23 16:37:46 -08001051 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001052 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001053 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001054 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001055 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001056 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001057
1058 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001059 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001060 main,
1061 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001062 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001063 senders=senders,
1064 recipients=recipients,
1065 sw1="s5",
1066 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001067 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001068
1069 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001070 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001071 onpass=main.assertReturnString,
1072 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001073
Jeremy Songsterff553672016-05-12 17:06:23 -07001074 main.step( "VLAN: Add point intents between h5 and h21" )
1075 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1076 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001077 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001078 ]
1079 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001080 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001081 ]
1082 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001083 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001084 main,
1085 name="VLAN2",
1086 senders=senders,
1087 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001088 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001089
1090 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001091 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001092 main,
1093 intentId=installResult,
1094 name="VLAN2",
1095 senders=senders,
1096 recipients=recipients,
1097 sw1="s5",
1098 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001099 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001100
1101 utilities.assert_equals( expect=main.TRUE,
1102 actual=testResult,
1103 onpass=main.assertReturnString,
1104 onfail=main.assertReturnString )
1105
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001106 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001107 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001108 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001109 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001110 ]
1111 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001112 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001113 ]
Jeremy42df2e72016-02-23 16:37:46 -08001114 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001115 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001116 main,
1117 name="1HOP IPV4",
1118 senders=senders,
1119 recipients=recipients,
1120 ethType="IPV4" )
1121
1122 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001123 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001124 main,
1125 intentId=installResult,
1126 name="1HOP IPV4",
1127 senders=senders,
1128 recipients=recipients,
1129 sw1="s5",
1130 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001131 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001132 else:
1133 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001134
1135 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001136 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001137 onpass=main.assertReturnString,
1138 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001139
Jeremy Songsterc032f162016-08-04 17:14:49 -07001140 main.step( "Add point to point intents using VLAN Encapsulation" )
1141 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1142 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001143 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001144 ]
1145 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001146 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001147 ]
1148 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001149 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001150 main,
1151 name="ENCAPSULATION",
1152 senders=senders,
1153 recipients=recipients,
1154 encap="VLAN" )
1155
1156 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001157 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001158 main,
1159 intentId=installResult,
1160 name="ENCAPSULATION",
1161 senders=senders,
1162 recipients=recipients,
1163 sw1="s5",
1164 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001165 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001166 else:
1167 main.CLIs[ 0 ].removeAllIntents( purge=True )
1168
1169 utilities.assert_equals( expect=main.TRUE,
1170 actual=testResult,
1171 onpass=main.assertReturnString,
1172 onfail=main.assertReturnString )
1173
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001174 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1175 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1176 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001177 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001178 ]
1179 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001180 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001181 ]
1182 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001183 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001184 main,
1185 name="NOOPTION",
1186 senders=senders,
1187 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001188 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001189
1190 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001191 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001192 main,
1193 intentId=installResult,
1194 name="NOOPTION",
1195 senders=senders,
1196 recipients=recipients,
1197 sw1="s5",
1198 sw2="s2",
1199 expectedLink=18 )
1200 else:
1201 main.CLIs[ 0 ].removeAllIntents( purge=True )
1202
1203 utilities.assert_equals( expect=main.TRUE,
1204 actual=testResult,
1205 onpass=main.assertReturnString,
1206 onfail=main.assertReturnString )
1207
Jon Hall78be4962017-05-23 14:53:53 -07001208 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001209 # main.step( "Add point to point intents using MPLS Encapsulation" )
1210 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1211 # senders = [
1212 # { "name": "h1", "device": "of:0000000000000005/1" }
1213 # ]
1214 # recipients = [
1215 # { "name": "h9", "device": "of:0000000000000006/1" }
1216 # ]
1217 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001218 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001219 # main,
1220 # name="ENCAPSULATION",
1221 # senders=senders,
1222 # recipients=recipients,
1223 # encap="MPLS" )
1224 #
1225 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001226 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001227 # main,
1228 # intentId=installResult,
1229 # name="ENCAPSULATION",
1230 # senders=senders,
1231 # recipients=recipients,
1232 # sw1="s5",
1233 # sw2="s2",
1234 # expectedLink=18 )
1235 # else:
1236 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1237 #
1238 # utilities.assert_equals( expect=main.TRUE,
1239 # actual=testResult,
1240 # onpass=main.assertReturnString,
1241 # onfail=main.assertReturnString )
1242
Jon Hall78be4962017-05-23 14:53:53 -07001243 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001244
kelvin-onlabb769f562015-07-15 17:05:10 -07001245 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001246 """
1247 Add single point to multi point intents
1248 - Get device ids
1249 - Add single point to multi point intents
1250 - Check intents
1251 - Verify flows
1252 - Ping hosts
1253 - Reroute
1254 - Link down
1255 - Verify flows
1256 - Check topology
1257 - Ping hosts
1258 - Link up
1259 - Verify flows
1260 - Check topology
1261 - Ping hosts
1262 - Remove intents
1263 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001264 if main.initialized == main.FALSE:
1265 main.log.error( "Test components did not start correctly, skipping further tests" )
1266 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001267 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001268 try:
1269 assert main.CLIs
1270 except AssertionError:
1271 main.log.error( "There is no main.CLIs, skipping test cases" )
1272 main.initialized = main.FALSE
1273 main.skipCase()
1274 try:
1275 assert main.Mininet1
1276 except AssertionError:
1277 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1278 main.initialized = main.FALSE
1279 main.skipCase()
1280 try:
1281 assert main.numSwitch
1282 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001283 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001284 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001285 main.initialized = main.FALSE
1286 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001287
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001288 main.testName = "Single to Multi Point Intents"
1289 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001290 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001291 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001292 " multi point intents using " +\
1293 str( main.numCtrls ) + " node(s) cluster;\n" +\
1294 "Different type of hosts will be tested in " +\
1295 "each step such as IPV4, Dual stack, VLAN etc" +\
1296 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001297 " OVS running in Mininet and compile intents" +\
1298 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001299
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001300 main.step( "NOOPTION: Install and test single point to multi point intents" )
1301 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1302 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001303 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001304 ]
1305 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001306 { "name": "h16", "device": "of:0000000000000006/8" },
1307 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001308 ]
Jon Hall9c888672017-05-15 18:03:54 -07001309 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1310 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001311 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001312 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001313 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001314 name="NOOPTION",
1315 senders=senders,
1316 recipients=recipients,
1317 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001318 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001319
1320 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001321 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001322 main,
1323 intentId=installResult,
1324 name="NOOPTION",
1325 senders=senders,
1326 recipients=recipients,
1327 badSenders=badSenders,
1328 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001329 sw1="s5",
1330 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001331 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001332 else:
1333 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001334
1335 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001336 actual=testResult,
1337 onpass=main.assertReturnString,
1338 onfail=main.assertReturnString )
1339
1340 main.step( "IPV4: Install and test single point to multi point intents" )
1341 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1342 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001343 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001344 ]
1345 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001346 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1347 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001348 ]
Jon Hall9c888672017-05-15 18:03:54 -07001349 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1350 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001351 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001352 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001353 main,
1354 name="IPV4",
1355 senders=senders,
1356 recipients=recipients,
1357 ethType="IPV4",
1358 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001359 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001360
1361 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001362 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001363 main,
1364 intentId=installResult,
1365 name="IPV4",
1366 senders=senders,
1367 recipients=recipients,
1368 badSenders=badSenders,
1369 badRecipients=badRecipients,
1370 sw1="s5",
1371 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001372 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001373 else:
1374 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001375
1376 utilities.assert_equals( expect=main.TRUE,
1377 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001378 onpass=main.assertReturnString,
1379 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001380
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001381 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001382 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 -08001383 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001384 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001385 ]
1386 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001387 { "name": "h16", "device": "of:0000000000000006/8" },
1388 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001389 ]
Jon Hall9c888672017-05-15 18:03:54 -07001390 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1391 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001392 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001393 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001394 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001395 name="IPV4_2",
1396 senders=senders,
1397 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001398 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001399 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001400 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001401
1402 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001403 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001404 main,
1405 intentId=installResult,
1406 name="IPV4_2",
1407 senders=senders,
1408 recipients=recipients,
1409 badSenders=badSenders,
1410 badRecipients=badRecipients,
1411 sw1="s5",
1412 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001413 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001414 else:
1415 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001416
1417 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001418 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001419 onpass=main.assertReturnString,
1420 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001421
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001422 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001423 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 -08001424 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001425 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001426 ]
1427 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001428 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1429 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001430 ]
Jon Hall9c888672017-05-15 18:03:54 -07001431 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1432 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001433 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001434 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001435 main,
alison52b25892016-09-19 10:53:48 -07001436 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001437 senders=senders,
1438 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001439 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001440 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001441
1442 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001443 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001444 main,
1445 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001446 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001447 senders=senders,
1448 recipients=recipients,
1449 badSenders=badSenders,
1450 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001451 sw1="s5",
1452 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001453 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001454 else:
1455 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001456
1457 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001458 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001459 onpass=main.assertReturnString,
1460 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001461
Jeremy Songsterff553672016-05-12 17:06:23 -07001462 main.step( "VLAN: Add single point to multi point intents" )
1463 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1464 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001465 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001466 ]
1467 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001468 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1469 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001470 ]
Jon Hall9c888672017-05-15 18:03:54 -07001471 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1472 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001473 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001474 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001475 main,
1476 name="VLAN2",
1477 senders=senders,
1478 recipients=recipients,
1479 sw1="s5",
1480 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001481 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001482
1483 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001484 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001485 main,
1486 intentId=installResult,
1487 name="VLAN2",
1488 senders=senders,
1489 recipients=recipients,
1490 badSenders=badSenders,
1491 badRecipients=badRecipients,
1492 sw1="s5",
1493 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001494 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001495 else:
1496 main.CLIs[ 0 ].removeAllIntents( purge=True )
1497
1498 utilities.assert_equals( expect=main.TRUE,
1499 actual=testResult,
1500 onpass=main.assertReturnString,
1501 onfail=main.assertReturnString )
1502
alison52b25892016-09-19 10:53:48 -07001503 # Does not support Single point to multi point encapsulation
1504 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1505 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1506 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001507 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001508 # ]
1509 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001510 # { "name": "h16", "device": "of:0000000000000006/8" },
1511 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001512 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001513 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1514 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001515 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001516 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001517 # main,
1518 # name="ENCAPSULATION",
1519 # senders=senders,
1520 # recipients=recipients,
1521 # sw1="s5",
1522 # sw2="s2",
1523 # encap="VLAN" )
1524 #
1525 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001526 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001527 # main,
1528 # intentId=installResult,
1529 # name="ENCAPSULATION",
1530 # senders=senders,
1531 # recipients=recipients,
1532 # badSenders=badSenders,
1533 # badRecipients=badRecipients,
1534 # sw1="s5",
1535 # sw2="s2",
1536 # expectedLink=18 )
1537 # else:
1538 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1539 #
1540 # utilities.assert_equals( expect=main.TRUE,
1541 # actual=testResult,
1542 # onpass=main.assertReturnString,
1543 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001544
Jon Hall78be4962017-05-23 14:53:53 -07001545 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001546
kelvin-onlabb769f562015-07-15 17:05:10 -07001547 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001548 """
1549 Add multi point to single point intents
1550 - Get device ids
1551 - Add multi point to single point intents
1552 - Check intents
1553 - Verify flows
1554 - Ping hosts
1555 - Reroute
1556 - Link down
1557 - Verify flows
1558 - Check topology
1559 - Ping hosts
1560 - Link up
1561 - Verify flows
1562 - Check topology
1563 - Ping hosts
1564 - Remove intents
1565 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001566 if main.initialized == main.FALSE:
1567 main.log.error( "Test components did not start correctly, skipping further tests" )
1568 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001569 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001570 try:
1571 assert main.CLIs
1572 except AssertionError:
1573 main.log.error( "There is no main.CLIs, skipping test cases" )
1574 main.initialized = main.FALSE
1575 main.skipCase()
1576 try:
1577 assert main.Mininet1
1578 except AssertionError:
1579 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1580 main.initialized = main.FALSE
1581 main.skipCase()
1582 try:
1583 assert main.numSwitch
1584 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001585 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001586 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001587 main.initialized = main.FALSE
1588 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001589
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001590 main.testName = "Multi To Single Point Intents"
1591 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001592 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001593 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001594 " multi point intents using " +\
1595 str( main.numCtrls ) + " node(s) cluster;\n" +\
1596 "Different type of hosts will be tested in " +\
1597 "each step such as IPV4, Dual stack, VLAN etc" +\
1598 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001599 " OVS running in Mininet and compile intents" +\
1600 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001601
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001602 main.step( "NOOPTION: Add multi point to single point intents" )
1603 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1604 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001605 { "name": "h16", "device": "of:0000000000000006/8" },
1606 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001607 ]
1608 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001609 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001610 ]
Jon Hall9c888672017-05-15 18:03:54 -07001611 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1612 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001613 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001614 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001615 main,
1616 name="NOOPTION",
1617 senders=senders,
1618 recipients=recipients,
1619 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001620 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001621
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001622 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001623 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001624 main,
1625 intentId=installResult,
1626 name="NOOPTION",
1627 senders=senders,
1628 recipients=recipients,
1629 badSenders=badSenders,
1630 badRecipients=badRecipients,
1631 sw1="s5",
1632 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001633 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001634 else:
1635 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001636
1637 utilities.assert_equals( expect=main.TRUE,
1638 actual=testResult,
1639 onpass=main.assertReturnString,
1640 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001641
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001642 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001643 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 -08001644 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001645 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1646 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001647 ]
1648 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001649 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001650 ]
Jon Hall9c888672017-05-15 18:03:54 -07001651 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1652 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001653 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001654 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001655 main,
1656 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001657 senders=senders,
1658 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001659 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001660 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001661 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001662
1663 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001664 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001665 main,
1666 intentId=installResult,
1667 name="IPV4",
1668 senders=senders,
1669 recipients=recipients,
1670 badSenders=badSenders,
1671 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001672 sw1="s5",
1673 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001674 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001675 else:
1676 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001677
1678 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001679 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001680 onpass=main.assertReturnString,
1681 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001682
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001683 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001684 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 -08001685 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001686 { "name": "h16", "device": "of:0000000000000006/8" },
1687 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001688 ]
1689 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001690 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001691 ]
Jon Hall9c888672017-05-15 18:03:54 -07001692 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1693 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001694 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001695 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001696 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001697 name="IPV4_2",
1698 senders=senders,
1699 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001700 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001701 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001702 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001703
1704 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001705 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001706 main,
1707 intentId=installResult,
1708 name="IPV4_2",
1709 senders=senders,
1710 recipients=recipients,
1711 badSenders=badSenders,
1712 badRecipients=badRecipients,
1713 sw1="s5",
1714 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001715 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001716 else:
1717 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001718
1719 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001720 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001721 onpass=main.assertReturnString,
1722 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001723
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001724 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001725 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 -08001726 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001727 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1728 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001729 ]
1730 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001731 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001732 ]
Jon Hall9c888672017-05-15 18:03:54 -07001733 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1734 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001735 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001736 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001737 main,
1738 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001739 senders=senders,
1740 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001741 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001742 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001743
1744 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001745 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001746 main,
1747 intentId=installResult,
1748 name="VLAN",
1749 senders=senders,
1750 recipients=recipients,
1751 badSenders=badSenders,
1752 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001753 sw1="s5",
1754 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001755 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001756 else:
1757 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001758
1759 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001760 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001761 onpass=main.assertReturnString,
1762 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001763
Jeremy Songsterff553672016-05-12 17:06:23 -07001764 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1765 main.step( "VLAN: Add multi point to single point intents" )
1766 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1767 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001768 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1769 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001770 ]
1771 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001772 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001773 ]
Jon Hall9c888672017-05-15 18:03:54 -07001774 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1775 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001776 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001777 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001778 main,
1779 name="VLAN2",
1780 senders=senders,
1781 recipients=recipients,
1782 sw1="s5",
1783 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001784 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001785
1786 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001787 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001788 main,
1789 intentId=installResult,
1790 name="VLAN2",
1791 senders=senders,
1792 recipients=recipients,
1793 badSenders=badSenders,
1794 badRecipients=badRecipients,
1795 sw1="s5",
1796 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001797 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001798 else:
1799 main.CLIs[ 0 ].removeAllIntents( purge=True )
1800
1801 utilities.assert_equals( expect=main.TRUE,
1802 actual=testResult,
1803 onpass=main.assertReturnString,
1804 onfail=main.assertReturnString )
1805
Jeremy Songsterc032f162016-08-04 17:14:49 -07001806 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1807 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1808 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001809 { "name": "h16", "device": "of:0000000000000006/8" },
1810 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001811 ]
1812 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001813 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001814 ]
Jon Hall9c888672017-05-15 18:03:54 -07001815 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1816 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001817 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001818 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001819 main,
1820 name="ENCAPSULATION",
1821 senders=senders,
1822 recipients=recipients,
1823 sw1="s5",
1824 sw2="s2",
1825 encap="VLAN" )
1826
1827 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001828 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001829 main,
1830 intentId=installResult,
1831 name="ENCAPSULATION",
1832 senders=senders,
1833 recipients=recipients,
1834 badSenders=badSenders,
1835 badRecipients=badRecipients,
1836 sw1="s5",
1837 sw2="s2",
1838 expectedLink=18 )
1839 else:
1840 main.CLIs[ 0 ].removeAllIntents( purge=True )
1841
1842 utilities.assert_equals( expect=main.TRUE,
1843 actual=testResult,
1844 onpass=main.assertReturnString,
1845 onfail=main.assertReturnString )
1846
Jon Hall78be4962017-05-23 14:53:53 -07001847 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07001848 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
1849 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1850 #senders = [
1851 # { "name": "h16", "device": "of:0000000000000006/8" },
1852 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001853 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001854 #recipients = [
1855 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07001856 # ]
Shreyaca8990f2017-03-16 11:43:11 -07001857 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07001858 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07001859 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001860 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001861 # main,
1862 # name="ENCAPSULATION",
1863 # senders=senders,
1864 # recipients=recipients,
1865 # sw1="s5",
1866 # sw2="s2",
1867 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07001868 #
Shreyaca8990f2017-03-16 11:43:11 -07001869 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001870 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07001871 # main,
1872 # intentId=installResult,
1873 # name="ENCAPSULATION",
1874 # senders=senders,
1875 # recipients=recipients,
1876 # badSenders=badSenders,
1877 # badRecipients=badRecipients,
1878 # sw1="s5",
1879 # sw2="s2",
1880 # expectedLink=18 )
1881 #else:
1882 # main.CLIs[ 0 ].removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001883 #
Shreyaca8990f2017-03-16 11:43:11 -07001884 #utilities.assert_equals( expect=main.TRUE,
1885 # actual=testResult,
1886 # onpass=main.assertReturnString,
1887 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07001888
Jon Hall78be4962017-05-23 14:53:53 -07001889 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001890
acsmars1ff5e052015-07-23 11:27:48 -07001891 def CASE5000( self, main ):
1892 """
acsmars5d8cc862015-09-25 09:44:50 -07001893 Tests Host Mobility
1894 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001895 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001896 if main.initialized == main.FALSE:
1897 main.log.error( "Test components did not start correctly, skipping further tests" )
1898 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001899 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001900 try:
1901 assert main.CLIs
1902 except AssertionError:
1903 main.log.error( "There is no main.CLIs, skipping test cases" )
1904 main.initialized = main.FALSE
1905 main.skipCase()
1906 try:
1907 assert main.Mininet1
1908 except AssertionError:
1909 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1910 main.initialized = main.FALSE
1911 main.skipCase()
1912 try:
1913 assert main.numSwitch
1914 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001915 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001916 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001917 main.initialized = main.FALSE
1918 main.skipCase()
alison52b25892016-09-19 10:53:48 -07001919 main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
1920 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001921 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001922
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001923 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07001924 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001925
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001926 # Send discovery ping from moved host
1927 # Moving the host brings down the default interfaces and creates a new one.
1928 # Scapy is restarted on this host to detect the new interface
1929 main.h1.stopScapy()
1930 main.h1.startScapy()
1931
1932 # Discover new host location in ONOS and populate host data.
1933 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001934 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1935 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001936
acsmars1ff5e052015-07-23 11:27:48 -07001937 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1938
1939 utilities.assert_equals( expect="of:0000000000000006",
1940 actual=h1PostMove,
1941 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001942 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001943 " to single point intents" +
1944 " with IPV4 type and MAC addresses" +
1945 " in the same VLAN" )
1946
1947 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001948 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001949 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1950 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001951 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001952 installResult = main.intents.installHostIntent( main,
1953 name="IPV4 Mobility IPV4",
1954 onosNode=0,
1955 host1=host1,
1956 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001957 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001958 testResult = main.intents.testHostIntent( main,
1959 name="Host Mobility IPV4",
1960 intentId=installResult,
1961 onosNode=0,
1962 host1=host1,
1963 host2=host2,
1964 sw1="s6",
1965 sw2="s2",
1966 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001967 else:
1968 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001969
1970 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001971 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001972 onpass=main.assertReturnString,
1973 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001974
Jon Hall78be4962017-05-23 14:53:53 -07001975 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001976
1977 def CASE6000( self, main ):
1978 """
1979 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1980 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001981 # At some later point discussion on this behavior in MPSP and SPMP intents
1982 # will be reoppened and this test case may need to be updated to reflect
1983 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001984 if main.initialized == main.FALSE:
1985 main.log.error( "Test components did not start correctly, skipping further tests" )
1986 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001987 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001988 try:
1989 assert main.CLIs
1990 except AssertionError:
1991 main.log.error( "There is no main.CLIs, skipping test cases" )
1992 main.initialized = main.FALSE
1993 main.skipCase()
1994 try:
1995 assert main.Mininet1
1996 except AssertionError:
1997 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1998 main.initialized = main.FALSE
1999 main.skipCase()
2000 try:
2001 assert main.numSwitch
2002 except AssertionError:
alison52b25892016-09-19 10:53:48 -07002003 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002004 main.initialized = main.FALSE
2005 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002006 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
2007 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07002008 main.step( "Installing Multi to Single Point intents with no options set" )
2009 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2010 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002011 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002012 { "name": "h16", "device": "of:0000000000000006/8" },
2013 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002014 ]
2015 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002016 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002017 ]
2018 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002019 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002020 ]
2021 isolatedRecipients = []
2022 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002023 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002024 main,
2025 name="NOOPTION",
2026 senders=senders,
2027 recipients=recipients,
2028 sw1="s5",
2029 sw2="s2" )
2030
2031 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002032 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002033 main,
2034 intentId=installResult,
2035 name="NOOPTION",
2036 senders=senders,
2037 recipients=recipients,
2038 isolatedSenders=isolatedSenders,
2039 isolatedRecipients=isolatedRecipients,
2040 sw1="s6",
2041 sw2="s2",
2042 sw3="s4",
2043 sw4="s1",
2044 sw5="s3",
2045 expectedLink1=16,
2046 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002047 else:
2048 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002049
2050 utilities.assert_equals( expect=main.TRUE,
2051 actual=testResult,
2052 onpass=main.assertReturnString,
2053 onfail=main.assertReturnString )
2054
Jeremy Songster9385d412016-06-02 17:57:36 -07002055 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2056
2057 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2058 "with partial failures allowed\n"
2059 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002060 { "name": "h16", "device": "of:0000000000000006/8" },
2061 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002062 ]
2063 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002064 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002065 ]
2066 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002067 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002068 ]
2069 isolatedRecipients = []
2070 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002071 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002072 main,
2073 name="NOOPTION",
2074 senders=senders,
2075 recipients=recipients,
2076 sw1="s5",
2077 sw2="s2",
2078 partial=True )
2079
2080 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002081 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002082 main,
2083 intentId=installResult,
2084 name="NOOPTION",
2085 senders=senders,
2086 recipients=recipients,
2087 isolatedSenders=isolatedSenders,
2088 isolatedRecipients=isolatedRecipients,
2089 sw1="s6",
2090 sw2="s2",
2091 sw3="s4",
2092 sw4="s1",
2093 sw5="s3",
2094 expectedLink1=16,
2095 expectedLink2=14,
2096 partial=True )
2097 else:
2098 main.CLIs[ 0 ].removeAllIntents( purge=True )
2099
2100 utilities.assert_equals( expect=main.TRUE,
2101 actual=testResult,
2102 onpass=main.assertReturnString,
2103 onfail=main.assertReturnString )
2104
Jeremye0cb5eb2016-01-27 17:39:09 -08002105 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002106 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2107 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002108 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002109 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002110 ]
2111 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002112 { "name": "h16", "device": "of:0000000000000006/8" },
2113 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002114 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002115 isolatedSenders = []
2116 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002117 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002118 ]
2119 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002120 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002121 main,
2122 name="NOOPTION",
2123 senders=senders,
2124 recipients=recipients,
2125 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002126 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002127
2128 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002129 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002130 main,
2131 intentId=installResult,
2132 name="NOOPTION",
2133 senders=senders,
2134 recipients=recipients,
2135 isolatedSenders=isolatedSenders,
2136 isolatedRecipients=isolatedRecipients,
2137 sw1="s6",
2138 sw2="s2",
2139 sw3="s4",
2140 sw4="s1",
2141 sw5="s3",
2142 expectedLink1=16,
2143 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002144 else:
2145 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002146
2147 utilities.assert_equals( expect=main.TRUE,
2148 actual=testResult,
2149 onpass=main.assertReturnString,
2150 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002151 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002152 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002153 "intents with partial failures allowed" )
2154 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2155 "point intent with partial failures allowed\n"
2156 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002157 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002158 ]
2159 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002160 { "name": "h16", "device": "of:0000000000000006/8" },
2161 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002162 ]
2163 isolatedSenders = []
2164 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002165 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002166 ]
2167 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002168 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002169 main,
2170 name="NOOPTION",
2171 senders=senders,
2172 recipients=recipients,
2173 sw1="s5",
2174 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002175 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002176
2177 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002178 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002179 main,
2180 intentId=installResult,
2181 name="NOOPTION",
2182 senders=senders,
2183 recipients=recipients,
2184 isolatedSenders=isolatedSenders,
2185 isolatedRecipients=isolatedRecipients,
2186 sw1="s6",
2187 sw2="s2",
2188 sw3="s4",
2189 sw4="s1",
2190 sw5="s3",
2191 expectedLink1=16,
2192 expectedLink2=14,
2193 partial=True )
2194 else:
2195 main.CLIs[ 0 ].removeAllIntents( purge=True )
2196
2197 utilities.assert_equals( expect=main.TRUE,
2198 actual=testResult,
2199 onpass=main.assertReturnString,
2200 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002201
Jon Hall78be4962017-05-23 14:53:53 -07002202 main.intents.report( main )