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