blob: 3096eee064747403a451471bcb5cb44ace2577d4 [file] [log] [blame]
andrew@onlab.us1bc346b2015-05-21 17:21:16 -04001
2"""
3Startup related methods for ONOS
4
5Guidelines:
6 * Group sequential functionalities together
7 * Methods should not prohibit cross platform execution
8 * Return main.TRUE on success or comprehensive error message
9 on failure (TBD)
10"""
andrew@onlab.us2bcfd8f2015-05-28 19:17:51 -040011import time
andrew@onlab.us1bc346b2015-05-21 17:21:16 -040012
13def __init__( self ):
14 self.ip = '127.0.0.1'
15
16def gitPullAndMci( branchName, commitLog=False ):
17 """
18 Pull from branch repository specified and compile changes
19 If commitLog is True, report commit information
20
21 Any errors / warnings will be handled by respective
22 driver function calls
23 """
24 co = main.ONOSbench.gitCheckout( branchName )
25 gp = main.ONOSbench.gitPull()
26 ci = main.ONOSbench.cleanInstall()
27
28 if co and gp and ci == main.TRUE:
29 if commitLog:
30 main.log.report( 'Commit information - ' )
31 main.ONOSbench.getVersion(report=True)
32
33 return main.TRUE
34
35 else:
36 # TODO: Comprehensive error message
37 return 'git pull and mci failed'
38
andrew@onlab.us2bcfd8f2015-05-28 19:17:51 -040039def initOnosStartupSequence( cellName, appStr, benchIp, mnIp, onosIps ):
andrew@onlab.us1bc346b2015-05-21 17:21:16 -040040 """
41 Startup sequence includes the following:
andrew@onlab.us2bcfd8f2015-05-28 19:17:51 -040042 * Create cell file
43 * Set cell variables on ONOS bench
44 * Verify cell
45 * Create ONOS package
46 * Force install ONOS package
47 * Start ONOS service
48 * Start ONOS cli
andrew@onlab.us1bc346b2015-05-21 17:21:16 -040049 """
andrew@onlab.us1bc346b2015-05-21 17:21:16 -040050
andrew@onlab.us2bcfd8f2015-05-28 19:17:51 -040051 # NOTE: leave out create cell file until bug addressed
52 #cf = main.ONOSbench.createCellFile( benchIp, cellName, mnIp,
53 # str(appStr), *onosIps )
54 numNodes = len(onosIps)
andrew@onlab.us1bc346b2015-05-21 17:21:16 -040055
andrew@onlab.us2bcfd8f2015-05-28 19:17:51 -040056 sc = main.ONOSbench.setCell( cellName )
57 vc = main.ONOSbench.verifyCell()
58 op = main.ONOSbench.onosPackage()
59 for addr in onosIps:
60 oi = main.ONOSbench.onosInstall( node = addr )
61
62 time.sleep( 5 )
63
64 iu = main.TRUE
65 for node in onosIps:
66 iu = iu and main.ONOSbench.isup( node )
67
68 cli = main.TRUE
69 for node in range( 0, numNodes ):
70 cli = cli and main.CLIs[node].startOnosCli( onosIps[node] )
71
72 if sc and vc and op and oi and iu and cli == main.TRUE:
73 return main.TRUE
74 else:
75 return main.FALSE
76