AntonySilvester | a1080f2 | 2016-04-26 13:05:57 +0530 | [diff] [blame] | 1 | """ |
| 2 | **** Scripted by Antony Silvester - antony.silvester@huawei.com ****** |
| 3 | |
| 4 | |
| 5 | This Test check the bgp_ls functionality |
| 6 | |
| 7 | List of test cases: |
| 8 | CASE1: Compile ONOS and push it to the test machines |
| 9 | CASE2: Discovery the topology using BGPLS |
| 10 | CASE3: Addition of new Node to existing topology |
| 11 | CASE4: Deletion of Node |
| 12 | Case5: Uninstalling the app |
| 13 | |
| 14 | |
| 15 | """ |
| 16 | |
| 17 | |
| 18 | class FUNCbgpls: |
| 19 | |
| 20 | def __init__( self ): |
| 21 | self.default = '' |
| 22 | |
| 23 | def CASE1( self, main ): |
| 24 | """ |
| 25 | CASE1 is to compile ONOS and push it to the test machines |
| 26 | |
| 27 | Startup sequence: |
| 28 | cell <name> |
| 29 | onos-verify-cell |
| 30 | NOTE: temporary - onos-remove-raft-logs |
| 31 | onos-uninstall |
| 32 | git pull |
| 33 | mvn clean install |
| 34 | onos-package |
| 35 | onos-install -f |
| 36 | onos-wait-for-start |
| 37 | start cli sessions |
| 38 | start BGPLS apps |
| 39 | |
| 40 | """ |
| 41 | |
| 42 | import os |
| 43 | main.log.info( "ONOS Single node start " + |
| 44 | "Scapy Tool - initialization" ) |
| 45 | main.case( "Setting up test environment" ) |
| 46 | main.caseExplanation = "Setup the test environment including " +\ |
| 47 | "installing ONOS, start ONOS." |
| 48 | |
| 49 | |
| 50 | PULLCODE = False |
| 51 | if main.params[ 'GIT' ][ 'pull' ] == 'True': |
| 52 | PULLCODE = True |
| 53 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 54 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 55 | ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 56 | scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] ) |
| 57 | |
| 58 | main.log.info( "Removing raft logs" ) |
| 59 | main.ONOSbench.onosRemoveRaftLogs() |
| 60 | |
| 61 | main.CLIs = [] |
| 62 | main.nodes = [] |
| 63 | main.numCtrls= 1 |
| 64 | |
| 65 | for i in range( 1, main.numCtrls + 1 ): |
| 66 | try: |
| 67 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 68 | main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 69 | ipList.append( main.nodes[ -1 ].ip_address ) |
| 70 | except AttributeError: |
| 71 | break |
| 72 | |
| 73 | main.log.info( "Uninstalling ONOS" ) |
| 74 | for node in main.nodes: |
| 75 | main.ONOSbench.onosUninstall( node.ip_address ) |
| 76 | |
| 77 | main.step( "Create cell file" ) |
| 78 | cellAppString = main.params[ 'ENV' ][ 'cellApps' ] |
| 79 | |
| 80 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName, |
| 81 | scapy_ip, |
| 82 | cellAppString, ipList ) |
| 83 | |
| 84 | main.step( "Applying cell variable to environment" ) |
| 85 | cellResult = main.ONOSbench.setCell( cellName ) |
| 86 | |
| 87 | verifyResult = main.ONOSbench.verifyCell() |
| 88 | |
| 89 | # Make sure ONOS process is not running |
| 90 | main.log.info( "Killing any ONOS processes" ) |
| 91 | killResults = main.TRUE |
| 92 | for node in main.nodes: |
| 93 | killed = main.ONOSbench.onosKill( node.ip_address ) |
| 94 | killResults = killResults and killed |
| 95 | |
| 96 | cleanInstallResult = main.TRUE |
| 97 | gitPullResult = main.FALSE |
| 98 | main.step( "Git checkout and pull" + gitBranch ) |
| 99 | if PULLCODE: |
| 100 | main.ONOSbench.gitCheckout( gitBranch ) |
| 101 | gitPullResult = main.ONOSbench.gitPull() |
| 102 | # values of 1 or 3 are good |
| 103 | utilities.assert_lesser( expect=0, actual=gitPullResult, |
| 104 | onpass="Git pull successful", |
| 105 | onfail="Git pull failed" ) |
| 106 | |
| 107 | #main.ONOSbench.getVersion( report=True ) |
| 108 | |
| 109 | main.step( "Using mvn clean install" ) |
| 110 | cleanInstallResult = main.TRUE |
| 111 | if PULLCODE and gitPullResult == main.TRUE: |
| 112 | cleanInstallResult = main.ONOSbench.cleanInstall() |
| 113 | else: |
| 114 | main.log.warn( "Did not pull new code so skipping mvn" + |
| 115 | "clean install" ) |
| 116 | utilities.assert_equals( expect=main.TRUE, |
| 117 | actual=cleanInstallResult, |
| 118 | onpass="MCI successful", |
| 119 | onfail="MCI failed" ) |
| 120 | |
| 121 | main.step( "Creating ONOS package" ) |
| 122 | packageResult = main.ONOSbench.onosPackage() |
| 123 | utilities.assert_equals( expect=main.TRUE, |
| 124 | actual=packageResult, |
| 125 | onpass="Successfully created ONOS package", |
| 126 | onfail="Failed to create ONOS package" ) |
| 127 | |
| 128 | main.step( "Installing ONOS package" ) |
| 129 | onosInstallResult = main.ONOSbench.onosInstall( |
| 130 | options="-f", node=main.nodes[0].ip_address ) |
| 131 | utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult, |
| 132 | onpass="ONOS install successful", |
| 133 | onfail="ONOS install failed" ) |
| 134 | |
| 135 | main.step( "Checking if ONOS is up yet" ) |
| 136 | print main.nodes[0].ip_address |
| 137 | for i in range( 2 ): |
| 138 | onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address ) |
| 139 | if onos1Isup: |
| 140 | break |
| 141 | utilities.assert_equals( expect=main.TRUE, actual=onos1Isup, |
| 142 | onpass="ONOS startup successful", |
| 143 | onfail="ONOS startup failed" ) |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 144 | main.step( "Starting ONOS CLI sessions" ) |
AntonySilvester | a1080f2 | 2016-04-26 13:05:57 +0530 | [diff] [blame] | 145 | print main.nodes[0].ip_address |
| 146 | cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address ) |
| 147 | utilities.assert_equals( expect=main.TRUE, actual=cliResults, |
| 148 | onpass="ONOS cli startup successful", |
| 149 | onfail="ONOS cli startup failed" ) |
| 150 | |
| 151 | main.step( "App Ids check" ) |
| 152 | appCheck = main.ONOScli1.appToIDCheck() |
| 153 | |
| 154 | if appCheck !=main.TRUE: |
| 155 | main.log.warn( main.CLIs[0].apps() ) |
| 156 | main.log.warn( main.CLIs[0].appIDs() ) |
| 157 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 158 | onpass="App Ids seem to be correct", |
| 159 | onfail="Something is wrong with app Ids" ) |
| 160 | if cliResults == main.FALSE: |
| 161 | main.log.error( "Failed to start ONOS,stopping test" ) |
| 162 | main.cleanup() |
| 163 | main.exit() |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | def CASE2( self, main ): |
| 170 | """ |
| 171 | Discovery the topology using BGPLS |
| 172 | """ |
| 173 | import os , sys |
| 174 | import re |
| 175 | import time |
| 176 | |
| 177 | main.case( "Testcase 2 : Discovery the Network Topology using BGPLS" ) |
| 178 | |
| 179 | try: |
| 180 | from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs |
| 181 | except ImportError: |
| 182 | main.log.exception( "Something wrong with import file or code error." ) |
| 183 | main.log.info( "Import Error, please check!" ) |
| 184 | main.cleanup() |
| 185 | main.exit() |
| 186 | |
| 187 | bgplsConfig = BgpLs() |
| 188 | Ne_id = bgplsConfig.Constants() |
| 189 | app = bgplsConfig.apps() |
| 190 | main.CLIs = [] |
| 191 | main.nodes = [] |
| 192 | main.numCtrls= 1 |
| 193 | |
| 194 | |
| 195 | ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 196 | scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] ) |
| 197 | httpport = main.params['HTTP']['port'] |
| 198 | path = main.params['HTTP']['path'] |
| 199 | bgplsConfig.ipValue(ipList,scapy_ip) |
| 200 | |
| 201 | for i in range( 1, main.numCtrls + 1 ): |
| 202 | try: |
| 203 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 204 | main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 205 | ipList.append( main.nodes[ -1 ].ip_address ) |
| 206 | except AttributeError: |
| 207 | break |
| 208 | |
| 209 | main.step( "Apply cell to environment" ) |
| 210 | bgplsConfig.Comments() |
| 211 | |
| 212 | bgplsConfig.Comments() |
| 213 | main.log.info( "Sending BGPLS information " ) |
| 214 | bgplsConfig.Comments() |
| 215 | |
| 216 | |
| 217 | main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/\ |
| 218 | dependencies/Scapyfiles/Topo_discovery.py" ) |
| 219 | bgplsConfig.Comments() |
| 220 | main.log.info( "Enable BGPlS plugin in ONOS" ) |
| 221 | bgplsConfig.Comments() |
| 222 | |
| 223 | |
| 224 | cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address) |
| 225 | |
| 226 | main.step( "Getting connected to ONOS" ) |
| 227 | utilities.assert_equals( expect=main.TRUE, actual=cliResults, |
| 228 | onpass="ONOS cli startup successful", |
| 229 | onfail="ONOS cli startup failed" ) |
| 230 | installResults = main.ONOScli1.activateApp( app[0]) |
| 231 | |
| 232 | main.step( "Install onos-app-bgp" ) |
| 233 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 234 | onpass="Install onos-app-bgp successful", |
| 235 | onfail="Install onos-app-bgp failed" ) |
| 236 | |
| 237 | bgpls_post = bgplsConfig.DictoJson() |
| 238 | |
| 239 | bgplsConfig.Comments() |
| 240 | main.log.info( "BGPLS RestConf input" ) |
| 241 | bgplsConfig.Comments() |
| 242 | |
| 243 | print (bgpls_post) |
| 244 | main.ONOSrest.user_name = "karaf" |
| 245 | main.ONOSrest.pwd = "karaf" |
Jon Hall | 1f5e65f | 2016-06-15 10:06:05 -0700 | [diff] [blame] | 246 | Poststatus, result = main.ONOSrest.send( '/network/configuration/', method="POST", data=bgpls_post) |
AntonySilvester | a1080f2 | 2016-04-26 13:05:57 +0530 | [diff] [blame] | 247 | main.step( "Configure BGP through RESTCONF" ) |
| 248 | |
| 249 | utilities.assert_equals( |
| 250 | expect='200', |
| 251 | actual=Poststatus, |
| 252 | onpass="Post Port Success", |
| 253 | onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) ) |
| 254 | |
| 255 | |
| 256 | bgplsConfig.Comments() |
| 257 | main.log.info( "Check Network devices are Updated in ONOS " ) |
| 258 | bgplsConfig.Comments() |
| 259 | time.sleep(15) |
| 260 | |
| 261 | response = main.ONOScli1.devices() |
| 262 | main.step( "Check the nodes are discovered" ) |
| 263 | if response.find( Ne_id[1][0]) and response.find(Ne_id[1][1]) and response.find(Ne_id[1][2]) != -1: |
| 264 | stepResult = main.TRUE |
| 265 | else: |
| 266 | stepResult = main.FALSE |
| 267 | utilities.assert_equals( expect=main.TRUE, |
| 268 | actual=stepResult, |
| 269 | onpass="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " sucess", |
| 270 | onfail="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " failed" ) |
| 271 | |
| 272 | |
| 273 | bgplsConfig.Comments() |
| 274 | main.log.info( "Kill Scapy process" ) |
| 275 | bgplsConfig.Comments() |
| 276 | |
| 277 | main.Scapy1.handle.sendline( "\x03" ) |
| 278 | time.sleep(90) #This Sleep time gives time for the socket to close. |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | def CASE3( self, main ): |
| 284 | """ |
| 285 | Addition of new Node to existing topology |
| 286 | """ |
| 287 | import os , sys |
| 288 | import re |
| 289 | import time |
| 290 | |
| 291 | main.case( "Testcase 3: Addition of New Node to existing topology" ) |
| 292 | try: |
| 293 | from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs |
| 294 | except ImportError: |
| 295 | main.log.exception( "Something wrong with import file or code error." ) |
| 296 | main.log.info( "Import Error, please check!" ) |
| 297 | main.cleanup() |
| 298 | main.exit() |
| 299 | |
| 300 | bgplsConfig = BgpLs() |
| 301 | Ne_id = bgplsConfig.Constants() |
| 302 | app = bgplsConfig.apps() |
| 303 | main.CLIs = [] |
| 304 | main.nodes = [] |
| 305 | main.numCtrls= 1 |
| 306 | |
| 307 | |
| 308 | ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 309 | scapy_ip = os.getenv( main.params ['SCAPY'] ['HOSTNAMES'] ) |
| 310 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 311 | cellAppString= main.params[ 'ENV' ][ 'cellApps' ] |
| 312 | httpport = main.params['HTTP']['port'] |
| 313 | path = main.params['HTTP']['path'] |
| 314 | |
| 315 | bgplsConfig.ipValue(ipList,scapy_ip) |
| 316 | |
| 317 | for i in range( 1, main.numCtrls + 1 ): |
| 318 | try: |
| 319 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 320 | main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 321 | ipList.append( main.nodes[ -1 ].ip_address ) |
| 322 | except AttributeError: |
| 323 | break |
| 324 | |
| 325 | bgplsConfig.Comments() |
| 326 | main.log.info( "Sending BGPLS Packet " ) |
| 327 | bgplsConfig.Comments() |
| 328 | |
| 329 | main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/\ |
| 330 | dependencies/Scapyfiles/Update_Node.py" ) |
| 331 | bgplsConfig.Comments() |
| 332 | main.log.info( "Enable BGPlS plugin in ONOS" ) |
| 333 | bgplsConfig.Comments() |
| 334 | |
| 335 | main.step( "UnInstall onos-app-bgp" ) |
| 336 | installResults = main.ONOScli1.deactivateApp( app[0] ) |
| 337 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 338 | onpass="Uninstall onos-app-bgp successful", |
| 339 | onfail="Uninstall onos-app-bgp failed" ) |
| 340 | |
| 341 | installResults = main.ONOScli1.activateApp( app[0]) |
| 342 | main.step( "Install onos-app-bgp" ) |
| 343 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 344 | onpass="Install onos-app-bgp successful", |
| 345 | onfail="Install onos-app-bgp failed" ) |
| 346 | |
| 347 | |
| 348 | bgpls_post = bgplsConfig.DictoJson() |
| 349 | |
| 350 | bgplsConfig.Comments() |
| 351 | main.log.info( "BGPLS RestConf input" ) |
| 352 | bgplsConfig.Comments() |
| 353 | |
| 354 | bgplsConfig.Comments() |
| 355 | main.log.info( "Check Network devices are Updated in ONOS " ) |
| 356 | bgplsConfig.Comments() |
| 357 | time.sleep(120) |
| 358 | |
| 359 | response = main.ONOScli1.devices() |
| 360 | main.step( "Check Newly added Node is getting updated" ) |
| 361 | |
| 362 | if response.find( Ne_id[1][3]) != -1: |
| 363 | stepResult = main.TRUE |
| 364 | else: |
| 365 | stepResult = main.FALSE |
| 366 | utilities.assert_equals( expect=main.TRUE, |
| 367 | actual=stepResult, |
| 368 | onpass="Node " + str( Ne_id[1][3] ) + " update sucess", |
| 369 | onfail="Node " + str( Ne_id[1][3]) + " update failed" ) |
| 370 | bgplsConfig.Comments() |
| 371 | main.log.info( "Kill Scapy process" ) |
| 372 | bgplsConfig.Comments() |
| 373 | main.Scapy1.handle.sendline( "\x03" ) |
| 374 | |
| 375 | |
| 376 | |
| 377 | def CASE4( self, main ): |
| 378 | """ |
| 379 | Deletion of Node |
| 380 | """ |
| 381 | import os , sys |
| 382 | import re |
| 383 | import time |
| 384 | main.case( "TestCase 4: Deletion of Node from existing Topology" ) |
| 385 | |
| 386 | try: |
| 387 | from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs |
| 388 | except ImportError: |
| 389 | main.log.exception( "Something wrong with import file or code error." ) |
| 390 | main.log.info( "Import Error, please check!" ) |
| 391 | main.cleanup() |
| 392 | main.exit() |
| 393 | |
| 394 | bgplsConfig = BgpLs() |
| 395 | Ne_id = bgplsConfig.Constants() |
| 396 | app = bgplsConfig.apps() |
| 397 | main.CLIs = [] |
| 398 | main.nodes = [] |
| 399 | main.numCtrls= 1 |
| 400 | |
| 401 | bgplsConfig.Comments() |
| 402 | main.log.info( "Blocked due to this defect : ONOS-3920 " ) |
| 403 | bgplsConfig.Comments() |
| 404 | |
| 405 | ''' |
| 406 | ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 407 | scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] ) |
| 408 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 409 | cellAppString= main.params[ 'ENV' ][ 'cellApps' ] |
| 410 | httpport = main.params['HTTP']['port'] |
| 411 | path = main.params['HTTP']['path'] |
| 412 | bgplsConfig = BgpLs() |
| 413 | bgplsConfig.ipValue(ipList,scapy_ip) |
| 414 | |
| 415 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName, |
| 416 | scapy_ip, |
| 417 | cellAppString, ipList , onosUser="karaf" ) |
| 418 | |
| 419 | for i in range( 1, main.numCtrls + 1 ): |
| 420 | try: |
| 421 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 422 | main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 423 | ipList.append( main.nodes[ -1 ].ip_address ) |
| 424 | except AttributeError: |
| 425 | break |
| 426 | |
| 427 | main.step( "Apply cell to environment" ) |
| 428 | bgplsConfig.Comments() |
| 429 | cellResult = main.ONOSbench.setCell( cellName ) |
| 430 | |
| 431 | bgplsConfig.Comments() |
| 432 | main.log.info( "Sending BGPLS information " ) |
| 433 | bgplsConfig.Comments() |
| 434 | |
| 435 | |
| 436 | main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py" ) |
| 437 | #main.Scapy1.handle.expect( "sdn:" ) |
| 438 | #main.Scapy1.handle.sendline( "rocks" ) |
| 439 | |
| 440 | |
| 441 | bgplsConfig.Comments() |
| 442 | main.log.info( "Enable BGPlS plugin in ONOS" ) |
| 443 | bgplsConfig.Comments() |
| 444 | |
| 445 | |
| 446 | cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address) |
| 447 | |
| 448 | main.step( "Getting connected to ONOS" ) |
| 449 | utilities.assert_equals( expect=main.TRUE, actual=cliResults, |
| 450 | onpass="ONOS cli startup successful", |
| 451 | onfail="ONOS cli startup failed" ) |
| 452 | installResults = main.ONOScli1.activateApp( app[0]) |
| 453 | |
| 454 | main.step( "Install onos-app-bgp" ) |
| 455 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 456 | onpass="Install onos-app-bgp successful", |
| 457 | onfail="Install onos-app-bgp failed" ) |
| 458 | |
| 459 | main.step( "Install onos-app-bgpflow" ) |
| 460 | installResults = main.ONOScli1.activateApp( app[1] ) |
| 461 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 462 | onpass="Install onos-app-bgpflow successful", |
| 463 | onfail="Install onos-app-bgpflow failed" ) |
| 464 | |
| 465 | |
| 466 | bgpls_post = bgplsConfig.DictoJson() |
| 467 | |
| 468 | bgplsConfig.Comments() |
| 469 | main.log.info( "BGPLS RestConf input" ) |
| 470 | bgplsConfig.Comments() |
| 471 | |
| 472 | print (bgpls_post) |
| 473 | main.ONOSrest.user_name = "karaf" |
| 474 | main.ONOSrest.pwd = "karaf" |
| 475 | Poststatus, result = main.ONOSrest.send( ipList,httpport,'', path + 'v1/network/configuration/', |
| 476 | 'POST', None, bgpls_post, debug=True ) |
| 477 | |
| 478 | main.step( "Configure BGP through RESTCONF" ) |
| 479 | utilities.assert_equals( |
| 480 | expect='200', |
| 481 | actual=Poststatus, |
| 482 | onpass="Post Port Success", |
| 483 | onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) ) |
| 484 | |
| 485 | |
| 486 | bgplsConfig.Comments() |
| 487 | main.log.info( "Check Network devices is deleted from ONOS " ) |
| 488 | bgplsConfig.Comments() |
| 489 | time.sleep(15) |
| 490 | |
| 491 | response = main.ONOScli1.devices() |
| 492 | |
| 493 | main.step( "Check whehther Node is deleted successfully" ) |
| 494 | |
| 495 | if response.find(Ne_id[3]) != -1: |
| 496 | stepResult = main.TRUE |
| 497 | else: |
| 498 | stepResult = main.FALSE |
| 499 | utilities.assert_equals( expect=main.FALSE, |
| 500 | actual=stepResult, |
| 501 | onpass="Node " + str( Ne_id[3] ) + " Deletion sucess", |
| 502 | onfail="Node " + str( Ne_id[3] ) + " Deletion failed" ) |
| 503 | |
| 504 | bgplsConfig.Comments() |
| 505 | main.log.info( "Kill Scapy process" ) |
| 506 | bgplsConfig.Comments() |
| 507 | |
| 508 | main.Scapy1.handle.sendline( "\x03" ) |
| 509 | ''' |
| 510 | |
| 511 | |
| 512 | def CASE5( self, main ): |
| 513 | """ |
| 514 | Uninstalling the app |
| 515 | """ |
| 516 | import os,sys |
| 517 | import re |
| 518 | import time |
| 519 | |
| 520 | main.case( "TestCase 5: UnInstalling of app" ) |
| 521 | try: |
| 522 | from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs |
| 523 | except ImportError: |
| 524 | main.log.exception( "Something wrong with import file or code error." ) |
| 525 | main.log.info( "Import Error, please check!" ) |
| 526 | main.cleanup() |
| 527 | main.exit() |
| 528 | |
| 529 | bgplsConfig = BgpLs() |
| 530 | app = bgplsConfig.apps() |
| 531 | main.CLIs = [] |
| 532 | main.nodes = [] |
| 533 | main.numCtrls= 1 |
| 534 | |
| 535 | |
| 536 | ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 537 | scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] ) |
| 538 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 539 | cellAppString= main.params[ 'ENV' ][ 'cellApps' ] |
| 540 | |
| 541 | bgplsConfig = BgpLs() |
| 542 | bgplsConfig.ipValue(ipList,scapy_ip) |
| 543 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName, |
| 544 | scapy_ip, |
| 545 | cellAppString, ipList , onosUser="karaf" ) |
| 546 | |
| 547 | for i in range( 1, main.numCtrls + 1 ): |
| 548 | try: |
| 549 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 550 | main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 551 | ipList.append( main.nodes[ -1 ].ip_address ) |
| 552 | except AttributeError: |
| 553 | break |
| 554 | |
| 555 | main.step( "Apply cell to environment" ) |
| 556 | bgplsConfig.Comments() |
| 557 | cellResult = main.ONOSbench.setCell( cellName ) |
| 558 | |
| 559 | bgplsConfig.Comments() |
| 560 | main.log.info( "Logging into ONOS CLI " ) |
| 561 | bgplsConfig.Comments() |
| 562 | |
| 563 | cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address ) |
| 564 | utilities.assert_equals( expect=main.TRUE, actual=cliResults, |
| 565 | onpass="ONOS cli startup successful", |
| 566 | onfail="ONOS cli startup failed" ) |
| 567 | |
| 568 | bgplsConfig.Comments() |
| 569 | main.log.info( "Uninstall onos-app-bgp" ) |
| 570 | bgplsConfig.Comments() |
| 571 | main.step( "UnInstall onos-app-bgp" ) |
| 572 | installResults = main.ONOScli1.deactivateApp( app[0] ) |
| 573 | utilities.assert_equals( expect=main.TRUE, actual=installResults, |
| 574 | onpass="Uninstall onos-app-bgp successful", |
| 575 | onfail="Uninstall onos-app-bgp failed" ) |
| 576 | |
| 577 | |
| 578 | |