Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2016 Open Networking Foundation (ONF) |
| 3 | |
| 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 | """ |
| 21 | |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 22 | # CASE1: Startup |
| 23 | # CASE2: Load vpls topology and configurations from demo script |
| 24 | # CASE3: Test CLI commands |
| 25 | |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 26 | |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 27 | class VPLSBasic: |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 28 | |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 29 | def __init__( self ): |
| 30 | self.default = '' |
| 31 | |
| 32 | def CASE1( self, main ): |
| 33 | """ |
| 34 | CASE1 is to compile ONOS and push it to the test machines |
| 35 | |
| 36 | Startup sequence: |
| 37 | cell <name> |
| 38 | onos-verify-cell |
| 39 | NOTE: temporary - onos-remove-raft-logs |
| 40 | onos-uninstall |
| 41 | start mininet |
| 42 | git pull |
| 43 | mvn clean install |
| 44 | onos-package |
| 45 | onos-install -f |
| 46 | onos-wait-for-start |
| 47 | start cli sessions |
| 48 | start tcpdump |
| 49 | """ |
| 50 | import imp |
| 51 | import time |
| 52 | import json |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 53 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 54 | try: |
| 55 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 56 | main.testSetUp = ONOSSetup() |
| 57 | except ImportError: |
| 58 | main.log.error( "ONOSSetup not found. exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 59 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 60 | main.testSetUp.envSetupDescription() |
| 61 | stepResult = main.FALSE |
| 62 | try: |
| 63 | # load some variables from the params file |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 64 | main.cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 65 | main.sleep = int( main.params[ 'SLEEP' ][ 'netcfg' ] ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 66 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 67 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 68 | ofPort = main.params[ 'CTRL' ][ 'port' ] |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 69 | stepResult = main.testSetUp.envSetup() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 70 | except Exception as e: |
| 71 | main.testSetUp.envSetupException( e ) |
| 72 | main.testSetUp.evnSetupConclusion( stepResult ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 73 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 74 | main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 75 | cellName=main.cellName ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 76 | |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 77 | main.step( "Starting Mininet" ) |
| 78 | # scp topo file to mininet |
| 79 | # TODO: move to params? |
| 80 | topoName = "vpls" |
| 81 | topoFile = "vpls.py" |
| 82 | filePath = main.ONOSbench.home + "/tools/test/topos/" |
| 83 | main.ONOSbench.scp( main.Mininet1, |
| 84 | filePath + topoFile, |
| 85 | main.Mininet1.home, |
| 86 | direction="to" ) |
| 87 | topo = " --custom " + main.Mininet1.home + topoFile + " --topo " + topoName |
Jeremy Ronquillo | 3008aa3 | 2017-07-07 15:38:57 -0700 | [diff] [blame] | 88 | args = " --switch ovs,protocols=OpenFlow13" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 89 | for ctrl in main.Cluster.active(): |
| 90 | args += " --controller=remote,ip=" + ctrl.ipAddress |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 91 | mnCmd = "sudo mn" + topo + args |
| 92 | mnResult = main.Mininet1.startNet( mnCmd=mnCmd ) |
| 93 | utilities.assert_equals( expect=main.TRUE, actual=mnResult, |
| 94 | onpass="Mininet Started", |
| 95 | onfail="Error starting Mininet" ) |
| 96 | |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 97 | |
| 98 | main.step( "Activate apps defined in the params file" ) |
| 99 | # get data from the params |
| 100 | apps = main.params.get( 'apps' ) |
| 101 | if apps: |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 102 | apps = apps.split( ',' ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 103 | main.log.warn( apps ) |
| 104 | activateResult = True |
| 105 | for app in apps: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 106 | main.Cluster.active( 0 ).CLI.app( app, "Activate" ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 107 | # TODO: check this worked |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 108 | time.sleep( main.sleep ) # wait for apps to activate |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 109 | for app in apps: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 110 | state = main.Cluster.active( 0 ).CLI.appStatus( app ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 111 | if state == "ACTIVE": |
Jon Hall | 937bc81 | 2017-01-31 16:44:10 -0800 | [diff] [blame] | 112 | activateResult = activateResult and True |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 113 | else: |
| 114 | main.log.error( "{} is in {} state".format( app, state ) ) |
Jon Hall | 937bc81 | 2017-01-31 16:44:10 -0800 | [diff] [blame] | 115 | activateResult = False |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 116 | utilities.assert_equals( expect=True, |
| 117 | actual=activateResult, |
| 118 | onpass="Successfully activated apps", |
| 119 | onfail="Failed to activate apps" ) |
| 120 | else: |
| 121 | main.log.warn( "No apps were specified to be loaded after startup" ) |
| 122 | |
| 123 | main.step( "Set ONOS configurations" ) |
| 124 | config = main.params.get( 'ONOS_Configuration' ) |
| 125 | if config: |
| 126 | main.log.debug( config ) |
| 127 | checkResult = main.TRUE |
| 128 | for component in config: |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 129 | for setting in config[ component ]: |
| 130 | value = config[ component ][ setting ] |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 131 | check = main.Cluster.active( 0 ).CLI.setCfg( component, setting, value ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 132 | main.log.info( "Value was changed? {}".format( main.TRUE == check ) ) |
| 133 | checkResult = check and checkResult |
| 134 | utilities.assert_equals( expect=main.TRUE, |
| 135 | actual=checkResult, |
| 136 | onpass="Successfully set config", |
| 137 | onfail="Failed to set config" ) |
| 138 | else: |
| 139 | main.log.warn( "No configurations were specified to be changed after startup" ) |
| 140 | |
| 141 | main.step( "App Ids check" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 142 | appCheck = main.Cluster.command( "appToIDCheck", returnBool=True ) |
| 143 | if appCheck != True: |
| 144 | main.log.warn( main.Cluster.active( 0 ).CLI.apps() ) |
| 145 | main.log.warn( main.Cluster.active( 0 ).CLI.appIDs() ) |
| 146 | utilities.assert_equals( expect=True, actual=appCheck, |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 147 | onpass="App Ids seem to be correct", |
| 148 | onfail="Something is wrong with app Ids" ) |
| 149 | |
| 150 | def CASE2( self, main ): |
| 151 | """ |
| 152 | Load and test vpls configurations from json configuration file |
| 153 | """ |
| 154 | import os.path |
| 155 | from tests.USECASE.VPLS.dependencies import vpls |
| 156 | |
Jeremy Ronquillo | 3008aa3 | 2017-07-07 15:38:57 -0700 | [diff] [blame] | 157 | main.vpls = vpls |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 158 | pprint = main.Cluster.active( 0 ).REST.pprint |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 159 | hosts = int( main.params[ 'vpls' ][ 'hosts' ] ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 160 | main.step( "Discover hosts using pings" ) |
| 161 | for i in range( 1, hosts + 1 ): |
| 162 | src = "h" + str( i ) |
| 163 | for j in range( 1, hosts + 1 ): |
| 164 | if j == i: |
| 165 | continue |
| 166 | dst = "h" + str( j ) |
| 167 | pingResult = main.Mininet1.pingHost( SRC=src, TARGET=dst ) |
| 168 | |
| 169 | main.step( "Load VPLS configurations" ) |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 170 | fileName = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 171 | app = main.params[ 'vpls' ][ 'name' ] |
Jeremy Ronquillo | 3008aa3 | 2017-07-07 15:38:57 -0700 | [diff] [blame] | 172 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 173 | loadVPLSResult = main.ONOSbench.onosNetCfg( main.Cluster.active( 0 ).ipAddress, "", fileName ) |
Jeremy Ronquillo | 3008aa3 | 2017-07-07 15:38:57 -0700 | [diff] [blame] | 174 | utilities.assert_equals( expect=main.TRUE, |
| 175 | actual=loadVPLSResult, |
| 176 | onpass="Loaded vpls configuration.", |
| 177 | onfail="Failed to load vpls configuration." ) |
| 178 | |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 179 | # Time for netcfg to load data |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 180 | time.sleep( main.sleep ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 181 | # 'Master' copy of test configuration |
Jeremy Ronquillo | 3008aa3 | 2017-07-07 15:38:57 -0700 | [diff] [blame] | 182 | |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 183 | try: |
| 184 | with open( os.path.expanduser( fileName ) ) as dataFile: |
| 185 | originalCfg = json.load( dataFile ) |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 186 | main.vplsConfig = originalCfg[ 'apps' ].get( app ).get( 'vpls' ).get( 'vplsList' ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 187 | except Exception as e: |
| 188 | main.log.error( "Error loading config file: {}".format( e ) ) |
| 189 | if main.vplsConfig: |
| 190 | result = True |
| 191 | else: |
| 192 | result = False |
| 193 | utilities.assert_equals( expect=True, |
| 194 | actual=result, |
| 195 | onpass="Loaded vpls configuration", |
| 196 | onfail="Failed to load vpls configuration" ) |
| 197 | |
| 198 | main.step( "Check interface configurations" ) |
| 199 | result = False |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 200 | getPorts = utilities.retry( f=main.Cluster.active( 0 ).REST.getNetCfg, |
Jeremy Ronquillo | 4a30ffe | 2017-06-07 11:36:35 -0700 | [diff] [blame] | 201 | retValue=False, |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 202 | kwargs={ "subjectClass" :"ports" }, |
| 203 | sleep=main.sleep ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 204 | onosCfg = pprint( getPorts ) |
| 205 | sentCfg = pprint( originalCfg.get( "ports" ) ) |
| 206 | |
| 207 | if onosCfg == sentCfg: |
| 208 | main.log.info( "ONOS interfaces NetCfg matches what was sent" ) |
| 209 | result = True |
| 210 | else: |
| 211 | main.log.error( "ONOS interfaces NetCfg doesn't match what was sent" ) |
| 212 | main.log.debug( "ONOS config: {}".format( onosCfg ) ) |
| 213 | main.log.debug( "Sent config: {}".format( sentCfg ) ) |
| 214 | utilities.assert_equals( expect=True, |
| 215 | actual=result, |
| 216 | onpass="Net Cfg added for interfaces", |
| 217 | onfail="Net Cfg not added for interfaces" ) |
| 218 | |
| 219 | # Run a bunch of checks to verify functionality based on configs |
| 220 | vpls.verify( main ) |
| 221 | |
Jeremy Ronquillo | 3008aa3 | 2017-07-07 15:38:57 -0700 | [diff] [blame] | 222 | main.step( "Loading vpls configuration in case any configuration was missed." ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 223 | loadVPLSResult = main.ONOSbench.onosNetCfg( main.Cluster.active( 0 ).ipAddress, "", fileName ) |
Jeremy Ronquillo | 3008aa3 | 2017-07-07 15:38:57 -0700 | [diff] [blame] | 224 | utilities.assert_equals( expect=main.TRUE, |
| 225 | actual=loadVPLSResult, |
| 226 | onpass="Loaded vpls configuration.", |
| 227 | onfail="Failed to load vpls configuration." ) |
| 228 | |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 229 | def CASE10( self, main ): |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 230 | """ |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 231 | Remove an interface from a vpls network |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 232 | """ |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 233 | main.step( "Remove an interface from a vpls network" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 234 | main.Cluster.active( 0 ).CLI.vplsRemIface( 'VPLS1', 'h1' ) |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 235 | time.sleep( main.sleep ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 236 | #update master config json |
| 237 | for network in main.vplsConfig: |
| 238 | if network.get( 'name' ) == 'VPLS1': |
| 239 | ifaces = network.get( 'interfaces' ) |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 240 | ifaces.remove( 'h1' ) |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 241 | main.vpls.verify( main ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 242 | |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 243 | |
| 244 | def CASE11( self, main ): |
| 245 | """ |
| 246 | Clean all VPLS configurations |
| 247 | """ |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 248 | main.step( "Clean all vpls configurations" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 249 | main.Cluster.active( 0 ).CLI.vplsClean() |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 250 | time.sleep( main.sleep ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 251 | main.vplsConfig = [] |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 252 | main.vpls.verify( main ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 253 | |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 254 | |
| 255 | def CASE12( self, main ): |
| 256 | """ |
| 257 | Create a new VPLS network. |
| 258 | """ |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 259 | main.step( "Create a new vpls network" ) |
| 260 | name = "Network1" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 261 | main.Cluster.active( 0 ).CLI.vplsCreate( name ) |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 262 | time.sleep( main.sleep ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 263 | network1 = { 'name': name, 'interfaces': [], 'encapsulation': 'NONE' } |
| 264 | main.vplsConfig.append( network1 ) |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 265 | main.vpls.verify( main ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 266 | |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 267 | |
| 268 | def CASE13( self, main ): |
| 269 | """ |
| 270 | Add interfaces to the new VPLS network. |
| 271 | """ |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 272 | main.step( "Add interfaces to the network" ) |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 273 | utilities.retry( f=main.Cluster.active( 0 ).CLI.vplsAddIface, |
| 274 | retValue=main.FALSE, |
| 275 | args=( name, "h1" ), |
| 276 | sleep=main.sleep ) |
| 277 | utilities.retry( f=main.Cluster.active( 0 ).CLI.vplsAddIface, |
| 278 | retValue=main.FALSE, |
| 279 | args=( name, "h5" ), |
| 280 | sleep=main.sleep ) |
| 281 | utilities.retry( f=main.Cluster.active( 0 ).CLI.vplsAddIface, |
| 282 | retValue=main.FALSE, |
| 283 | args=( name, "h4" ), |
| 284 | sleep=main.sleep ) |
| 285 | time.sleep( main.sleep ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 286 | for network in main.vplsConfig: |
| 287 | if network.get( 'name' ) == name: |
| 288 | ifaces = network.get( 'interfaces' ) |
| 289 | ifaces.append( 'h1' ) |
| 290 | ifaces.append( 'h4' ) |
| 291 | ifaces.append( 'h5' ) |
| 292 | network[ 'interfaces' ] = ifaces |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 293 | main.vpls.verify( main ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 294 | |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 295 | |
| 296 | def CASE14( self, main ): |
| 297 | """ |
| 298 | Add MPLS encapsulation. |
| 299 | """ |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 300 | main.step( "Add MPLS encapsulation to a vpls network" ) |
| 301 | encapType = "MPLS" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 302 | main.Cluster.active( 0 ).CLI.vplsSetEncap( name, encapType ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 303 | for network in main.vplsConfig: |
| 304 | if network.get( 'name' ) == name: |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 305 | network[ 'encapsulation' ] = encapType |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 306 | time.sleep( main.sleep ) |
| 307 | main.vpls.verify( main ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 308 | |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 309 | |
| 310 | def CASE15( self, main ): |
| 311 | """ |
| 312 | Change an encapsulation type. |
| 313 | """ |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 314 | main.step( "Change an encapsulation type" ) |
| 315 | encapType = "VLAN" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 316 | main.Cluster.active( 0 ).CLI.vplsSetEncap( name, encapType ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 317 | for network in main.vplsConfig: |
| 318 | if network.get( 'name' ) == name: |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 319 | network[ 'encapsulation' ] = encapType |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 320 | time.sleep( main.sleep ) |
| 321 | main.vpls.verify( main ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 322 | |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 323 | |
| 324 | def CASE16( self, main ): |
| 325 | """ |
| 326 | Remove encapsulation. |
| 327 | """ |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 328 | main.step( "Remove encapsulation" ) |
| 329 | encapType = "NONE" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 330 | main.Cluster.active( 0 ).CLI.vplsSetEncap( name, encapType ) |
Jon Hall | 2c8959e | 2016-12-16 12:17:34 -0800 | [diff] [blame] | 331 | for network in main.vplsConfig: |
| 332 | if network.get( 'name' ) == name: |
Jon Hall | ed25823 | 2017-05-24 17:30:18 -0700 | [diff] [blame] | 333 | network[ 'encapsulation' ] = encapType |
Jeremy Ronquillo | d7791d8 | 2017-08-14 16:23:08 +0000 | [diff] [blame] | 334 | time.sleep( main.sleep ) |
| 335 | main.vpls.verify( main ) |