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