blob: f799854facda2c4ec7e5b1861a02f466960193b6 [file] [log] [blame]
AntonySilvestera1080f22016-04-26 13:05:57 +05301"""
2**** Scripted by Antony Silvester - antony.silvester@huawei.com ******
3
4
5This Test check the bgp_ls functionality
6
7List of test cases:
8CASE1: Compile ONOS and push it to the test machines
9CASE2: Discovery the topology using BGPLS
10CASE3: Addition of new Node to existing topology
AntonySilvester02652382016-07-13 16:44:45 +053011CASE4: Verification of Links thats is discovered"
12CASE5: Deletion of Links
13Case6: Uninstalling the app
AntonySilvestera1080f22016-04-26 13:05:57 +053014
15
16"""
17
18
19class FUNCbgpls:
20
21 def __init__( self ):
22 self.default = ''
23
24 def CASE1( self, main ):
25 """
26 CASE1 is to compile ONOS and push it to the test machines
27
28 Startup sequence:
29 cell <name>
30 onos-verify-cell
31 NOTE: temporary - onos-remove-raft-logs
32 onos-uninstall
33 git pull
34 mvn clean install
35 onos-package
36 onos-install -f
37 onos-wait-for-start
38 start cli sessions
39 start BGPLS apps
40
41 """
42
43 import os
44 main.log.info( "ONOS Single node start " +
45 "Scapy Tool - initialization" )
46 main.case( "Setting up test environment" )
47 main.caseExplanation = "Setup the test environment including " +\
48 "installing ONOS, start ONOS."
49
50
51 PULLCODE = False
52 if main.params[ 'GIT' ][ 'pull' ] == 'True':
53 PULLCODE = True
54 gitBranch = main.params[ 'GIT' ][ 'branch' ]
55 cellName = main.params[ 'ENV' ][ 'cellName' ]
56 ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
57 scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
58
59 main.log.info( "Removing raft logs" )
60 main.ONOSbench.onosRemoveRaftLogs()
61
62 main.CLIs = []
63 main.nodes = []
64 main.numCtrls= 1
65
66 for i in range( 1, main.numCtrls + 1 ):
67 try:
68 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
69 main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
70 ipList.append( main.nodes[ -1 ].ip_address )
71 except AttributeError:
72 break
73
74 main.log.info( "Uninstalling ONOS" )
75 for node in main.nodes:
76 main.ONOSbench.onosUninstall( node.ip_address )
77
78 main.step( "Create cell file" )
79 cellAppString = main.params[ 'ENV' ][ 'cellApps' ]
80
81 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
82 scapy_ip,
83 cellAppString, ipList )
84
85 main.step( "Applying cell variable to environment" )
86 cellResult = main.ONOSbench.setCell( cellName )
87
88 verifyResult = main.ONOSbench.verifyCell()
89
90 # Make sure ONOS process is not running
91 main.log.info( "Killing any ONOS processes" )
92 killResults = main.TRUE
93 for node in main.nodes:
94 killed = main.ONOSbench.onosKill( node.ip_address )
95 killResults = killResults and killed
96
97 cleanInstallResult = main.TRUE
98 gitPullResult = main.FALSE
99 main.step( "Git checkout and pull" + gitBranch )
100 if PULLCODE:
101 main.ONOSbench.gitCheckout( gitBranch )
102 gitPullResult = main.ONOSbench.gitPull()
103 # values of 1 or 3 are good
104 utilities.assert_lesser( expect=0, actual=gitPullResult,
105 onpass="Git pull successful",
106 onfail="Git pull failed" )
107
108 #main.ONOSbench.getVersion( report=True )
109
110 main.step( "Using mvn clean install" )
111 cleanInstallResult = main.TRUE
112 if PULLCODE and gitPullResult == main.TRUE:
113 cleanInstallResult = main.ONOSbench.cleanInstall()
114 else:
115 main.log.warn( "Did not pull new code so skipping mvn" +
116 "clean install" )
117 utilities.assert_equals( expect=main.TRUE,
118 actual=cleanInstallResult,
119 onpass="MCI successful",
120 onfail="MCI failed" )
121
122 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700123 packageResult = main.ONOSbench.buckBuild()
AntonySilvestera1080f22016-04-26 13:05:57 +0530124 utilities.assert_equals( expect=main.TRUE,
125 actual=packageResult,
126 onpass="Successfully created ONOS package",
127 onfail="Failed to create ONOS package" )
128
129 main.step( "Installing ONOS package" )
130 onosInstallResult = main.ONOSbench.onosInstall(
alisonb1a26522016-11-22 17:27:17 -0800131 options="-f", node=main.nodes[ 0 ].ip_address )
AntonySilvestera1080f22016-04-26 13:05:57 +0530132 utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult,
133 onpass="ONOS install successful",
134 onfail="ONOS install failed" )
135
136 main.step( "Checking if ONOS is up yet" )
137 print main.nodes[0].ip_address
138 for i in range( 2 ):
alisonb1a26522016-11-22 17:27:17 -0800139 onos1Isup = main.ONOSbench.isup( main.nodes[ 0 ].ip_address )
AntonySilvestera1080f22016-04-26 13:05:57 +0530140 if onos1Isup:
141 break
142 utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
143 onpass="ONOS startup successful",
144 onfail="ONOS startup failed" )
Chiyu Chengef109502016-11-21 15:51:38 -0800145
146 main.step( "Set up ONOS secure SSH" )
alisonb1a26522016-11-22 17:27:17 -0800147 secureSshResult = main.ONOSbench.onosSecureSSH( node=main.nodes[ 0 ].ip_address )
Chiyu Chengef109502016-11-21 15:51:38 -0800148 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
alisonb1a26522016-11-22 17:27:17 -0800149 onpass="Test step PASS",
150 onfail="Test step FAIL" )
Chiyu Chengef109502016-11-21 15:51:38 -0800151
Jon Hall6509dbf2016-06-21 17:01:17 -0700152 main.step( "Starting ONOS CLI sessions" )
alisonb1a26522016-11-22 17:27:17 -0800153 print main.nodes[ 0 ].ip_address
154 cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address )
AntonySilvestera1080f22016-04-26 13:05:57 +0530155 utilities.assert_equals( expect=main.TRUE, actual=cliResults,
156 onpass="ONOS cli startup successful",
157 onfail="ONOS cli startup failed" )
158
159 main.step( "App Ids check" )
160 appCheck = main.ONOScli1.appToIDCheck()
161
162 if appCheck !=main.TRUE:
alisonb1a26522016-11-22 17:27:17 -0800163 main.log.warn( main.CLIs[ 0 ].apps() )
164 main.log.warn( main.CLIs[ 0 ].appIDs() )
AntonySilvestera1080f22016-04-26 13:05:57 +0530165 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
166 onpass="App Ids seem to be correct",
167 onfail="Something is wrong with app Ids" )
168 if cliResults == main.FALSE:
169 main.log.error( "Failed to start ONOS,stopping test" )
170 main.cleanup()
171 main.exit()
172
173
174
175
176
177 def CASE2( self, main ):
178 """
179 Discovery the topology using BGPLS
180 """
181 import os , sys
182 import re
183 import time
184
185 main.case( "Testcase 2 : Discovery the Network Topology using BGPLS" )
186
187 try:
188 from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
189 except ImportError:
190 main.log.exception( "Something wrong with import file or code error." )
191 main.log.info( "Import Error, please check!" )
192 main.cleanup()
193 main.exit()
194
195 bgplsConfig = BgpLs()
196 Ne_id = bgplsConfig.Constants()
197 app = bgplsConfig.apps()
198 main.CLIs = []
199 main.nodes = []
200 main.numCtrls= 1
201
202
203 ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
204 scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
205 httpport = main.params['HTTP']['port']
206 path = main.params['HTTP']['path']
207 bgplsConfig.ipValue(ipList,scapy_ip)
208
209 for i in range( 1, main.numCtrls + 1 ):
210 try:
211 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
212 main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
213 ipList.append( main.nodes[ -1 ].ip_address )
214 except AttributeError:
215 break
216
217 main.step( "Apply cell to environment" )
218 bgplsConfig.Comments()
219
220 bgplsConfig.Comments()
221 main.log.info( "Sending BGPLS information " )
222 bgplsConfig.Comments()
223
224
225 main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/\
226 dependencies/Scapyfiles/Topo_discovery.py" )
227 bgplsConfig.Comments()
228 main.log.info( "Enable BGPlS plugin in ONOS" )
229 bgplsConfig.Comments()
230
231
232 cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address)
233
234 main.step( "Getting connected to ONOS" )
235 utilities.assert_equals( expect=main.TRUE, actual=cliResults,
236 onpass="ONOS cli startup successful",
237 onfail="ONOS cli startup failed" )
238 installResults = main.ONOScli1.activateApp( app[0])
239
240 main.step( "Install onos-app-bgp" )
241 utilities.assert_equals( expect=main.TRUE, actual=installResults,
242 onpass="Install onos-app-bgp successful",
243 onfail="Install onos-app-bgp failed" )
244
245 bgpls_post = bgplsConfig.DictoJson()
246
247 bgplsConfig.Comments()
248 main.log.info( "BGPLS RestConf input" )
249 bgplsConfig.Comments()
250
251 print (bgpls_post)
alisonb1a26522016-11-22 17:27:17 -0800252 main.ONOSrest.user_name = "onos"
253 main.ONOSrest.pwd = "rocks"
Jon Hall1f5e65f2016-06-15 10:06:05 -0700254 Poststatus, result = main.ONOSrest.send( '/network/configuration/', method="POST", data=bgpls_post)
AntonySilvestera1080f22016-04-26 13:05:57 +0530255 main.step( "Configure BGP through RESTCONF" )
256
257 utilities.assert_equals(
258 expect='200',
259 actual=Poststatus,
260 onpass="Post Port Success",
261 onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
262
263
264 bgplsConfig.Comments()
265 main.log.info( "Check Network devices are Updated in ONOS " )
266 bgplsConfig.Comments()
267 time.sleep(15)
268
269 response = main.ONOScli1.devices()
270 main.step( "Check the nodes are discovered" )
271 if response.find( Ne_id[1][0]) and response.find(Ne_id[1][1]) and response.find(Ne_id[1][2]) != -1:
272 stepResult = main.TRUE
273 else:
274 stepResult = main.FALSE
275 utilities.assert_equals( expect=main.TRUE,
276 actual=stepResult,
277 onpass="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " sucess",
278 onfail="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " failed" )
279
280
281 bgplsConfig.Comments()
282 main.log.info( "Kill Scapy process" )
283 bgplsConfig.Comments()
284
285 main.Scapy1.handle.sendline( "\x03" )
AntonySilvester02652382016-07-13 16:44:45 +0530286 time.sleep( 90 ) #This Sleep time gives time for the socket to close.
AntonySilvestera1080f22016-04-26 13:05:57 +0530287
288
289
290
291 def CASE3( self, main ):
292 """
293 Addition of new Node to existing topology
294 """
295 import os , sys
296 import re
297 import time
298
299 main.case( "Testcase 3: Addition of New Node to existing topology" )
300 try:
301 from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
302 except ImportError:
303 main.log.exception( "Something wrong with import file or code error." )
304 main.log.info( "Import Error, please check!" )
305 main.cleanup()
306 main.exit()
307
308 bgplsConfig = BgpLs()
309 Ne_id = bgplsConfig.Constants()
310 app = bgplsConfig.apps()
311 main.CLIs = []
312 main.nodes = []
313 main.numCtrls= 1
314
315
316 ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
317 scapy_ip = os.getenv( main.params ['SCAPY'] ['HOSTNAMES'] )
318 cellName = main.params[ 'ENV' ][ 'cellName' ]
319 cellAppString= main.params[ 'ENV' ][ 'cellApps' ]
320 httpport = main.params['HTTP']['port']
321 path = main.params['HTTP']['path']
322
323 bgplsConfig.ipValue(ipList,scapy_ip)
324
325 for i in range( 1, main.numCtrls + 1 ):
326 try:
327 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
328 main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
329 ipList.append( main.nodes[ -1 ].ip_address )
330 except AttributeError:
331 break
332
333 bgplsConfig.Comments()
334 main.log.info( "Sending BGPLS Packet " )
335 bgplsConfig.Comments()
336
337 main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/\
338 dependencies/Scapyfiles/Update_Node.py" )
339 bgplsConfig.Comments()
340 main.log.info( "Enable BGPlS plugin in ONOS" )
341 bgplsConfig.Comments()
342
343 main.step( "UnInstall onos-app-bgp" )
344 installResults = main.ONOScli1.deactivateApp( app[0] )
345 utilities.assert_equals( expect=main.TRUE, actual=installResults,
346 onpass="Uninstall onos-app-bgp successful",
347 onfail="Uninstall onos-app-bgp failed" )
348
349 installResults = main.ONOScli1.activateApp( app[0])
350 main.step( "Install onos-app-bgp" )
351 utilities.assert_equals( expect=main.TRUE, actual=installResults,
352 onpass="Install onos-app-bgp successful",
353 onfail="Install onos-app-bgp failed" )
354
355
356 bgpls_post = bgplsConfig.DictoJson()
357
358 bgplsConfig.Comments()
359 main.log.info( "BGPLS RestConf input" )
360 bgplsConfig.Comments()
361
362 bgplsConfig.Comments()
363 main.log.info( "Check Network devices are Updated in ONOS " )
364 bgplsConfig.Comments()
365 time.sleep(120)
366
367 response = main.ONOScli1.devices()
368 main.step( "Check Newly added Node is getting updated" )
369
370 if response.find( Ne_id[1][3]) != -1:
371 stepResult = main.TRUE
372 else:
373 stepResult = main.FALSE
374 utilities.assert_equals( expect=main.TRUE,
375 actual=stepResult,
AntonySilvester02652382016-07-13 16:44:45 +0530376 onpass="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update sucess",
377 onfail="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update failed" )
AntonySilvestera1080f22016-04-26 13:05:57 +0530378 bgplsConfig.Comments()
379 main.log.info( "Kill Scapy process" )
380 bgplsConfig.Comments()
381 main.Scapy1.handle.sendline( "\x03" )
AntonySilvester02652382016-07-13 16:44:45 +0530382 time.sleep( 90 ) #This Sleep time gives time for the socket to close.
AntonySilvestera1080f22016-04-26 13:05:57 +0530383
384
385 def CASE4( self, main ):
386 """
AntonySilvester02652382016-07-13 16:44:45 +0530387 Verification of Links in existing topology
AntonySilvestera1080f22016-04-26 13:05:57 +0530388 """
AntonySilvester02652382016-07-13 16:44:45 +0530389 import json
AntonySilvestera1080f22016-04-26 13:05:57 +0530390 import time
AntonySilvester02652382016-07-13 16:44:45 +0530391 import os
392 main.case( "Testcase 4: Verification of Links thats is discovered" )
AntonySilvestera1080f22016-04-26 13:05:57 +0530393 try:
394 from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
395 except ImportError:
396 main.log.exception( "Something wrong with import file or code error." )
397 main.log.info( "Import Error, please check!" )
398 main.cleanup()
399 main.exit()
400
401 bgplsConfig = BgpLs()
AntonySilvestera1080f22016-04-26 13:05:57 +0530402 app = bgplsConfig.apps()
403 main.CLIs = []
404 main.nodes = []
405 main.numCtrls= 1
AntonySilvestera1080f22016-04-26 13:05:57 +0530406 ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
407 scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
AntonySilvestera1080f22016-04-26 13:05:57 +0530408 bgplsConfig.ipValue(ipList,scapy_ip)
409
AntonySilvestera1080f22016-04-26 13:05:57 +0530410 for i in range( 1, main.numCtrls + 1 ):
411 try:
412 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
413 main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
414 ipList.append( main.nodes[ -1 ].ip_address )
415 except AttributeError:
416 break
417
AntonySilvestera1080f22016-04-26 13:05:57 +0530418 bgplsConfig.Comments()
AntonySilvester02652382016-07-13 16:44:45 +0530419 main.log.info( "Sending BGPLS Link information Packet " )
AntonySilvestera1080f22016-04-26 13:05:57 +0530420 bgplsConfig.Comments()
421
AntonySilvester02652382016-07-13 16:44:45 +0530422 main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Link_Update_Node.py" )
AntonySilvestera1080f22016-04-26 13:05:57 +0530423 bgplsConfig.Comments()
424 main.log.info( "Enable BGPlS plugin in ONOS" )
425 bgplsConfig.Comments()
426
AntonySilvester02652382016-07-13 16:44:45 +0530427 main.step( "UnInstall onos-app-bgp" )
428 installResults = main.ONOScli1.deactivateApp( app[ 0 ] )
429 utilities.assert_equals( expect=main.TRUE, actual=installResults,
430 onpass="Uninstall onos-app-bgp successful",
431 onfail="Uninstall onos-app-bgp failed" )
AntonySilvestera1080f22016-04-26 13:05:57 +0530432
AntonySilvester02652382016-07-13 16:44:45 +0530433 installResults = main.ONOScli1.activateApp( app[ 0 ])
AntonySilvestera1080f22016-04-26 13:05:57 +0530434 main.step( "Install onos-app-bgp" )
435 utilities.assert_equals( expect=main.TRUE, actual=installResults,
436 onpass="Install onos-app-bgp successful",
437 onfail="Install onos-app-bgp failed" )
AntonySilvestera1080f22016-04-26 13:05:57 +0530438 bgplsConfig.Comments()
AntonySilvester02652382016-07-13 16:44:45 +0530439 main.log.info( "Checking the Link Discovery Status" )
AntonySilvestera1080f22016-04-26 13:05:57 +0530440 bgplsConfig.Comments()
AntonySilvester02652382016-07-13 16:44:45 +0530441 time.sleep( 120 ) # Time taken to discovery the links
442 response = main.ONOScli1.links()
443 linksResp = json.loads( response )
444 check_link = bgplsConfig.checkLinks( linksResp )
AntonySilvestera1080f22016-04-26 13:05:57 +0530445
AntonySilvester02652382016-07-13 16:44:45 +0530446 if check_link == True:
447 reply_Check_Link = main.TRUE
448 utilities.assert_equals( expect= main.TRUE,
449 actual=reply_Check_Link ,
450 onpass="Link Discovery Success.",
451 onfail="Link Discovery Failed." )
AntonySilvestera1080f22016-04-26 13:05:57 +0530452 bgplsConfig.Comments()
453 main.log.info( "Kill Scapy process" )
454 bgplsConfig.Comments()
AntonySilvestera1080f22016-04-26 13:05:57 +0530455 main.Scapy1.handle.sendline( "\x03" )
AntonySilvester02652382016-07-13 16:44:45 +0530456 time.sleep( 90 )
AntonySilvestera1080f22016-04-26 13:05:57 +0530457
458 def CASE5( self, main ):
459 """
AntonySilvester02652382016-07-13 16:44:45 +0530460 Deletion of links
461 """
462 import json
463 import time
464 import os
465 main.case( "Testcase 5: Deletion of Link in existing topology" )
466 try:
467 from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
468 except ImportError:
469 main.log.exception( "Something wrong with import file or code error." )
470 main.log.info( "Import Error, please check!" )
471 main.cleanup()
472 main.exit()
473
474 bgplsConfig = BgpLs()
475 app = bgplsConfig.apps()
476 main.CLIs = []
477 main.nodes = []
478 main.numCtrls= 1
479 ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
480 scapy_ip = os.getenv(main.params [ 'SCAPY' ] [ 'HOSTNAMES' ] )
481 bgplsConfig.ipValue(ipList,scapy_ip)
482
483 for i in range( 1, main.numCtrls + 1 ):
484 try:
485 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
486 main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
487 ipList.append( main.nodes[ -1 ].ip_address )
488 except AttributeError:
489 break
490
491 bgplsConfig.Comments()
492 main.log.info( "Sending BGPLS Delete Link Packet " )
493 bgplsConfig.Comments()
494
495 main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py" )
496 bgplsConfig.Comments()
497 main.log.info( "Enable BGPlS plugin in ONOS" )
498 bgplsConfig.Comments()
499
500 main.step( "UnInstall onos-app-bgp" )
501 installResults = main.ONOScli1.deactivateApp( app[ 0 ] )
502 utilities.assert_equals( expect=main.TRUE, actual=installResults,
503 onpass="Uninstall onos-app-bgp successful",
504 onfail="Uninstall onos-app-bgp failed" )
505
506 installResults = main.ONOScli1.activateApp( app[ 0 ])
507 main.step( "Install onos-app-bgp" )
508 utilities.assert_equals( expect=main.TRUE, actual=installResults,
509 onpass="Install onos-app-bgp successful",
510 onfail="Install onos-app-bgp failed" )
511 bgplsConfig.Comments()
512 main.log.info( "Checking whether the links is deleted" )
513 bgplsConfig.Comments()
514 time.sleep( 120 ) # Time taken to discovery the links
515 response = main.ONOScli1.links()
516 linksResp = json.loads( response )
517 check_link = bgplsConfig.checkLinks( linksResp )
518 if check_link == False:
519 reply_Check_Link = main.TRUE
520 utilities.assert_equals( expect= main.TRUE,
521 actual=reply_Check_Link ,
522 onpass="Link is Deleted Successfully.",
523 onfail="Link is Deletion Failed." )
524 bgplsConfig.Comments()
525 main.log.info( "Kill Scapy process" )
526 bgplsConfig.Comments()
527 main.Scapy1.handle.sendline( "\x03" )
528 time.sleep( 90 )
529
530 def CASE6( self, main ):
531 """
AntonySilvestera1080f22016-04-26 13:05:57 +0530532 Uninstalling the app
533 """
534 import os,sys
535 import re
536 import time
537
538 main.case( "TestCase 5: UnInstalling of app" )
539 try:
540 from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
541 except ImportError:
542 main.log.exception( "Something wrong with import file or code error." )
543 main.log.info( "Import Error, please check!" )
544 main.cleanup()
545 main.exit()
546
547 bgplsConfig = BgpLs()
548 app = bgplsConfig.apps()
549 main.CLIs = []
550 main.nodes = []
551 main.numCtrls= 1
552
553
554 ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
555 scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
556 cellName = main.params[ 'ENV' ][ 'cellName' ]
557 cellAppString= main.params[ 'ENV' ][ 'cellApps' ]
558
559 bgplsConfig = BgpLs()
560 bgplsConfig.ipValue(ipList,scapy_ip)
561 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
562 scapy_ip,
AntonySilvester02652382016-07-13 16:44:45 +0530563 cellAppString, ipList )
AntonySilvestera1080f22016-04-26 13:05:57 +0530564
565 for i in range( 1, main.numCtrls + 1 ):
566 try:
567 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
568 main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
569 ipList.append( main.nodes[ -1 ].ip_address )
570 except AttributeError:
571 break
572
573 main.step( "Apply cell to environment" )
574 bgplsConfig.Comments()
575 cellResult = main.ONOSbench.setCell( cellName )
576
577 bgplsConfig.Comments()
578 main.log.info( "Logging into ONOS CLI " )
579 bgplsConfig.Comments()
580
581 cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
582 utilities.assert_equals( expect=main.TRUE, actual=cliResults,
583 onpass="ONOS cli startup successful",
584 onfail="ONOS cli startup failed" )
585
586 bgplsConfig.Comments()
587 main.log.info( "Uninstall onos-app-bgp" )
588 bgplsConfig.Comments()
589 main.step( "UnInstall onos-app-bgp" )
590 installResults = main.ONOScli1.deactivateApp( app[0] )
591 utilities.assert_equals( expect=main.TRUE, actual=installResults,
592 onpass="Uninstall onos-app-bgp successful",
593 onfail="Uninstall onos-app-bgp failed" )
594
AntonySilvester02652382016-07-13 16:44:45 +0530595 main.log.info( "Check for Errors or Exception End of the Script" )
596 errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address, ["ERROR",\
597 "EXCEPT"] )
598 utilities.assert_equals( expect= 0, actual=errorLog,
599 onpass="No Exception or Error occured",
Chiyu Chengef109502016-11-21 15:51:38 -0800600 onfail="Exception or Error occured" )