kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1 | |
| 2 | # Testing the basic intent functionality of ONOS |
| 3 | |
| 4 | import time |
| 5 | import json |
| 6 | |
| 7 | class FUNCintent: |
| 8 | |
| 9 | def __init__( self ): |
| 10 | self.default = '' |
| 11 | |
| 12 | def CASE1( self, main ): |
| 13 | import time |
| 14 | import os |
| 15 | import imp |
| 16 | |
| 17 | """ |
| 18 | - Construct tests variables |
| 19 | - GIT ( optional ) |
| 20 | - Checkout ONOS master branch |
| 21 | - Pull latest ONOS code |
| 22 | - Building ONOS ( optional ) |
| 23 | - Install ONOS package |
| 24 | - Build ONOS package |
| 25 | """ |
| 26 | |
| 27 | main.case( "Constructing test variables and building ONOS package" ) |
| 28 | main.step( "Constructing test variables" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 29 | main.caseExplanation = "This test case is mainly for loading " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 30 | "from params file, and pull and build the " +\ |
| 31 | " latest ONOS package" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 32 | stepResult = main.FALSE |
| 33 | |
| 34 | # Test variables |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 35 | try: |
| 36 | main.testOnDirectory = os.path.dirname( os.getcwd ( ) ) |
| 37 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 38 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 39 | main.dependencyPath = main.testOnDirectory + \ |
| 40 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 41 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 42 | main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," ) |
| 43 | if main.ONOSbench.maxNodes: |
| 44 | main.maxNodes = int( main.ONOSbench.maxNodes ) |
| 45 | else: |
| 46 | main.maxNodes = 0 |
| 47 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 48 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
| 49 | wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ] |
| 50 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 51 | main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] ) |
| 52 | main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] ) |
| 53 | main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] ) |
| 54 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
| 55 | main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] ) |
| 56 | main.numLinks = int( main.params[ 'MININET' ][ 'links' ] ) |
| 57 | main.cellData = {} # for creating cell file |
| 58 | main.hostsData = {} |
| 59 | main.CLIs = [] |
| 60 | main.ONOSip = [] |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 61 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 62 | main.ONOSip = main.ONOSbench.getOnosIps() |
| 63 | print main.ONOSip |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 64 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 65 | # Assigning ONOS cli handles to a list |
| 66 | for i in range( 1, main.maxNodes + 1 ): |
| 67 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 68 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 69 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 70 | main.startUp = imp.load_source( wrapperFile1, |
| 71 | main.dependencyPath + |
| 72 | wrapperFile1 + |
| 73 | ".py" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 74 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 75 | main.intentFunction = imp.load_source( wrapperFile2, |
| 76 | main.dependencyPath + |
| 77 | wrapperFile2 + |
| 78 | ".py" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 79 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 80 | main.topo = imp.load_source( wrapperFile3, |
| 81 | main.dependencyPath + |
| 82 | wrapperFile3 + |
| 83 | ".py" ) |
| 84 | |
| 85 | copyResult = main.ONOSbench.copyMininetFile( main.topology, |
| 86 | main.dependencyPath, |
| 87 | main.Mininet1.user_name, |
| 88 | main.Mininet1.ip_address ) |
| 89 | if main.CLIs: |
| 90 | stepResult = main.TRUE |
| 91 | else: |
| 92 | main.log.error( "Did not properly created list of ONOS CLI handle" ) |
| 93 | stepResult = main.FALSE |
| 94 | except Exception as e: |
| 95 | main.log.exception(e) |
| 96 | main.cleanup() |
| 97 | main.exit() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 98 | |
| 99 | utilities.assert_equals( expect=main.TRUE, |
| 100 | actual=stepResult, |
| 101 | onpass="Successfully construct " + |
| 102 | "test variables ", |
| 103 | onfail="Failed to construct test variables" ) |
| 104 | |
| 105 | if gitPull == 'True': |
| 106 | main.step( "Building ONOS in " + gitBranch + " branch" ) |
| 107 | onosBuildResult = main.startUp.onosBuild( main, gitBranch ) |
| 108 | stepResult = onosBuildResult |
| 109 | utilities.assert_equals( expect=main.TRUE, |
| 110 | actual=stepResult, |
| 111 | onpass="Successfully compiled " + |
| 112 | "latest ONOS", |
| 113 | onfail="Failed to compile " + |
| 114 | "latest ONOS" ) |
| 115 | else: |
| 116 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 117 | "clean install" ) |
Jon Hall | 106be08 | 2015-07-22 09:53:00 -0700 | [diff] [blame] | 118 | main.ONOSbench.getVersion( report=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 119 | |
| 120 | def CASE2( self, main ): |
| 121 | """ |
| 122 | - Set up cell |
| 123 | - Create cell file |
| 124 | - Set cell file |
| 125 | - Verify cell file |
| 126 | - Kill ONOS process |
| 127 | - Uninstall ONOS cluster |
| 128 | - Verify ONOS start up |
| 129 | - Install ONOS cluster |
| 130 | - Connect to cli |
| 131 | """ |
| 132 | |
| 133 | # main.scale[ 0 ] determines the current number of ONOS controller |
| 134 | main.numCtrls = int( main.scale[ 0 ] ) |
| 135 | |
| 136 | main.case( "Starting up " + str( main.numCtrls ) + |
| 137 | " node(s) ONOS cluster" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 138 | main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 139 | " node(s) ONOS cluster" |
| 140 | |
| 141 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 142 | |
| 143 | #kill off all onos processes |
| 144 | main.log.info( "Safety check, killing all ONOS processes" + |
| 145 | " before initiating enviornment setup" ) |
| 146 | |
| 147 | for i in range( main.maxNodes ): |
| 148 | main.ONOSbench.onosDie( main.ONOSip[ i ] ) |
| 149 | |
| 150 | print "NODE COUNT = ", main.numCtrls |
| 151 | |
| 152 | tempOnosIp = [] |
| 153 | for i in range( main.numCtrls ): |
| 154 | tempOnosIp.append( main.ONOSip[i] ) |
| 155 | |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 156 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, |
| 157 | "temp", main.Mininet1.ip_address, |
| 158 | main.apps, tempOnosIp ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 159 | |
| 160 | main.step( "Apply cell to environment" ) |
| 161 | cellResult = main.ONOSbench.setCell( "temp" ) |
| 162 | verifyResult = main.ONOSbench.verifyCell() |
| 163 | stepResult = cellResult and verifyResult |
| 164 | utilities.assert_equals( expect=main.TRUE, |
| 165 | actual=stepResult, |
| 166 | onpass="Successfully applied cell to " + \ |
| 167 | "environment", |
| 168 | onfail="Failed to apply cell to environment " ) |
| 169 | |
| 170 | main.step( "Creating ONOS package" ) |
| 171 | packageResult = main.ONOSbench.onosPackage() |
| 172 | stepResult = packageResult |
| 173 | utilities.assert_equals( expect=main.TRUE, |
| 174 | actual=stepResult, |
| 175 | onpass="Successfully created ONOS package", |
| 176 | onfail="Failed to create ONOS package" ) |
| 177 | |
| 178 | time.sleep( main.startUpSleep ) |
| 179 | main.step( "Uninstalling ONOS package" ) |
| 180 | onosUninstallResult = main.TRUE |
| 181 | for i in range( main.numCtrls ): |
| 182 | onosUninstallResult = onosUninstallResult and \ |
| 183 | main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] ) |
| 184 | stepResult = onosUninstallResult |
| 185 | utilities.assert_equals( expect=main.TRUE, |
| 186 | actual=stepResult, |
| 187 | onpass="Successfully uninstalled ONOS package", |
| 188 | onfail="Failed to uninstall ONOS package" ) |
| 189 | |
| 190 | time.sleep( main.startUpSleep ) |
| 191 | main.step( "Installing ONOS package" ) |
| 192 | onosInstallResult = main.TRUE |
| 193 | for i in range( main.numCtrls ): |
| 194 | onosInstallResult = onosInstallResult and \ |
| 195 | main.ONOSbench.onosInstall( node=main.ONOSip[ i ] ) |
| 196 | stepResult = onosInstallResult |
| 197 | utilities.assert_equals( expect=main.TRUE, |
| 198 | actual=stepResult, |
| 199 | onpass="Successfully installed ONOS package", |
| 200 | onfail="Failed to install ONOS package" ) |
| 201 | |
| 202 | time.sleep( main.startUpSleep ) |
| 203 | main.step( "Starting ONOS service" ) |
| 204 | stopResult = main.TRUE |
| 205 | startResult = main.TRUE |
| 206 | onosIsUp = main.TRUE |
| 207 | |
| 208 | for i in range( main.numCtrls ): |
| 209 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 210 | if onosIsUp == main.TRUE: |
| 211 | main.log.report( "ONOS instance is up and ready" ) |
| 212 | else: |
| 213 | main.log.report( "ONOS instance may not be up, stop and " + |
| 214 | "start ONOS again " ) |
| 215 | for i in range( main.numCtrls ): |
| 216 | stopResult = stopResult and \ |
| 217 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 218 | for i in range( main.numCtrls ): |
| 219 | startResult = startResult and \ |
| 220 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 221 | stepResult = onosIsUp and stopResult and startResult |
| 222 | utilities.assert_equals( expect=main.TRUE, |
| 223 | actual=stepResult, |
| 224 | onpass="ONOS service is ready", |
| 225 | onfail="ONOS service did not start properly" ) |
| 226 | |
| 227 | main.step( "Start ONOS cli" ) |
| 228 | cliResult = main.TRUE |
| 229 | for i in range( main.numCtrls ): |
| 230 | cliResult = cliResult and \ |
| 231 | main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] ) |
| 232 | stepResult = cliResult |
| 233 | utilities.assert_equals( expect=main.TRUE, |
| 234 | actual=stepResult, |
| 235 | onpass="Successfully start ONOS cli", |
| 236 | onfail="Failed to start ONOS cli" ) |
| 237 | |
| 238 | # Remove the first element in main.scale list |
| 239 | main.scale.remove( main.scale[ 0 ] ) |
| 240 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 241 | def CASE8( self, main ): |
| 242 | """ |
| 243 | Compare Topo |
| 244 | """ |
| 245 | import json |
| 246 | |
| 247 | main.case( "Compare ONOS Topology view to Mininet topology" ) |
| 248 | main.caseExplanation = "Compare topology elements between Mininet" +\ |
| 249 | " and ONOS" |
| 250 | |
| 251 | main.step( "Gathering topology information" ) |
| 252 | # TODO: add a paramaterized sleep here |
| 253 | devicesResults = main.TRUE |
| 254 | linksResults = main.TRUE |
| 255 | hostsResults = main.TRUE |
| 256 | devices = main.topo.getAllDevices( main ) |
| 257 | hosts = main.topo.getAllHosts( main ) |
| 258 | ports = main.topo.getAllPorts( main ) |
| 259 | links = main.topo.getAllLinks( main ) |
| 260 | clusters = main.topo.getAllClusters( main ) |
| 261 | |
| 262 | mnSwitches = main.Mininet1.getSwitches() |
| 263 | mnLinks = main.Mininet1.getLinks() |
| 264 | mnHosts = main.Mininet1.getHosts() |
| 265 | |
| 266 | main.step( "Conmparing MN topology to ONOS topology" ) |
| 267 | for controller in range( main.numCtrls ): |
| 268 | controllerStr = str( controller + 1 ) |
| 269 | if devices[ controller ] and ports[ controller ] and\ |
| 270 | "Error" not in devices[ controller ] and\ |
| 271 | "Error" not in ports[ controller ]: |
| 272 | |
| 273 | currentDevicesResult = main.Mininet1.compareSwitches( |
| 274 | mnSwitches, |
| 275 | json.loads( devices[ controller ] ), |
| 276 | json.loads( ports[ controller ] ) ) |
| 277 | else: |
| 278 | currentDevicesResult = main.FALSE |
| 279 | utilities.assert_equals( expect=main.TRUE, |
| 280 | actual=currentDevicesResult, |
| 281 | onpass="ONOS" + controllerStr + |
| 282 | " Switches view is correct", |
| 283 | onfail="ONOS" + controllerStr + |
| 284 | " Switches view is incorrect" ) |
Jon Hall | 46d4825 | 2015-08-03 11:41:16 -0700 | [diff] [blame] | 285 | devicesResults = devicesResults and currentDevicesResult |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 286 | |
| 287 | if links[ controller ] and "Error" not in links[ controller ]: |
| 288 | currentLinksResult = main.Mininet1.compareLinks( |
| 289 | mnSwitches, mnLinks, |
| 290 | json.loads( links[ controller ] ) ) |
| 291 | else: |
| 292 | currentLinksResult = main.FALSE |
| 293 | utilities.assert_equals( expect=main.TRUE, |
| 294 | actual=currentLinksResult, |
| 295 | onpass="ONOS" + controllerStr + |
| 296 | " links view is correct", |
| 297 | onfail="ONOS" + controllerStr + |
| 298 | " links view is incorrect" ) |
Jon Hall | 46d4825 | 2015-08-03 11:41:16 -0700 | [diff] [blame] | 299 | linksResults = linksResults and currentLinksResult |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 300 | |
| 301 | if hosts[ controller ] or "Error" not in hosts[ controller ]: |
| 302 | currentHostsResult = main.Mininet1.compareHosts( |
| 303 | mnHosts, |
| 304 | json.loads( hosts[ controller ] ) ) |
| 305 | else: |
| 306 | currentHostsResult = main.FALSE |
| 307 | utilities.assert_equals( expect=main.TRUE, |
| 308 | actual=currentHostsResult, |
| 309 | onpass="ONOS" + controllerStr + |
| 310 | " hosts exist in Mininet", |
| 311 | onfail="ONOS" + controllerStr + |
| 312 | " hosts don't match Mininet" ) |
Jon Hall | 46d4825 | 2015-08-03 11:41:16 -0700 | [diff] [blame] | 313 | hostsResults = hostsResults and currentHostsResult |
| 314 | topoResults = hostsResults and linksResults and devicesResults |
| 315 | utilities.assert_equals( expect=main.TRUE, |
| 316 | actual=topoResults, |
| 317 | onpass="ONOS correctly discovered the topology", |
| 318 | onfail="ONOS incorrectly discovered the topology" ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 319 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 320 | def CASE9( self, main ): |
| 321 | ''' |
| 322 | Report errors/warnings/exceptions |
| 323 | ''' |
| 324 | main.log.info( "Error report: \n" ) |
| 325 | main.ONOSbench.logReport( globalONOSip[0], |
| 326 | [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ], |
| 327 | "s" ) |
| 328 | #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" ) |
| 329 | |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 330 | def CASE10( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 331 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 332 | Start Mininet topology with OF 1.0 switches |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 333 | """ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 334 | main.OFProtocol = "1.0" |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 335 | main.log.report( "Start Mininet topology with OF 1.0 switches" ) |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 336 | main.case( "Start Mininet topology with OF 1.0 switches" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 337 | main.caseExplanation = "Start mininet topology with OF 1.0 " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 338 | "switches to test intents, exits out if " +\ |
| 339 | "topology did not start correctly" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 340 | |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 341 | main.step( "Starting Mininet topology with OF 1.0 switches" ) |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 342 | args = "--switch ovs,protocols=OpenFlow10" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 343 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 344 | main.topology, |
| 345 | args=args ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 346 | stepResult = topoResult |
| 347 | utilities.assert_equals( expect=main.TRUE, |
| 348 | actual=stepResult, |
| 349 | onpass="Successfully loaded topology", |
| 350 | onfail="Failed to load topology" ) |
| 351 | # Exit if topology did not load properly |
| 352 | if not topoResult: |
| 353 | main.cleanup() |
| 354 | main.exit() |
| 355 | |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 356 | def CASE11( self, main ): |
| 357 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 358 | Start Mininet topology with OF 1.3 switches |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 359 | """ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 360 | main.OFProtocol = "1.3" |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 361 | main.log.report( "Start Mininet topology with OF 1.3 switches" ) |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 362 | main.case( "Start Mininet topology with OF 1.3 switches" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 363 | main.caseExplanation = "Start mininet topology with OF 1.3 " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 364 | "switches to test intents, exits out if " +\ |
| 365 | "topology did not start correctly" |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 366 | |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 367 | main.step( "Starting Mininet topology with OF 1.3 switches" ) |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 368 | args = "--switch ovs,protocols=OpenFlow13" |
| 369 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
| 370 | main.topology, |
| 371 | args=args ) |
| 372 | stepResult = topoResult |
| 373 | utilities.assert_equals( expect=main.TRUE, |
| 374 | actual=stepResult, |
| 375 | onpass="Successfully loaded topology", |
| 376 | onfail="Failed to load topology" ) |
| 377 | # Exit if topology did not load properly |
| 378 | if not topoResult: |
| 379 | main.cleanup() |
| 380 | main.exit() |
| 381 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 382 | def CASE12( self, main ): |
| 383 | """ |
| 384 | Assign mastership to controllers |
| 385 | """ |
| 386 | import re |
| 387 | |
| 388 | main.case( "Assign switches to controllers" ) |
| 389 | main.step( "Assigning switches to controllers" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 390 | main.caseExplanation = "Assign OF " + main.OFProtocol +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 391 | " switches to ONOS nodes" |
| 392 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 393 | assignResult = main.TRUE |
| 394 | switchList = [] |
| 395 | |
| 396 | # Creates a list switch name, use getSwitch() function later... |
| 397 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 398 | switchList.append( 's' + str( i ) ) |
| 399 | |
| 400 | tempONOSip = [] |
| 401 | for i in range( main.numCtrls ): |
| 402 | tempONOSip.append( main.ONOSip[ i ] ) |
| 403 | |
| 404 | assignResult = main.Mininet1.assignSwController( sw=switchList, |
| 405 | ip=tempONOSip, |
| 406 | port='6633' ) |
| 407 | if not assignResult: |
| 408 | main.cleanup() |
| 409 | main.exit() |
| 410 | |
| 411 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 412 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 413 | print( "Response is " + str( response ) ) |
| 414 | if re.search( "tcp:" + main.ONOSip[ 0 ], response ): |
| 415 | assignResult = assignResult and main.TRUE |
| 416 | else: |
| 417 | assignResult = main.FALSE |
| 418 | stepResult = assignResult |
| 419 | utilities.assert_equals( expect=main.TRUE, |
| 420 | actual=stepResult, |
| 421 | onpass="Successfully assigned switches" + |
| 422 | "to controller", |
| 423 | onfail="Failed to assign switches to " + |
| 424 | "controller" ) |
| 425 | def CASE13( self, main ): |
| 426 | """ |
| 427 | Discover all hosts and store its data to a dictionary |
| 428 | """ |
| 429 | main.case( "Discover all hosts" ) |
| 430 | |
| 431 | stepResult = main.TRUE |
| 432 | main.step( "Discover all hosts using pingall " ) |
| 433 | stepResult = main.intentFunction.getHostsData( main ) |
| 434 | utilities.assert_equals( expect=main.TRUE, |
| 435 | actual=stepResult, |
| 436 | onpass="Successfully discovered hosts", |
| 437 | onfail="Failed to discover hosts" ) |
| 438 | |
| 439 | def CASE14( self, main ): |
| 440 | """ |
| 441 | Stop mininet |
| 442 | """ |
| 443 | main.log.report( "Stop Mininet topology" ) |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 444 | main.case( "Stop Mininet topology" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 445 | main.caseExplanation = "Stopping the current mininet topology " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 446 | "to start up fresh" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 447 | |
| 448 | main.step( "Stopping Mininet Topology" ) |
| 449 | topoResult = main.Mininet1.stopNet( ) |
| 450 | stepResult = topoResult |
| 451 | utilities.assert_equals( expect=main.TRUE, |
| 452 | actual=stepResult, |
| 453 | onpass="Successfully stop mininet", |
| 454 | onfail="Failed to stop mininet" ) |
| 455 | # Exit if topology did not load properly |
| 456 | if not topoResult: |
| 457 | main.cleanup() |
| 458 | main.exit() |
| 459 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 460 | def CASE1000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 461 | """ |
| 462 | Add host intents between 2 host: |
| 463 | - Discover hosts |
| 464 | - Add host intents |
| 465 | - Check intents |
| 466 | - Verify flows |
| 467 | - Ping hosts |
| 468 | - Reroute |
| 469 | - Link down |
| 470 | - Verify flows |
| 471 | - Check topology |
| 472 | - Ping hosts |
| 473 | - Link up |
| 474 | - Verify flows |
| 475 | - Check topology |
| 476 | - Ping hosts |
| 477 | - Remove intents |
| 478 | """ |
| 479 | import time |
| 480 | import json |
| 481 | import re |
| 482 | |
| 483 | # Assert variables - These variable's name|format must be followed |
| 484 | # if you want to use the wrapper function |
| 485 | assert main, "There is no main" |
| 486 | assert main.CLIs, "There is no main.CLIs" |
| 487 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 488 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 489 | main.numSwitch" |
| 490 | |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 491 | intentLeadersOld = main.CLIs[ 0 ].leaderCandidates() |
| 492 | |
kelvin-onlab | 825b57d | 2015-07-24 13:43:59 -0700 | [diff] [blame] | 493 | main.case( "Host Intents Test - " + str( main.numCtrls ) + |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 494 | " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 495 | main.caseExplanation = "This test case tests Host intents using " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 496 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 497 | "Different type of hosts will be tested in " +\ |
| 498 | "each step such as IPV4, Dual stack, VLAN " +\ |
| 499 | "etc;\nThe test will use OF " + main.OFProtocol\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 500 | + " OVS running in Mininet" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 501 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 502 | main.step( "IPV4: Add host intents between h1 and h9" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 503 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 504 | stepResult = main.intentFunction.hostIntent( main, |
| 505 | onosNode='0', |
| 506 | name='IPV4', |
| 507 | host1='h1', |
| 508 | host2='h9', |
| 509 | host1Id='00:00:00:00:00:01/-1', |
| 510 | host2Id='00:00:00:00:00:09/-1', |
| 511 | sw1='s5', |
| 512 | sw2='s2', |
| 513 | expectedLink=18 ) |
| 514 | |
| 515 | utilities.assert_equals( expect=main.TRUE, |
| 516 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 517 | onpass="IPV4: Host intent test successful " + |
| 518 | "between two IPV4 hosts", |
| 519 | onfail="IPV4: Host intent test failed " + |
| 520 | "between two IPV4 hosts") |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 521 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 522 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 523 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 524 | stepResult = main.intentFunction.hostIntent( main, |
| 525 | name='DUALSTACK', |
| 526 | host1='h3', |
| 527 | host2='h11', |
| 528 | host1Id='00:00:00:00:00:03/-1', |
| 529 | host2Id='00:00:00:00:00:0B/-1', |
| 530 | sw1='s5', |
| 531 | sw2='s2', |
| 532 | expectedLink=18 ) |
| 533 | |
| 534 | utilities.assert_equals( expect=main.TRUE, |
| 535 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 536 | onpass="DUALSTACK: Host intent test " + |
| 537 | "successful between two " + |
| 538 | "dual stack host using IPV4", |
| 539 | onfail="DUALSTACK: Host intent test " + |
| 540 | "failed between two" + |
| 541 | "dual stack host using IPV4" ) |
| 542 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 543 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 544 | main.step( "DUALSTACK2: Add host intents between h1 and h11" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 545 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 546 | stepResult = main.intentFunction.hostIntent( main, |
| 547 | name='DUALSTACK2', |
| 548 | host1='h1', |
| 549 | host2='h11', |
| 550 | sw1='s5', |
| 551 | sw2='s2', |
| 552 | expectedLink=18 ) |
| 553 | |
| 554 | utilities.assert_equals( expect=main.TRUE, |
| 555 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 556 | onpass="DUALSTACK2: Host intent test " + |
| 557 | "successful between two " + |
| 558 | "dual stack host using IPV4", |
| 559 | onfail="DUALSTACK2: Host intent test " + |
| 560 | "failed between two" + |
| 561 | "dual stack host using IPV4" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 562 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 563 | main.step( "1HOP: Add host intents between h1 and h3" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 564 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 565 | stepResult = main.intentFunction.hostIntent( main, |
| 566 | name='1HOP', |
| 567 | host1='h1', |
| 568 | host2='h3' ) |
| 569 | |
| 570 | utilities.assert_equals( expect=main.TRUE, |
| 571 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 572 | onpass="1HOP: Host intent test " + |
| 573 | "successful between two " + |
| 574 | "host using IPV4 in the same switch", |
| 575 | onfail="1HOP: Host intent test " + |
| 576 | "failed between two" + |
| 577 | "host using IPV4 in the same switch" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 578 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 579 | main.step( "VLAN1: Add vlan host intents between h4 and h12" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 580 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 581 | stepResult = main.intentFunction.hostIntent( main, |
| 582 | name='VLAN1', |
| 583 | host1='h4', |
| 584 | host2='h12', |
| 585 | host1Id='00:00:00:00:00:04/100', |
| 586 | host2Id='00:00:00:00:00:0C/100', |
| 587 | sw1='s5', |
| 588 | sw2='s2', |
| 589 | expectedLink=18 ) |
| 590 | |
| 591 | utilities.assert_equals( expect=main.TRUE, |
| 592 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 593 | onpass="VLAN1: Host intent test " + |
| 594 | "successful between two " + |
| 595 | "host using IPV4 in the same VLAN", |
| 596 | onfail="VLAN1: Host intent test " + |
| 597 | "failed between two" + |
| 598 | "host using IPV4 in the same VLAN" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 599 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 600 | main.step( "VLAN2: Add inter vlan host intents between h13 and h20" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 601 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 602 | stepResult = main.intentFunction.hostIntent( main, |
| 603 | name='VLAN2', |
| 604 | host1='h13', |
| 605 | host2='h20' ) |
| 606 | |
| 607 | utilities.assert_equals( expect=main.FALSE, |
| 608 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 609 | onpass="VLAN2: Host intent negative test " + |
| 610 | "successful between two " + |
| 611 | "host using IPV4 in different VLAN", |
| 612 | onfail="VLAN2: Host intent negative test " + |
| 613 | "failed between two" + |
| 614 | "host using IPV4 in different VLAN" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 615 | |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 616 | |
| 617 | intentLeadersNew = main.CLIs[ 0 ].leaderCandidates() |
| 618 | main.intentFunction.checkLeaderChange( intentLeadersOld, |
| 619 | intentLeadersNew ) |
| 620 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 621 | def CASE2000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 622 | """ |
| 623 | Add point intents between 2 hosts: |
| 624 | - Get device ids | ports |
| 625 | - Add point intents |
| 626 | - Check intents |
| 627 | - Verify flows |
| 628 | - Ping hosts |
| 629 | - Reroute |
| 630 | - Link down |
| 631 | - Verify flows |
| 632 | - Check topology |
| 633 | - Ping hosts |
| 634 | - Link up |
| 635 | - Verify flows |
| 636 | - Check topology |
| 637 | - Ping hosts |
| 638 | - Remove intents |
| 639 | """ |
| 640 | import time |
| 641 | import json |
| 642 | import re |
| 643 | |
| 644 | # Assert variables - These variable's name|format must be followed |
| 645 | # if you want to use the wrapper function |
| 646 | assert main, "There is no main" |
| 647 | assert main.CLIs, "There is no main.CLIs" |
| 648 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 649 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 650 | main.numSwitch" |
| 651 | |
kelvin-onlab | 825b57d | 2015-07-24 13:43:59 -0700 | [diff] [blame] | 652 | main.case( "Point Intents Test - " + str( main.numCtrls ) + |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 653 | " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 654 | main.caseExplanation = "This test case will test point to point" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 655 | " intents using " + str( main.numCtrls ) +\ |
| 656 | " node(s) cluster;\n" +\ |
| 657 | "Different type of hosts will be tested in " +\ |
| 658 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 659 | ";\nThe test will use OF " + main.OFProtocol +\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 660 | " OVS running in Mininet" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 661 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 662 | # No option point intents |
| 663 | main.step( "NOOPTION: Add point intents between h1 and h9" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 664 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 665 | stepResult = main.intentFunction.pointIntent( |
| 666 | main, |
| 667 | name="NOOPTION", |
| 668 | host1="h1", |
| 669 | host2="h9", |
| 670 | deviceId1="of:0000000000000005/1", |
| 671 | deviceId2="of:0000000000000006/1", |
| 672 | sw1="s5", |
| 673 | sw2="s2", |
| 674 | expectedLink=18 ) |
| 675 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 676 | utilities.assert_equals( expect=main.TRUE, |
| 677 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 678 | onpass="NOOPTION: Point intent test " + |
| 679 | "successful using no match action", |
| 680 | onfail="NOOPTION: Point intent test " + |
| 681 | "failed using no match action" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 682 | |
| 683 | stepResult = main.TRUE |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 684 | main.step( "IPV4: Add point intents between h1 and h9" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 685 | stepResult = main.intentFunction.pointIntent( |
| 686 | main, |
| 687 | name="IPV4", |
| 688 | host1="h1", |
| 689 | host2="h9", |
| 690 | deviceId1="of:0000000000000005/1", |
| 691 | deviceId2="of:0000000000000006/1", |
| 692 | port1="", |
| 693 | port2="", |
| 694 | ethType="IPV4", |
| 695 | mac1="00:00:00:00:00:01", |
| 696 | mac2="00:00:00:00:00:09", |
| 697 | bandwidth="", |
| 698 | lambdaAlloc=False, |
| 699 | ipProto="", |
| 700 | ip1="", |
| 701 | ip2="", |
| 702 | tcp1="", |
| 703 | tcp2="", |
| 704 | sw1="s5", |
| 705 | sw2="s2", |
| 706 | expectedLink=18 ) |
| 707 | |
| 708 | utilities.assert_equals( expect=main.TRUE, |
| 709 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 710 | onpass="IPV4: Point intent test " + |
| 711 | "successful using IPV4 type with " + |
| 712 | "MAC addresses", |
| 713 | onfail="IPV4: Point intent test " + |
| 714 | "failed using IPV4 type with " + |
| 715 | "MAC addresses" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 716 | main.step( "IPV4_2: Add point intents between h1 and h9" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 717 | stepResult = main.TRUE |
| 718 | stepResult = main.intentFunction.pointIntent( |
| 719 | main, |
| 720 | name="IPV4_2", |
| 721 | host1="h1", |
| 722 | host2="h9", |
| 723 | deviceId1="of:0000000000000005/1", |
| 724 | deviceId2="of:0000000000000006/1", |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 725 | ipProto="", |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 726 | ip1="", |
| 727 | ip2="", |
| 728 | tcp1="", |
| 729 | tcp2="", |
| 730 | sw1="s5", |
| 731 | sw2="s2", |
| 732 | expectedLink=18 ) |
| 733 | |
| 734 | utilities.assert_equals( expect=main.TRUE, |
| 735 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 736 | onpass="IPV4_2: Point intent test " + |
| 737 | "successful using IPV4 type with " + |
| 738 | "no MAC addresses", |
| 739 | onfail="IPV4_2: Point intent test " + |
| 740 | "failed using IPV4 type with " + |
| 741 | "no MAC addresses" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 742 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 743 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 744 | stepResult = main.TRUE |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 745 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 746 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
kelvin-onlab | 0ad05d1 | 2015-07-23 14:21:15 -0700 | [diff] [blame] | 747 | try: |
| 748 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 749 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 750 | except KeyError: |
| 751 | main.log.debug( "Key Error getting IP addresses of h1 | h9 in" + |
| 752 | "main.hostsData" ) |
| 753 | ip1 = main.Mininet1.getIPAddress( 'h1') |
| 754 | ip2 = main.Mininet1.getIPAddress( 'h9') |
| 755 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 756 | ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ] |
kelvin-onlab | 79ce049 | 2015-07-27 16:14:39 -0700 | [diff] [blame] | 757 | # Uneccessary, not including this in the selectors |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 758 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 759 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 760 | |
| 761 | stepResult = main.intentFunction.pointIntent( |
| 762 | main, |
| 763 | name="SDNIP-TCP", |
| 764 | host1="h1", |
| 765 | host2="h9", |
| 766 | deviceId1="of:0000000000000005/1", |
| 767 | deviceId2="of:0000000000000006/1", |
| 768 | mac1=mac1, |
| 769 | mac2=mac2, |
| 770 | ethType="IPV4", |
| 771 | ipProto=ipProto, |
| 772 | ip1=ip1, |
kelvin-onlab | 79ce049 | 2015-07-27 16:14:39 -0700 | [diff] [blame] | 773 | ip2=ip2 ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 774 | |
| 775 | utilities.assert_equals( expect=main.TRUE, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 776 | actual=stepResult, |
| 777 | onpass="SDNIP-TCP: Point intent test " + |
| 778 | "successful using IPV4 type with " + |
| 779 | "IP protocol TCP enabled", |
| 780 | onfail="SDNIP-TCP: Point intent test " + |
| 781 | "failed using IPV4 type with " + |
| 782 | "IP protocol TCP enabled" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 783 | |
| 784 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
| 785 | stepResult = main.TRUE |
| 786 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 787 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
| 788 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 789 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 790 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 791 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 792 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 793 | |
| 794 | stepResult = main.intentFunction.pointIntent( |
| 795 | main, |
| 796 | name="SDNIP-ICMP", |
| 797 | host1="h1", |
| 798 | host2="h9", |
| 799 | deviceId1="of:0000000000000005/1", |
| 800 | deviceId2="of:0000000000000006/1", |
| 801 | mac1=mac1, |
| 802 | mac2=mac2, |
| 803 | ethType="IPV4", |
| 804 | ipProto=ipProto ) |
| 805 | |
| 806 | utilities.assert_equals( expect=main.TRUE, |
| 807 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 808 | onpass="SDNIP-ICMP: Point intent test " + |
| 809 | "successful using IPV4 type with " + |
| 810 | "IP protocol ICMP enabled", |
| 811 | onfail="SDNIP-ICMP: Point intent test " + |
| 812 | "failed using IPV4 type with " + |
| 813 | "IP protocol ICMP enabled" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 814 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 815 | main.step( "DUALSTACK1: Add point intents between h1 and h9" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 816 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 817 | stepResult = main.intentFunction.pointIntent( |
| 818 | main, |
| 819 | name="DUALSTACK1", |
| 820 | host1="h3", |
| 821 | host2="h11", |
| 822 | deviceId1="of:0000000000000005", |
| 823 | deviceId2="of:0000000000000006", |
| 824 | port1="3", |
| 825 | port2="3", |
| 826 | ethType="IPV4", |
| 827 | mac1="00:00:00:00:00:03", |
| 828 | mac2="00:00:00:00:00:0B", |
| 829 | bandwidth="", |
| 830 | lambdaAlloc=False, |
| 831 | ipProto="", |
| 832 | ip1="", |
| 833 | ip2="", |
| 834 | tcp1="", |
| 835 | tcp2="", |
| 836 | sw1="s5", |
| 837 | sw2="s2", |
| 838 | expectedLink=18 ) |
| 839 | |
| 840 | utilities.assert_equals( expect=main.TRUE, |
| 841 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 842 | onpass="DUALSTACK1: Point intent test " + |
| 843 | "successful using IPV4 type with " + |
| 844 | "MAC addresses", |
| 845 | onfail="DUALSTACK1: Point intent test " + |
| 846 | "failed using IPV4 type with " + |
| 847 | "MAC addresses" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 848 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 849 | main.step( "VLAN: Add point intents between h5 and h21" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 850 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 851 | stepResult = main.intentFunction.pointIntent( |
| 852 | main, |
| 853 | name="VLAN", |
| 854 | host1="h5", |
| 855 | host2="h21", |
| 856 | deviceId1="of:0000000000000005/5", |
| 857 | deviceId2="of:0000000000000007/5", |
| 858 | port1="", |
| 859 | port2="", |
| 860 | ethType="IPV4", |
| 861 | mac1="00:00:00:00:00:05", |
| 862 | mac2="00:00:00:00:00:15", |
| 863 | bandwidth="", |
| 864 | lambdaAlloc=False, |
| 865 | ipProto="", |
| 866 | ip1="", |
| 867 | ip2="", |
| 868 | tcp1="", |
| 869 | tcp2="", |
| 870 | sw1="s5", |
| 871 | sw2="s2", |
| 872 | expectedLink=18 ) |
| 873 | |
| 874 | utilities.assert_equals( expect=main.TRUE, |
| 875 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 876 | onpass="VLAN1: Point intent test " + |
| 877 | "successful using IPV4 type with " + |
| 878 | "MAC addresses", |
| 879 | onfail="VLAN1: Point intent test " + |
| 880 | "failed using IPV4 type with " + |
| 881 | "MAC addresses" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 882 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 883 | main.step( "1HOP: Add point intents between h1 and h3" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 884 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 885 | stepResult = main.intentFunction.hostIntent( main, |
| 886 | name='1HOP', |
| 887 | host1='h1', |
| 888 | host2='h3' ) |
| 889 | |
| 890 | utilities.assert_equals( expect=main.TRUE, |
| 891 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 892 | onpass="1HOP: Point intent test " + |
| 893 | "successful using IPV4 type with " + |
| 894 | "no MAC addresses", |
| 895 | onfail="1HOP: Point intent test " + |
| 896 | "failed using IPV4 type with " + |
| 897 | "no MAC addresses" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 898 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 899 | def CASE3000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 900 | """ |
| 901 | Add single point to multi point intents |
| 902 | - Get device ids |
| 903 | - Add single point to multi point intents |
| 904 | - Check intents |
| 905 | - Verify flows |
| 906 | - Ping hosts |
| 907 | - Reroute |
| 908 | - Link down |
| 909 | - Verify flows |
| 910 | - Check topology |
| 911 | - Ping hosts |
| 912 | - Link up |
| 913 | - Verify flows |
| 914 | - Check topology |
| 915 | - Ping hosts |
| 916 | - Remove intents |
| 917 | """ |
| 918 | assert main, "There is no main" |
| 919 | assert main.CLIs, "There is no main.CLIs" |
| 920 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 921 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 922 | main.numSwitch" |
| 923 | |
kelvin-onlab | 825b57d | 2015-07-24 13:43:59 -0700 | [diff] [blame] | 924 | main.case( "Single To Multi Point Intents Test - " + |
kelvin-onlab | e5c1ada | 2015-07-24 11:49:40 -0700 | [diff] [blame] | 925 | str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 926 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 927 | " multi point intents using " +\ |
| 928 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 929 | "Different type of hosts will be tested in " +\ |
| 930 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 931 | ";\nThe test will use OF " + main.OFProtocol +\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 932 | " OVS running in Mininet" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 933 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 934 | main.step( "NOOPTION: Add single point to multi point intents" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 935 | stepResult = main.TRUE |
| 936 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 937 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 938 | 'of:0000000000000007/8' ] |
| 939 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ] |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 940 | stepResult = main.intentFunction.singleToMultiIntent( |
| 941 | main, |
| 942 | name="NOOPTION", |
| 943 | hostNames=hostNames, |
| 944 | devices=devices, |
| 945 | sw1="s5", |
| 946 | sw2="s2", |
| 947 | expectedLink=18 ) |
| 948 | |
| 949 | utilities.assert_equals( expect=main.TRUE, |
| 950 | actual=stepResult, |
| 951 | onpass="NOOPTION: Successfully added single " |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 952 | + " point to multi point intents" + |
| 953 | " with no match action", |
| 954 | onfail="NOOPTION: Failed to add single point" |
| 955 | + " point to multi point intents" + |
| 956 | " with no match action" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 957 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 958 | main.step( "IPV4: Add single point to multi point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 959 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 960 | stepResult = main.intentFunction.singleToMultiIntent( |
| 961 | main, |
| 962 | name="IPV4", |
| 963 | hostNames=hostNames, |
| 964 | devices=devices, |
| 965 | ports=None, |
| 966 | ethType="IPV4", |
| 967 | macs=macs, |
| 968 | bandwidth="", |
| 969 | lambdaAlloc=False, |
| 970 | ipProto="", |
| 971 | ipAddresses="", |
| 972 | tcp="", |
| 973 | sw1="s5", |
| 974 | sw2="s2", |
| 975 | expectedLink=18 ) |
| 976 | |
| 977 | utilities.assert_equals( expect=main.TRUE, |
| 978 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 979 | onpass="IPV4: Successfully added single " |
| 980 | + " point to multi point intents" + |
| 981 | " with IPV4 type and MAC addresses", |
| 982 | onfail="IPV4: Failed to add single point" |
| 983 | + " point to multi point intents" + |
| 984 | " with IPV4 type and MAC addresses" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 985 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 986 | main.step( "IPV4_2: Add single point to multi point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 987 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 988 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 989 | stepResult = main.intentFunction.singleToMultiIntent( |
| 990 | main, |
| 991 | name="IPV4", |
| 992 | hostNames=hostNames, |
| 993 | ethType="IPV4", |
| 994 | lambdaAlloc=False ) |
| 995 | |
| 996 | utilities.assert_equals( expect=main.TRUE, |
| 997 | actual=stepResult, |
| 998 | onpass="IPV4_2: Successfully added single " |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 999 | + " point to multi point intents" + |
| 1000 | " with IPV4 type and no MAC addresses", |
| 1001 | onfail="IPV4_2: Failed to add single point" |
| 1002 | + " point to multi point intents" + |
| 1003 | " with IPV4 type and no MAC addresses" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1004 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1005 | main.step( "VLAN: Add single point to multi point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1006 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1007 | hostNames = [ 'h4', 'h12', 'h20' ] |
| 1008 | devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \ |
| 1009 | 'of:0000000000000007/4' ] |
| 1010 | macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ] |
| 1011 | stepResult = main.intentFunction.singleToMultiIntent( |
| 1012 | main, |
| 1013 | name="VLAN", |
| 1014 | hostNames=hostNames, |
| 1015 | devices=devices, |
| 1016 | ports=None, |
| 1017 | ethType="IPV4", |
| 1018 | macs=macs, |
| 1019 | bandwidth="", |
| 1020 | lambdaAlloc=False, |
| 1021 | ipProto="", |
| 1022 | ipAddresses="", |
| 1023 | tcp="", |
| 1024 | sw1="s5", |
| 1025 | sw2="s2", |
| 1026 | expectedLink=18 ) |
| 1027 | |
| 1028 | utilities.assert_equals( expect=main.TRUE, |
| 1029 | actual=stepResult, |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1030 | onpass="VLAN: Successfully added single " |
| 1031 | + " point to multi point intents" + |
| 1032 | " with IPV4 type and MAC addresses" + |
| 1033 | " in the same VLAN", |
| 1034 | onfail="VLAN: Failed to add single point" |
| 1035 | + " point to multi point intents" + |
| 1036 | " with IPV4 type and MAC addresses" + |
| 1037 | " in the same VLAN") |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1038 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1039 | def CASE4000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1040 | """ |
| 1041 | Add multi point to single point intents |
| 1042 | - Get device ids |
| 1043 | - Add multi point to single point intents |
| 1044 | - Check intents |
| 1045 | - Verify flows |
| 1046 | - Ping hosts |
| 1047 | - Reroute |
| 1048 | - Link down |
| 1049 | - Verify flows |
| 1050 | - Check topology |
| 1051 | - Ping hosts |
| 1052 | - Link up |
| 1053 | - Verify flows |
| 1054 | - Check topology |
| 1055 | - Ping hosts |
| 1056 | - Remove intents |
| 1057 | """ |
| 1058 | assert main, "There is no main" |
| 1059 | assert main.CLIs, "There is no main.CLIs" |
| 1060 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1061 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1062 | main.numSwitch" |
| 1063 | |
kelvin-onlab | 825b57d | 2015-07-24 13:43:59 -0700 | [diff] [blame] | 1064 | main.case( "Multi To Single Point Intents Test - " + |
kelvin-onlab | e5c1ada | 2015-07-24 11:49:40 -0700 | [diff] [blame] | 1065 | str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1066 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1067 | " multi point intents using " +\ |
| 1068 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1069 | "Different type of hosts will be tested in " +\ |
| 1070 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1071 | ";\nThe test will use OF " + main.OFProtocol +\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 1072 | " OVS running in Mininet" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1073 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1074 | main.step( "NOOPTION: Add multi point to single point intents" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1075 | stepResult = main.TRUE |
| 1076 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 1077 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 1078 | 'of:0000000000000007/8' ] |
| 1079 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ] |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1080 | stepResult = main.intentFunction.multiToSingleIntent( |
| 1081 | main, |
| 1082 | name="NOOPTION", |
| 1083 | hostNames=hostNames, |
| 1084 | devices=devices, |
| 1085 | sw1="s5", |
| 1086 | sw2="s2", |
| 1087 | expectedLink=18 ) |
| 1088 | |
| 1089 | utilities.assert_equals( expect=main.TRUE, |
| 1090 | actual=stepResult, |
| 1091 | onpass="NOOPTION: Successfully added multi " |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1092 | + " point to single point intents" + |
| 1093 | " with no match action", |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1094 | onfail="NOOPTION: Failed to add multi point" + |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1095 | " to single point intents" + |
| 1096 | " with no match action" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1097 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1098 | main.step( "IPV4: Add multi point to single point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1099 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1100 | stepResult = main.intentFunction.multiToSingleIntent( |
| 1101 | main, |
| 1102 | name="IPV4", |
| 1103 | hostNames=hostNames, |
| 1104 | devices=devices, |
| 1105 | ports=None, |
| 1106 | ethType="IPV4", |
| 1107 | macs=macs, |
| 1108 | bandwidth="", |
| 1109 | lambdaAlloc=False, |
| 1110 | ipProto="", |
| 1111 | ipAddresses="", |
| 1112 | tcp="", |
| 1113 | sw1="s5", |
| 1114 | sw2="s2", |
| 1115 | expectedLink=18 ) |
| 1116 | |
| 1117 | utilities.assert_equals( expect=main.TRUE, |
| 1118 | actual=stepResult, |
| 1119 | onpass="IPV4: Successfully added multi point" |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1120 | + " to single point intents" + |
| 1121 | " with IPV4 type and MAC addresses", |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1122 | onfail="IPV4: Failed to add multi point" + |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1123 | " to single point intents" + |
| 1124 | " with IPV4 type and MAC addresses" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1125 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1126 | main.step( "IPV4_2: Add multi point to single point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1127 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1128 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 1129 | stepResult = main.intentFunction.multiToSingleIntent( |
| 1130 | main, |
| 1131 | name="IPV4", |
| 1132 | hostNames=hostNames, |
| 1133 | ethType="IPV4", |
| 1134 | lambdaAlloc=False ) |
| 1135 | |
| 1136 | utilities.assert_equals( expect=main.TRUE, |
| 1137 | actual=stepResult, |
| 1138 | onpass="IPV4_2: Successfully added multi point" |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1139 | + " to single point intents" + |
| 1140 | " with IPV4 type and no MAC addresses", |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1141 | onfail="IPV4_2: Failed to add multi point" + |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1142 | " to single point intents" + |
| 1143 | " with IPV4 type and no MAC addresses" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1144 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1145 | main.step( "VLAN: Add multi point to single point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1146 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1147 | hostNames = [ 'h5', 'h13', 'h21' ] |
| 1148 | devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \ |
| 1149 | 'of:0000000000000007/5' ] |
| 1150 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ] |
| 1151 | stepResult = main.intentFunction.multiToSingleIntent( |
| 1152 | main, |
| 1153 | name="VLAN", |
| 1154 | hostNames=hostNames, |
| 1155 | devices=devices, |
| 1156 | ports=None, |
| 1157 | ethType="IPV4", |
| 1158 | macs=macs, |
| 1159 | bandwidth="", |
| 1160 | lambdaAlloc=False, |
| 1161 | ipProto="", |
| 1162 | ipAddresses="", |
| 1163 | tcp="", |
| 1164 | sw1="s5", |
| 1165 | sw2="s2", |
| 1166 | expectedLink=18 ) |
| 1167 | |
| 1168 | utilities.assert_equals( expect=main.TRUE, |
| 1169 | actual=stepResult, |
| 1170 | onpass="VLAN: Successfully added multi point" |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1171 | + " to single point intents" + |
| 1172 | " with IPV4 type and MAC addresses" + |
| 1173 | " in the same VLAN", |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1174 | onfail="VLAN: Failed to add multi point" + |
| 1175 | " to single point intents" ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1176 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1177 | def CASE5000( self, main ): |
| 1178 | """ |
| 1179 | Will add description in next patch set |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1180 | """ |
| 1181 | assert main, "There is no main" |
| 1182 | assert main.CLIs, "There is no main.CLIs" |
| 1183 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1184 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1185 | main.numSwitch" |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1186 | main.case( "Test host mobility with host intents " ) |
| 1187 | main.step( " Testing host mobility by moving h1 from s5 to s6" ) |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1188 | h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 1189 | |
| 1190 | main.log.info( "Moving h1 from s5 to s6") |
| 1191 | |
| 1192 | main.Mininet1.moveHost( "h1","s5","s6" ) |
| 1193 | |
| 1194 | main.intentFunction.getHostsData( main ) |
| 1195 | h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 1196 | |
| 1197 | utilities.assert_equals( expect="of:0000000000000006", |
| 1198 | actual=h1PostMove, |
| 1199 | onpass="Mobility: Successfully moved h1 to s6", |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1200 | onfail="Mobility: Failed to moved h1 to s6" + |
| 1201 | " to single point intents" + |
| 1202 | " with IPV4 type and MAC addresses" + |
| 1203 | " in the same VLAN" ) |
| 1204 | |
| 1205 | main.step( "IPV4: Add host intents between h1 and h9" ) |
| 1206 | stepResult = main.TRUE |
| 1207 | stepResult = main.intentFunction.hostIntent( main, |
| 1208 | onosNode='0', |
| 1209 | name='IPV4', |
| 1210 | host1='h1', |
| 1211 | host2='h9', |
| 1212 | host1Id='00:00:00:00:00:01/-1', |
| 1213 | host2Id='00:00:00:00:00:09/-1' ) |
| 1214 | |
| 1215 | utilities.assert_equals( expect=main.TRUE, |
| 1216 | actual=stepResult, |
| 1217 | onpass="IPV4: Host intent test successful " + |
| 1218 | "between two IPV4 hosts", |
| 1219 | onfail="IPV4: Host intent test failed " + |
| 1220 | "between two IPV4 hosts") |