Read env for onos ips
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 4502971..2645514 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1898,3 +1898,37 @@
main.cleanup()
main.exit()
+
+ def getOnosIpFromEnv(self):
+
+ import os
+
+ # returns a list of ip addresses for the onos nodes, will work with up to 7 nodes + OCN and OCI
+ # returns in format [ 'x', OC1 ip, OC2 i... ect. ... , ONN ip ]
+
+ ONOSIps = ['x']
+
+ x = 1
+ while True:
+ try:
+ temp = os.environ[ 'OC' + str(x) ]
+ except:
+ break
+ ONOSIps.append(temp)
+ x += 1
+
+ try:
+ temp = os.environ[ 'OCN' ]
+ except:
+ main.log.error("MISSING OCN ENVIRONMENT VARIABLE")
+
+ ONOSIps.append(temp)
+
+ try:
+ temp = os.environ[ 'OCI' ]
+ except:
+ main.log.error("MISSING OCN ENVIRONMENT VARIABLE")
+
+ ONOSIps.append(temp)
+ return ONOSIps
+
diff --git a/TestON/tests/FuncIntent/FuncIntent.params b/TestON/tests/FuncIntent/FuncIntent.params
index 125122e..7e5d8ce 100755
--- a/TestON/tests/FuncIntent/FuncIntent.params
+++ b/TestON/tests/FuncIntent/FuncIntent.params
@@ -14,16 +14,16 @@
</GIT>
<CTRL>
<num>3</num>
- <ip1>10.128.10.21</ip1>
+ <ip1>OC1</ip1>
<port1>6633</port1>
- <ip2>10.128.10.22</ip2>
+ <ip2>OC2</ip2>
<port2>6633</port2>
- <ip3>10.128.10.23</ip3>
+ <ip3>OC3</ip3>
<port3>6633</port3>
</CTRL>
<BENCH>
<user>admin</user>
- <ip1>10.128.10.20</ip1>
+ <ip1>10.128.5.55</ip1>
</BENCH>
<MININET>
<switch>7</switch>
diff --git a/TestON/tests/FuncIntent/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index 3adb025..758becb 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -27,19 +27,20 @@
onos-wait-for-start
"""
global init
+ global globalONOSip
try:
if type(init) is not bool:
init = False
except NameError:
init = False
+
#Local variables
cellName = main.params[ 'ENV' ][ 'cellName' ]
apps = main.params[ 'ENV' ][ 'cellApps' ]
gitBranch = main.params[ 'GIT' ][ 'branch' ]
- benchIp = main.params[ 'BENCH' ][ 'ip1' ]
+ benchIp = os.environ[ 'OCN' ]
benchUser = main.params[ 'BENCH' ][ 'user' ]
topology = main.params[ 'MININET' ][ 'topo' ]
- maxNodes = int( main.params[ 'availableNodes' ] )
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
@@ -55,7 +56,6 @@
if init == False:
init = True
- main.ONOSip = []
main.ONOSport = []
main.scale = ( main.params[ 'SCALE' ] ).split( "," )
main.numCtrls = int( main.scale[ 0 ] )
@@ -78,19 +78,26 @@
else:
main.log.warn( "Did not pull new code so skipping mvn " +
"clean install" )
- # Populate main.ONOSip with ips from params
- for i in range( 1, maxNodes + 1):
- main.ONOSip.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
- main.ONOSport.append( main.params[ 'CTRL' ][ 'port' +
- str( i ) ])
+
+ globalONOSip = main.ONOSbench.getOnosIpFromEnv()
+
+ maxNodes = ( len(globalONOSip) - 3 )
main.numCtrls = int( main.scale[ 0 ] )
main.scale.remove( main.scale[ 0 ] )
+
+ main.ONOSip = [0]
+ for i in range( 1, maxNodes + 1 ):
+ main.ONOSip.append( globalONOSip[i] )
+
+
+
#kill off all onos processes
main.log.info( "Safety check, killing all ONOS processes" +
" before initiating enviornment setup" )
- for i in range( maxNodes ):
- main.ONOSbench.onosDie( main.ONOSip[ i ] )
+ for i in range(1, maxNodes+1):
+ main.ONOSbench.onosDie( globalONOSip[ i ] )
+
"""
main.step( "Apply cell to environment" )
cellResult = main.ONOSbench.setCell( cellName )
@@ -110,6 +117,7 @@
onpass="Successfully removed raft logs",
onfail="Failed to remove raft logs" )
"""
+
print "NODE COUNT = ", main.numCtrls
main.log.info( "Creating cell file" )
cellIp = []
@@ -139,7 +147,7 @@
main.step( "Uninstalling ONOS package" )
onosUninstallResult = main.TRUE
- for i in range( main.numCtrls):
+ for i in range( 1, main.numCtrls + 1):
onosUninstallResult = onosUninstallResult and \
main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
stepResult = onosUninstallResult
@@ -150,7 +158,7 @@
time.sleep( 5 )
main.step( "Installing ONOS package" )
onosInstallResult = main.TRUE
- for i in range( main.numCtrls):
+ for i in range( 1, main.numCtrls+1):
onosInstallResult = onosInstallResult and \
main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
stepResult = onosInstallResult
@@ -159,12 +167,12 @@
onpass="Successfully installed ONOS package",
onfail="Failed to install ONOS package" )
- time.sleep( 5 )
+ time.sleep( 20 )
main.step( "Starting ONOS service" )
stopResult = main.TRUE
startResult = main.TRUE
onosIsUp = main.TRUE
- for i in range( main.numCtrls ):
+ for i in range( 1, main.numCtrls+1 ):
onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
if onosIsUp == main.TRUE:
main.log.report( "ONOS instance is up and ready" )