Update Cluster Driver
Change-Id: I8a3a57e19637ff210548e57d41178e6f194cf694
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index 3772667..79c1c18 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -65,12 +65,10 @@
main.testSetUp.envSetupDescription()
stepResult = main.FALSE
try:
- main.nodeList = main.params['CASE1']['NodeList'].split(",")
main.onosStartupSleep = float( main.params['CASE1']['SleepTimers']['onosStartup'] )
main.onosCfgSleep = float( main.params['CASE1']['SleepTimers']['onosCfg'] )
main.mnStartupSleep = float( main.params['CASE1']['SleepTimers']['mnStartup'] )
main.mnCfgSleep = float( main.params['CASE1']['SleepTimers']['mnCfg'] )
- main.numCtrls = int( main.params['CASE10']['numNodes'] )
stepResult = main.testSetUp.envSetup( includeGitPull=False )
except Exception as e:
main.testSetUp.envSetupException( e )
@@ -83,7 +81,7 @@
Report errors/warnings/exceptions
'''
main.log.info("Error report: \n" )
- main.ONOSbench.logReport( main.ONOSip[0],
+ main.ONOSbench.logReport( main.Cluster.active( 0 ).ipAddress,
[ "INFO",
"FOLLOWER",
"WARN",
@@ -110,16 +108,17 @@
main.testSetUp
except ( NameError, AttributeError ):
main.testSetUp = ONOSSetup()
- main.case( "Start up " + str( main.numCtrls ) + "-node onos cluster.")
+ main.case( "Start up " + str( main.Cluster.numCtrls ) + "-node onos cluster.")
main.step( "Start ONOS cluster with basic (drivers) app.")
- stepResult = main.ONOSbench.startBasicONOS( nodeList=main.ONOSip, opSleep=200,
- onosUser=main.ONOScli1.karafUser )
+ stepResult = main.ONOSbench.startBasicONOS( nodeList=main.Cluster.getIps(),
+ opSleep=200,
+ onosUser=main.ONOScell.karafUser )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully started basic ONOS cluster ",
onfail="Failed to start basic ONOS Cluster " )
- main.testSetUp.startOnosClis()
+ main.testSetUp.startOnosClis( main.Cluster )
main.step( "Activate onos apps.")
main.apps = main.params['CASE10'].get( 'Apps' )
@@ -127,15 +126,15 @@
main.log.info( "Apps to activate: " + main.apps )
activateResult = main.TRUE
for a in main.apps.split(","):
- activateResult = activateResult & main.ONOScli1.activateApp(a)
+ activateResult = activateResult & main.Cluster.active( 0 ).CLI.activateApp( a )
# TODO: check this worked
time.sleep( main.onosCfgSleep ) # wait for apps to activate
else:
main.log.warn( "No configurations were specified to be changed after startup" )
utilities.assert_equals( expect=main.TRUE,
- actual=activateResult,
- onpass="Successfully set config",
- onfail="Failed to set config" )
+ actual=activateResult,
+ onpass="Successfully set config",
+ onfail="Failed to set config" )
main.step( "Set ONOS configurations" )
config = main.params['CASE10'].get( 'ONOS_Configuration' )
@@ -145,7 +144,7 @@
for component in config:
for setting in config[component]:
value = config[component][setting]
- check = main.ONOScli1.setCfg( component, setting, value )
+ check = main.Cluster.active( 0 ).CLI.setCfg( component, setting, value )
main.log.info( "Value was changed? {}".format( main.TRUE == check ) )
checkResult = check and checkResult
utilities.assert_equals( expect=main.TRUE,
@@ -180,9 +179,10 @@
main.step( "Assign switches to controllers.")
assignResult = main.TRUE
for i in range(1, 8):
- assignResult = assignResult & main.Mininet1.assignSwController( sw="s" + str( i ),
- ip=main.ONOSip,
- port='6653' )
+ assignResult = assignResult & \
+ main.Mininet1.assignSwController( sw="s" + str( i ),
+ ip=main.Cluster.getIps(),
+ port='6653' )
time.sleep(main.mnCfgSleep)
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -196,8 +196,8 @@
"""
main.case( "Test some onos commands through CLI. ")
- main.log.debug( main.ONOScli1.sendline("summary") )
- main.log.debug( main.ONOScli1.sendline("devices") )
+ main.log.debug( main.Cluster.active( 0 ).CLI.sendline("summary") )
+ main.log.debug( main.Cluster.active( 0 ).CLI.sendline("devices") )
def CASE22( self, main ):
"""
@@ -205,8 +205,8 @@
"""
main.case( " Sample tests using ONOS REST API handles. ")
- main.log.debug( main.ONOSrest1.send("/devices") )
- main.log.debug( main.ONOSrest1.apps() )
+ main.log.debug( main.Cluster.active( 0 ).REST.send("/devices") )
+ main.log.debug( main.Cluster.active( 0 ).REST.apps() )
def CASE32( self, main ):
"""
@@ -217,9 +217,11 @@
"""
main.case( "Configure onos-app-fwd and check if configuration successful. " )
main.step( "Install reactive forwarding app." )
- installResults = main.ONOScli1.activateApp( "org.onosproject.fwd" )
- utilities.assert_equals( expect=main.TRUE, actual=installResults,
- onpass = "Configure fwd successful", onfail="Configure fwd failed" )
+ installResults = main.Cluster.active( 0 ).CLI.activateApp( "org.onosproject.fwd" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=installResults,
+ onpass = "Configure fwd successful",
+ onfail="Configure fwd failed" )
main.step( "Run pingall to check connectivity. " )
pingResult = main.FALSE
passMsg = "Reactive Pingall test passed"
@@ -228,4 +230,7 @@
main.log.warn( "First pingall failed. Trying again..." )
pingResult = main.Mininet1.pingall()
passMsg += "on the second try"
- utilities.assert_equals( expect=main.TRUE, actual=pingResult, onpass=passMsg, onfail= "Reactive Pingall failed, " + "one or more ping pairs failed." )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=pingResult,
+ onpass=passMsg,
+ onfail= "Reactive Pingall failed, " + "one or more ping pairs failed." )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
index 3cea19b..27925b7 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
@@ -5,52 +5,37 @@
Even with some handles not used in test cases, we want to define
all onos cells here, for cases to set up onos cluster.
-->
- <ONOSbench>
- <host>localhost</host>
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
<user>sdn</user>
<password>rocks</password>
- <type>OnosDriver</type>
+ <type>OnosClusterDriver</type>
<connect_order>1</connect_order>
<COMPONENTS>
- <home></home> #defines where onos home is
- <prompt></prompt>
+ <cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+ <karaf_username></karaf_username>
+ <karaf_password></karaf_password>
+ <web_user></web_user>
+ <web_pass></web_pass>
+ <rest_port></rest_port>
+ <prompt></prompt> # TODO: we technically need a few of these, one per component
+ <onos_home></onos_home> # defines where onos home is
+ <nodes> 1 </nodes> # number of nodes in the cluster
</COMPONENTS>
- </ONOSbench>
-
- <ONOScli1>
- <host>localhost</host>
- <user>sdn</user>
- <password>rocks</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS>
- <prompt></prompt>
- </COMPONENTS>
- </ONOScli1>
+ </ONOScell>
<Mininet1>
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>2</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
<prompt></prompt>
</COMPONENTS>
</Mininet1>
- <ONOSrest1>
- <host>OC1</host>
- <port>8181</port>
- <user>onos</user>
- <password>rocks</password>
- <type>OnosRestDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS>
- <prompt></prompt>
- </COMPONENTS>
- </ONOSrest1>
-
</COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index ac5e8b5..a276634 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -56,12 +56,10 @@
'''
try:
from tests.dependencies.ONOSSetup import ONOSSetup
- from dependencies.Cluster import Cluster
except ImportError:
main.log.error( "ONOSSetup not found. exiting the test" )
main.exit()
try:
- main.Cluster = Cluster( main.ONOScell.nodes )
main.testSetUp
except ( NameError, AttributeError ):
main.testSetUp = ONOSSetup()
@@ -69,12 +67,10 @@
main.testSetUp.envSetupDescription()
stepResult = main.FALSE
try:
- main.nodeList = main.params['CASE1']['NodeList'].split(",")
main.onosStartupSleep = float(main.params['CASE1']['SleepTimers']['onosStartup'])
main.onosCfgSleep = float(main.params['CASE1']['SleepTimers']['onosCfg'])
main.mnStartupSleep = float(main.params['CASE1']['SleepTimers']['mnStartup'])
main.mnCfgSleep = float(main.params['CASE1']['SleepTimers']['mnCfg'])
- main.numCtrls = int( main.params['CASE10']['numNodes'] )
stepResult = main.testSetUp.envSetup( includeGitPull=False )
except Exception as e:
main.testSetUp.envSetupException( e )
@@ -87,8 +83,7 @@
Report errors/warnings/exceptions
'''
main.log.info("Error report: \n" )
- ONOSbench = main.ONOScell.nodes[0].Bench
- ONOSbench.logReport( main.Cluster.controllers[0].ipAddress,
+ main.ONOSbench.logReport( main.Cluster.runningNodes[0].ipAddress,
[ "INFO",
"FOLLOWER",
"WARN",
@@ -116,11 +111,10 @@
import time
- size = len( main.Cluster.controllers )
- main.case( "Start up " + str( size ) + "-node onos cluster." )
+ main.case( "Start up " + str( main.Cluster.numCtrls ) + "-node onos cluster." )
main.step( "Start ONOS cluster with basic (drivers) app.")
- stepResult = ONOSbench.startBasicONOS( nodeList=main.Cluster.getIps(), opSleep=200,
+ stepResult = main.ONOSbench.startBasicONOS( nodeList=main.Cluster.getIps(), opSleep=200,
onosUser=main.ONOScell.karafUser )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -135,7 +129,7 @@
main.log.info( "Apps to activate: " + main.apps )
activateResult = main.TRUE
for a in main.apps.split(","):
- activateResult = activateResult & main.ONOScli1.activateApp(a)
+ activateResult = activateResult & main.Cluster.active( 0 ).CLI.activateApp(a)
# TODO: check this worked
time.sleep( main.onosCfgSleep ) # wait for apps to activate
else:
@@ -153,7 +147,7 @@
for component in config:
for setting in config[component]:
value = config[component][setting]
- check = main.Cluster.controllers[0].setCfg( component, setting, value )
+ check = main.Cluster.runningNodes[0].setCfg( component, setting, value )
main.log.info( "Value was changed? {}".format( main.TRUE == check ) )
checkResult = check and checkResult
utilities.assert_equals( expect=main.TRUE,
@@ -204,8 +198,8 @@
"""
main.case( "Test some onos commands through CLI. ")
- main.log.debug( main.Cluster.controllers[1].sendline("summary") )
- main.log.debug( main.Cluster.controllers[2].sendline("devices") )
+ main.log.debug( main.Cluster.active( 0 ).CLI.sendline( "summary" ) )
+ main.log.debug( main.Cluster.active( 1 ).CLI.sendline( "devices" ) )
def CASE22( self, main ):
"""
@@ -213,8 +207,8 @@
"""
main.case( " Sample tests using ONOS REST API handles. ")
- main.log.debug( main.Cluster.controllers[2].send("/devices") )
- main.log.debug( main.Cluster.controllers[-1].apps() )
+ main.log.debug( main.Cluster.active( 0 ).REST.send( "/devices" ) )
+ main.log.debug( main.Cluster.active( 2 ).REST.apps() )
def CASE32( self, main ):
"""
@@ -225,9 +219,11 @@
"""
main.case( "Configure onos-app-fwd and check if configuration successful. " )
main.step( "Install reactive forwarding app." )
- installResults = main.Cluster.controllers[0].activateApp( "org.onosproject.fwd" )
- utilities.assert_equals( expect=main.TRUE, actual=installResults,
- onpass= "Configure fwd successful", onfail= "Configure fwd failed" )
+ installResults = main.Cluster.active( 0 ).CLI.activateApp( "org.onosproject.fwd" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=installResults,
+ onpass= "Configure fwd successful",
+ onfail= "Configure fwd failed" )
main.step( "Run pingall to check connectivity. " )
pingResult = main.FALSE
passMsg = "Reactive Pingall test passed"
@@ -236,4 +232,7 @@
main.log.warn("First pingall failed. Trying again...")
pingResult = main.Mininet1.pingall()
passMsg += "on the second try"
- utilities.assert_equals( expect=main.TRUE, actual=pingResult, onpass=passMsg, onfail= "Reactive Pingall failed, " + "one or more ping pairs failed" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=pingResult,
+ onpass=passMsg,
+ onfail= "Reactive Pingall failed, " + "one or more ping pairs failed" )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
index 5ab7af6..5eb64a0 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
@@ -13,6 +13,7 @@
<connect_order>1</connect_order>
<COMPONENTS>
<cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
<karaf_username></karaf_username>
<karaf_password></karaf_password>
<web_user></web_user>
@@ -29,7 +30,7 @@
<user>sdn</user>
<password>rocks</password>
<type>MininetCliDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>2</connect_order>
<COMPONENTS>
<home>~/mininet/custom/</home>
</COMPONENTS>