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