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