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