Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 1 | # ScaleOutTemplate |
| 2 | # |
| 3 | # CASE1 starts number of nodes specified in param file |
| 4 | # |
| 5 | # cameron@onlab.us |
| 6 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 7 | import sys |
| 8 | import os |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 9 | |
| 10 | |
| 11 | class ScaleOutTemplate: |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 12 | |
| 13 | def __init__( self ): |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 14 | self.default = '' |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 15 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 16 | def CASE1( self, main ): |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 17 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 18 | global clusterCount |
| 19 | clusterCount = 1 |
| 20 | |
| 21 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 22 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 23 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 24 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 25 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
| 26 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 27 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 28 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 29 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 30 | |
| 31 | main.log.step( "Cleaning Enviornment..." ) |
| 32 | main.ONOSbench.onosUninstall( ONOS1Ip ) |
| 33 | main.ONOSbench.onosUninstall( ONOS2Ip ) |
| 34 | main.ONOSbench.onosUninstall( ONOS3Ip ) |
| 35 | |
| 36 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 37 | if gitPull == 'on': |
| 38 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 39 | pullResult = main.ONOSbench.gitPull() |
| 40 | |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 41 | else: |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 42 | checkoutResult = main.TRUE |
| 43 | pullResult = main.TRUE |
| 44 | main.log.info( "Skipped git checkout and pull" ) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 45 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 46 | #mvnResult = main.ONOSbench.cleanInstall() |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 47 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 48 | main.step( "Set cell for ONOS cli env" ) |
| 49 | main.ONOS1cli.setCell( cellName ) |
| 50 | main.ONOS2cli.setCell( cellName ) |
| 51 | main.ONOS3cli.setCell( cellName ) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 52 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 53 | main.step( "Creating ONOS package" ) |
| 54 | packageResult = main.ONOSbench.onosPackage() |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 55 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 56 | main.step( "Installing ONOS package" ) |
| 57 | install1Result = main.ONOSbench.onosInstall( node=ONOS1Ip ) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 58 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 59 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 60 | main.step( "Applying cell file to environment" ) |
| 61 | cellApplyResult = main.ONOSbench.setCell( cellName ) |
| 62 | main.step( "verify cells" ) |
| 63 | verifyCellResult = main.ONOSbench.verifyCell() |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 64 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 65 | main.step( "Set cell for ONOS cli env" ) |
| 66 | main.ONOS1cli.setCell() |
| 67 | cli1 = main.ONOS1cli.startOnosCli( ONOS1Ip ) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 68 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 69 | def CASE2( self, main ): |
| 70 | '' |
| 71 | 'Increase number of nodes and initiate CLI' |
| 72 | '' |
| 73 | import time |
| 74 | |
| 75 | global clusterCount |
| 76 | |
| 77 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 78 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 79 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 80 | #ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ] |
| 81 | #ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ] |
| 82 | #ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ] |
| 83 | #ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ] |
| 84 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 85 | scale = int( main.params[ 'SCALE' ] ) |
| 86 | |
| 87 | # Cluster size increased everytime the case is defined |
| 88 | clusterCount += scale |
| 89 | |
| 90 | main.log.report( "Increasing cluster size to " + |
| 91 | str( clusterCount ) ) |
| 92 | installResult = main.FALSE |
| 93 | |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 94 | if scale == 2: |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 95 | if clusterCount == 3: |
| 96 | main.log.info( "Installing nodes 2 and 3" ) |
| 97 | install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip ) |
| 98 | install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip ) |
| 99 | cli2 = main.ONOS1cli.startOnosCli(ONOS1_ip) |
| 100 | cli3 = main.ONOS1cli.startOnosCli(ONOS2_ip) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 101 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 102 | |
| 103 | #elif clusterCount == 5: |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 104 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 105 | # main.log.info( "Installing nodes 4 and 5" ) |
| 106 | # node4Result = main.ONOSbench.onosInstall( node=ONOS4Ip ) |
| 107 | # node5Result = main.ONOSbench.onosInstall( node=ONOS5Ip ) |
| 108 | # installResult = node4Result and node5Result |
| 109 | # time.sleep( 5 ) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 110 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 111 | # main.ONOS4cli.startOnosCli( ONOS4Ip ) |
| 112 | # main.ONOS5cli.startOnosCli( ONOS5Ip ) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 113 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 114 | #elif clusterCount == 7: |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 115 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 116 | # main.log.info( "Installing nodes 4 and 5" ) |
| 117 | # node6Result = main.ONOSbench.onosInstall( node=ONOS6Ip ) |
| 118 | # node7Result = main.ONOSbench.onosInstall( node=ONOS7Ip ) |
| 119 | # installResult = node6Result and node7Result |
| 120 | # time.sleep( 5 ) |
| 121 | |
| 122 | # main.ONOS6cli.startOnosCli( ONOS6Ip ) |
| 123 | # main.ONOS7cli.startOnosCli( ONOS7Ip ) |
| 124 | # |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 125 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 126 | if scale == 1: |
| 127 | if clusterCount == 2: |
| 128 | main.log.info( "Installing node 2" ) |
| 129 | install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip ) |
| 130 | cli2 = main.ONOS1cli.startOnosCli(ONOS2_ip) |
Cameron Franke | 2ea90e5 | 2015-01-21 10:04:16 -0800 | [diff] [blame] | 131 | |
andrew@onlab.us | c400b11 | 2015-01-21 15:33:19 -0800 | [diff] [blame^] | 132 | if clusterCount == 3: |
| 133 | main.log.info( "Installing node 3" ) |
| 134 | install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip ) |
| 135 | cli3 = main.ONOS1cli.startOnosCli(ONOS3_ip) |