blob: 4bfa2440ee424b97eae423ce279cd8a6e6ea6526 [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
35 cleanInstallResult = main.TRUE
36 gitPullResult = main.TRUE
37
38 main.step( "Git pull" )
39 gitPullResult = main.FALSE
40 #Need to push some new code to ONOS before using the git pull
41 #gitPullResult = main.ONOSbench.gitPull()
42
pingping-lin6f919c32015-08-25 14:04:33 -070043 main.step( "Using mvn clean install" )
pingping-lin4ed949d2015-08-13 17:15:48 -070044 if gitPullResult == main.TRUE:
pingping-lin1dad42e2015-08-26 11:36:33 -070045 #cleanInstallResult = main.ONOSbench.cleanInstall()
46 cleanInstallResult = main.ONOSbench.cleanInstall( skipTest=True)
pingping-lin4ed949d2015-08-13 17:15:48 -070047 else:
48 main.log.warn( "Did not pull new code so skipping mvn " +
49 "clean install" )
pingping-lin4ed949d2015-08-13 17:15:48 -070050 main.ONOSbench.getVersion( report=True )
51
52 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -070053 packageResult = main.ONOSbench.buckBuild()
pingping-lin4ed949d2015-08-13 17:15:48 -070054
55 main.step( "Installing ONOS package" )
56 onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
57 node=ONOS1Ip )
58
59 main.step( "Checking if ONOS is up yet" )
60 for i in range( 2 ):
61 onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
62 if onos1Isup:
63 break
64 if not onos1Isup:
65 main.log.report( "ONOS1 didn't start!" )
66
Chiyu Chengef109502016-11-21 15:51:38 -080067 main.step( "Set up ONOS secure SSH" )
68 secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
69
pingping-lin4ed949d2015-08-13 17:15:48 -070070 cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
71 commandlineTimeout=100, onosStartTimeout=600)
72
73 case1Result = ( cleanInstallResult and packageResult and
74 cellResult and verifyResult and
75 onos1InstallResult and
Chiyu Chengef109502016-11-21 15:51:38 -080076 onos1Isup and secureSshResult and
77 cliResult )
pingping-lin4ed949d2015-08-13 17:15:48 -070078
79 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
80 onpass="ONOS startup successful",
81 onfail="ONOS startup NOT successful" )
82
83 if case1Result == main.FALSE:
84 main.cleanup()
85 main.exit()
86
87 def CASE9( self, main ):
88 """
89 Test the SDN-IP Performance
90 Test whether SDN-IP can boot with 600,000 routes from an external peer.
91 Since our goal for SDN-IP is to handle 600,000 routes, in this test case
92 we statically configure an external peer Quagga with 655360 routes.
93 Thus, we pre-know the routes and intents it should be, and then boot the
94 whole system and check whether the numbers of routes and intents from
95 ONOS CLI are correct.
96 """
97 import time
98 import json
99 from operator import eq
100 from time import localtime, strftime
101
102 # We configured one external BGP peer with 655360 routes
103 routeNumberExpected = 655360
104 m2SIntentsNumberExpected = 655360
105
106 main.case("This case is to testing the performance of SDN-IP with \
107 single ONOS instance" )
108 time.sleep( 10 )
109
110 main.step( "Get devices in the network" )
111 listResult = main.ONOScli.devices( jsonFormat=False )
112 main.log.info( listResult )
113
114 main.step( "Get links in the network" )
115 listResult = main.ONOScli.links ( jsonFormat=False )
116 main.log.info( listResult )
117
118 main.log.info( "Activate sdn-ip application" )
119 main.ONOScli.activateApp( "org.onosproject.sdnip" )
120
121 main.step("Sleep 1200 seconds")
122 # wait until SDN-IP receives all routes and ONOS installs all intents
pingping-lin6f919c32015-08-25 14:04:33 -0700123 time.sleep( int(main.params[ 'timers' ][ 'SystemBoot' ]) )
pingping-lin4ed949d2015-08-13 17:15:48 -0700124
125 main.step( "Checking routes installed" )
126
127 main.log.info( "Total route number expected is:" )
128 main.log.info( routeNumberExpected )
129
130 routeNumberActual = main.ONOScli.ipv4RouteNumber()
131 main.log.info("Total route number actual is: ")
132 main.log.info(routeNumberActual)
133
134 utilities.assertEquals(
135 expect=routeNumberExpected, actual=routeNumberActual,
136 onpass="***Routes in SDN-IP are correct!***",
137 onfail="***Routes in SDN-IP are wrong!***" )
138
139
140 main.step( "Checking MultiPointToSinglePointIntent intents installed" )
141
142 main.log.info( "MultiPointToSinglePoint intent number expected is:" )
143 main.log.info( m2SIntentsNumberExpected )
144
145 m2SIntentsNumberActual = main.ONOScli.m2SIntentInstalledNumber()
146 main.log.info( "MultiPointToSinglePoint intent number actual is:" )
147 main.log.info(m2SIntentsNumberActual)
148
149 utilities.assertEquals(
150 expect=True,
151 actual=eq( m2SIntentsNumberExpected, m2SIntentsNumberActual ),
152 onpass="***MultiPointToSinglePoint intent number is correct!***",
153 onfail="***MultiPointToSinglePoint intent number is wrong!***" )