Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 1 | """ |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 2 | Copyright 2016 Open Networking Foundation ( ONF ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 3 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 7 | |
| 8 | TestON is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 2 of the License, or |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 11 | ( at your option ) any later version. |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 12 | |
| 13 | TestON is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 21 | import re |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 22 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 23 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 24 | class ONOSSetup: |
| 25 | main = None |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 26 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 27 | def __init__( self ): |
| 28 | self.default = '' |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 29 | |
| 30 | def envSetupDescription( self ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 31 | """ |
| 32 | Introduction part of the test. It will initialize some basic vairables. |
| 33 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 34 | main.case( "Constructing test variables and building ONOS package" ) |
| 35 | main.step( "Constructing test variables" ) |
| 36 | main.caseExplanation = "For loading from params file, and pull" + \ |
| 37 | " and build the latest ONOS package" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 38 | try: |
| 39 | from tests.dependencies.Cluster import Cluster |
| 40 | except ImportError: |
| 41 | main.log.error( "Cluster not found. exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 42 | main.cleanAndExit() |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 43 | try: |
| 44 | main.Cluster |
| 45 | except ( NameError, AttributeError ): |
| 46 | main.Cluster = Cluster( main.ONOScell.nodes ) |
| 47 | main.ONOSbench = main.Cluster.controllers[ 0 ].Bench |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 48 | main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir ) |
| 49 | |
| 50 | def gitPulling( self ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 51 | """ |
| 52 | it will do git checkout or pull if they are enabled from the params file. |
| 53 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 54 | main.case( "Pull onos branch and build onos on Teststation." ) |
| 55 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
| 56 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 57 | if gitPull == 'True': |
| 58 | main.step( "Git Checkout ONOS branch: " + gitBranch ) |
| 59 | stepResult = main.ONOSbench.gitCheckout( branch=gitBranch ) |
| 60 | utilities.assert_equals( expect=main.TRUE, |
| 61 | actual=stepResult, |
| 62 | onpass="Successfully checkout onos branch.", |
| 63 | onfail="Failed to checkout onos branch. Exiting test..." ) |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 64 | if not stepResult: |
| 65 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 66 | |
| 67 | main.step( "Git Pull on ONOS branch:" + gitBranch ) |
| 68 | stepResult = main.ONOSbench.gitPull() |
| 69 | utilities.assert_equals( expect=main.TRUE, |
| 70 | actual=stepResult, |
| 71 | onpass="Successfully pull onos. ", |
| 72 | onfail="Failed to pull onos. Exiting test ..." ) |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 73 | if not stepResult: |
| 74 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 75 | |
| 76 | else: |
| 77 | main.log.info( "Skipped git checkout and pull as they are disabled in params file" ) |
| 78 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 79 | def envSetup( self, includeGitPull=True ): |
| 80 | """ |
| 81 | Description: |
| 82 | some environment setup for the test. |
| 83 | Required: |
| 84 | * includeGitPull - if wish to git pulling function to be executed. |
| 85 | Returns: |
| 86 | Returns main.TRUE |
| 87 | """ |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 88 | if includeGitPull: |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 89 | self.gitPulling() |
Jon Hall | ca31989 | 2017-06-15 15:25:22 -0700 | [diff] [blame] | 90 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 91 | try: |
| 92 | from tests.dependencies.Cluster import Cluster |
| 93 | except ImportError: |
| 94 | main.log.error( "Cluster not found. exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 95 | main.cleanAndExit() |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 96 | try: |
| 97 | main.Cluster |
| 98 | except ( NameError, AttributeError ): |
| 99 | main.Cluster = Cluster( main.ONOScell.nodes ) |
| 100 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 101 | main.cellData = {} # For creating cell file |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 102 | |
Jon Hall | ca31989 | 2017-06-15 15:25:22 -0700 | [diff] [blame] | 103 | return main.TRUE |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 104 | |
Jon Hall | ca31989 | 2017-06-15 15:25:22 -0700 | [diff] [blame] | 105 | def envSetupException( self, e ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 106 | """ |
| 107 | Description: |
| 108 | handles the exception that might occur from the environment setup. |
| 109 | Required: |
| 110 | * includeGitPull - exceeption code e. |
| 111 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 112 | main.log.exception( e ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 113 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 114 | |
Jon Hall | ca31989 | 2017-06-15 15:25:22 -0700 | [diff] [blame] | 115 | def evnSetupConclusion( self, stepResult ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 116 | """ |
| 117 | Description: |
| 118 | compare the result of the envSetup of the test. |
| 119 | Required: |
| 120 | * stepResult - Result of the envSetup. |
| 121 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 122 | utilities.assert_equals( expect=main.TRUE, |
| 123 | actual=stepResult, |
| 124 | onpass="Successfully construct " + |
| 125 | "test variables ", |
| 126 | onfail="Failed to construct test variables" ) |
| 127 | |
| 128 | main.commit = main.ONOSbench.getVersion( report=True ) |
| 129 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 130 | def setNumCtrls( self, hasMultiNodeRounds ): |
| 131 | """ |
| 132 | Description: |
| 133 | Set new number of controls if it uses different number of nodes. |
| 134 | different number of nodes should be pre-defined in main.scale. |
| 135 | Required: |
| 136 | * hasMultiNodeRouds - if the test is testing different number of nodes. |
| 137 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 138 | if hasMultiNodeRounds: |
| 139 | try: |
| 140 | main.cycle |
| 141 | except Exception: |
| 142 | main.cycle = 0 |
| 143 | main.cycle += 1 |
| 144 | # main.scale[ 0 ] determines the current number of ONOS controller |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 145 | main.Cluster.setRunningNode( int( main.scale.pop( 0 ) ) ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 146 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 147 | def killingAllOnos( self, cluster, killRemoveMax, stopOnos ): |
| 148 | """ |
| 149 | Description: |
| 150 | killing the onos. It will either kill the current runningnodes or |
| 151 | max number of the nodes. |
| 152 | Required: |
| 153 | * cluster - the cluster driver that will be used. |
| 154 | * killRemoveMax - The boolean that will decide either to kill |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 155 | only running nodes ( False ) or max number of nodes ( True ). |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 156 | * stopOnos - If wish to stop onos before killing it. True for |
| 157 | enable stop , False for disable stop. |
| 158 | Returns: |
| 159 | Returns main.TRUE if successfully killing it. |
| 160 | """ |
| 161 | main.log.info( "Safety check, killing all ONOS processes" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 162 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 163 | return cluster.kill( killRemoveMax, stopOnos ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 164 | |
Devin Lim | e9f0ccf | 2017-08-11 17:25:12 -0700 | [diff] [blame] | 165 | def createApplyCell( self, cluster, newCell, cellName, |
| 166 | Mininet, useSSH, ips, installMax=False ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 167 | """ |
| 168 | Description: |
| 169 | create new cell ( optional ) and apply it. It will also verify the |
| 170 | cell. |
| 171 | Required: |
| 172 | * cluster - the cluster driver that will be used. |
| 173 | * newCell - True for making a new cell and False for not making it. |
| 174 | * cellName - The name of the cell. |
| 175 | * Mininet - a mininet driver that will be used. |
| 176 | * useSSH - True for using ssh when creating a cell |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 177 | * ips - ip( s ) of the node( s ). |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 178 | Returns: |
| 179 | Returns main.TRUE if it successfully executed. |
| 180 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 181 | if newCell: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 182 | cluster.createCell( cellName, Mininet, useSSH, ips ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 183 | main.step( "Apply cell to environment" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 184 | stepResult = cluster.applyCell( cellName ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 185 | utilities.assert_equals( expect=main.TRUE, |
| 186 | actual=stepResult, |
| 187 | onpass="Successfully applied cell to " + |
| 188 | "environment", |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 189 | onfail="Failed to apply cell to environment" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 190 | return stepResult |
| 191 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 192 | def uninstallOnos( self, cluster, uninstallMax ): |
| 193 | """ |
| 194 | Description: |
| 195 | uninstalling onos and verify the result. |
| 196 | Required: |
| 197 | * cluster - a cluster driver that will be used. |
| 198 | * uninstallMax - True for uninstalling max number of nodes |
| 199 | False for uninstalling the current running nodes. |
| 200 | Returns: |
| 201 | Returns main.TRUE if it successfully uninstalled. |
| 202 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 203 | main.step( "Uninstalling ONOS package" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 204 | onosUninstallResult = cluster.uninstall( uninstallMax ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 205 | utilities.assert_equals( expect=main.TRUE, |
| 206 | actual=onosUninstallResult, |
| 207 | onpass="Successfully uninstalled ONOS package", |
| 208 | onfail="Failed to uninstall ONOS package" ) |
| 209 | return onosUninstallResult |
| 210 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 211 | def buildOnos( self, cluster ): |
| 212 | """ |
| 213 | Description: |
| 214 | build the onos using buck build onos and verify the result |
| 215 | Required: |
| 216 | * cluster - the cluster driver that will be used. |
| 217 | Returns: |
| 218 | Returns main.TRUE if it successfully built. |
| 219 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 220 | main.step( "Creating ONOS package" ) |
| 221 | packageResult = main.ONOSbench.buckBuild() |
| 222 | utilities.assert_equals( expect=main.TRUE, |
| 223 | actual=packageResult, |
| 224 | onpass="Successfully created ONOS package", |
| 225 | onfail="Failed to create ONOS package" ) |
| 226 | return packageResult |
| 227 | |
Devin Lim | e9f0ccf | 2017-08-11 17:25:12 -0700 | [diff] [blame] | 228 | def installOnos( self, cluster, installMax, parallel=True ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 229 | """ |
| 230 | Description: |
| 231 | Installing onos and verify the result |
| 232 | Required: |
| 233 | * cluster - the cluster driver that will be used. |
| 234 | * installMax - True for installing max number of nodes |
| 235 | False for installing current running nodes only. |
| 236 | Returns: |
| 237 | Returns main.TRUE if it successfully installed |
| 238 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 239 | main.step( "Installing ONOS package" ) |
| 240 | onosInstallResult = main.TRUE |
| 241 | |
Devin Lim | e9f0ccf | 2017-08-11 17:25:12 -0700 | [diff] [blame] | 242 | cluster.install( installMax, parallel ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 243 | utilities.assert_equals( expect=main.TRUE, |
| 244 | actual=onosInstallResult, |
| 245 | onpass="Successfully installed ONOS package", |
| 246 | onfail="Failed to install ONOS package" ) |
| 247 | if not onosInstallResult: |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 248 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 249 | return onosInstallResult |
| 250 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 251 | def setupSsh( self, cluster ): |
| 252 | """ |
| 253 | Description: |
| 254 | set up ssh to the onos and verify the result |
| 255 | Required: |
| 256 | * cluster - the cluster driver that will be used. |
| 257 | Returns: |
| 258 | Returns main.TRUE if it successfully setup the ssh to |
| 259 | the onos. |
| 260 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 261 | main.step( "Set up ONOS secure SSH" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 262 | secureSshResult = cluster.ssh() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 263 | utilities.assert_equals( expect=main.TRUE, |
| 264 | actual=secureSshResult, |
| 265 | onpass="Test step PASS", |
| 266 | onfail="Test step FAIL" ) |
| 267 | return secureSshResult |
| 268 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 269 | def checkOnosService( self, cluster ): |
| 270 | """ |
| 271 | Description: |
| 272 | Checking if the onos service is up and verify the result |
| 273 | Required: |
| 274 | * cluster - the cluster driver that will be used. |
| 275 | Returns: |
| 276 | Returns main.TRUE if it successfully checked |
| 277 | """ |
| 278 | main.step( "Checking ONOS service" ) |
| 279 | stepResult = cluster.checkService() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 280 | utilities.assert_equals( expect=main.TRUE, |
| 281 | actual=stepResult, |
| 282 | onpass="ONOS service is ready on all nodes", |
| 283 | onfail="ONOS service did not start properly on all nodes" ) |
| 284 | return stepResult |
| 285 | |
Jon Hall | ca31989 | 2017-06-15 15:25:22 -0700 | [diff] [blame] | 286 | def startOnosClis( self, cluster ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 287 | """ |
| 288 | Description: |
| 289 | starting Onos using onosCli driver and verify the result |
| 290 | Required: |
| 291 | * cluster - the cluster driver that will be used. |
| 292 | Returns: |
| 293 | Returns main.TRUE if it successfully started. It will exit |
| 294 | the test if not started properly. |
| 295 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 296 | main.step( "Starting ONOS CLI sessions" ) |
Jon Hall | ca31989 | 2017-06-15 15:25:22 -0700 | [diff] [blame] | 297 | startCliResult = cluster.startCLIs() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 298 | if not startCliResult: |
| 299 | main.log.info( "ONOS CLI did not start up properly" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 300 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 301 | else: |
| 302 | main.log.info( "Successful CLI startup" ) |
| 303 | utilities.assert_equals( expect=main.TRUE, |
| 304 | actual=startCliResult, |
| 305 | onpass="Successfully start ONOS cli", |
| 306 | onfail="Failed to start ONOS cli" ) |
| 307 | return startCliResult |
| 308 | |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 309 | def processList( self, functions, args ): |
| 310 | if functions is not None: |
| 311 | if isinstance( functions, list ): |
| 312 | i = 0 |
| 313 | for f in functions: |
| 314 | f( *( args[ i ] ) ) if args is not None and args[ i ] is not None else f() |
| 315 | i += 1 |
| 316 | else: |
| 317 | functions( *args ) if args is not None else functions() |
| 318 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 319 | def ONOSSetUp( self, Mininet, cluster, hasMultiNodeRounds=False, startOnos=True, newCell=True, |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 320 | cellName="temp", removeLog=False, extraApply=None, applyArgs=None, extraClean=None, |
| 321 | cleanArgs=None, skipPack=False, installMax=False, useSSH=True, killRemoveMax=True, |
Devin Lim | e9f0ccf | 2017-08-11 17:25:12 -0700 | [diff] [blame] | 322 | stopOnos=False, installParallel=True ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 323 | """ |
| 324 | Description: |
| 325 | Initial ONOS setting up of the tests. It will also verify the result of each steps. |
| 326 | The procedures will be: |
| 327 | killing onos |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 328 | creating ( optional ) /applying cell |
| 329 | removing raft logs ( optional ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 330 | uninstalling onos |
| 331 | extra procedure to be applied( optional ) |
| 332 | building onos |
| 333 | installing onos |
| 334 | extra cleanup to be applied ( optional ) |
| 335 | setting up ssh to the onos |
| 336 | checking the onos service |
| 337 | starting onos |
| 338 | Required: |
| 339 | * Mininet - the mininet driver that will be used |
| 340 | * cluster - the cluster driver that will be used. |
| 341 | * hasMultiNodeRouds - True if the test is testing different set of nodes |
| 342 | * startOnos - True if wish to start onos. |
| 343 | * newCell - True for making a new cell and False for not making it. |
| 344 | * cellName - Name of the cell that will be used. |
| 345 | * removeLog - True if wish to remove raft logs |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 346 | * extraApply - Function( s ) that will be called before building ONOS. Default to None. |
| 347 | * applyArgs - argument of the functon( s ) of the extraApply. Should be in list. |
| 348 | * extraClean - Function( s ) that will be called after building ONOS. Defaults to None. |
| 349 | * cleanArgs - argument of the functon( s ) of the extraClean. Should be in list. |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 350 | * skipPack - True if wish to skip some packing. |
| 351 | * installMax - True if wish to install onos max number of nodes |
| 352 | False if wish to install onos of running nodes only |
| 353 | * useSSH - True for using ssh when creating a cell |
| 354 | * killRemoveMax - True for removing/killing max number of nodes. False for |
| 355 | removing/killing running nodes only. |
| 356 | * stopOnos - True if wish to stop onos before killing it. |
| 357 | Returns: |
| 358 | Returns main.TRUE if it everything successfully proceeded. |
| 359 | """ |
| 360 | self.setNumCtrls( hasMultiNodeRounds ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 361 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 362 | main.case( "Starting up " + str( cluster.numCtrls ) + |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 363 | " node(s) ONOS cluster" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 364 | main.caseExplanation = "Set up ONOS with " + str( cluster.numCtrls ) + \ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 365 | " node(s) ONOS cluster" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 366 | killResult = self.killingAllOnos( cluster, killRemoveMax, stopOnos ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 367 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 368 | main.log.info( "NODE COUNT = " + str( cluster.numCtrls ) ) |
| 369 | cellResult = main.TRUE |
| 370 | packageResult = main.TRUE |
| 371 | onosUninstallResult = main.TRUE |
| 372 | onosCliResult = main.TRUE |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 373 | if not skipPack: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 374 | tempOnosIp = [] |
| 375 | for ctrl in cluster.runningNodes: |
| 376 | tempOnosIp.append( ctrl.ipAddress ) |
| 377 | cellResult = self.createApplyCell( cluster, newCell, |
| 378 | cellName, Mininet, |
Devin Lim | e9f0ccf | 2017-08-11 17:25:12 -0700 | [diff] [blame] | 379 | useSSH, tempOnosIp, |
| 380 | installMax ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 381 | if removeLog: |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 382 | main.log.info( "Removing raft logs" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 383 | main.ONOSbench.onosRemoveRaftLogs() |
| 384 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 385 | onosUninstallResult = self.uninstallOnos( cluster, killRemoveMax ) |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 386 | self.processList( extraApply, applyArgs ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 387 | packageResult = self.buildOnos( cluster ) |
| 388 | |
Devin Lim | e9f0ccf | 2017-08-11 17:25:12 -0700 | [diff] [blame] | 389 | onosInstallResult = self.installOnos( cluster, installMax, installParallel ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 390 | |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 391 | self.processList( extraClean, cleanArgs ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 392 | secureSshResult = self.setupSsh( cluster ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 393 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 394 | onosServiceResult = self.checkOnosService( cluster ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 395 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 396 | if startOnos: |
Jon Hall | ca31989 | 2017-06-15 15:25:22 -0700 | [diff] [blame] | 397 | onosCliResult = self.startOnosClis( cluster ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 398 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 399 | return killResult and cellResult and packageResult and onosUninstallResult and \ |
Jon Hall | 4f360bc | 2017-09-07 10:19:52 -0700 | [diff] [blame] | 400 | onosInstallResult and secureSshResult and onosServiceResult and onosCliResult |