blob: 0134e4201d69dc85bdee1f0001c416c81c0951a0 [file] [log] [blame]
pingping-lin4ed949d2015-08-13 17:15:48 -07001class SDNIPperf:
2
3 def __init__( self ):
4 self.default = ''
5 global branchName
6
7 # This case is to setup ONOS
8 def CASE100( self, main ):
9 """
10 CASE100 is to compile ONOS and push it to the test machines
11 Startup sequence:
12 cell <name>
13 onos-verify-cell
14 git pull
15 mvn clean install
16 onos-package
17 onos-install -f
18 onos-wait-for-start
19 """
20 main.case( "Setting up test environment" )
21
22 cellName = main.params[ 'ENV' ][ 'cellName' ]
23 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
24
25 main.step( "Applying cell variable to environment" )
26 cellResult = main.ONOSbench.setCell( cellName )
27 verifyResult = main.ONOSbench.verifyCell()
28
29 branchName = main.ONOSbench.getBranchName()
30 main.log.info( "ONOS is on branch: " + branchName )
31
32 main.log.report( "Uninstalling ONOS" )
33 main.ONOSbench.onosUninstall( ONOS1Ip )
34
pingping-lin4ed949d2015-08-13 17:15:48 -070035 main.step( "Git pull" )
36 gitPullResult = main.FALSE
37 #Need to push some new code to ONOS before using the git pull
38 #gitPullResult = main.ONOSbench.gitPull()
39
pingping-lin4ed949d2015-08-13 17:15:48 -070040 main.ONOSbench.getVersion( report=True )
41
42 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -070043 packageResult = main.ONOSbench.buckBuild()
pingping-lin4ed949d2015-08-13 17:15:48 -070044
45 main.step( "Installing ONOS package" )
46 onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
47 node=ONOS1Ip )
48
You Wangf5de25b2017-01-06 15:13:01 -080049 main.step( "Set up ONOS secure SSH" )
50 secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
51
pingping-lin4ed949d2015-08-13 17:15:48 -070052 main.step( "Checking if ONOS is up yet" )
53 for i in range( 2 ):
54 onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
55 if onos1Isup:
56 break
57 if not onos1Isup:
58 main.log.report( "ONOS1 didn't start!" )
59
60 cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
61 commandlineTimeout=100, onosStartTimeout=600)
62
Devin Lim8d7c7782017-06-07 16:21:20 -070063 case1Result = ( packageResult and cellResult and
64 verifyResult and onos1InstallResult and
Chiyu Chengef109502016-11-21 15:51:38 -080065 onos1Isup and secureSshResult and
66 cliResult )
pingping-lin4ed949d2015-08-13 17:15:48 -070067
68 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
69 onpass="ONOS startup successful",
70 onfail="ONOS startup NOT successful" )
71
72 if case1Result == main.FALSE:
73 main.cleanup()
74 main.exit()
75
76 def CASE9( self, main ):
77 """
78 Test the SDN-IP Performance
79 Test whether SDN-IP can boot with 600,000 routes from an external peer.
80 Since our goal for SDN-IP is to handle 600,000 routes, in this test case
81 we statically configure an external peer Quagga with 655360 routes.
82 Thus, we pre-know the routes and intents it should be, and then boot the
83 whole system and check whether the numbers of routes and intents from
84 ONOS CLI are correct.
85 """
86 import time
87 import json
88 from operator import eq
89 from time import localtime, strftime
90
91 # We configured one external BGP peer with 655360 routes
92 routeNumberExpected = 655360
93 m2SIntentsNumberExpected = 655360
94
95 main.case("This case is to testing the performance of SDN-IP with \
96 single ONOS instance" )
97 time.sleep( 10 )
98
99 main.step( "Get devices in the network" )
100 listResult = main.ONOScli.devices( jsonFormat=False )
101 main.log.info( listResult )
102
103 main.step( "Get links in the network" )
104 listResult = main.ONOScli.links ( jsonFormat=False )
105 main.log.info( listResult )
106
107 main.log.info( "Activate sdn-ip application" )
108 main.ONOScli.activateApp( "org.onosproject.sdnip" )
109
110 main.step("Sleep 1200 seconds")
111 # wait until SDN-IP receives all routes and ONOS installs all intents
pingping-lin6f919c32015-08-25 14:04:33 -0700112 time.sleep( int(main.params[ 'timers' ][ 'SystemBoot' ]) )
pingping-lin4ed949d2015-08-13 17:15:48 -0700113
114 main.step( "Checking routes installed" )
115
116 main.log.info( "Total route number expected is:" )
117 main.log.info( routeNumberExpected )
118
119 routeNumberActual = main.ONOScli.ipv4RouteNumber()
120 main.log.info("Total route number actual is: ")
121 main.log.info(routeNumberActual)
122
123 utilities.assertEquals(
124 expect=routeNumberExpected, actual=routeNumberActual,
125 onpass="***Routes in SDN-IP are correct!***",
126 onfail="***Routes in SDN-IP are wrong!***" )
127
128
129 main.step( "Checking MultiPointToSinglePointIntent intents installed" )
130
131 main.log.info( "MultiPointToSinglePoint intent number expected is:" )
132 main.log.info( m2SIntentsNumberExpected )
133
134 m2SIntentsNumberActual = main.ONOScli.m2SIntentInstalledNumber()
135 main.log.info( "MultiPointToSinglePoint intent number actual is:" )
136 main.log.info(m2SIntentsNumberActual)
137
138 utilities.assertEquals(
139 expect=True,
140 actual=eq( m2SIntentsNumberExpected, m2SIntentsNumberActual ),
141 onpass="***MultiPointToSinglePoint intent number is correct!***",
142 onfail="***MultiPointToSinglePoint intent number is wrong!***" )