GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 1 | class FUNCflow: |
| 2 | |
| 3 | def __init__( self ): |
| 4 | self.default = '' |
| 5 | |
| 6 | def CASE1( self, main ): |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 7 | import os |
| 8 | import imp |
| 9 | |
| 10 | """ |
| 11 | - Construct tests variables |
| 12 | - GIT ( optional ) |
| 13 | - Checkout ONOS master branch |
| 14 | - Pull latest ONOS code |
| 15 | - Building ONOS ( optional ) |
| 16 | - Install ONOS package |
| 17 | - Build ONOS package |
| 18 | """ |
| 19 | |
| 20 | main.case( "Constructing test variables and building ONOS package" ) |
| 21 | main.step( "Constructing test variables" ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 22 | |
| 23 | # Test variables |
| 24 | main.testOnDirectory = os.path.dirname( os.getcwd ( ) ) |
| 25 | main.cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 26 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 27 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 28 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
| 29 | main.ONOSport = main.params[ 'CTRL' ][ 'port' ] |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 30 | main.dependencyPath = main.testOnDirectory + \ |
| 31 | main.params[ 'DEPENDENCY' ][ 'path' ] |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 32 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 33 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 34 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 35 | main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 36 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 37 | main.startMNSleep = int( main.params[ 'SLEEP' ][ 'startMN' ] ) |
| 38 | main.addFlowSleep = int( main.params[ 'SLEEP' ][ 'addFlow' ] ) |
| 39 | main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 40 | main.debug = main.params[ 'DEBUG' ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 41 | main.swDPID = main.params[ 'TEST' ][ 'swDPID' ] |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 42 | main.cellData = { } # for creating cell file |
| 43 | main.CLIs = [ ] |
| 44 | main.ONOSip = [ ] |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 45 | |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 46 | main.debug = True if "on" in main.debug else False |
| 47 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 48 | main.ONOSip = main.ONOSbench.getOnosIps( ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 49 | |
| 50 | # Assigning ONOS cli handles to a list |
| 51 | for i in range( 1, main.maxNodes + 1 ): |
| 52 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 53 | |
| 54 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 55 | main.startUp = imp.load_source( wrapperFile1, |
| 56 | main.dependencyPath + |
| 57 | wrapperFile1 + |
| 58 | ".py" ) |
| 59 | |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 60 | main.topo = imp.load_source( wrapperFile2, |
| 61 | main.dependencyPath + |
| 62 | wrapperFile2 + |
| 63 | ".py" ) |
| 64 | |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 65 | |
GlennRC | 94ed223 | 2015-10-07 15:08:57 -0700 | [diff] [blame] | 66 | copyResult = main.ONOSbench.scp( main.Mininet1, |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 67 | main.dependencyPath + main.topology, |
| 68 | main.Mininet1.home + '/custom/', |
GlennRC | 94ed223 | 2015-10-07 15:08:57 -0700 | [diff] [blame] | 69 | direction="to" ) |
| 70 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 71 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 72 | actual=copyResult, |
| 73 | onpass="Successfully copy " + "test variables ", |
| 74 | onfail="Failed to copy test variables" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 75 | |
| 76 | |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 77 | if main.CLIs: |
| 78 | stepResult = main.TRUE |
| 79 | else: |
| 80 | main.log.error( "Did not properly created list of ONOS CLI handle" ) |
| 81 | stepResult = main.FALSE |
| 82 | |
| 83 | utilities.assert_equals( expect=main.TRUE, |
| 84 | actual=stepResult, |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 85 | onpass="Successfully construct " + "test variables ", |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 86 | onfail="Failed to construct test variables" ) |
| 87 | |
| 88 | if gitPull == 'True': |
| 89 | main.step( "Building ONOS in " + gitBranch + " branch" ) |
| 90 | onosBuildResult = main.startUp.onosBuild( main, gitBranch ) |
| 91 | stepResult = onosBuildResult |
| 92 | utilities.assert_equals( expect=main.TRUE, |
| 93 | actual=stepResult, |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 94 | onpass="Successfully compiled " + "latest ONOS", |
| 95 | onfail="Failed to compile " + "latest ONOS" ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 96 | else: |
| 97 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 98 | "clean install" ) |
| 99 | |
| 100 | def CASE2( self, main ): |
| 101 | """ |
| 102 | - Set up cell |
| 103 | - Create cell file |
| 104 | - Set cell file |
| 105 | - Verify cell file |
| 106 | - Kill ONOS process |
| 107 | - Uninstall ONOS cluster |
| 108 | - Verify ONOS start up |
| 109 | - Install ONOS cluster |
| 110 | - Connect to cli |
| 111 | """ |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 112 | import time |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 113 | |
| 114 | main.numCtrls = int( main.maxNodes ) |
| 115 | |
| 116 | main.case( "Starting up " + str( main.numCtrls ) + |
| 117 | " node(s) ONOS cluster" ) |
| 118 | |
| 119 | #kill off all onos processes |
| 120 | main.log.info( "Safety check, killing all ONOS processes" + |
Jon Hall | 70b2ff4 | 2015-11-17 15:49:44 -0800 | [diff] [blame] | 121 | " before initiating environment setup" ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 122 | |
| 123 | for i in range( main.maxNodes ): |
| 124 | main.ONOSbench.onosDie( main.ONOSip[ i ] ) |
| 125 | |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 126 | main.log.info( "NODE COUNT = " + str( main.numCtrls ) ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 127 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 128 | tempOnosIp = [ ] |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 129 | for i in range( main.numCtrls ): |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 130 | tempOnosIp.append( main.ONOSip[ i ] ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 131 | |
Jon Hall | 53c5e66 | 2016-04-13 16:06:56 -0700 | [diff] [blame] | 132 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, |
| 133 | "temp", |
| 134 | main.Mininet1.ip_address, |
| 135 | main.apps, |
| 136 | tempOnosIp ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 137 | |
| 138 | main.step( "Apply cell to environment" ) |
| 139 | cellResult = main.ONOSbench.setCell( "temp" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 140 | verifyResult = main.ONOSbench.verifyCell( ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 141 | stepResult = cellResult and verifyResult |
| 142 | utilities.assert_equals( expect=main.TRUE, |
| 143 | actual=stepResult, |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 144 | onpass="Successfully applied cell to " + "environment", |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 145 | onfail="Failed to apply cell to environment " ) |
| 146 | |
| 147 | main.step( "Creating ONOS package" ) |
Jon Hall | bd60ea0 | 2016-08-23 10:03:59 -0700 | [diff] [blame] | 148 | packageResult = main.ONOSbench.buckBuild() |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 149 | stepResult = packageResult |
| 150 | utilities.assert_equals( expect=main.TRUE, |
| 151 | actual=stepResult, |
| 152 | onpass="Successfully created ONOS package", |
| 153 | onfail="Failed to create ONOS package" ) |
| 154 | |
| 155 | time.sleep( main.startUpSleep ) |
| 156 | main.step( "Uninstalling ONOS package" ) |
| 157 | onosUninstallResult = main.TRUE |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 158 | for ip in main.ONOSip: |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 159 | onosUninstallResult = onosUninstallResult and \ |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 160 | main.ONOSbench.onosUninstall( nodeIp=ip ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 161 | stepResult = onosUninstallResult |
| 162 | utilities.assert_equals( expect=main.TRUE, |
| 163 | actual=stepResult, |
| 164 | onpass="Successfully uninstalled ONOS package", |
| 165 | onfail="Failed to uninstall ONOS package" ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 166 | time.sleep( main.startUpSleep ) |
| 167 | main.step( "Installing ONOS package" ) |
| 168 | onosInstallResult = main.TRUE |
| 169 | for i in range( main.numCtrls ): |
| 170 | onosInstallResult = onosInstallResult and \ |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 171 | main.ONOSbench.onosInstall( node=main.ONOSip[ i ] ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 172 | stepResult = onosInstallResult |
| 173 | utilities.assert_equals( expect=main.TRUE, |
| 174 | actual=stepResult, |
| 175 | onpass="Successfully installed ONOS package", |
| 176 | onfail="Failed to install ONOS package" ) |
| 177 | |
| 178 | time.sleep( main.startUpSleep ) |
| 179 | main.step( "Starting ONOS service" ) |
| 180 | stopResult = main.TRUE |
| 181 | startResult = main.TRUE |
| 182 | onosIsUp = main.TRUE |
| 183 | |
| 184 | for i in range( main.numCtrls ): |
| 185 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 186 | if onosIsUp == main.TRUE: |
| 187 | main.log.report( "ONOS instance is up and ready" ) |
| 188 | else: |
| 189 | main.log.report( "ONOS instance may not be up, stop and " + |
| 190 | "start ONOS again " ) |
| 191 | for i in range( main.numCtrls ): |
| 192 | stopResult = stopResult and \ |
| 193 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 194 | for i in range( main.numCtrls ): |
| 195 | startResult = startResult and \ |
| 196 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 197 | stepResult = onosIsUp and stopResult and startResult |
| 198 | utilities.assert_equals( expect=main.TRUE, |
| 199 | actual=stepResult, |
| 200 | onpass="ONOS service is ready", |
| 201 | onfail="ONOS service did not start properly" ) |
| 202 | |
Chiyu Cheng | ef10950 | 2016-11-21 15:51:38 -0800 | [diff] [blame^] | 203 | main.step( "Set up ONOS secure SSH" ) |
| 204 | secureSshResult = main.TRUE |
| 205 | for i in range( int( main.numCtrls ) ): |
| 206 | secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] ) |
| 207 | utilities.assert_equals( expect=main.TRUE, actual=secureSshResult, |
| 208 | onpass="Test step PASS", |
| 209 | onfail="Test step FAIL" ) |
| 210 | |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 211 | main.step( "Start ONOS cli" ) |
| 212 | cliResult = main.TRUE |
| 213 | for i in range( main.numCtrls ): |
| 214 | cliResult = cliResult and \ |
| 215 | main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] ) |
| 216 | stepResult = cliResult |
| 217 | utilities.assert_equals( expect=main.TRUE, |
| 218 | actual=stepResult, |
| 219 | onpass="Successfully start ONOS cli", |
| 220 | onfail="Failed to start ONOS cli" ) |
| 221 | |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 222 | def CASE10( self, main ): |
| 223 | ''' |
| 224 | Start Mininet |
| 225 | ''' |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 226 | import json |
| 227 | |
| 228 | main.case( "Setup mininet and compare ONOS topology view to Mininet topology" ) |
| 229 | main.caseExplanation = "Start mininet with custom topology and compare topology " +\ |
| 230 | "elements between Mininet and ONOS" |
| 231 | |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 232 | main.step( "Setup Mininet Topology" ) |
| 233 | topology = main.Mininet1.home + '/custom/' + main.topology |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 234 | stepResult = main.Mininet1.startNet( topoFile = topology ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 235 | |
| 236 | utilities.assert_equals( expect=main.TRUE, |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 237 | actual=stepResult, |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 238 | onpass="Successfully loaded topology", |
| 239 | onfail="Failed to load topology" ) |
| 240 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 241 | main.step( "Assign switch to controller" ) |
| 242 | stepResult = main.Mininet1.assignSwController( "s1", main.ONOSip[0] ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 243 | |
| 244 | utilities.assert_equals( expect=main.TRUE, |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 245 | actual=stepResult, |
| 246 | onpass="Successfully assigned switch to controller", |
| 247 | onfail="Failed to assign switch to controller" ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 248 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 249 | time.sleep( main.startMNSleep ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 250 | |
Jon Hall | 70b2ff4 | 2015-11-17 15:49:44 -0800 | [diff] [blame] | 251 | main.step( "Comparing MN topology to ONOS topology" ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 252 | main.log.info( "Gathering topology information" ) |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 253 | devices = main.topo.getAllDevices( main ) |
| 254 | hosts = main.topo.getAllHosts( main ) |
| 255 | ports = main.topo.getAllPorts( main ) |
| 256 | links = main.topo.getAllLinks( main ) |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 257 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 258 | mnSwitches = main.Mininet1.getSwitches( ) |
| 259 | mnLinks = main.Mininet1.getLinks( ) |
| 260 | mnHosts = main.Mininet1.getHosts( ) |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 261 | |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 262 | for controller in range( main.numCtrls ): |
| 263 | controllerStr = str( controller + 1 ) |
| 264 | if devices[ controller ] and ports[ controller ] and\ |
| 265 | "Error" not in devices[ controller ] and\ |
| 266 | "Error" not in ports[ controller ]: |
| 267 | |
| 268 | currentDevicesResult = main.Mininet1.compareSwitches( |
| 269 | mnSwitches, |
| 270 | json.loads( devices[ controller ] ), |
| 271 | json.loads( ports[ controller ] ) ) |
| 272 | else: |
| 273 | currentDevicesResult = main.FALSE |
| 274 | utilities.assert_equals( expect=main.TRUE, |
| 275 | actual=currentDevicesResult, |
| 276 | onpass="ONOS" + controllerStr + |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 277 | " Switches view is correct", |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 278 | onfail="ONOS" + controllerStr + |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 279 | " Switches view is incorrect" ) |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 280 | if links[ controller ] and "Error" not in links[ controller ]: |
| 281 | currentLinksResult = main.Mininet1.compareLinks( |
| 282 | mnSwitches, mnLinks, |
| 283 | json.loads( links[ controller ] ) ) |
| 284 | else: |
| 285 | currentLinksResult = main.FALSE |
| 286 | utilities.assert_equals( expect=main.TRUE, |
| 287 | actual=currentLinksResult, |
| 288 | onpass="ONOS" + controllerStr + |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 289 | " links view is correct", |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 290 | onfail="ONOS" + controllerStr + |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 291 | " links view is incorrect" ) |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 292 | |
| 293 | if hosts[ controller ] or "Error" not in hosts[ controller ]: |
| 294 | currentHostsResult = main.Mininet1.compareHosts( |
| 295 | mnHosts, |
| 296 | json.loads( hosts[ controller ] ) ) |
| 297 | else: |
| 298 | currentHostsResult = main.FALSE |
| 299 | utilities.assert_equals( expect=main.TRUE, |
| 300 | actual=currentHostsResult, |
| 301 | onpass="ONOS" + controllerStr + |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 302 | " hosts exist in Mininet", |
GlennRC | 1704d07 | 2015-10-07 18:40:45 -0700 | [diff] [blame] | 303 | onfail="ONOS" + controllerStr + |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 304 | " hosts don't match Mininet") |
GlennRC | a539137 | 2015-10-14 17:28:15 -0700 | [diff] [blame] | 305 | |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 306 | |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 307 | def CASE66( self, main ): |
| 308 | ''' |
| 309 | Testing scapy |
| 310 | ''' |
| 311 | main.case( "Testing scapy" ) |
| 312 | main.step( "Creating Host1 component" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 313 | main.Scapy.createHostComponent( "h1" ) |
| 314 | main.Scapy.createHostComponent( "h2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 315 | hosts = [ main.h1, main.h2 ] |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 316 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 317 | host.startHostCli( ) |
| 318 | host.startScapy( ) |
| 319 | host.updateSelf( ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 320 | main.log.debug( host.name ) |
| 321 | main.log.debug( host.hostIp ) |
| 322 | main.log.debug( host.hostMac ) |
| 323 | |
| 324 | main.step( "Sending/Receiving Test packet - Filter doesn't match" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 325 | main.log.info( "Starting Filter..." ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 326 | main.h2.startFilter( ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 327 | main.log.info( "Building Ether frame..." ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 328 | main.h1.buildEther( dst=main.h2.hostMac ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 329 | main.log.info( "Sending Packet..." ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 330 | main.h1.sendPacket( ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 331 | main.log.info( "Checking Filter..." ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 332 | finished = main.h2.checkFilter( ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 333 | main.log.debug( finished ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 334 | i = "" |
| 335 | if finished: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 336 | a = main.h2.readPackets( ) |
| 337 | for i in a.splitlines( ): |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 338 | main.log.info( i ) |
| 339 | else: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 340 | kill = main.h2.killFilter( ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 341 | main.log.debug( kill ) |
| 342 | main.h2.handle.sendline( "" ) |
| 343 | main.h2.handle.expect( main.h2.scapyPrompt ) |
| 344 | main.log.debug( main.h2.handle.before ) |
| 345 | utilities.assert_equals( expect=True, |
| 346 | actual="dst=00:00:00:00:00:02 src=00:00:00:00:00:01" in i, |
| 347 | onpass="Pass", |
| 348 | onfail="Fail" ) |
| 349 | |
| 350 | main.step( "Sending/Receiving Test packet - Filter matches" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 351 | main.h2.startFilter( ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 352 | main.h1.buildEther( dst=main.h2.hostMac ) |
| 353 | main.h1.buildIP( dst=main.h2.hostIp ) |
| 354 | main.h1.sendPacket( ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 355 | finished = main.h2.checkFilter( ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 356 | i = "" |
| 357 | if finished: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 358 | a = main.h2.readPackets( ) |
| 359 | for i in a.splitlines( ): |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 360 | main.log.info( i ) |
| 361 | else: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 362 | kill = main.h2.killFilter( ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 363 | main.log.debug( kill ) |
| 364 | main.h2.handle.sendline( "" ) |
| 365 | main.h2.handle.expect( main.h2.scapyPrompt ) |
| 366 | main.log.debug( main.h2.handle.before ) |
| 367 | utilities.assert_equals( expect=True, |
| 368 | actual="dst=00:00:00:00:00:02 src=00:00:00:00:00:01" in i, |
| 369 | onpass="Pass", |
| 370 | onfail="Fail" ) |
| 371 | |
| 372 | |
| 373 | |
| 374 | main.step( "Clean up host components" ) |
| 375 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 376 | host.stopScapy( ) |
| 377 | main.Mininet1.removeHostComponent( "h1" ) |
| 378 | main.Mininet1.removeHostComponent( "h2" ) |
Jon Hall | 892818c | 2015-10-20 17:58:34 -0700 | [diff] [blame] | 379 | |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 380 | def CASE1000( self, main ): |
| 381 | ''' |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 382 | Add flows with MAC selectors and verify the flows |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 383 | ''' |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 384 | import json |
| 385 | import time |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 386 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 387 | main.case( "Verify flow MAC selectors are correctly compiled" ) |
| 388 | main.caseExplanation = "Install two flows with only MAC selectors " +\ |
| 389 | "specified, then verify flows are added in ONOS, finally "+\ |
| 390 | "send a packet that only specifies the MAC src and dst." |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 391 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 392 | main.step( "Add flows with MAC addresses as the only selectors" ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 393 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 394 | main.log.info( "Creating host components" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 395 | main.Scapy.createHostComponent( "h1" ) |
| 396 | main.Scapy.createHostComponent( "h2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 397 | hosts = [ main.h1, main.h2 ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 398 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 399 | host.startHostCli( ) |
| 400 | host.startScapy( ) |
| 401 | host.updateSelf( ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 402 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 403 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 404 | # send output on port2 |
| 405 | # recieve input on port1 |
| 406 | egress = 2 |
| 407 | ingress = 1 |
| 408 | |
| 409 | # Add flows that sends packets from port1 to port2 with correct |
| 410 | # MAC src and dst addresses |
| 411 | main.log.info( "Adding flow with MAC selectors" ) |
| 412 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 413 | egressPort=egress, |
| 414 | ingressPort=ingress, |
| 415 | ethSrc=main.h1.hostMac, |
| 416 | ethDst=main.h2.hostMac, |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 417 | debug=main.debug ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 418 | |
GlennRC | a539137 | 2015-10-14 17:28:15 -0700 | [diff] [blame] | 419 | utilities.assert_equals( expect=main.TRUE, |
| 420 | actual=stepResult, |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 421 | onpass="Successfully added flows", |
| 422 | onfail="Failed add flows" ) |
GlennRC | a539137 | 2015-10-14 17:28:15 -0700 | [diff] [blame] | 423 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 424 | # Giving ONOS time to add the flows |
| 425 | time.sleep( main.addFlowSleep ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 426 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 427 | main.step( "Check flows are in the ADDED state" ) |
| 428 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 429 | main.log.info( "Get the flows from ONOS" ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 430 | try: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 431 | flows = json.loads( main.ONOSrest.flows( ) ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 432 | |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 433 | stepResult = main.TRUE |
| 434 | for f in flows: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 435 | if "rest" in f.get( "appId" ): |
| 436 | if "ADDED" not in f.get( "state" ): |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 437 | stepResult = main.FALSE |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 438 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 439 | except TypeError: |
| 440 | main.log.error( "No Flows found by the REST API" ) |
| 441 | stepResult = main.FALSE |
| 442 | except ValueError: |
| 443 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 444 | main.cleanup( ) |
| 445 | main.exit( ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 446 | |
| 447 | utilities.assert_equals( expect=main.TRUE, |
| 448 | actual=stepResult, |
| 449 | onpass="All flows are in the ADDED state", |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 450 | onfail="All flows are NOT in the ADDED state" ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 451 | |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 452 | main.step( "Check flows are in Mininet's flow table" ) |
| 453 | |
| 454 | # get the flow IDs that were added through rest |
| 455 | main.log.info( "Getting the flow IDs from ONOS" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 456 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 457 | # convert the flowIDs to ints then hex and finally back to strings |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 458 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 459 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 460 | |
| 461 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 462 | |
| 463 | utilities.assert_equals( expect=main.TRUE, |
| 464 | actual=stepResult, |
| 465 | onpass="All flows are in mininet", |
| 466 | onfail="All flows are NOT in mininet" ) |
| 467 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 468 | main.step( "Send a packet to verify the flows are correct" ) |
| 469 | |
| 470 | # Specify the src and dst MAC addr |
| 471 | main.log.info( "Constructing packet" ) |
| 472 | main.h1.buildEther( src=main.h1.hostMac, dst=main.h2.hostMac ) |
| 473 | |
| 474 | # Filter for packets with the correct host name. Otherwise, |
| 475 | # the filter we catch any packet that is sent to host2 |
| 476 | # NOTE: I believe it doesn't matter which host name it is, |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 477 | # as long as the src and dst are both specified |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 478 | main.log.info( "Starting filter on host2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 479 | main.h2.startFilter( pktFilter="ether host %s" % main.h1.hostMac ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 480 | |
| 481 | main.log.info( "Sending packet to host2" ) |
| 482 | main.h1.sendPacket() |
| 483 | |
| 484 | main.log.info( "Checking filter for our packet" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 485 | stepResult = main.h2.checkFilter( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 486 | if stepResult: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 487 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 488 | else: |
| 489 | main.h2.killFilter( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 490 | |
| 491 | main.log.info( "Clean up host components" ) |
| 492 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 493 | host.stopScapy( ) |
| 494 | main.Mininet1.removeHostComponent( "h1" ) |
| 495 | main.Mininet1.removeHostComponent( "h2" ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 496 | |
| 497 | utilities.assert_equals( expect=main.TRUE, |
| 498 | actual=stepResult, |
| 499 | onpass="Successfully sent a packet", |
| 500 | onfail="Failed to send a packet" ) |
| 501 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 502 | def CASE1400( self, main ): |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 503 | ''' |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 504 | Add flows with IPv4 selectors and verify the flows |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 505 | ''' |
| 506 | import json |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 507 | import time |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 508 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 509 | main.case( "Verify flow IP selectors are correctly compiled" ) |
| 510 | main.caseExplanation = "Install two flows with only IP selectors " +\ |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 511 | "specified, then verify flows are added in ONOS, finally " +\ |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 512 | "send a packet that only specifies the IP src and dst." |
| 513 | |
| 514 | main.step( "Add flows with IPv4 addresses as the only selectors" ) |
| 515 | |
| 516 | main.log.info( "Creating host components" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 517 | main.Scapy.createHostComponent( "h1" ) |
| 518 | main.Scapy.createHostComponent( "h2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 519 | hosts = [ main.h1, main.h2 ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 520 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 521 | host.startHostCli( ) |
| 522 | host.startScapy( ) |
| 523 | host.updateSelf( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 524 | |
| 525 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 526 | # send output on port2 |
| 527 | # recieve input on port1 |
| 528 | egress = 2 |
| 529 | ingress = 1 |
| 530 | # IPv4 etherType = 0x800 |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 531 | ethType = main.params[ 'TEST' ][ 'ip4Type' ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 532 | |
| 533 | # Add flows that connects host1 to host2 |
| 534 | main.log.info( "Add flow with port ingress 1 to port egress 2" ) |
| 535 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 536 | egressPort=egress, |
| 537 | ingressPort=ingress, |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 538 | ethType=ethType, |
| 539 | ipSrc=( "IPV4_SRC", main.h1.hostIp+"/32" ), |
| 540 | ipDst=( "IPV4_DST", main.h2.hostIp+"/32" ), |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 541 | debug=main.debug ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 542 | |
| 543 | utilities.assert_equals( expect=main.TRUE, |
| 544 | actual=stepResult, |
| 545 | onpass="Successfully added flows", |
| 546 | onfail="Failed add flows" ) |
| 547 | |
| 548 | # Giving ONOS time to add the flow |
| 549 | time.sleep( main.addFlowSleep ) |
| 550 | |
| 551 | main.step( "Check flow is in the ADDED state" ) |
| 552 | |
| 553 | main.log.info( "Get the flows from ONOS" ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 554 | try: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 555 | flows = json.loads( main.ONOSrest.flows( ) ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 556 | |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 557 | stepResult = main.TRUE |
| 558 | for f in flows: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 559 | if "rest" in f.get( "appId" ): |
| 560 | if "ADDED" not in f.get( "state" ): |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 561 | stepResult = main.FALSE |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 562 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 563 | except TypeError: |
| 564 | main.log.error( "No Flows found by the REST API" ) |
| 565 | stepResult = main.FALSE |
| 566 | except ValueError: |
| 567 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 568 | main.cleanup( ) |
| 569 | main.exit( ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 570 | |
| 571 | utilities.assert_equals( expect=main.TRUE, |
| 572 | actual=stepResult, |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 573 | onpass="All flows are in the ADDED state", |
| 574 | onfail="All flows are NOT in the ADDED state" ) |
| 575 | |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 576 | main.step( "Check flows are in Mininet's flow table" ) |
| 577 | |
| 578 | # get the flow IDs that were added through rest |
| 579 | main.log.info( "Getting the flow IDs from ONOS" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 580 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 581 | # convert the flowIDs to ints then hex and finally back to strings |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 582 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 583 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 584 | |
| 585 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 586 | |
| 587 | utilities.assert_equals( expect=main.TRUE, |
| 588 | actual=stepResult, |
| 589 | onpass="All flows are in mininet", |
| 590 | onfail="All flows are NOT in mininet" ) |
| 591 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 592 | main.step( "Send a packet to verify the flow is correct" ) |
| 593 | |
| 594 | main.log.info( "Constructing packet" ) |
| 595 | # No need for the MAC src dst |
| 596 | main.h1.buildEther( dst=main.h2.hostMac ) |
| 597 | main.h1.buildIP( src=main.h1.hostIp, dst=main.h2.hostIp ) |
| 598 | |
| 599 | main.log.info( "Starting filter on host2" ) |
| 600 | # Defaults to ip |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 601 | main.h2.startFilter( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 602 | |
| 603 | main.log.info( "Sending packet to host2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 604 | main.h1.sendPacket( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 605 | |
| 606 | main.log.info( "Checking filter for our packet" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 607 | stepResult = main.h2.checkFilter( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 608 | if stepResult: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 609 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 610 | else: main.h2.killFilter( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 611 | |
| 612 | main.log.info( "Clean up host components" ) |
| 613 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 614 | host.stopScapy( ) |
| 615 | main.Mininet1.removeHostComponent( "h1" ) |
| 616 | main.Mininet1.removeHostComponent( "h2" ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 617 | |
| 618 | utilities.assert_equals( expect=main.TRUE, |
| 619 | actual=stepResult, |
| 620 | onpass="Successfully sent a packet", |
| 621 | onfail="Failed to send a packet" ) |
| 622 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 623 | def CASE1500 (self, main ): |
| 624 | """ |
| 625 | Add flow with IPv6 selector and verify the flow |
| 626 | """ |
| 627 | import json |
| 628 | import time |
| 629 | main.case( "Verify IPv6 selector is correctly compiled" ) |
| 630 | main.caseExplanation = "Install two flows with only IP selectors " + \ |
| 631 | "specified, then verify flows are added in ONOS, finally " + \ |
| 632 | "send a packet that only specifies the IP src and dst." |
| 633 | |
| 634 | main.step( "Add flows with IPv6 addresses as the only selectors" ) |
| 635 | |
| 636 | main.log.info( "Creating host components" ) |
| 637 | main.Scapy.createHostComponent( "h5" ) |
| 638 | main.Scapy.createHostComponent( "h6" ) |
| 639 | hosts = [ main.h5, main.h6 ] |
| 640 | |
| 641 | for host in hosts: |
| 642 | host.startHostCli( ) |
| 643 | host.startScapy( ) |
| 644 | host.updateSelf( IPv6=True ) |
| 645 | |
| 646 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 647 | # send output on port2 |
| 648 | # recieve input on port1 |
| 649 | egress = 6 |
| 650 | ingress = 5 |
| 651 | # IPv6 etherType = 0x86DD |
| 652 | ethType = main.params[ 'TEST' ][ 'ip6Type' ] |
| 653 | |
| 654 | # Add flows that connects host1 to host2 |
| 655 | main.log.info( "Add flow with port ingress 5 to port egress 6" ) |
| 656 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 657 | egressPort=egress, |
| 658 | ingressPort=ingress, |
| 659 | ethType=ethType, |
| 660 | ipSrc=( "IPV6_SRC", main.h5.hostIp + "/128" ), |
| 661 | ipDst=( "IPV6_DST", main.h6.hostIp + "/128" ), |
| 662 | debug=main.debug ) |
| 663 | |
| 664 | utilities.assert_equals( expect=main.TRUE, |
| 665 | actual=stepResult, |
| 666 | onpass="Successfully added flows", |
| 667 | onfail="Failed add flows" ) |
| 668 | |
| 669 | # Giving ONOS time to add the flow |
| 670 | time.sleep( main.addFlowSleep ) |
| 671 | |
| 672 | main.step( "Check flow is in the ADDED state" ) |
| 673 | |
| 674 | main.log.info( "Get the flows from ONOS" ) |
| 675 | try: |
| 676 | flows = json.loads( main.ONOSrest.flows( ) ) |
| 677 | |
| 678 | stepResult = main.TRUE |
| 679 | for f in flows: |
| 680 | if "rest" in f.get( "appId" ): |
| 681 | if "ADDED" not in f.get( "state" ): |
| 682 | stepResult = main.FALSE |
| 683 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
| 684 | except TypeError: |
| 685 | main.log.error( "No Flows found by the REST API" ) |
| 686 | stepResult = main.FALSE |
| 687 | except ValueError: |
| 688 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
| 689 | main.cleanup( ) |
| 690 | main.exit( ) |
| 691 | |
| 692 | utilities.assert_equals( expect=main.TRUE, |
| 693 | actual=stepResult, |
| 694 | onpass="All flows are in the ADDED state", |
| 695 | onfail="All flows are NOT in the ADDED state" ) |
| 696 | |
| 697 | main.step( "Check flows are in Mininet's flow table" ) |
| 698 | |
| 699 | # get the flow IDs that were added through rest |
| 700 | main.log.info( "Getting the flow IDs from ONOS" ) |
| 701 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
| 702 | # convert the flowIDs to ints then hex and finally back to strings |
| 703 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 704 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
| 705 | |
| 706 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 707 | |
| 708 | utilities.assert_equals( expect=main.TRUE, |
| 709 | actual=stepResult, |
| 710 | onpass="All flows are in mininet", |
| 711 | onfail="All flows are NOT in mininet" ) |
| 712 | |
| 713 | main.step( "Send a packet to verify the flow is correct" ) |
| 714 | |
| 715 | main.log.info( "Constructing packet" ) |
| 716 | # No need for the MAC src dst |
| 717 | main.h5.buildEther( dst=main.h6.hostMac ) |
| 718 | main.h5.buildIPv6( src=main.h5.hostIp, dst=main.h6.hostIp ) |
| 719 | |
| 720 | main.log.info( "Starting filter on host6" ) |
| 721 | # Defaults to ip |
| 722 | main.h6.startFilter( pktFilter="ip6" ) |
| 723 | main.log.info( "Sending packet to host6" ) |
| 724 | main.h5.sendPacket( ) |
| 725 | |
| 726 | main.log.info( "Checking filter for our packet" ) |
| 727 | stepResult = main.h6.checkFilter( ) |
| 728 | if stepResult: |
| 729 | main.log.info( "Packet: %s" % main.h6.readPackets( ) ) |
| 730 | else: |
| 731 | main.h6.killFilter( ) |
| 732 | |
| 733 | main.log.info( "Clean up host components" ) |
| 734 | for host in hosts: |
| 735 | host.stopScapy( ) |
| 736 | main.Mininet1.removeHostComponent( "h5" ) |
| 737 | main.Mininet1.removeHostComponent( "h6" ) |
| 738 | |
| 739 | utilities.assert_equals( expect=main.TRUE, |
| 740 | actual=stepResult, |
| 741 | onpass="Successfully sent a packet", |
| 742 | onfail="Failed to send a packet" ) |
| 743 | |
| 744 | |
| 745 | def CASE1100( self, main ): |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 746 | ''' |
| 747 | Add flow with VLAN selector and verify the flow |
| 748 | ''' |
| 749 | import json |
| 750 | import time |
| 751 | |
| 752 | main.case( "Verify VLAN selector is correctly compiled" ) |
| 753 | main.caseExplanation = "Install one flow with only the VLAN selector " +\ |
| 754 | "specified, then verify the flow is added in ONOS, and finally "+\ |
| 755 | "broadcast a packet with the correct VLAN tag." |
| 756 | |
| 757 | # We do this here to utilize the hosts information |
| 758 | main.log.info( "Creating host components" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 759 | main.Scapy.createHostComponent( "h3" ) |
| 760 | main.Scapy.createHostComponent( "h4" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 761 | hosts = [ main.h3, main.h4 ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 762 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 763 | host.startHostCli( ) |
| 764 | host.startScapy( ) |
| 765 | host.updateSelf( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 766 | |
| 767 | |
| 768 | main.step( "Add a flow with the VLAN tag as the only selector" ) |
| 769 | |
| 770 | # Add flows that connects the two vlan hosts h3 and h4 |
| 771 | # Host 3 is on port 3 and host 4 is on port 4 |
| 772 | vlan = main.params[ 'TEST' ][ 'vlan' ] |
| 773 | egress = 4 |
| 774 | ingress = 3 |
| 775 | # VLAN ethType = 0x8100 |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 776 | ethType = main.params[ 'TEST' ][ 'vlanType' ] |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 777 | |
| 778 | # Add only one flow because we don't need a response |
| 779 | main.log.info( "Add flow with port ingress 1 to port egress 2" ) |
| 780 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 781 | egressPort=egress, |
| 782 | ingressPort=ingress, |
| 783 | ethType=ethType, |
| 784 | vlan=vlan, |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 785 | debug=main.debug ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 786 | |
| 787 | |
| 788 | utilities.assert_equals( expect=main.TRUE, |
| 789 | actual=stepResult, |
| 790 | onpass="Successfully added flow", |
| 791 | onfail="Failed add flows" ) |
| 792 | |
| 793 | # Giving ONOS time to add the flows |
| 794 | time.sleep( main.addFlowSleep ) |
| 795 | |
| 796 | main.step( "Check flows are in the ADDED state" ) |
| 797 | |
| 798 | main.log.info( "Get the flows from ONOS" ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 799 | try: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 800 | flows = json.loads( main.ONOSrest.flows( ) ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 801 | |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 802 | stepResult = main.TRUE |
| 803 | for f in flows: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 804 | if "rest" in f.get( "appId" ): |
| 805 | if "ADDED" not in f.get( "state" ): |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 806 | stepResult = main.FALSE |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 807 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 808 | except TypeError: |
| 809 | main.log.error( "No Flows found by the REST API" ) |
| 810 | stepResult = main.FALSE |
| 811 | except ValueError: |
| 812 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 813 | main.cleanup( ) |
| 814 | main.exit( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 815 | |
| 816 | utilities.assert_equals( expect=main.TRUE, |
| 817 | actual=stepResult, |
| 818 | onpass="All flows are in the ADDED state", |
| 819 | onfail="All flows are NOT in the ADDED state" ) |
| 820 | |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 821 | main.step( "Check flows are in Mininet's flow table" ) |
| 822 | |
| 823 | # get the flow IDs that were added through rest |
| 824 | main.log.info( "Getting the flow IDs from ONOS" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 825 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 826 | # convert the flowIDs to ints then hex and finally back to strings |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 827 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 828 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 829 | |
| 830 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 831 | |
| 832 | utilities.assert_equals( expect=main.TRUE, |
| 833 | actual=stepResult, |
| 834 | onpass="All flows are in mininet", |
| 835 | onfail="All flows are NOT in mininet" ) |
| 836 | |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 837 | main.step( "Send a packet to verify the flow are correct" ) |
| 838 | |
| 839 | # The receiving interface |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 840 | recIface = "{}-eth0.{}".format( main.h4.name, vlan ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 841 | main.log.info( "Starting filter on host2" ) |
| 842 | # Filter is setup to catch any packet on the vlan interface with the correct vlan tag |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 843 | main.h4.startFilter( ifaceName=recIface, pktFilter = "" ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 844 | |
| 845 | # Broadcast the packet on the vlan interface. We only care if the flow forwards |
| 846 | # the packet with the correct vlan tag, not if the mac addr is correct |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 847 | sendIface = "{}-eth0.{}".format( main.h3.name, vlan ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 848 | main.log.info( "Broadcasting the packet with a vlan tag" ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 849 | main.h3.sendPacket( iface=sendIface, |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 850 | packet="Ether()/Dot1Q(vlan={})".format( vlan ) ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 851 | |
| 852 | main.log.info( "Checking filter for our packet" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 853 | stepResult = main.h4.checkFilter( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 854 | if stepResult: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 855 | main.log.info( "Packet: %s" % main.h4.readPackets( ) ) |
| 856 | else: main.h4.killFilter( ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 857 | |
| 858 | main.log.info( "Clean up host components" ) |
| 859 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 860 | host.stopScapy( ) |
| 861 | main.Mininet1.removeHostComponent( "h3" ) |
| 862 | main.Mininet1.removeHostComponent( "h4" ) |
GlennRC | 073e8bc | 2015-10-27 17:11:28 -0700 | [diff] [blame] | 863 | |
| 864 | utilities.assert_equals( expect=main.TRUE, |
| 865 | actual=stepResult, |
| 866 | onpass="Successfully sent a packet", |
| 867 | onfail="Failed to send a packet" ) |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 868 | |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 869 | def CASE1300( self, main ): |
| 870 | ''' |
| 871 | Add flows with MPLS selector and verify the flows |
| 872 | ''' |
| 873 | import json |
| 874 | import time |
| 875 | |
| 876 | main.case( "Verify the MPLS selector is correctly compiled on the flow." ) |
| 877 | main.caseExplanation = "Install one flow with an MPLS selector, " +\ |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 878 | "verify the flow is added in ONOS, and finally " +\ |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 879 | "send a packet via scapy that has a MPLS label." |
| 880 | |
| 881 | main.step( "Add a flow with a MPLS selector" ) |
| 882 | |
| 883 | main.log.info( "Creating host components" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 884 | main.Scapy.createHostComponent( "h1" ) |
| 885 | main.Scapy.createHostComponent( "h2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 886 | hosts = [ main.h1, main.h2 ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 887 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 888 | host.startHostCli( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 889 | host.startScapy( main.dependencyPath ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 890 | host.updateSelf( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 891 | |
| 892 | # ports |
| 893 | egress = 2 |
| 894 | ingress = 1 |
| 895 | # MPLS etherType |
| 896 | ethType = main.params[ 'TEST' ][ 'mplsType' ] |
| 897 | # MPLS label |
| 898 | mplsLabel = main.params[ 'TEST' ][ 'mpls' ] |
| 899 | |
| 900 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 901 | main.log.info( "Adding flow with MPLS selector" ) |
| 902 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 903 | egressPort=egress, |
| 904 | ingressPort=ingress, |
| 905 | ethType=ethType, |
| 906 | mpls=mplsLabel, |
| 907 | debug=main.debug ) |
| 908 | |
| 909 | utilities.assert_equals( expect=main.TRUE, |
| 910 | actual=stepResult, |
| 911 | onpass="Successfully added flow", |
| 912 | onfail="Failed add flow" ) |
| 913 | |
| 914 | # Giving ONOS time to add the flow |
| 915 | time.sleep( main.addFlowSleep ) |
| 916 | |
| 917 | main.step( "Check flow is in the ADDED state" ) |
| 918 | |
| 919 | main.log.info( "Get the flows from ONOS" ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 920 | try: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 921 | flows = json.loads( main.ONOSrest.flows( ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 922 | |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 923 | stepResult = main.TRUE |
| 924 | for f in flows: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 925 | if "rest" in f.get( "appId" ): |
| 926 | if "ADDED" not in f.get( "state" ): |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 927 | stepResult = main.FALSE |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 928 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 929 | except TypeError: |
| 930 | main.log.error( "No Flows found by the REST API" ) |
| 931 | stepResult = main.FALSE |
| 932 | except ValueError: |
| 933 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 934 | main.cleanup( ) |
| 935 | main.exit( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 936 | |
| 937 | utilities.assert_equals( expect=main.TRUE, |
| 938 | actual=stepResult, |
| 939 | onpass="All flows are in the ADDED state", |
| 940 | onfail="All flows are NOT in the ADDED state" ) |
| 941 | |
| 942 | main.step( "Check flows are in Mininet's flow table" ) |
| 943 | |
| 944 | # get the flow IDs that were added through rest |
| 945 | main.log.info( "Getting the flow IDs from ONOS" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 946 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 947 | # convert the flowIDs to ints then hex and finally back to strings |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 948 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 949 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 950 | |
| 951 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=True ) |
| 952 | |
| 953 | utilities.assert_equals( expect=main.TRUE, |
| 954 | actual=stepResult, |
| 955 | onpass="All flows are in mininet", |
| 956 | onfail="All flows are NOT in mininet" ) |
| 957 | |
| 958 | main.step( "Send a packet to verify the flow is correct" ) |
| 959 | |
| 960 | main.log.info( "Starting filter on host2" ) |
| 961 | main.h2.startFilter( pktFilter="mpls" ) |
| 962 | |
| 963 | main.log.info( "Constructing packet" ) |
| 964 | main.log.info( "Sending packet to host2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 965 | main.h1.sendPacket( packet='Ether()/MPLS(label={})'.format( mplsLabel ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 966 | |
| 967 | main.log.info( "Checking filter for our packet" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 968 | stepResult = main.h2.checkFilter( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 969 | if stepResult: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 970 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 971 | else: main.h2.killFilter( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 972 | |
| 973 | main.log.info( "Clean up host components" ) |
| 974 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 975 | host.stopScapy( ) |
| 976 | main.Mininet1.removeHostComponent( "h1" ) |
| 977 | main.Mininet1.removeHostComponent( "h2" ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 978 | |
| 979 | utilities.assert_equals( expect=main.TRUE, |
| 980 | actual=stepResult, |
| 981 | onpass="Successfully sent a packet", |
| 982 | onfail="Failed to send a packet" ) |
| 983 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 984 | def CASE1700( self, main ): |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 985 | ''' |
| 986 | Add flows with a TCP selector and verify the flow |
| 987 | ''' |
| 988 | import json |
| 989 | import time |
| 990 | |
| 991 | main.case( "Verify the TCP selector is correctly compiled on the flow" ) |
| 992 | main.caseExplanation = "Install a flow with only the TCP selector " +\ |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 993 | "specified, verify the flow is added in ONOS, and finally " +\ |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 994 | "send a TCP packet to verify the TCP selector is compiled correctly." |
| 995 | |
| 996 | main.step( "Add a flow with a TCP selector" ) |
| 997 | |
| 998 | main.log.info( "Creating host components" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 999 | main.Scapy.createHostComponent( "h1" ) |
| 1000 | main.Scapy.createHostComponent( "h2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1001 | hosts = [ main.h1, main.h2 ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1002 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1003 | host.startHostCli( ) |
| 1004 | host.startScapy( ) |
| 1005 | host.updateSelf( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1006 | |
| 1007 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 1008 | egress = 2 |
| 1009 | ingress = 1 |
| 1010 | # IPv4 etherType |
| 1011 | ethType = main.params[ 'TEST' ][ 'ip4Type' ] |
| 1012 | # IP protocol |
| 1013 | ipProto = main.params[ 'TEST' ][ 'tcpProto' ] |
| 1014 | # TCP port destination |
| 1015 | tcpDst = main.params[ 'TEST' ][ 'tcpDst' ] |
| 1016 | |
| 1017 | main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" ) |
| 1018 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 1019 | egressPort=egress, |
| 1020 | ingressPort=ingress, |
| 1021 | ethType=ethType, |
| 1022 | ipProto=ipProto, |
| 1023 | tcpDst=tcpDst, |
| 1024 | debug=main.debug ) |
| 1025 | |
| 1026 | utilities.assert_equals( expect=main.TRUE, |
| 1027 | actual=stepResult, |
| 1028 | onpass="Successfully added flows", |
| 1029 | onfail="Failed add flows" ) |
| 1030 | |
| 1031 | # Giving ONOS time to add the flow |
| 1032 | time.sleep( main.addFlowSleep ) |
| 1033 | |
| 1034 | main.step( "Check flow is in the ADDED state" ) |
| 1035 | |
| 1036 | main.log.info( "Get the flows from ONOS" ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1037 | try: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1038 | flows = json.loads( main.ONOSrest.flows( ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1039 | |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1040 | stepResult = main.TRUE |
| 1041 | for f in flows: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1042 | if "rest" in f.get( "appId" ): |
| 1043 | if "ADDED" not in f.get( "state" ): |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1044 | stepResult = main.FALSE |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1045 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1046 | except TypeError: |
| 1047 | main.log.error( "No Flows found by the REST API" ) |
| 1048 | stepResult = main.FALSE |
| 1049 | except ValueError: |
| 1050 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1051 | main.cleanup( ) |
| 1052 | main.exit( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1053 | |
| 1054 | utilities.assert_equals( expect=main.TRUE, |
| 1055 | actual=stepResult, |
| 1056 | onpass="All flows are in the ADDED state", |
| 1057 | onfail="All flows are NOT in the ADDED state" ) |
| 1058 | |
| 1059 | main.step( "Check flows are in Mininet's flow table" ) |
| 1060 | |
| 1061 | # get the flow IDs that were added through rest |
| 1062 | main.log.info( "Getting the flow IDs from ONOS" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1063 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1064 | # convert the flowIDs to ints then hex and finally back to strings |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1065 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 1066 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1067 | |
| 1068 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 1069 | |
| 1070 | utilities.assert_equals( expect=main.TRUE, |
| 1071 | actual=stepResult, |
| 1072 | onpass="All flows are in mininet", |
| 1073 | onfail="All flows are NOT in mininet" ) |
| 1074 | |
| 1075 | main.step( "Send a packet to verify the flow is correct" ) |
| 1076 | |
| 1077 | main.log.info( "Constructing packet" ) |
| 1078 | # No need for the MAC src dst |
| 1079 | main.h1.buildEther( dst=main.h2.hostMac ) |
| 1080 | main.h1.buildIP( dst=main.h2.hostIp ) |
| 1081 | main.h1.buildTCP( dport=tcpDst ) |
| 1082 | |
| 1083 | main.log.info( "Starting filter on host2" ) |
| 1084 | # Defaults to ip |
| 1085 | main.h2.startFilter( pktFilter="tcp" ) |
| 1086 | |
| 1087 | main.log.info( "Sending packet to host2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1088 | main.h1.sendPacket( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1089 | |
| 1090 | main.log.info( "Checking filter for our packet" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1091 | stepResult = main.h2.checkFilter( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1092 | if stepResult: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1093 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 1094 | else: main.h2.killFilter( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1095 | |
| 1096 | main.log.info( "Clean up host components" ) |
| 1097 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1098 | host.stopScapy( ) |
| 1099 | main.Mininet1.removeHostComponent( "h1" ) |
| 1100 | main.Mininet1.removeHostComponent( "h2" ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1101 | |
| 1102 | utilities.assert_equals( expect=main.TRUE, |
| 1103 | actual=stepResult, |
| 1104 | onpass="Successfully sent a packet", |
| 1105 | onfail="Failed to send a packet" ) |
| 1106 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1107 | def CASE1600( self, main ): |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1108 | ''' |
| 1109 | Add flows with a UDP selector and verify the flow |
| 1110 | ''' |
| 1111 | import json |
| 1112 | import time |
| 1113 | |
| 1114 | main.case( "Verify the UDP selector is correctly compiled on the flow" ) |
| 1115 | main.caseExplanation = "Install a flow with only the UDP selector " +\ |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1116 | "specified, verify the flow is added in ONOS, and finally " +\ |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1117 | "send a UDP packet to verify the UDP selector is compiled correctly." |
| 1118 | |
| 1119 | main.step( "Add a flow with a UDP selector" ) |
| 1120 | |
| 1121 | main.log.info( "Creating host components" ) |
Jon Hall | a510a8a | 2016-05-04 15:09:28 -0700 | [diff] [blame] | 1122 | main.Scapy.createHostComponent( "h1" ) |
| 1123 | main.Scapy.createHostComponent( "h2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1124 | hosts = [ main.h1, main.h2 ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1125 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1126 | host.startHostCli( ) |
| 1127 | host.startScapy( ) |
| 1128 | host.updateSelf( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1129 | |
| 1130 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 1131 | egress = 2 |
| 1132 | ingress = 1 |
| 1133 | # IPv4 etherType |
| 1134 | ethType = main.params[ 'TEST' ][ 'ip4Type' ] |
| 1135 | # IP protocol |
| 1136 | ipProto = main.params[ 'TEST' ][ 'udpProto' ] |
| 1137 | # UDP port destination |
| 1138 | udpDst = main.params[ 'TEST' ][ 'udpDst' ] |
| 1139 | |
| 1140 | main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" ) |
| 1141 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 1142 | egressPort=egress, |
| 1143 | ingressPort=ingress, |
| 1144 | ethType=ethType, |
| 1145 | ipProto=ipProto, |
| 1146 | udpDst=udpDst, |
| 1147 | debug=main.debug ) |
| 1148 | |
| 1149 | utilities.assert_equals( expect=main.TRUE, |
| 1150 | actual=stepResult, |
| 1151 | onpass="Successfully added flows", |
| 1152 | onfail="Failed add flows" ) |
| 1153 | |
| 1154 | # Giving ONOS time to add the flow |
| 1155 | time.sleep( main.addFlowSleep ) |
| 1156 | |
| 1157 | main.step( "Check flow is in the ADDED state" ) |
| 1158 | |
| 1159 | main.log.info( "Get the flows from ONOS" ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1160 | try: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1161 | flows = json.loads( main.ONOSrest.flows( ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1162 | |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1163 | stepResult = main.TRUE |
| 1164 | for f in flows: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1165 | if "rest" in f.get( "appId" ): |
| 1166 | if "ADDED" not in f.get( "state" ): |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1167 | stepResult = main.FALSE |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1168 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1169 | except TypeError: |
| 1170 | main.log.error( "No Flows found by the REST API" ) |
| 1171 | stepResult = main.FALSE |
| 1172 | except ValueError: |
| 1173 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1174 | main.cleanup( ) |
| 1175 | main.exit( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1176 | |
| 1177 | utilities.assert_equals( expect=main.TRUE, |
| 1178 | actual=stepResult, |
| 1179 | onpass="All flows are in the ADDED state", |
| 1180 | onfail="All flows are NOT in the ADDED state" ) |
| 1181 | |
| 1182 | main.step( "Check flows are in Mininet's flow table" ) |
| 1183 | |
| 1184 | # get the flow IDs that were added through rest |
| 1185 | main.log.info( "Getting the flow IDs from ONOS" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1186 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1187 | # convert the flowIDs to ints then hex and finally back to strings |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1188 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 1189 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1190 | |
| 1191 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 1192 | |
| 1193 | utilities.assert_equals( expect=main.TRUE, |
| 1194 | actual=stepResult, |
| 1195 | onpass="All flows are in mininet", |
| 1196 | onfail="All flows are NOT in mininet" ) |
| 1197 | |
| 1198 | main.step( "Send a packet to verify the flow is correct" ) |
| 1199 | |
| 1200 | main.log.info( "Constructing packet" ) |
| 1201 | # No need for the MAC src dst |
| 1202 | main.h1.buildEther( dst=main.h2.hostMac ) |
| 1203 | main.h1.buildIP( dst=main.h2.hostIp ) |
| 1204 | main.h1.buildUDP( dport=udpDst ) |
| 1205 | |
| 1206 | main.log.info( "Starting filter on host2" ) |
| 1207 | # Defaults to ip |
| 1208 | main.h2.startFilter( pktFilter="udp" ) |
| 1209 | |
| 1210 | main.log.info( "Sending packet to host2" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1211 | main.h1.sendPacket( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1212 | |
| 1213 | main.log.info( "Checking filter for our packet" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1214 | stepResult = main.h2.checkFilter( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1215 | if stepResult: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1216 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 1217 | else: main.h2.killFilter( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1218 | |
| 1219 | main.log.info( "Clean up host components" ) |
| 1220 | for host in hosts: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1221 | host.stopScapy( ) |
| 1222 | main.Mininet1.removeHostComponent( "h1" ) |
| 1223 | main.Mininet1.removeHostComponent( "h2" ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1224 | |
| 1225 | utilities.assert_equals( expect=main.TRUE, |
| 1226 | actual=stepResult, |
| 1227 | onpass="Successfully sent a packet", |
| 1228 | onfail="Failed to send a packet" ) |
| 1229 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1230 | def CASE1900( self, main ): |
| 1231 | ''' |
| 1232 | Add flows with a ICMPv4 selector and verify the flow |
| 1233 | ''' |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1234 | import json |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1235 | import time |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1236 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1237 | main.case( "Verify the ICMPv4 selector is correctly compiled on the flow" ) |
| 1238 | main.caseExplanation = "Install a flow with only the ICMPv4 selector " +\ |
| 1239 | "specified, verify the flow is added in ONOS, and finally " +\ |
| 1240 | "send a IMCPv4 packet to verify the ICMPv4 selector is compiled correctly." |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1241 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1242 | main.step( "Add a flow with a ICMPv4 selector" ) |
| 1243 | |
| 1244 | main.log.info( "Creating host components" ) |
| 1245 | main.Scapy.createHostComponent( "h1" ) |
| 1246 | main.Scapy.createHostComponent( "h2" ) |
| 1247 | hosts = [ main.h1, main.h2 ] |
| 1248 | for host in hosts: |
| 1249 | host.startHostCli( ) |
| 1250 | host.startScapy( ) |
| 1251 | host.updateSelf( ) |
| 1252 | |
| 1253 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 1254 | egress = 2 |
| 1255 | ingress = 1 |
| 1256 | # IPv4 etherType |
| 1257 | ethType = main.params[ 'TEST' ][ 'ip4Type' ] |
| 1258 | # IP protocol |
| 1259 | ipProto = main.params[ 'TEST' ][ 'icmpProto' ] |
| 1260 | |
| 1261 | main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" ) |
| 1262 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 1263 | egressPort=egress, |
| 1264 | ingressPort=ingress, |
| 1265 | ethType=ethType, |
| 1266 | ipProto=ipProto, |
| 1267 | debug=main.debug ) |
| 1268 | |
| 1269 | utilities.assert_equals( expect=main.TRUE, |
| 1270 | actual=stepResult, |
| 1271 | onpass="Successfully added flows", |
| 1272 | onfail="Failed add flows" ) |
| 1273 | |
| 1274 | # Giving ONOS time to add the flow |
| 1275 | time.sleep( main.addFlowSleep ) |
| 1276 | |
| 1277 | main.step( "Check flow is in the ADDED state" ) |
| 1278 | |
| 1279 | main.log.info( "Get the flows from ONOS" ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1280 | try: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1281 | flows = json.loads( main.ONOSrest.flows( ) ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1282 | |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1283 | stepResult = main.TRUE |
| 1284 | for f in flows: |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1285 | if "rest" in f.get( "appId" ): |
| 1286 | if "ADDED" not in f.get( "state" ): |
| 1287 | stepResult = main.FALSE |
| 1288 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
Jeremy | 8616099 | 2016-04-11 10:05:53 -0700 | [diff] [blame] | 1289 | except TypeError: |
| 1290 | main.log.error( "No Flows found by the REST API" ) |
| 1291 | stepResult = main.FALSE |
| 1292 | except ValueError: |
| 1293 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1294 | main.cleanup( ) |
| 1295 | main.exit( ) |
| 1296 | |
| 1297 | utilities.assert_equals( expect=main.TRUE, |
| 1298 | actual=stepResult, |
| 1299 | onpass="All flows are in the ADDED state", |
| 1300 | onfail="All flows are NOT in the ADDED state" ) |
| 1301 | |
| 1302 | main.step( "Check flows are in Mininet's flow table" ) |
| 1303 | |
| 1304 | # get the flow IDs that were added through rest |
| 1305 | main.log.info( "Getting the flow IDs from ONOS" ) |
| 1306 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
| 1307 | # convert the flowIDs to ints then hex and finally back to strings |
| 1308 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 1309 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
| 1310 | |
| 1311 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 1312 | |
| 1313 | utilities.assert_equals( expect=main.TRUE, |
| 1314 | actual=stepResult, |
| 1315 | onpass="All flows are in mininet", |
| 1316 | onfail="All flows are NOT in mininet" ) |
| 1317 | |
| 1318 | main.step( "Send a packet to verify the flow is correct" ) |
| 1319 | |
| 1320 | main.log.info( "Constructing packet" ) |
| 1321 | # No need for the MAC src dst |
| 1322 | main.h1.buildEther( dst=main.h2.hostMac ) |
| 1323 | main.h1.buildIP( dst=main.h2.hostIp ) |
| 1324 | main.h1.buildICMP( ) |
| 1325 | |
| 1326 | main.log.info( "Starting filter on host2" ) |
| 1327 | # Defaults to ip |
| 1328 | main.h2.startFilter( pktFilter="icmp" ) |
| 1329 | |
| 1330 | main.log.info( "Sending packet to host2" ) |
| 1331 | main.h1.sendPacket( ) |
| 1332 | |
| 1333 | main.log.info( "Checking filter for our packet" ) |
| 1334 | stepResult = main.h2.checkFilter( ) |
| 1335 | if stepResult: |
| 1336 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 1337 | else: main.h2.killFilter( ) |
| 1338 | |
| 1339 | main.log.info( "Clean up host components" ) |
| 1340 | for host in hosts: |
| 1341 | host.stopScapy( ) |
| 1342 | main.Mininet1.removeHostComponent( "h1" ) |
| 1343 | main.Mininet1.removeHostComponent( "h2" ) |
| 1344 | |
| 1345 | utilities.assert_equals( expect=main.TRUE, |
| 1346 | actual=stepResult, |
| 1347 | onpass="Successfully sent a packet", |
| 1348 | onfail="Failed to send a packet" ) |
| 1349 | |
| 1350 | def CASE2000( self, main ): |
| 1351 | ''' |
| 1352 | Add flows with a ICMPv6 selector and verify the flow |
| 1353 | ''' |
| 1354 | import json |
| 1355 | import time |
| 1356 | |
| 1357 | main.case( "Verify the ICMPv6 selector is correctly compiled on the flow" ) |
| 1358 | main.caseExplanation = "Install a flow with only the ICMPv6 selector " +\ |
| 1359 | "specified, verify the flow is added in ONOS, and finally " +\ |
| 1360 | "send a IMCPv6 packet to verify the ICMPv6 selector is compiled correctly." |
| 1361 | |
| 1362 | main.step( "Add a flow with a ICMPv6 selector" ) |
| 1363 | |
| 1364 | main.log.info( "Creating host components" ) |
| 1365 | main.Scapy.createHostComponent( "h5" ) |
| 1366 | main.Scapy.createHostComponent( "h6" ) |
| 1367 | hosts =[ main.h5, main.h6 ] |
| 1368 | for host in hosts: |
| 1369 | host.startHostCli( ) |
| 1370 | host.startScapy( ) |
| 1371 | host.updateSelf( IPv6=True ) |
| 1372 | |
| 1373 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 1374 | egress =6 |
| 1375 | ingress =5 |
| 1376 | # IPv6 etherType |
| 1377 | ethType = main.params[ 'TEST' ][ 'ip6Type' ] |
| 1378 | # IP protocol |
| 1379 | ipProto = main.params[ 'TEST' ][ 'icmp6Proto' ] |
| 1380 | |
| 1381 | main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" ) |
| 1382 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 1383 | egressPort=egress, |
| 1384 | ingressPort=ingress, |
| 1385 | ethType=ethType, |
| 1386 | ipProto=ipProto, |
| 1387 | debug=main.debug ) |
| 1388 | |
| 1389 | utilities.assert_equals( expect=main.TRUE, |
| 1390 | actual=stepResult, |
| 1391 | onpass="Successfully added flows", |
| 1392 | onfail="Failed add flows" ) |
| 1393 | |
| 1394 | # Giving ONOS time to add the flow |
| 1395 | time.sleep( main.addFlowSleep ) |
| 1396 | |
| 1397 | main.step( "Check flow is in the ADDED state" ) |
| 1398 | |
| 1399 | main.log.info( "Get the flows from ONOS" ) |
| 1400 | try: |
| 1401 | flows = json.loads( main.ONOSrest.flows( ) ) |
| 1402 | |
| 1403 | stepResult = main.TRUE |
| 1404 | for f in flows: |
| 1405 | if "rest" in f.get( "appId" ): |
| 1406 | if "ADDED" not in f.get( "state" ): |
| 1407 | stepResult = main.FALSE |
| 1408 | main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
| 1409 | except TypeError: |
| 1410 | main.log.error( "No Flows found by the REST API" ) |
| 1411 | stepResult = main.FALSE |
| 1412 | except ValueError: |
| 1413 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
| 1414 | main.cleanup( ) |
| 1415 | main.exit( ) |
| 1416 | |
| 1417 | utilities.assert_equals( expect=main.TRUE, |
| 1418 | actual=stepResult, |
| 1419 | onpass="All flows are in the ADDED state", |
| 1420 | onfail="All flows are NOT in the ADDED state" ) |
| 1421 | |
| 1422 | main.step( "Check flows are in Mininet's flow table" ) |
| 1423 | |
| 1424 | # get the flow IDs that were added through rest |
| 1425 | main.log.info( "Getting the flow IDs from ONOS" ) |
| 1426 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
| 1427 | # convert the flowIDs to ints then hex and finally back to strings |
| 1428 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 1429 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
| 1430 | |
| 1431 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 1432 | |
| 1433 | utilities.assert_equals( expect=main.TRUE, |
| 1434 | actual=stepResult, |
| 1435 | onpass="All flows are in mininet", |
| 1436 | onfail="All flows are NOT in mininet" ) |
| 1437 | |
| 1438 | main.step( "Send a packet to verify the flow is correct" ) |
| 1439 | |
| 1440 | main.log.info( "Constructing packet" ) |
| 1441 | # No need for the MAC src dst |
| 1442 | main.h5.buildEther( dst=main.h6.hostMac ) |
| 1443 | main.h5.buildIPv6( dst=main.h6.hostIp ) |
| 1444 | main.h5.buildICMP( ipVersion=6 ) |
| 1445 | |
| 1446 | main.log.info( "Starting filter on host2" ) |
| 1447 | # Defaults to ip |
| 1448 | main.h6.startFilter( pktFilter="icmp6" ) |
| 1449 | |
| 1450 | main.log.info( "Sending packet to host2" ) |
| 1451 | main.h5.sendPacket( ) |
| 1452 | |
| 1453 | main.log.info( "Checking filter for our packet" ) |
| 1454 | stepResult = main.h6.checkFilter( ) |
| 1455 | if stepResult: |
| 1456 | main.log.info( "Packet: %s" % main.h6.readPackets( ) ) |
| 1457 | else: main.h6.killFilter( ) |
| 1458 | |
| 1459 | main.log.info( "Clean up host components" ) |
| 1460 | for host in hosts: |
| 1461 | host.stopScapy( ) |
| 1462 | main.Mininet1.removeHostComponent( "h5" ) |
| 1463 | main.Mininet1.removeHostComponent( "h6" ) |
| 1464 | |
| 1465 | utilities.assert_equals( expect=main.TRUE, |
| 1466 | actual=stepResult, |
| 1467 | onpass="Successfully sent a packet", |
| 1468 | onfail="Failed to send a packet" ) |
| 1469 | |
| 1470 | def CASE3000( self, main ): |
| 1471 | ''' |
| 1472 | Delete flow |
| 1473 | ''' |
| 1474 | import json |
| 1475 | |
| 1476 | main.case( "Delete flows that were added through rest" ) |
| 1477 | main.step( "Deleting flows" ) |
| 1478 | |
| 1479 | main.log.info( "Getting flows" ) |
| 1480 | try: |
| 1481 | flows = json.loads( main.ONOSrest.flows( ) ) |
| 1482 | |
| 1483 | stepResult = main.TRUE |
| 1484 | for f in flows: |
| 1485 | if "rest" in f.get( "appId" ): |
| 1486 | if main.debug: main.log.debug( "Flow to be deleted:\n{}".format( main.ONOSrest.pprint( f ) ) ) |
| 1487 | stepResult = stepResult and main.ONOSrest.removeFlow( f.get( "deviceId" ), f.get( "id" ) ) |
| 1488 | except TypeError: |
| 1489 | main.log.error( "No Flows found by the REST API" ) |
| 1490 | stepResult = main.FALSE |
| 1491 | except ValueError: |
| 1492 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
| 1493 | main.cleanup( ) |
| 1494 | main.exit( ) |
GlennRC | 956ea74 | 2015-11-05 16:14:15 -0800 | [diff] [blame] | 1495 | |
| 1496 | utilities.assert_equals( expect=main.TRUE, |
| 1497 | actual=stepResult, |
| 1498 | onpass="Successfully deleting flows", |
| 1499 | onfail="Failed to delete flows" ) |
| 1500 | |
| 1501 | time.sleep( main.delFlowSleep ) |
| 1502 | |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1503 | |
| 1504 | def CASE1200(self, main ): |
| 1505 | ''' |
| 1506 | Add flows with a ARP selector and verify the flow |
| 1507 | ''' |
| 1508 | import json |
| 1509 | import time |
| 1510 | |
| 1511 | main.case( "Verify flow IP selectors are correctly compiled" ) |
| 1512 | main.caseExplanation = "Install two flows with only IP selectors " + \ |
| 1513 | "specified, then verify flows are added in ONOS, finally " + \ |
| 1514 | "send a packet that only specifies the IP src and dst." |
| 1515 | |
| 1516 | main.step( "Add flows with ARP addresses as the only selectors" ) |
| 1517 | |
| 1518 | main.log.info( "Creating host components" ) |
| 1519 | main.Scapy.createHostComponent( "h1" ) |
| 1520 | main.Scapy.createHostComponent( "h2" ) |
| 1521 | hosts = [ main.h1, main.h2 ] |
| 1522 | for host in hosts: |
| 1523 | host.startHostCli( ) |
| 1524 | host.startScapy( ) |
| 1525 | host.updateSelf( ) |
| 1526 | |
| 1527 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 1528 | # send output on port2 |
| 1529 | # recieve input on port1 |
| 1530 | egress = 2 |
| 1531 | ingress = 1 |
| 1532 | # ARP etherType = 0x0806 |
| 1533 | ethType = main.params[ 'TEST' ][ 'arpType' ] |
| 1534 | |
| 1535 | # Add flows that connects host1 to host2 |
| 1536 | main.log.info( "Add flow with port ingress 1 to port egress 2" ) |
| 1537 | stepResult = main.ONOSrest.addFlow(deviceId=main.swDPID, |
| 1538 | egressPort=egress, |
| 1539 | ingressPort=ingress, |
| 1540 | ethType=ethType, |
| 1541 | priority=40001, |
| 1542 | debug=main.debug ) |
| 1543 | |
| 1544 | utilities.assert_equals( expect=main.TRUE, |
| 1545 | actual=stepResult, |
| 1546 | onpass="Successfully added flows", |
| 1547 | onfail="Failed add flows" ) |
| 1548 | |
| 1549 | # Giving ONOS time to add the flow |
| 1550 | time.sleep( main.addFlowSleep ) |
| 1551 | |
| 1552 | main.step( "Check flow is in the ADDED state" ) |
| 1553 | |
| 1554 | main.log.info( "Get the flows from ONOS" ) |
| 1555 | try: |
| 1556 | flows = json.loads( main.ONOSrest.flows( ) ) |
| 1557 | |
| 1558 | stepResult = main.TRUE |
| 1559 | for f in flows: |
| 1560 | if "rest" in f.get( "appId" ): |
| 1561 | if "ADDED" not in f.get( "state" ): |
| 1562 | stepResult = main.FALSE |
| 1563 | main.log.error("Flow: %s in state: %s" % ( f.get("id"), f.get( "state" ) ) ) |
| 1564 | except TypeError: |
| 1565 | main.log.error( "No Flows found by the REST API" ) |
| 1566 | stepResult = main.FALSE |
| 1567 | except ValueError: |
| 1568 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
| 1569 | main.cleanup( ) |
| 1570 | main.exit( ) |
| 1571 | |
| 1572 | utilities.assert_equals( expect=main.TRUE, |
| 1573 | actual=stepResult, |
| 1574 | onpass="All flows are in the ADDED state", |
| 1575 | onfail="All flows are NOT in the ADDED state" ) |
| 1576 | |
| 1577 | main.step( "Check flows are in Mininet's flow table" ) |
| 1578 | |
| 1579 | # get the flow IDs that were added through rest |
| 1580 | main.log.info( "Getting the flow IDs from ONOS" ) |
| 1581 | flowIds = [f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
| 1582 | # convert the flowIDs to ints then hex and finally back to strings |
| 1583 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 1584 | main.log.info("ONOS flow IDs: {}".format( flowIds ) ) |
| 1585 | |
| 1586 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 1587 | |
| 1588 | utilities.assert_equals( expect=main.TRUE, |
| 1589 | actual=stepResult, |
| 1590 | onpass="All flows are in mininet", |
| 1591 | onfail="All flows are NOT in mininet" ) |
| 1592 | |
| 1593 | main.step( "Send a packet to verify the flow is correct" ) |
| 1594 | |
| 1595 | main.log.info( "Constructing packet" ) |
| 1596 | # No need for the MAC src dst |
| 1597 | main.h1.buildEther( src=main.h1.hostMac, dst=main.h2.hostMac ) |
| 1598 | main.h1.buildARP( pdst=main.h2.hostIp ) |
| 1599 | |
| 1600 | main.log.info( "Starting filter on host2" ) |
| 1601 | # Defaults to ip |
| 1602 | main.h2.startFilter( pktFilter="arp" ) |
| 1603 | |
| 1604 | main.log.info( "Sending packet to host2" ) |
| 1605 | main.h1.sendPacket( ) |
| 1606 | |
| 1607 | main.log.info( "Checking filter for our packet" ) |
| 1608 | stepResult = main.h2.checkFilter( ) |
| 1609 | if stepResult: |
| 1610 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 1611 | else: |
| 1612 | main.h2.killFilter( ) |
| 1613 | |
| 1614 | main.log.info( "Clean up host components" ) |
| 1615 | for host in hosts: |
| 1616 | host.stopScapy( ) |
| 1617 | main.Mininet1.removeHostComponent( "h1" ) |
| 1618 | main.Mininet1.removeHostComponent( "h2" ) |
| 1619 | |
| 1620 | utilities.assert_equals( expect=main.TRUE, |
| 1621 | actual=stepResult, |
| 1622 | onpass="Successfully sent a packet", |
| 1623 | onfail="Failed to send a packet" ) |
| 1624 | |
| 1625 | def CASE1800( self, main ): |
| 1626 | ''' |
| 1627 | Add flows with a SCTP selector and verify the flow |
| 1628 | ''' |
| 1629 | import json |
| 1630 | import time |
| 1631 | |
| 1632 | main.case( "Verify the UDP selector is correctly compiled on the flow" ) |
| 1633 | main.caseExplanation = "Install a flow with only the UDP selector " + \ |
| 1634 | "specified, verify the flow is added in ONOS, and finally " + \ |
| 1635 | "send a UDP packet to verify the UDP selector is compiled correctly." |
| 1636 | |
| 1637 | main.step( "Add a flow with a SCTP selector" ) |
| 1638 | |
| 1639 | main.log.info( "Creating host components" ) |
| 1640 | main.Scapy.createHostComponent( "h1" ) |
| 1641 | main.Scapy.createHostComponent( "h2" ) |
| 1642 | hosts = [ main.h1, main.h2 ] |
| 1643 | for host in hosts: |
| 1644 | host.startHostCli( ) |
| 1645 | host.startScapy( ) |
| 1646 | host.updateSelf( ) |
| 1647 | |
| 1648 | # Add a flow that connects host1 on port1 to host2 on port2 |
| 1649 | egress = 2 |
| 1650 | ingress = 1 |
| 1651 | # IPv4 etherType |
| 1652 | ethType = main.params[ 'TEST' ][ 'ip4Type' ] |
| 1653 | # IP protocol |
| 1654 | ipProto = main.params[ 'TEST' ][ 'sctpProto' ] |
| 1655 | |
| 1656 | main.log.info("Add a flow that connects host1 on port1 to host2 on port2") |
| 1657 | stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID, |
| 1658 | egressPort=egress, |
| 1659 | ingressPort=ingress, |
| 1660 | ethType=ethType, |
| 1661 | ipProto=ipProto, |
| 1662 | debug=main.debug ) |
| 1663 | |
| 1664 | utilities.assert_equals( expect=main.TRUE, |
| 1665 | actual=stepResult, |
| 1666 | onpass="Successfully added flows", |
| 1667 | onfail="Failed add flows" ) |
| 1668 | |
| 1669 | # Giving ONOS time to add the flow |
| 1670 | time.sleep( main.addFlowSleep ) |
| 1671 | |
| 1672 | main.step( "Check flow is in the ADDED state" ) |
| 1673 | |
| 1674 | main.log.info( "Get the flows from ONOS" ) |
| 1675 | try: |
| 1676 | flows = json.loads( main.ONOSrest.flows( ) ) |
| 1677 | |
| 1678 | stepResult = main.TRUE |
| 1679 | for f in flows: |
| 1680 | if "rest" in f.get( "appId" ): |
| 1681 | if "ADDED" not in f.get( "state" ): |
| 1682 | stepResult = main.FALSE |
| 1683 | main.log.error("Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) ) |
| 1684 | except TypeError: |
| 1685 | main.log.error( "No Flows found by the REST API" ) |
| 1686 | stepResult = main.FALSE |
| 1687 | except ValueError: |
| 1688 | main.log.error( "Problem getting Flows state from REST API. Exiting test" ) |
| 1689 | main.cleanup( ) |
| 1690 | main.exit( ) |
| 1691 | |
| 1692 | utilities.assert_equals( expect=main.TRUE, |
| 1693 | actual=stepResult, |
| 1694 | onpass="All flows are in the ADDED state", |
| 1695 | onfail="All flows are NOT in the ADDED state" ) |
| 1696 | |
| 1697 | main.step( "Check flows are in Mininet's flow table" ) |
| 1698 | |
| 1699 | # get the flow IDs that were added through rest |
| 1700 | main.log.info( "Getting the flow IDs from ONOS" ) |
| 1701 | flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ] |
| 1702 | # convert the flowIDs to ints then hex and finally back to strings |
| 1703 | flowIds = [ str( hex( int( x ) ) ) for x in flowIds ] |
| 1704 | main.log.info( "ONOS flow IDs: {}".format( flowIds ) ) |
| 1705 | |
| 1706 | stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False ) |
| 1707 | |
| 1708 | utilities.assert_equals( expect=main.TRUE, |
| 1709 | actual=stepResult, |
| 1710 | onpass="All flows are in mininet", |
| 1711 | onfail="All flows are NOT in mininet" ) |
| 1712 | |
| 1713 | main.step( "Send a packet to verify the flow is correct" ) |
| 1714 | |
| 1715 | main.log.info( "Constructing packet" ) |
| 1716 | # No need for the MAC src dst |
| 1717 | main.h1.buildEther( dst=main.h2.hostMac ) |
| 1718 | main.h1.buildIP( dst=main.h2.hostIp ) |
| 1719 | main.h1.buildSCTP( ) |
| 1720 | |
| 1721 | main.log.info( "Starting filter on host2" ) |
| 1722 | # Defaults to ip |
| 1723 | main.h2.startFilter( pktFilter="sctp" ) |
| 1724 | |
| 1725 | main.log.info( "Sending packet to host2" ) |
| 1726 | main.h1.sendPacket( ) |
| 1727 | |
| 1728 | main.log.info( "Checking filter for our packet" ) |
| 1729 | stepResult = main.h2.checkFilter( ) |
| 1730 | if stepResult: |
| 1731 | main.log.info( "Packet: %s" % main.h2.readPackets( ) ) |
| 1732 | else: |
| 1733 | main.h2.killFilter( ) |
| 1734 | |
| 1735 | main.log.info( "Clean up host components" ) |
| 1736 | for host in hosts: |
| 1737 | host.stopScapy( ) |
| 1738 | main.Mininet1.removeHostComponent( "h1" ) |
| 1739 | main.Mininet1.removeHostComponent( "h2" ) |
| 1740 | |
| 1741 | utilities.assert_equals( expect=main.TRUE, |
| 1742 | actual=stepResult, |
| 1743 | onpass="Successfully sent a packet", |
| 1744 | onfail="Failed to send a packet" ) |
| 1745 | |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 1746 | def CASE100( self, main ): |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 1747 | ''' |
| 1748 | Report errors/warnings/exceptions |
| 1749 | ''' |
alison | e14d7b0 | 2016-07-06 10:31:51 -0700 | [diff] [blame] | 1750 | main.log.info( "Error report: \n" ) |
GlennRC | 5147a42 | 2015-10-06 17:26:17 -0700 | [diff] [blame] | 1751 | main.ONOSbench.logReport( main.ONOSip[ 0 ], |
| 1752 | [ "INFO", |
| 1753 | "FOLLOWER", |
| 1754 | "WARN", |
| 1755 | "flow", |
| 1756 | "ERROR", |
| 1757 | "Except" ], |
GlennRC | 6844994 | 2015-10-16 16:03:12 -0700 | [diff] [blame] | 1758 | "s" ) |