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