blob: a05662cf48c176f608d780572dacb5008246aa34 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001
2class CassandraCheck:
3
4 def __init__(self) :
5 self.default = ''
6
7 def CASE1(self,main) :
8 '''
9 First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
10 If ONOS if not running properly, it will restart ONOS once before continuing.
11 It will then check if the ONOS has a view of all the switches and links as defined in the params file.
12 The test will only pass if ONOS is running properly, and has a full view of all topology elements.
13 '''
14 import time
15 main.case("Checking if the startup was clean...")
16 main.step("Testing startup Zookeeper")
17 data = main.Zookeeper1.isup()
18 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
19 main.step("Testing startup Cassandra")
20 data = main.Cassandra1.isup()
21 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
22 main.step("Testing startup ONOS")
23 main.ONOS1.start()
24 main.ONOS2.start()
25 main.ONOS3.start()
26 main.ONOS4.start()
27 main.ONOS5.start()
28 main.ONOS6.start()
29 main.ONOS7.start()
30 main.ONOS8.start()
31 data = main.ONOS1.isup()
32 if data == main.FALSE:
33 main.log.info("Something is funny... restarting ONOS")
34 main.ONOS1.stop()
35 time.sleep(3)
36 main.ONOS1.start()
37 time.sleep(5)
38 data = main.ONOS1.isup()
39 #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
40 topoview = main.TRUE
41 if topoview == main.TRUE & data == main.TRUE :
42 data = main.TRUE
43 else:
44 data = main.FALSE
45
46 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running and has full view of topology",onfail="ONOS didn't start or has fragmented view of topology...")
47
48 def CASE2(self,main) :
49 '''
50 Second case is to stress adding and removing flows to see if it can crash any cassandras
51 '''
52 import time
53 main.case("Adding and deleting flows")
54 main.step("Adding 1008 flows")
55 #main.ONOS1.add_flow("~/flowdef_files/flowdef_3node_1008.txt")
56 main.ONOS1.add_flow("~/flowdef_files/flowdef_3node_1008.txt")
57 time.sleep(30)
58 main.ONOS1.delete_flow("all")
59 main.ONOS1.check_for_no_exceptions()
60 test = main.Cassandra1.isup()
61 utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Cassandra is still good",onfail="Something broke on Cassandra")
62
63 def CASE3(self,main) :
64 '''
65 Merely testing if a specific driver call works
66 '''
67 main.case("Checking for exceptions")
68 main.step("Step 1")
69 test = main.ONOS1.check_for_no_exceptions()
70 utilities.assert_equals(expect=main.TRUE,actual=test)
71