blob: c7ae06295bbf1d1f250151a935f96c004373fa69 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07002Copyright 2015 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003
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
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070011 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070012
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"""
kelvin-onlabd48a68c2015-07-13 16:01:36 -070021# Testing the basic intent functionality of ONOS
22
Jon Hall78be4962017-05-23 14:53:53 -070023
kelvin-onlabd48a68c2015-07-13 16:01:36 -070024class FUNCintent:
25
26 def __init__( self ):
27 self.default = ''
28
29 def CASE1( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -070030 import imp
Jon Hallf632d202015-07-30 15:45:11 -070031 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070032 """
33 - Construct tests variables
34 - GIT ( optional )
35 - Checkout ONOS master branch
36 - Pull latest ONOS code
37 - Building ONOS ( optional )
38 - Install ONOS package
39 - Build ONOS package
40 """
Devin Lim58046fa2017-07-05 16:55:00 -070041 try:
42 from tests.dependencies.ONOSSetup import ONOSSetup
43 main.testSetUp = ONOSSetup()
44 except ImportError:
45 main.log.error( "ONOSSetup not found. exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -070046 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -070047 main.testSetUp.envSetupDescription()
kelvin-onlabd48a68c2015-07-13 16:01:36 -070048 stepResult = main.FALSE
49
You Wanga0f6ff62018-01-11 15:46:30 -080050 from tests.dependencies.Network import Network
51 main.Network = Network()
52
kelvin-onlabd48a68c2015-07-13 16:01:36 -070053 # Test variables
Jon Halla3e02432015-07-24 15:55:42 -070054 try:
Jon Halla3e02432015-07-24 15:55:42 -070055 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
Jon Halla3e02432015-07-24 15:55:42 -070056 main.dependencyPath = main.testOnDirectory + \
57 main.params[ 'DEPENDENCY' ][ 'path' ]
58 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
59 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070060
Jon Halla3e02432015-07-24 15:55:42 -070061 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
62 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
63 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
64 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
65 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
acsmarscfa52272015-08-06 15:21:45 -070066 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
Jon Halla3e02432015-07-24 15:55:42 -070067 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
68 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
Shreyaca8990f2017-03-16 11:43:11 -070069 main.checkConnectionSleep = int( main.params[ 'SLEEP' ][ 'checkConnection' ] )
70 main.checkFlowCountSleep = int( main.params[ 'SLEEP' ][ 'checkFlowCount' ] )
71 main.checkIntentHostSleep = int( main.params[ 'SLEEP' ][ 'checkIntentHost' ] )
72 main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] )
acsmars59a4c552015-09-10 18:11:19 -070073 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
Jeremy Songster306ed7a2016-07-19 10:59:07 -070074 main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
Devin Lima4f95bc2017-08-11 11:13:03 -070075 main.generalAttemptsNum = int( main.params[ 'RETRY' ][ 'generalAttempts' ] )
76 main.middleAttemptsNum = int( main.params[ 'RETRY' ][ 'middleAttempts' ] )
77 main.minimumAttemptsNum = int( main.params[ 'RETRY' ][ 'minimumAttempts' ] )
78 main.checkConnectionAttNum = int( main.params[ 'RETRY' ][ 'checkConnectionAtt' ] )
79 main.removeIntentAttNum = int( main.params[ 'RETRY' ][ 'removeIntentAtt' ] )
Jon Halla3e02432015-07-24 15:55:42 -070080 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
81 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
Jon Halla3e02432015-07-24 15:55:42 -070082 main.hostsData = {}
Jeremy Songster1f39bf02016-01-20 17:17:25 -080083 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
84 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070085 main.assertReturnString = '' # Assembled assert return string
Jon Hall78be4962017-05-23 14:53:53 -070086 main.cycle = 0 # How many times FUNCintent has run through its tests
You Wangf6574de2018-02-09 14:43:47 -080087 main.usePortstate = True if main.params[ 'TEST' ][ 'usePortstate' ] == "True" else False
kelvin-onlabd48a68c2015-07-13 16:01:36 -070088
Jon Halla3e02432015-07-24 15:55:42 -070089 # -- INIT SECTION, ONLY RUNS ONCE -- #
kelvin-onlabd48a68c2015-07-13 16:01:36 -070090
Jon Hall78be4962017-05-23 14:53:53 -070091 main.intents = imp.load_source( wrapperFile2,
Jon Halla3e02432015-07-24 15:55:42 -070092 main.dependencyPath +
93 wrapperFile2 +
94 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070095
You Wanga0f6ff62018-01-11 15:46:30 -080096 if hasattr( main, "Mininet1" ):
97 copyResult1 = main.ONOSbench.scp( main.Mininet1,
98 main.dependencyPath +
99 main.topology,
100 main.Mininet1.home + "custom/",
101 direction="to" )
Devin Lim58046fa2017-07-05 16:55:00 -0700102
Devin Lim142b5342017-07-20 15:22:39 -0700103 stepResult = main.testSetUp.envSetup()
Jon Halla3e02432015-07-24 15:55:42 -0700104 except Exception as e:
Devin Lim58046fa2017-07-05 16:55:00 -0700105 main.testSetUp.envSetupException( e )
106 main.testSetUp.evnSetupConclusion( stepResult )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700107
108 def CASE2( self, main ):
109 """
110 - Set up cell
111 - Create cell file
112 - Set cell file
113 - Verify cell file
114 - Kill ONOS process
115 - Uninstall ONOS cluster
116 - Verify ONOS start up
117 - Install ONOS cluster
118 - Connect to cli
119 """
Jeremycd872222016-03-29 10:08:34 -0700120 main.flowCompiler = "Flow Rules"
You Wanga0f6ff62018-01-11 15:46:30 -0800121 main.initialized = main.testSetUp.ONOSSetUp( main.Cluster, True )
Jon Hall78be4962017-05-23 14:53:53 -0700122 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700123
Jon Halla3e02432015-07-24 15:55:42 -0700124 def CASE8( self, main ):
125 """
acsmars59a4c552015-09-10 18:11:19 -0700126 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700127 """
Devin Lim58046fa2017-07-05 16:55:00 -0700128 import time
129 try:
130 from tests.dependencies.topology import Topology
131 except ImportError:
132 main.log.error( "Topology not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700133 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700134 try:
135 main.topoRelated
136 except ( NameError, AttributeError ):
137 main.topoRelated = Topology()
138 main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700139
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700140 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700141 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700142 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700143 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700144 if main.initialized == main.FALSE:
145 main.log.error( "Test components did not start correctly, skipping further tests" )
146 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700147 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700148 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700149 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700150 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700151 "switches to test intents, exits out if " +\
152 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700153
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700154 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700155 args = "--switch ovs,protocols=OpenFlow10"
Devin Lim29a9e3d2018-01-30 14:09:47 -0800156 topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700157 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700158 stepResult = topoResult
159 utilities.assert_equals( expect=main.TRUE,
160 actual=stepResult,
161 onpass="Successfully loaded topology",
162 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700163
164 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700165 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700166 main.initialized = main.FALSE
167 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700168
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700169 def CASE11( self, main ):
170 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700171 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700172 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700173 if main.initialized == main.FALSE:
174 main.log.error( "Test components did not start correctly, skipping further tests" )
175 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700176 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700177 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700178 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700179 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700180 "switches to test intents, exits out if " +\
181 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700182
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700183 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700184 args = "--switch ovs,protocols=OpenFlow13"
Devin Lim29a9e3d2018-01-30 14:09:47 -0800185 topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700186 args=args )
187 stepResult = topoResult
188 utilities.assert_equals( expect=main.TRUE,
189 actual=stepResult,
190 onpass="Successfully loaded topology",
191 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700192 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700193 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700194 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700195
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700196 def CASE12( self, main ):
197 """
198 Assign mastership to controllers
199 """
200 import re
201
Jeremyd9e4eb12016-04-13 12:09:06 -0700202 if main.initialized == main.FALSE:
203 main.log.error( "Test components did not start correctly, skipping further tests" )
204 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700205 main.case( "Assign switches to controllers" )
206 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700207 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700208 " switches to ONOS nodes"
209
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700210 switchList = []
211
212 # Creates a list switch name, use getSwitch() function later...
213 for i in range( 1, ( main.numSwitch + 1 ) ):
214 switchList.append( 's' + str( i ) )
215
Devin Lim142b5342017-07-20 15:22:39 -0700216 tempONOSip = main.Cluster.getIps()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700217
You Wanga0f6ff62018-01-11 15:46:30 -0800218 assignResult = main.Network.assignSwController( sw=switchList,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700219 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700220 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700221 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700222 main.log.error( "Problem assigning mastership of switches" )
223 main.initialized = main.FALSE
224 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700225
226 for i in range( 1, ( main.numSwitch + 1 ) ):
You Wanga0f6ff62018-01-11 15:46:30 -0800227 response = main.Network.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700228 main.log.debug( "Response is " + str( response ) )
Devin Lim142b5342017-07-20 15:22:39 -0700229 if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700230 assignResult = assignResult and main.TRUE
231 else:
232 assignResult = main.FALSE
233 stepResult = assignResult
234 utilities.assert_equals( expect=main.TRUE,
235 actual=stepResult,
236 onpass="Successfully assigned switches" +
237 "to controller",
238 onfail="Failed to assign switches to " +
239 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700240 if not stepResult:
241 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700242
Jon Hall78be4962017-05-23 14:53:53 -0700243 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700244 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800245 Create Scapy components
246 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700247 if main.initialized == main.FALSE:
248 main.log.error( "Test components did not start correctly, skipping further tests" )
249 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800250 main.case( "Create scapy components" )
251 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800252 scapyResult = main.TRUE
253 for hostName in main.scapyHostNames:
254 main.Scapy1.createHostComponent( hostName )
255 main.scapyHosts.append( getattr( main, hostName ) )
256
257 main.step( "Start scapy components" )
258 for host in main.scapyHosts:
259 host.startHostCli()
260 host.startScapy()
261 host.updateSelf()
262 main.log.debug( host.name )
263 main.log.debug( host.hostIp )
264 main.log.debug( host.hostMac )
265
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800266 utilities.assert_equals( expect=main.TRUE,
267 actual=scapyResult,
268 onpass="Successfully created Scapy Components",
269 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700270 if not scapyResult:
271 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800272
273 def CASE14( self, main ):
274 """
275 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700276 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700277 if main.initialized == main.FALSE:
278 main.log.error( "Test components did not start correctly, skipping further tests" )
279 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700280 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800281 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700282 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700283
Jon Hall78be4962017-05-23 14:53:53 -0700284 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
285 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700286 utilities.assert_equals( expect=main.TRUE,
287 actual=stepResult,
288 onpass="Successfully discovered hosts",
289 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700290 if not stepResult:
291 main.initialized = main.FALSE
292 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700293
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800294 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700295 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700296 utilities.assert_equals( expect=main.TRUE,
297 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800298 onpass="Successfully populated hostsData",
299 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700300 if not stepResult:
301 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800302
303 def CASE15( self, main ):
304 """
305 Discover all hosts with scapy arp packets and store its data to a dictionary
306 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700307 if main.initialized == main.FALSE:
308 main.log.error( "Test components did not start correctly, skipping further tests" )
309 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800310 main.case( "Discover all hosts using scapy" )
311 main.step( "Send packets from each host to the first host and confirm onos discovery" )
312
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800313 if len( main.scapyHosts ) < 1:
314 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700315 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800316 main.skipCase()
317
318 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700319 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800320
Jon Hall78be4962017-05-23 14:53:53 -0700321 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800322 retValue=main.FALSE, args=[ main ],
323 attempts=main.checkTopoAttempts, sleep=2 )
324
325 utilities.assert_equals( expect=main.TRUE,
326 actual=stepResult,
327 onpass="ONOS correctly discovered all hosts",
328 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700329 if not stepResult:
330 main.initialized = main.FALSE
331 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800332
333 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700334 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800335 utilities.assert_equals( expect=main.TRUE,
336 actual=stepResult,
337 onpass="Successfully populated hostsData",
338 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700339 if not stepResult:
340 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800341
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800342 def CASE16( self, main ):
343 """
Jeremy42df2e72016-02-23 16:37:46 -0800344 Balance Masters
345 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700346 if main.initialized == main.FALSE:
347 main.log.error( "Test components did not start correctly, skipping further tests" )
348 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800349 main.case( "Balance mastership of switches" )
350 main.step( "Balancing mastership of switches" )
351
Devin Lim142b5342017-07-20 15:22:39 -0700352 balanceResult = utilities.retry( f=main.Cluster.active( 0 ).CLI.balanceMasters, retValue=main.FALSE, args=[] )
Jeremy42df2e72016-02-23 16:37:46 -0800353
354 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700355 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800356 onpass="Successfully balanced mastership of switches",
357 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700358 if not balanceResult:
359 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800360
361 def CASE17( self, main ):
362 """
Jeremy6e9748f2016-03-25 15:03:39 -0700363 Use Flow Objectives
364 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700365 if main.initialized == main.FALSE:
366 main.log.error( "Test components did not start correctly, skipping further tests" )
367 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700368 main.case( "Enable intent compilation using Flow Objectives" )
369 main.step( "Enabling Flow Objectives" )
370
371 main.flowCompiler = "Flow Objectives"
372
373 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
374
Devin Lim142b5342017-07-20 15:22:39 -0700375 stepResult = main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700376 propName="useFlowObjectives", value="true" )
Devin Lim142b5342017-07-20 15:22:39 -0700377 stepResult &= main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700378 propName="defaultFlowObjectiveCompiler",
379 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700380
381 utilities.assert_equals( expect=main.TRUE,
382 actual=stepResult,
383 onpass="Successfully activated Flow Objectives",
384 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700385 if not balanceResult:
386 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700387
388 def CASE18( self, main ):
389 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800390 Stop mininet and remove scapy host
391 """
Devin Lim58046fa2017-07-05 16:55:00 -0700392 try:
393 from tests.dependencies.utils import Utils
394 except ImportError:
395 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700396 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700397 try:
398 main.Utils
399 except ( NameError, AttributeError ):
400 main.Utils = Utils()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800401 main.log.report( "Stop Mininet and Scapy" )
402 main.case( "Stop Mininet and Scapy" )
403 main.caseExplanation = "Stopping the current mininet topology " +\
404 "to start up fresh"
405 main.step( "Stopping and Removing Scapy Host Components" )
406 scapyResult = main.TRUE
407 for host in main.scapyHosts:
408 scapyResult = scapyResult and host.stopScapy()
409 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
410
411 for host in main.scapyHosts:
412 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
413 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
414
415 main.scapyHosts = []
416 main.scapyHostIPs = []
417
418 utilities.assert_equals( expect=main.TRUE,
419 actual=scapyResult,
420 onpass="Successfully stopped scapy and removed host components",
421 onfail="Failed to stop mininet and scapy" )
422
Devin Lim58046fa2017-07-05 16:55:00 -0700423 mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700424 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800425 if not ( mininetResult and scapyResult ):
Devin Lim44075962017-08-11 10:56:37 -0700426 main.cleanAndExit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700427
Jeremy Songster17147f22016-05-31 18:30:52 -0700428 def CASE19( self, main ):
429 """
430 Copy the karaf.log files after each testcase cycle
431 """
Devin Lim58046fa2017-07-05 16:55:00 -0700432 try:
433 from tests.dependencies.utils import Utils
434 except ImportError:
435 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700436 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700437 try:
438 main.Utils
439 except ( NameError, AttributeError ):
440 main.Utils = Utils()
Devin Lim142b5342017-07-20 15:22:39 -0700441 main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700442
kelvin-onlabb769f562015-07-15 17:05:10 -0700443 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700444 """
445 Add host intents between 2 host:
446 - Discover hosts
447 - Add host intents
448 - Check intents
449 - Verify flows
450 - Ping hosts
451 - Reroute
452 - Link down
453 - Verify flows
454 - Check topology
455 - Ping hosts
456 - Link up
457 - Verify flows
458 - Check topology
459 - Ping hosts
460 - Remove intents
461 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700462 if main.initialized == main.FALSE:
463 main.log.error( "Test components did not start correctly, skipping further tests" )
464 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700465 # Assert variables - These variable's name|format must be followed
466 # if you want to use the wrapper function
467 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700468 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700469 assert main.numSwitch
470 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700471 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700472 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700473 main.initialized = main.FALSE
474 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700475
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800476 # Save leader candidates
Devin Lim142b5342017-07-20 15:22:39 -0700477 intentLeadersOld = main.Cluster.active( 0 ).CLI.leaderCandidates()
acsmarse6b410f2015-07-17 14:39:34 -0700478
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700479 main.testName = "Host Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700480 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700481 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700482 main.caseExplanation = "This test case tests Host intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -0700483 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700484 "Different type of hosts will be tested in " +\
485 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700486 "etc;\nThe test will use OF " + main.OFProtocol +\
487 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700488 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700489
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700490 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700491 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700492 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
493 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800494 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700495 installResult = main.intents.installHostIntent( main,
496 name="IPV4",
497 onosNode=0,
498 host1=host1,
499 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800500 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700501 testResult = main.intents.testHostIntent( main,
502 name="IPV4",
503 intentId=installResult,
504 onosNode=0,
505 host1=host1,
506 host2=host2,
507 sw1="s5",
508 sw2="s2",
509 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800510 else:
Devin Lim142b5342017-07-20 15:22:39 -0700511 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800512
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700513 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800514 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700515 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700516 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700517
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700518 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700519 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700520 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700521 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800522 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700523 installResult = main.intents.installHostIntent( main,
524 name="DUALSTACK",
525 onosNode=0,
526 host1=host1,
527 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800528
529 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700530 testResult = main.intents.testHostIntent( main,
531 name="DUALSTACK",
532 intentId=installResult,
533 onosNode=0,
534 host1=host1,
535 host2=host2,
536 sw1="s5",
537 sw2="s2",
538 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700539
540 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800541 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700542 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700543 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700544
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700545 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700546 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700547 host1 = { "name": "h1" }
548 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800549 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700550 installResult = main.intents.installHostIntent( main,
551 name="DUALSTACK2",
552 onosNode=0,
553 host1=host1,
554 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800555
556 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700557 testResult = main.intents.testHostIntent( main,
558 name="DUALSTACK2",
559 intentId=installResult,
560 onosNode=0,
561 host1=host1,
562 host2=host2,
563 sw1="s5",
564 sw2="s2",
565 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800566 else:
Devin Lim142b5342017-07-20 15:22:39 -0700567 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700568
569 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800570 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700571 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700572 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700573
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700574 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700575 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700576 host1 = { "name": "h1" }
577 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800578 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700579 installResult = main.intents.installHostIntent( main,
580 name="1HOP",
581 onosNode=0,
582 host1=host1,
583 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800584
585 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700586 testResult = main.intents.testHostIntent( main,
587 name="1HOP",
588 intentId=installResult,
589 onosNode=0,
590 host1=host1,
591 host2=host2,
592 sw1="s5",
593 sw2="s2",
594 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800595 else:
Devin Lim142b5342017-07-20 15:22:39 -0700596 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700597
598 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800599 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700600 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700601 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700602
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700603 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700604 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700605 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
606 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800607 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700608 installResult = main.intents.installHostIntent( main,
609 name="VLAN1",
610 onosNode=0,
611 host1=host1,
612 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800613 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700614 testResult = main.intents.testHostIntent( main,
615 name="VLAN1",
616 intentId=installResult,
617 onosNode=0,
618 host1=host1,
619 host2=host2,
620 sw1="s5",
621 sw2="s2",
622 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800623 else:
Devin Lim142b5342017-07-20 15:22:39 -0700624 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700625
626 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800627 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700628 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700629 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700630
Jeremy Songsterff553672016-05-12 17:06:23 -0700631 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
632 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700633 host1 = { "name": "h5", "vlan": "200" }
634 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700635 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700636 installResult = main.intents.installHostIntent( main,
637 name="VLAN2",
638 onosNode=0,
639 host1=host1,
640 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700641
642 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700643 testResult = main.intents.testHostIntent( main,
644 name="VLAN2",
645 intentId=installResult,
646 onosNode=0,
647 host1=host1,
648 host2=host2,
649 sw1="s5",
650 sw2="s2",
651 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700652 else:
Devin Lim142b5342017-07-20 15:22:39 -0700653 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -0700654
655 utilities.assert_equals( expect=main.TRUE,
656 actual=testResult,
657 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700658 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700659
Jeremy Songsterc032f162016-08-04 17:14:49 -0700660 main.step( "Encapsulation: Add host intents between h1 and h9" )
661 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700662 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
663 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700664 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700665 installResult = main.intents.installHostIntent( main,
666 name="ENCAPSULATION",
667 onosNode=0,
668 host1=host1,
669 host2=host2,
670 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700671 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700672 testResult = main.intents.testHostIntent( main,
673 name="ENCAPSULATION",
674 intentId=installResult,
675 onosNode=0,
676 host1=host1,
677 host2=host2,
678 sw1="s5",
679 sw2="s2",
680 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700681 else:
Devin Lim142b5342017-07-20 15:22:39 -0700682 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700683
684 utilities.assert_equals( expect=main.TRUE,
685 actual=testResult,
686 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700687 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700688
Jon Hall78be4962017-05-23 14:53:53 -0700689 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700690 # main.step( "Encapsulation: Add host intents between h1 and h9" )
691 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
692 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
693 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
694 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700695 # installResult = main.intents.installHostIntent( main,
696 # name="ENCAPSULATION",
697 # onosNode=0,
698 # host1=host1,
699 # host2=host2,
700 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700701 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700702 # testResult = main.intents.testHostIntent( main,
703 # name="ENCAPSULATION",
704 # intentId=installResult,
705 # onosNode=0,
706 # host1=host1,
707 # host2=host2,
708 # sw1="s5",
709 # sw2="s2",
710 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700711 # else:
Devin Lim142b5342017-07-20 15:22:39 -0700712 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -0700713 #
714 # utilities.assert_equals( expect=main.TRUE,
715 # actual=testResult,
716 # onpass=main.assertReturnString,
717 # onfail=main.assertReturnString )
718
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700719 main.step( "Confirm that ONOS leadership is unchanged" )
Devin Lim142b5342017-07-20 15:22:39 -0700720 intentLeadersNew = main.Cluster.active( 0 ).CLI.leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700721 testResult = main.intents.checkLeaderChange( intentLeadersOld,
722 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700723
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800724 utilities.assert_equals( expect=main.TRUE,
725 actual=testResult,
726 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700727 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800728
Jon Hall78be4962017-05-23 14:53:53 -0700729 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700730
kelvin-onlabb769f562015-07-15 17:05:10 -0700731 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700732 """
733 Add point intents between 2 hosts:
734 - Get device ids | ports
735 - Add point intents
736 - Check intents
737 - Verify flows
738 - Ping hosts
739 - Reroute
740 - Link down
741 - Verify flows
742 - Check topology
743 - Ping hosts
744 - Link up
745 - Verify flows
746 - Check topology
747 - Ping hosts
748 - Remove intents
749 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700750 if main.initialized == main.FALSE:
751 main.log.error( "Test components did not start correctly, skipping further tests" )
752 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700753 # Assert variables - These variable's name|format must be followed
754 # if you want to use the wrapper function
755 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700756 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700757 assert main.numSwitch
758 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700759 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700760 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700761 main.initialized = main.FALSE
762 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700763
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700764 main.testName = "Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700765 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700766 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700767 main.caseExplanation = "This test case will test point to point" +\
Devin Lim142b5342017-07-20 15:22:39 -0700768 " intents using " + str( main.Cluster.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700769 " node(s) cluster;\n" +\
770 "Different type of hosts will be tested in " +\
771 "each step such as IPV4, Dual stack, VLAN etc" +\
772 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700773 " OVS running in Mininet and compile intents" +\
774 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700775
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700776 # No option point intents
777 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700778 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800779 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700780 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800781 ]
782 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700783 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800784 ]
Jeremy42df2e72016-02-23 16:37:46 -0800785 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700786 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700787 main,
788 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800789 senders=senders,
790 recipients=recipients )
791
792 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700793 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800794 main,
795 intentId=installResult,
796 name="NOOPTION",
797 senders=senders,
798 recipients=recipients,
799 sw1="s5",
800 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700801 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800802 else:
Devin Lim142b5342017-07-20 15:22:39 -0700803 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700804
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700805 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800806 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700807 onpass=main.assertReturnString,
808 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700809
kelvin-onlabb769f562015-07-15 17:05:10 -0700810 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700811 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800812 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700813 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800814 ]
815 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700816 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800817 ]
Jeremy42df2e72016-02-23 16:37:46 -0800818 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700819 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700820 main,
821 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800822 senders=senders,
823 recipients=recipients,
824 ethType="IPV4" )
825
826 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700827 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800828 main,
829 intentId=installResult,
830 name="IPV4",
831 senders=senders,
832 recipients=recipients,
833 sw1="s5",
834 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700835 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800836 else:
Devin Lim142b5342017-07-20 15:22:39 -0700837 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700838
839 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800840 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700841 onpass=main.assertReturnString,
842 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800843
Jon Hall78be4962017-05-23 14:53:53 -0700844 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800845 main.assertReturnString = "Assertion Result for protected point intent\n"
846 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700847 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800848 ]
849 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700850 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800851 ]
852 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700853 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800854 main,
855 name="Protected",
856 senders=senders,
857 recipients=recipients,
858 protected=True )
859
860 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700861 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800862 main,
863 name="Protected",
864 intentId=installResult,
865 senders=senders,
866 recipients=recipients,
867 sw1="s5",
868 sw2="s2",
869 protected=True,
870 expectedLink=18 )
871 else:
Devin Lim142b5342017-07-20 15:22:39 -0700872 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alisonda157272016-12-22 01:13:21 -0800873
874 utilities.assert_equals( expect=main.TRUE,
875 actual=testResult,
876 onpass=main.assertReturnString,
877 onfail=main.assertReturnString )
878
kelvin-onlabb769f562015-07-15 17:05:10 -0700879 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700880 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800881 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700882 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800883 ]
884 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700885 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800886 ]
Jeremy42df2e72016-02-23 16:37:46 -0800887 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700888 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700889 main,
890 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800891 senders=senders,
892 recipients=recipients,
893 ethType="IPV4" )
894
895 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700896 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800897 main,
898 intentId=installResult,
899 name="IPV4_2",
900 senders=senders,
901 recipients=recipients,
902 sw1="s5",
903 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700904 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800905 else:
Devin Lim142b5342017-07-20 15:22:39 -0700906 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700907
908 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800909 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700910 onpass=main.assertReturnString,
911 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700912
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700913 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700914 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800915 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700916 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700917 "ip": ( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800918 ]
919 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700920 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700921 "ip": ( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800922 ]
Jeremy6f000c62016-02-25 17:02:28 -0800923 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700924 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800925 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
926 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800927 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700928 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800929 main,
930 name="SDNIP-ICMP",
931 senders=senders,
932 recipients=recipients,
933 ethType="IPV4",
934 ipProto=ipProto,
935 tcpSrc=tcpSrc,
936 tcpDst=tcpDst )
937
938 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700939 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800940 main,
941 intentId=installResult,
942 name="SDNIP_ICMP",
943 senders=senders,
944 recipients=recipients,
945 sw1="s5",
946 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700947 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700948 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800949 else:
Devin Lim142b5342017-07-20 15:22:39 -0700950 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700951
952 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800953 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700954 onpass=main.assertReturnString,
955 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700956
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700957 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700958 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700959 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
960 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700961 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
962 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700963 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
964 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
965 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
966
Jon Hall78be4962017-05-23 14:53:53 -0700967 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700968 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700969 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700970 host1="h1",
971 host2="h9",
972 deviceId1="of:0000000000000005/1",
973 deviceId2="of:0000000000000006/1",
974 mac1=mac1,
975 mac2=mac2,
976 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700977 ipProto=ipProto,
978 ip1=ip1,
979 ip2=ip2,
980 tcp1=tcp1,
981 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -0700982
983 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -0800984 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -0700985 onpass=main.assertReturnString,
986 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700987
acsmars5d8cc862015-09-25 09:44:50 -0700988 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
989 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800990 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700991 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800992 ]
993 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700994 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800995 ]
Jeremy42df2e72016-02-23 16:37:46 -0800996 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700997 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700998 main,
999 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001000 senders=senders,
1001 recipients=recipients,
1002 ethType="IPV4" )
1003
1004 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001005 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001006 main,
1007 intentId=installResult,
1008 name="DUALSTACK1",
1009 senders=senders,
1010 recipients=recipients,
1011 sw1="s5",
1012 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001013 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001014 else:
Devin Lim142b5342017-07-20 15:22:39 -07001015 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001016
1017 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001018 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001019 onpass=main.assertReturnString,
1020 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001021
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001022 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001023 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001024 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001025 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001026 ]
1027 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001028 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001029 ]
Jeremy42df2e72016-02-23 16:37:46 -08001030 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001031 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001032 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001033 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001034 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001035 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001036
1037 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001038 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001039 main,
1040 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001041 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001042 senders=senders,
1043 recipients=recipients,
1044 sw1="s5",
1045 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001046 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001047
1048 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001049 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001050 onpass=main.assertReturnString,
1051 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001052
Jeremy Songsterff553672016-05-12 17:06:23 -07001053 main.step( "VLAN: Add point intents between h5 and h21" )
1054 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1055 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001056 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001057 ]
1058 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001059 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001060 ]
1061 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001062 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001063 main,
1064 name="VLAN2",
1065 senders=senders,
1066 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001067 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001068
1069 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001070 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001071 main,
1072 intentId=installResult,
1073 name="VLAN2",
1074 senders=senders,
1075 recipients=recipients,
1076 sw1="s5",
1077 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001078 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001079
1080 utilities.assert_equals( expect=main.TRUE,
1081 actual=testResult,
1082 onpass=main.assertReturnString,
1083 onfail=main.assertReturnString )
1084
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001085 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001086 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001087 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001088 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001089 ]
1090 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001091 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001092 ]
Jeremy42df2e72016-02-23 16:37:46 -08001093 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001094 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001095 main,
1096 name="1HOP IPV4",
1097 senders=senders,
1098 recipients=recipients,
1099 ethType="IPV4" )
1100
1101 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001102 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001103 main,
1104 intentId=installResult,
1105 name="1HOP IPV4",
1106 senders=senders,
1107 recipients=recipients,
1108 sw1="s5",
1109 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001110 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001111 else:
Devin Lim142b5342017-07-20 15:22:39 -07001112 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001113
1114 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001115 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001116 onpass=main.assertReturnString,
1117 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001118
Jeremy Songsterc032f162016-08-04 17:14:49 -07001119 main.step( "Add point to point intents using VLAN Encapsulation" )
1120 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1121 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001122 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001123 ]
1124 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001125 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001126 ]
1127 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001128 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001129 main,
1130 name="ENCAPSULATION",
1131 senders=senders,
1132 recipients=recipients,
1133 encap="VLAN" )
1134
1135 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001136 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001137 main,
1138 intentId=installResult,
1139 name="ENCAPSULATION",
1140 senders=senders,
1141 recipients=recipients,
1142 sw1="s5",
1143 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001144 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001145 else:
Devin Lim142b5342017-07-20 15:22:39 -07001146 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001147
1148 utilities.assert_equals( expect=main.TRUE,
1149 actual=testResult,
1150 onpass=main.assertReturnString,
1151 onfail=main.assertReturnString )
1152
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001153 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1154 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1155 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001156 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001157 ]
1158 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001159 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001160 ]
1161 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001162 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001163 main,
1164 name="NOOPTION",
1165 senders=senders,
1166 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001167 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001168
1169 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001170 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001171 main,
1172 intentId=installResult,
1173 name="NOOPTION",
1174 senders=senders,
1175 recipients=recipients,
1176 sw1="s5",
1177 sw2="s2",
1178 expectedLink=18 )
1179 else:
Devin Lim142b5342017-07-20 15:22:39 -07001180 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001181
1182 utilities.assert_equals( expect=main.TRUE,
1183 actual=testResult,
1184 onpass=main.assertReturnString,
1185 onfail=main.assertReturnString )
1186
Jon Hall78be4962017-05-23 14:53:53 -07001187 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001188 # main.step( "Add point to point intents using MPLS Encapsulation" )
1189 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1190 # senders = [
1191 # { "name": "h1", "device": "of:0000000000000005/1" }
1192 # ]
1193 # recipients = [
1194 # { "name": "h9", "device": "of:0000000000000006/1" }
1195 # ]
1196 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001197 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001198 # main,
1199 # name="ENCAPSULATION",
1200 # senders=senders,
1201 # recipients=recipients,
1202 # encap="MPLS" )
1203 #
1204 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001205 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001206 # main,
1207 # intentId=installResult,
1208 # name="ENCAPSULATION",
1209 # senders=senders,
1210 # recipients=recipients,
1211 # sw1="s5",
1212 # sw2="s2",
1213 # expectedLink=18 )
1214 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001215 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001216 #
1217 # utilities.assert_equals( expect=main.TRUE,
1218 # actual=testResult,
1219 # onpass=main.assertReturnString,
1220 # onfail=main.assertReturnString )
1221
Jon Hall78be4962017-05-23 14:53:53 -07001222 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001223
kelvin-onlabb769f562015-07-15 17:05:10 -07001224 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001225 """
1226 Add single point to multi point intents
1227 - Get device ids
1228 - Add single point to multi point intents
1229 - Check intents
1230 - Verify flows
1231 - Ping hosts
1232 - Reroute
1233 - Link down
1234 - Verify flows
1235 - Check topology
1236 - Ping hosts
1237 - Link up
1238 - Verify flows
1239 - Check topology
1240 - Ping hosts
1241 - Remove intents
1242 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001243 if main.initialized == main.FALSE:
1244 main.log.error( "Test components did not start correctly, skipping further tests" )
1245 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001246 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001247 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001248 assert main.numSwitch
1249 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001250 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001251 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001252 main.initialized = main.FALSE
1253 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001254
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001255 main.testName = "Single to Multi Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001256 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001257 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001258 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001259 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001260 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001261 "Different type of hosts will be tested in " +\
1262 "each step such as IPV4, Dual stack, VLAN etc" +\
1263 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001264 " OVS running in Mininet and compile intents" +\
1265 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001266
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001267 main.step( "NOOPTION: Install and test single point to multi point intents" )
1268 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1269 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001270 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001271 ]
1272 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001273 { "name": "h16", "device": "of:0000000000000006/8" },
1274 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001275 ]
Jon Hall9c888672017-05-15 18:03:54 -07001276 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1277 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001278 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001279 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001280 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001281 name="NOOPTION",
1282 senders=senders,
1283 recipients=recipients,
1284 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001285 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001286
1287 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001288 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001289 main,
1290 intentId=installResult,
1291 name="NOOPTION",
1292 senders=senders,
1293 recipients=recipients,
1294 badSenders=badSenders,
1295 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001296 sw1="s5",
1297 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001298 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001299 else:
Devin Lim142b5342017-07-20 15:22:39 -07001300 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001301
1302 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001303 actual=testResult,
1304 onpass=main.assertReturnString,
1305 onfail=main.assertReturnString )
1306
1307 main.step( "IPV4: Install and test single point to multi point intents" )
1308 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1309 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001310 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001311 ]
1312 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001313 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1314 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001315 ]
Jon Hall9c888672017-05-15 18:03:54 -07001316 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1317 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001318 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001319 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001320 main,
1321 name="IPV4",
1322 senders=senders,
1323 recipients=recipients,
1324 ethType="IPV4",
1325 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001326 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001327
1328 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001329 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001330 main,
1331 intentId=installResult,
1332 name="IPV4",
1333 senders=senders,
1334 recipients=recipients,
1335 badSenders=badSenders,
1336 badRecipients=badRecipients,
1337 sw1="s5",
1338 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001339 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001340 else:
Devin Lim142b5342017-07-20 15:22:39 -07001341 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001342
1343 utilities.assert_equals( expect=main.TRUE,
1344 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001345 onpass=main.assertReturnString,
1346 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001347
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001348 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001349 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 -08001350 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001351 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001352 ]
1353 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001354 { "name": "h16", "device": "of:0000000000000006/8" },
1355 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001356 ]
Jon Hall9c888672017-05-15 18:03:54 -07001357 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1358 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001359 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001360 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001361 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001362 name="IPV4_2",
1363 senders=senders,
1364 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001365 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001366 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001367 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001368
1369 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001370 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001371 main,
1372 intentId=installResult,
1373 name="IPV4_2",
1374 senders=senders,
1375 recipients=recipients,
1376 badSenders=badSenders,
1377 badRecipients=badRecipients,
1378 sw1="s5",
1379 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001380 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001381 else:
Devin Lim142b5342017-07-20 15:22:39 -07001382 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001383
1384 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001385 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001386 onpass=main.assertReturnString,
1387 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001388
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001389 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001390 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 -08001391 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001392 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001393 ]
1394 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001395 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1396 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001397 ]
Jon Hall9c888672017-05-15 18:03:54 -07001398 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1399 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001400 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001401 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001402 main,
alison52b25892016-09-19 10:53:48 -07001403 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001404 senders=senders,
1405 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001406 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001407 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001408
1409 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001410 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001411 main,
1412 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001413 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001414 senders=senders,
1415 recipients=recipients,
1416 badSenders=badSenders,
1417 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001418 sw1="s5",
1419 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001420 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001421 else:
Devin Lim142b5342017-07-20 15:22:39 -07001422 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001423
1424 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001425 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001426 onpass=main.assertReturnString,
1427 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001428
Jeremy Songsterff553672016-05-12 17:06:23 -07001429 main.step( "VLAN: Add single point to multi point intents" )
1430 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1431 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001432 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001433 ]
1434 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001435 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1436 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001437 ]
Jon Hall9c888672017-05-15 18:03:54 -07001438 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1439 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001440 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001441 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001442 main,
1443 name="VLAN2",
1444 senders=senders,
1445 recipients=recipients,
1446 sw1="s5",
1447 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001448 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001449
1450 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001451 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001452 main,
1453 intentId=installResult,
1454 name="VLAN2",
1455 senders=senders,
1456 recipients=recipients,
1457 badSenders=badSenders,
1458 badRecipients=badRecipients,
1459 sw1="s5",
1460 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001461 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001462 else:
Devin Lim142b5342017-07-20 15:22:39 -07001463 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001464
1465 utilities.assert_equals( expect=main.TRUE,
1466 actual=testResult,
1467 onpass=main.assertReturnString,
1468 onfail=main.assertReturnString )
1469
alison52b25892016-09-19 10:53:48 -07001470 # Does not support Single point to multi point encapsulation
1471 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1472 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1473 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001474 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001475 # ]
1476 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001477 # { "name": "h16", "device": "of:0000000000000006/8" },
1478 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001479 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001480 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1481 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001482 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001483 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001484 # main,
1485 # name="ENCAPSULATION",
1486 # senders=senders,
1487 # recipients=recipients,
1488 # sw1="s5",
1489 # sw2="s2",
1490 # encap="VLAN" )
1491 #
1492 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001493 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001494 # main,
1495 # intentId=installResult,
1496 # name="ENCAPSULATION",
1497 # senders=senders,
1498 # recipients=recipients,
1499 # badSenders=badSenders,
1500 # badRecipients=badRecipients,
1501 # sw1="s5",
1502 # sw2="s2",
1503 # expectedLink=18 )
1504 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001505 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001506 #
1507 # utilities.assert_equals( expect=main.TRUE,
1508 # actual=testResult,
1509 # onpass=main.assertReturnString,
1510 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001511
Jon Hall78be4962017-05-23 14:53:53 -07001512 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001513
kelvin-onlabb769f562015-07-15 17:05:10 -07001514 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001515 """
1516 Add multi point to single point intents
1517 - Get device ids
1518 - Add multi point to single point intents
1519 - Check intents
1520 - Verify flows
1521 - Ping hosts
1522 - Reroute
1523 - Link down
1524 - Verify flows
1525 - Check topology
1526 - Ping hosts
1527 - Link up
1528 - Verify flows
1529 - Check topology
1530 - Ping hosts
1531 - Remove intents
1532 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001533 if main.initialized == main.FALSE:
1534 main.log.error( "Test components did not start correctly, skipping further tests" )
1535 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001536 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001537 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001538 assert main.numSwitch
1539 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001540 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001541 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001542 main.initialized = main.FALSE
1543 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001544
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001545 main.testName = "Multi To Single Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001546 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001547 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001548 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001549 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001550 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001551 "Different type of hosts will be tested in " +\
1552 "each step such as IPV4, Dual stack, VLAN etc" +\
1553 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001554 " OVS running in Mininet and compile intents" +\
1555 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001556
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001557 main.step( "NOOPTION: Add multi point to single point intents" )
1558 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1559 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001560 { "name": "h16", "device": "of:0000000000000006/8" },
1561 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001562 ]
1563 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001564 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001565 ]
Jon Hall9c888672017-05-15 18:03:54 -07001566 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1567 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001568 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001569 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001570 main,
1571 name="NOOPTION",
1572 senders=senders,
1573 recipients=recipients,
1574 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001575 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001576
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001577 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001578 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001579 main,
1580 intentId=installResult,
1581 name="NOOPTION",
1582 senders=senders,
1583 recipients=recipients,
1584 badSenders=badSenders,
1585 badRecipients=badRecipients,
1586 sw1="s5",
1587 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001588 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001589 else:
Devin Lim142b5342017-07-20 15:22:39 -07001590 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001591
1592 utilities.assert_equals( expect=main.TRUE,
1593 actual=testResult,
1594 onpass=main.assertReturnString,
1595 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001596
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001597 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001598 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 -08001599 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001600 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1601 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001602 ]
1603 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001604 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001605 ]
Jon Hall9c888672017-05-15 18:03:54 -07001606 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1607 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001608 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001609 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001610 main,
1611 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001612 senders=senders,
1613 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001614 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001615 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001616 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001617
1618 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001619 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001620 main,
1621 intentId=installResult,
1622 name="IPV4",
1623 senders=senders,
1624 recipients=recipients,
1625 badSenders=badSenders,
1626 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001627 sw1="s5",
1628 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001629 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001630 else:
Devin Lim142b5342017-07-20 15:22:39 -07001631 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001632
1633 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001634 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001635 onpass=main.assertReturnString,
1636 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001637
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001638 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001639 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 -08001640 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001641 { "name": "h16", "device": "of:0000000000000006/8" },
1642 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001643 ]
1644 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001645 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001646 ]
Jon Hall9c888672017-05-15 18:03:54 -07001647 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1648 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001649 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001650 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001651 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001652 name="IPV4_2",
1653 senders=senders,
1654 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001655 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001656 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001657 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001658
1659 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001660 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001661 main,
1662 intentId=installResult,
1663 name="IPV4_2",
1664 senders=senders,
1665 recipients=recipients,
1666 badSenders=badSenders,
1667 badRecipients=badRecipients,
1668 sw1="s5",
1669 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001670 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001671 else:
Devin Lim142b5342017-07-20 15:22:39 -07001672 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001673
1674 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001675 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001676 onpass=main.assertReturnString,
1677 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001678
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001679 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001680 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 -08001681 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001682 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1683 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001684 ]
1685 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001686 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001687 ]
Jon Hall9c888672017-05-15 18:03:54 -07001688 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1689 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001690 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001691 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001692 main,
1693 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001694 senders=senders,
1695 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001696 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001697 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001698
1699 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001700 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001701 main,
1702 intentId=installResult,
1703 name="VLAN",
1704 senders=senders,
1705 recipients=recipients,
1706 badSenders=badSenders,
1707 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001708 sw1="s5",
1709 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001710 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001711 else:
Devin Lim142b5342017-07-20 15:22:39 -07001712 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001713
1714 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001715 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001716 onpass=main.assertReturnString,
1717 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001718
Jeremy Songsterff553672016-05-12 17:06:23 -07001719 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1720 main.step( "VLAN: Add multi point to single point intents" )
1721 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1722 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001723 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1724 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001725 ]
1726 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001727 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001728 ]
Jon Hall9c888672017-05-15 18:03:54 -07001729 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1730 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001731 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001732 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001733 main,
1734 name="VLAN2",
1735 senders=senders,
1736 recipients=recipients,
1737 sw1="s5",
1738 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001739 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001740
1741 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001742 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001743 main,
1744 intentId=installResult,
1745 name="VLAN2",
1746 senders=senders,
1747 recipients=recipients,
1748 badSenders=badSenders,
1749 badRecipients=badRecipients,
1750 sw1="s5",
1751 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001752 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001753 else:
Devin Lim142b5342017-07-20 15:22:39 -07001754 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001755
1756 utilities.assert_equals( expect=main.TRUE,
1757 actual=testResult,
1758 onpass=main.assertReturnString,
1759 onfail=main.assertReturnString )
1760
Jeremy Songsterc032f162016-08-04 17:14:49 -07001761 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1762 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1763 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001764 { "name": "h16", "device": "of:0000000000000006/8" },
1765 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001766 ]
1767 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001768 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001769 ]
Jon Hall9c888672017-05-15 18:03:54 -07001770 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1771 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001772 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001773 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001774 main,
1775 name="ENCAPSULATION",
1776 senders=senders,
1777 recipients=recipients,
1778 sw1="s5",
1779 sw2="s2",
1780 encap="VLAN" )
1781
1782 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001783 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001784 main,
1785 intentId=installResult,
1786 name="ENCAPSULATION",
1787 senders=senders,
1788 recipients=recipients,
1789 badSenders=badSenders,
1790 badRecipients=badRecipients,
1791 sw1="s5",
1792 sw2="s2",
1793 expectedLink=18 )
1794 else:
Devin Lim142b5342017-07-20 15:22:39 -07001795 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001796
1797 utilities.assert_equals( expect=main.TRUE,
1798 actual=testResult,
1799 onpass=main.assertReturnString,
1800 onfail=main.assertReturnString )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07001801 """
1802 Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
1803 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1804 main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1805 senders = [
1806 { "name": "h16", "device": "of:0000000000000006/8" },
1807 { "name": "h24", "device": "of:0000000000000007/8" }
1808 ]
1809 recipients = [
1810 { "name": "h8", "device": "of:0000000000000005/8" }
1811 ]
1812 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1813 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
1814 testResult = main.FALSE
1815 installResult = main.intents.installMultiToSingleIntent(
1816 main,
1817 name="ENCAPSULATION",
1818 senders=senders,
1819 recipients=recipients,
1820 sw1="s5",
1821 sw2="s2",
1822 encap="MPLS" )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001823
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07001824 if installResult:
1825 testResult = main.intents.testPointIntent(
1826 main,
1827 intentId=installResult,
1828 name="ENCAPSULATION",
1829 senders=senders,
1830 recipients=recipients,
1831 badSenders=badSenders,
1832 badRecipients=badRecipients,
1833 sw1="s5",
1834 sw2="s2",
1835 expectedLink=18 )
1836 else:
1837 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
1838
1839 utilities.assert_equals( expect=main.TRUE,
1840 actual=testResult,
1841 onpass=main.assertReturnString,
1842 onfail=main.assertReturnString )
1843 """
alison52b25892016-09-19 10:53:48 -07001844
Jon Hall78be4962017-05-23 14:53:53 -07001845 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001846
acsmars1ff5e052015-07-23 11:27:48 -07001847 def CASE5000( self, main ):
1848 """
acsmars5d8cc862015-09-25 09:44:50 -07001849 Tests Host Mobility
1850 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001851 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001852 if main.initialized == main.FALSE:
1853 main.log.error( "Test components did not start correctly, skipping further tests" )
1854 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001855 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001856 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001857 assert main.numSwitch
1858 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001859 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001860 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001861 main.initialized = main.FALSE
1862 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001863 main.case( "Test host mobility with host intents " + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001864 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001865 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001866
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001867 main.log.info( "Moving h1 from s5 to s6" )
You Wanga0f6ff62018-01-11 15:46:30 -08001868 main.Network.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001869
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001870 # Send discovery ping from moved host
1871 # Moving the host brings down the default interfaces and creates a new one.
1872 # Scapy is restarted on this host to detect the new interface
1873 main.h1.stopScapy()
1874 main.h1.startScapy()
1875
1876 # Discover new host location in ONOS and populate host data.
1877 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001878 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1879 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001880
acsmars1ff5e052015-07-23 11:27:48 -07001881 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1882
1883 utilities.assert_equals( expect="of:0000000000000006",
1884 actual=h1PostMove,
1885 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001886 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001887 " to single point intents" +
1888 " with IPV4 type and MAC addresses" +
1889 " in the same VLAN" )
1890
1891 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001892 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001893 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1894 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001895 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001896 installResult = main.intents.installHostIntent( main,
1897 name="IPV4 Mobility IPV4",
1898 onosNode=0,
1899 host1=host1,
1900 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001901 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001902 testResult = main.intents.testHostIntent( main,
1903 name="Host Mobility IPV4",
1904 intentId=installResult,
1905 onosNode=0,
1906 host1=host1,
1907 host2=host2,
1908 sw1="s6",
1909 sw2="s2",
1910 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001911 else:
Devin Lim142b5342017-07-20 15:22:39 -07001912 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001913
1914 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001915 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001916 onpass=main.assertReturnString,
1917 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001918
Jon Hall78be4962017-05-23 14:53:53 -07001919 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001920
1921 def CASE6000( self, main ):
1922 """
1923 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1924 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001925 # At some later point discussion on this behavior in MPSP and SPMP intents
1926 # will be reoppened and this test case may need to be updated to reflect
1927 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001928 if main.initialized == main.FALSE:
1929 main.log.error( "Test components did not start correctly, skipping further tests" )
1930 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001931 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001932 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001933 assert main.numSwitch
1934 except AssertionError:
alison52b25892016-09-19 10:53:48 -07001935 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001936 main.initialized = main.FALSE
1937 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001938 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001939 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07001940 main.step( "Installing Multi to Single Point intents with no options set" )
1941 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1942 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08001943 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001944 { "name": "h16", "device": "of:0000000000000006/8" },
1945 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001946 ]
1947 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001948 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001949 ]
1950 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001951 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001952 ]
1953 isolatedRecipients = []
1954 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001955 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08001956 main,
1957 name="NOOPTION",
1958 senders=senders,
1959 recipients=recipients,
1960 sw1="s5",
1961 sw2="s2" )
1962
1963 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001964 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08001965 main,
1966 intentId=installResult,
1967 name="NOOPTION",
1968 senders=senders,
1969 recipients=recipients,
1970 isolatedSenders=isolatedSenders,
1971 isolatedRecipients=isolatedRecipients,
1972 sw1="s6",
1973 sw2="s2",
1974 sw3="s4",
1975 sw4="s1",
1976 sw5="s3",
1977 expectedLink1=16,
1978 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001979 else:
Devin Lim142b5342017-07-20 15:22:39 -07001980 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001981
1982 utilities.assert_equals( expect=main.TRUE,
1983 actual=testResult,
1984 onpass=main.assertReturnString,
1985 onfail=main.assertReturnString )
1986
Jeremy Songster9385d412016-06-02 17:57:36 -07001987 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
1988
1989 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1990 "with partial failures allowed\n"
1991 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001992 { "name": "h16", "device": "of:0000000000000006/8" },
1993 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07001994 ]
1995 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001996 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07001997 ]
1998 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001999 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002000 ]
2001 isolatedRecipients = []
2002 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002003 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002004 main,
2005 name="NOOPTION",
2006 senders=senders,
2007 recipients=recipients,
2008 sw1="s5",
2009 sw2="s2",
2010 partial=True )
2011
2012 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002013 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002014 main,
2015 intentId=installResult,
2016 name="NOOPTION",
2017 senders=senders,
2018 recipients=recipients,
2019 isolatedSenders=isolatedSenders,
2020 isolatedRecipients=isolatedRecipients,
2021 sw1="s6",
2022 sw2="s2",
2023 sw3="s4",
2024 sw4="s1",
2025 sw5="s3",
2026 expectedLink1=16,
2027 expectedLink2=14,
2028 partial=True )
2029 else:
Devin Lim142b5342017-07-20 15:22:39 -07002030 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002031
2032 utilities.assert_equals( expect=main.TRUE,
2033 actual=testResult,
2034 onpass=main.assertReturnString,
2035 onfail=main.assertReturnString )
2036
Jeremye0cb5eb2016-01-27 17:39:09 -08002037 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002038 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2039 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002040 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002041 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002042 ]
2043 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002044 { "name": "h16", "device": "of:0000000000000006/8" },
2045 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002046 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002047 isolatedSenders = []
2048 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002049 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002050 ]
2051 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002052 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002053 main,
2054 name="NOOPTION",
2055 senders=senders,
2056 recipients=recipients,
2057 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002058 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002059
2060 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002061 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002062 main,
2063 intentId=installResult,
2064 name="NOOPTION",
2065 senders=senders,
2066 recipients=recipients,
2067 isolatedSenders=isolatedSenders,
2068 isolatedRecipients=isolatedRecipients,
2069 sw1="s6",
2070 sw2="s2",
2071 sw3="s4",
2072 sw4="s1",
2073 sw5="s3",
2074 expectedLink1=16,
2075 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002076 else:
Devin Lim142b5342017-07-20 15:22:39 -07002077 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002078
2079 utilities.assert_equals( expect=main.TRUE,
2080 actual=testResult,
2081 onpass=main.assertReturnString,
2082 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002083 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002084 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002085 "intents with partial failures allowed" )
2086 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2087 "point intent with partial failures allowed\n"
2088 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002089 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002090 ]
2091 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002092 { "name": "h16", "device": "of:0000000000000006/8" },
2093 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002094 ]
2095 isolatedSenders = []
2096 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002097 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002098 ]
2099 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002100 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002101 main,
2102 name="NOOPTION",
2103 senders=senders,
2104 recipients=recipients,
2105 sw1="s5",
2106 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002107 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002108
2109 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002110 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002111 main,
2112 intentId=installResult,
2113 name="NOOPTION",
2114 senders=senders,
2115 recipients=recipients,
2116 isolatedSenders=isolatedSenders,
2117 isolatedRecipients=isolatedRecipients,
2118 sw1="s6",
2119 sw2="s2",
2120 sw3="s4",
2121 sw4="s1",
2122 sw5="s3",
2123 expectedLink1=16,
2124 expectedLink2=14,
2125 partial=True )
2126 else:
Devin Lim142b5342017-07-20 15:22:39 -07002127 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002128
2129 utilities.assert_equals( expect=main.TRUE,
2130 actual=testResult,
2131 onpass=main.assertReturnString,
2132 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002133
Jon Hall78be4962017-05-23 14:53:53 -07002134 main.intents.report( main )