Disabled Single to Multi NOOPTION test subcase. Added exception handling for json loads to CASE8.
Made Exceptions more specific
Change-Id: Ie58ad0b984c2d351c3298ace23e421f80366ce33
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 627275b..73bcc75 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -211,6 +211,7 @@
else:
main.log.report( "ONOS instance may not be up, stop and " +
"start ONOS again " )
+
for i in range( main.numCtrls ):
stopResult = stopResult and \
main.ONOSbench.onosStop( main.ONOSip[ i ] )
@@ -289,10 +290,15 @@
"Error" not in devices[ controller ] and\
"Error" not in ports[ controller ]:
- currentDevicesResult = main.Mininet1.compareSwitches(
- mnSwitches,
- json.loads( devices[ controller ] ),
- json.loads( ports[ controller ] ) )
+ try:
+ deviceData = json.loads( devices[ controller ] )
+ portData = json.loads( ports[ controller ] )
+ except (TypeError,ValueError):
+ main.log.error("Could not load json:" + str( devices[ controller ] ) + ' or ' + str( ports[ controller ] ))
+ currentDevicesResult = main.FALSE
+ else:
+ currentDevicesResult = main.Mininet1.compareSwitches(
+ mnSwitches,deviceData,portData )
else:
currentDevicesResult = main.FALSE
if not currentDevicesResult:
@@ -300,19 +306,29 @@
devicesResults = devicesResults and currentDevicesResult
# Compare Links
if links[ controller ] and "Error" not in links[ controller ]:
- currentLinksResult = main.Mininet1.compareLinks(
- mnSwitches, mnLinks,
- json.loads( links[ controller ] ) )
+ try:
+ linkData = json.loads( links[ controller ] )
+ except (TypeError,ValueError):
+ main.log.error("Could not load json:" + str( links[ controller ] ) )
+ currentLinksResult = main.FALSE
+ else:
+ currentLinksResult = main.Mininet1.compareLinks(
+ mnSwitches, mnLinks,linkData )
else:
currentLinksResult = main.FALSE
if not currentLinksResult:
linkFails.append( controllerStr )
linksResults = linksResults and currentLinksResult
# Compare Hosts
- if hosts[ controller ] or "Error" not in hosts[ controller ]:
- currentHostsResult = main.Mininet1.compareHosts(
- mnHosts,
- json.loads( hosts[ controller ] ) )
+ if hosts[ controller ] and "Error" not in hosts[ controller ]:
+ try:
+ hostData = json.loads( hosts[ controller ] )
+ except (TypeError,ValueError):
+ main.log.error("Could not load json:" + str( hosts[ controller ] ) )
+ currentHostsResult = main.FALSE
+ else:
+ currentHostsResult = main.Mininet1.compareHosts(
+ mnHosts,hostData )
else:
currentHostsResult = main.FALSE
if not currentHostsResult:
@@ -958,29 +974,36 @@
";\nThe test will use OF " + main.OFProtocol +\
" OVS running in Mininet"
- main.step( "NOOPTION: Add single point to multi point intents" )
- stepResult = main.TRUE
hostNames = [ 'h8', 'h16', 'h24' ]
devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
'of:0000000000000007/8' ]
macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
- stepResult = main.intentFunction.singleToMultiIntent(
- main,
- name="NOOPTION",
- hostNames=hostNames,
- devices=devices,
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="NOOPTION: Successfully added single "
- + " point to multi point intents" +
- " with no match action",
- onfail="NOOPTION: Failed to add single point"
- + " point to multi point intents" +
- " with no match action" )
+ # This test as written attempts something that is improbable to succeed
+ # Single to Multi Point Raw intent cannot be bi-directional, so pings are not usable to test it
+ # This test should be re-written so that one single-to-multi NOOPTION
+ # intent is installed, with listeners at the destinations, so that one way
+ # packets can be detected
+ #
+ # main.step( "NOOPTION: Add single point to multi point intents" )
+ # stepResult = main.TRUE
+ # stepResult = main.intentFunction.singleToMultiIntent(
+ # main,
+ # name="NOOPTION",
+ # hostNames=hostNames,
+ # devices=devices,
+ # sw1="s5",
+ # sw2="s2",
+ # expectedLink=18 )
+ #
+ # utilities.assert_equals( expect=main.TRUE,
+ # actual=stepResult,
+ # onpass="NOOPTION: Successfully added single "
+ # + " point to multi point intents" +
+ # " with no match action",
+ # onfail="NOOPTION: Failed to add single point"
+ # + " point to multi point intents" +
+ # " with no match action" )
main.step( "IPV4: Add single point to multi point intents" )
stepResult = main.TRUE