FUNCopticalFixing
Change-Id: I72726539ee0cb359bbdb3aa8d48a330812092379
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 032460b..9b0a509 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2235,8 +2235,18 @@
try:
returnValue = main.TRUE
# Generating a dictionary: intent id as a key and state as value
- intentsDict = self.getIntentState( intentsId )
- if len( intentsId ) != len( intentsDict ):
+
+ #intentsDict = self.getIntentState( intentsId )
+ intentsDict = []
+ for intent in json.loads( self.intents() ):
+ if isinstance ( intentsId, types.StringType) \
+ and intent.get('id') == intentsId:
+ intentsDict.append(intent)
+ elif isinstance ( intentsId, types.ListType ) \
+ and any( intent.get( 'id' ) == ids for ids in intentsId ):
+ intentsDict.append(intent)
+
+ if not intentsDict:
main.log.info( self.name + ": There is something wrong " +
"getting intents state" )
return main.FALSE
@@ -2251,7 +2261,6 @@
+ " does not equal expected state = "
+ expectedState )
returnValue = main.FALSE
-
elif isinstance( expectedState, types.ListType ):
for intents in intentsDict:
if not any( state == intents.get( 'state' ) for state in
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 454bd95..46d978f 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -2487,17 +2487,17 @@
there is an error.
"""
try:
- cmd = "onos-netcfg {0} {1}{2}.json".format( controllerIps, path, fileName )
- main.log.info( "Sending: " + cmd )
- main.ONOSbench.handle.sendline( cmd )
- handle = self.handle.before
- print handle
- if "Error" in handle:
- main.log.error( self.name + ": " + self.handle.before )
- return main.FALSE
- else:
- self.handle.expect( self.prompt )
- return main.TRUE
+ for ip in controllerIps:
+ cmd = "onos-netcfg {0} {1}{2}.json".format( ip, path, fileName )
+ main.log.info( "Sending: " + cmd )
+ main.ONOSbench.handle.sendline( cmd )
+ handle = self.handle.before
+ if "Error" in handle:
+ main.log.error( self.name + ": " + self.handle.before )
+ return main.FALSE
+ else:
+ self.handle.expect( self.prompt )
+ return main.TRUE
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
diff --git a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.params b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.params
index ee70b7b..ed94439 100644
--- a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.params
+++ b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.params
@@ -13,8 +13,7 @@
# 31 - Add and test bidirectional point intents
# 32 - Add and test bidirectional host intents
- <testcases>1,[2,10,21,22,23,31,32,14,19,2,10,16,21,22,23,31,32,14,19]*1,[2,10,17,21,22,23,31,32,14,19,2,10,16,17,21,22,23,31,32,14,19]*1</testcases>
-
+ <testcases>1,[2,10,22,23,31,32,14,19,2,10,16,22,23,31,32,14,19]*1,[2,10,17,22,23,31,32,14,19,2,10,16,17,22,23,31,32,14,19]*1</testcases>
<SCALE>
<size>1,3,1,3</size>
</SCALE>
@@ -41,10 +40,10 @@
# make sure that these numbers reflect the number of switches, links, and
# hosts in the optical topology specified below
<MININET>
- <switch>5</switch>
- <links>10</links>
+ <switch>7</switch>
+ <links>14</links>
<hosts>2</hosts>
- <toponame>ectopo</toponame>
+ <toponame>ectest</toponame>
</MININET>
</PARAMS>
diff --git a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
index c2a3483..c7ae463 100644
--- a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
+++ b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
@@ -158,6 +158,7 @@
time.sleep( main.startUpSleep )
main.step( "Installing ONOS package" )
onosInstallResult = main.TRUE
+ del main.activeONOSip[:]
for i in range( main.numCtrls ):
onosInstallResult = onosInstallResult and \
main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
@@ -220,17 +221,22 @@
Start Mininet opticalTest Topology
"""
main.case( "Mininet with Linc-OE startup" )
+ main.step( "Push TopoDDriver.json to ONOS through onos-netcfg" )
+ topoResult = main.ONOSbench.onosNetCfg( controllerIps=main.activeONOSip, path=main.dependencyPath,
+ fileName="TopoDDriver" )
+ #Exit if topology did not load properly
+ if not topoResult:
+ main.cleanup()
+ main.exit()
+
main.caseExplanation = "Start opticalTest.py topology included with ONOS"
- if main.opticalTopo:
- main.step( "Copying optical topology to $ONOS_ROOT/tools/test/topos/" )
- main.ONOSbench.scp( main.ONOSbench,
- "{0}{1}.py".format( main.dependencyPath, main.opticalTopo ),
- "~/onos/tools/test/topos/{0}.py".format( main.opticalTopo ) )
main.step( "Starting mininet and LINC-OE" )
- topoResult = main.TRUE
time.sleep( 10 )
- controllerIPs = ' '.join( main.activeONOSip )
- opticalMnScript = main.LincOE.runOpticalMnScript( ctrllerIP=controllerIPs, topology=main.opticalTopo )
+ controllerIPs = ','.join( main.activeONOSip )
+ cIps = ""
+ for i in range(0,4):
+ cIps += controllerIPs + ' '
+ opticalMnScript = main.LincOE.runOpticalMnScript( ctrllerIP=cIps, topology=main.opticalTopo )
topoResult = opticalMnScript
utilities.assert_equals(
expect=main.TRUE,
@@ -238,16 +244,6 @@
onpass="Started the topology successfully ",
onfail="Failed to start the topology" )
- main.step( "Push Topology.json to ONOS through onos-netcfg" )
- pushResult = main.TRUE
- time.sleep( 20 )
- main.ONOSbench.onosNetCfg( controllerIps=controllerIPs, path=main.dependencyPath, fileName="Topology" )
-
- # Exit if topology did not load properly
- if not topoResult:
- main.cleanup()
- main.exit()
-
def CASE14( self, main ):
"""
Stop mininet
@@ -367,7 +363,7 @@
arpingHostResults = main.TRUE
for host in hosts:
- if main.LincOE.arping( host ):
+ if main.LincOE.arping( host, ethDevice=host+"-eth0" ):
main.log.info( "Successfully reached host {} with arping".format( host ) )
else:
main.log.error( "Could not reach host {} with arping".format( host ) )
@@ -529,12 +525,12 @@
checkFlowResult = main.TRUE
main.pIntentsId = []
pIntent1 = main.CLIs[ 0 ].addPointIntent(
- "of:0000000000000001/1",
- "of:0000000000000002/1" )
+ "of:0000000000000015/1",
+ "of:000000000000000b/2" )
time.sleep( 10 )
pIntent2 = main.CLIs[ 0 ].addPointIntent(
- "of:0000000000000002/1",
- "of:0000000000000001/1" )
+ "of:000000000000000b/2",
+ "of:0000000000000015/1" )
main.pIntentsId.append( pIntent1 )
main.pIntentsId.append( pIntent2 )
time.sleep( 10 )
@@ -542,6 +538,9 @@
checkStateResult = main.CLIs[ 0 ].checkIntentState(
intentsId=main.pIntentsId )
time.sleep( 10 )
+ checkStateResult = utilities.retry( f=main.CLIs[0].checkIntentState,
+ retValue=main.FALSE, args=( main.pIntentsId, "INSTALLED" ),
+ sleep=main.checkIntentSleep, attempts=10 )
main.log.info( "Checking flows state" )
checkFlowResult = main.CLIs[ 0 ].checkFlowsState()
# Sleep for 10 seconds to provide time for the intent state to change
@@ -575,7 +574,7 @@
onfail="Failed to ping between h1 and h2" )
main.step( "Remove Point to Point intents" )
- removeResult = main.FALSE
+ removeResult = main.TRUE
# Check remaining intents
try:
intentsJson = json.loads( main.CLIs[ 0 ].intents() )
@@ -589,9 +588,11 @@
time.sleep( 15 )
for i in range( main.numCtrls ):
- if len( json.loads( main.CLIs[ i ].intents() ) ):
- print json.loads( main.CLIs[ i ].intents() )
- removeResult = main.FALSE
+ if not any ( intent.get('state') == 'WITHDRAWING' for intent
+ in json.loads( main.CLIs[i].intents() ) ):
+ main.log.debug( json.loads( main.CLIs[i].intents ) )
+ removeResult = main.FALSE
+ break
else:
removeResult = main.TRUE
except ( TypeError, ValueError ):
@@ -682,9 +683,11 @@
time.sleep( 15 )
for i in range( main.numCtrls ):
- if len( json.loads( main.CLIs[ i ].intents() ) ):
- print json.loads( main.CLIs[ i ].intents() )
- removeResult = main.FALSE
+ if not any ( intent.get('state') == 'WITHDRAWING' for intent
+ in json.loads( main.CLIs[i].intents() ) ):
+ main.log.debug( json.loads( main.CLIs[i].intents ) )
+ removeResult = main.FALSE
+ break
else:
removeResult = main.TRUE
except ( TypeError, ValueError ):
diff --git a/TestON/tests/FUNC/FUNCoptical/dependencies/TopoDDriver.json b/TestON/tests/FUNC/FUNCoptical/dependencies/TopoDDriver.json
new file mode 100644
index 0000000..a3320e1
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCoptical/dependencies/TopoDDriver.json
@@ -0,0 +1,14 @@
+{
+ "devices": {
+ "of:000000000000000b": {
+ "basic": {
+ "driver" : "default"
+ }
+ },
+ "of:0000000000000015": {
+ "basic": {
+ "driver" : "default"
+ }
+ }
+ }
+}