blob: 26550897fc82a366d9af9b75cde4b8f98900b8b4 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001
2class OnosScale:
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 time the convergence time of a topology for ONOS.
51 It shuts down the ONOS, drops keyspace, starts ONOS...
52 Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
53 '''
54 import time
55 main.case("Timing Onos Convergence for switch -> ONOS1")
56 main.step("Bringing ONOS down...")
57 main.log.info("all switch no controllers")
58 main.Mininet2.ctrl_none()
59 main.Mininet3.ctrl_none()
60 main.Mininet4.ctrl_none()
61 main.Mininet5.ctrl_none()
62 main.Mininet6.ctrl_none()
63 main.Mininet7.ctrl_none()
64 main.Mininet8.ctrl_none()
65 main.log.info("bringing ONOS down")
66 main.ONOS1.stop()
67 main.ONOS2.stop()
68 main.ONOS3.stop()
69 main.ONOS4.stop()
70 main.ONOS5.stop()
71 main.ONOS6.stop()
72 main.ONOS7.stop()
73 main.ONOS8.stop()
74 main.log.info("Dropping keyspace...")
75 main.ONOS1.drop_keyspace()
76 time.sleep(5)
77 main.log.info("Bringing ONOS up")
78 main.ONOS1.start()
79 time.sleep(5)
80 main.ONOS2.start()
81 main.ONOS3.start()
82 main.ONOS4.start()
83 main.ONOS5.start()
84 main.ONOS6.start()
85 main.ONOS7.start()
86 main.ONOS8.start()
87 main.ONOS1.isup()
88 main.ONOS2.isup()
89 main.ONOS3.isup()
90 main.ONOS4.isup()
91 main.ONOS5.isup()
92 main.ONOS6.isup()
93 main.ONOS7.isup()
94 main.ONOS8.isup()
95 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
96 main.log.info("Pointing the Switches at controller... then BEGIN time")
97 main.Mininet2.ctrl_local()
98 main.Mininet3.ctrl_local()
99 main.Mininet4.ctrl_local()
100 main.Mininet5.ctrl_local()
101 main.Mininet6.ctrl_local()
102 main.Mininet7.ctrl_local()
103 main.Mininet8.ctrl_local()
104 #main.Mininet2.ctrl_one(main.params['RestIP'])
105 #main.Mininet3.ctrl_one(main.params['RestIP'])
106 #main.Mininet4.ctrl_one(main.params['RestIP'])
107 #main.Mininet5.ctrl_one(main.params['RestIP'])
108 #main.Mininet6.ctrl_one(main.params['RestIP'])
109 #main.Mininet7.ctrl_one(main.params['RestIP'])
110 #main.Mininet8.ctrl_one(main.params['RestIP'])
111 t1 = time.time()
112 for i in range(4) :
113 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
114 if result == 1 :
115 break
116 else :
117 time.sleep(1)
118 t2 = time.time()
119 conv_time = t2 - t1
120 if result == 1 :
121 main.log.info( "Convergence time of : %f seconds" % conv_time )
122 if float(conv_time) < float(main.params['TargetTime']) :
123 test=main.TRUE
124 main.log.info("Time is less then supplied target time")
125 else:
126 test=main.FALSE
127 main.log.info("Time is greater then supplied target time")
128 else :
129 main.log.info( "ONOS did NOT converge over : %f seconds" % conv_time )
130 test=main.FALSE
131
132 utilities.assert_equals(expect=main.TRUE,actual=test)
133