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