Exception handling added to FUNCintent where needed
and made related changes to driver and teston functions
Change-Id: I8db4949d7eeabb5067a3b70d238348858d0a445f
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 89e591b..0a1d25f 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -852,7 +852,7 @@
response = self.execute( cmd = cmd, prompt="mininet>" ,timeout=10 )
print response
pattern = "h\d-eth([\w])"
- ipAddressSearch = re.search( pattern, response )
+ ipAddressSearch = re.search( pattern, response )
print ipAddressSearch.group(1)
intf= host + "-eth" + str(ipAddressSearch.group(1))
cmd = host + " ip -6 addr add %s dev %s" % ( IP, intf )
@@ -1951,15 +1951,14 @@
timeout )
if i == 0:
main.log.info( "Exiting mininet..." )
- response = self.execute(
- cmd="exit",
- prompt="(.*)",
- timeout=120 )
- main.log.info( self.name + ": Stopped" )
- self.handle.sendline( "sudo mn -c" )
- response = main.TRUE
+ response = self.execute( cmd="exit",
+ prompt="(.*)",
+ timeout=120 )
+ main.log.info( self.name + ": Stopped" )
+ self.handle.sendline( "sudo mn -c" )
+ response = main.TRUE
- if i == 1:
+ elif i == 1:
main.log.info( " Mininet trying to exit while not " +
"in the mininet prompt" )
elif i == 2:
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 3c8b2ef..c5ac77e 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -928,20 +928,19 @@
if jsonFormat:
cmdStr += " -j"
handle = self.sendline( cmdStr )
- assert "Command not found:" not in handle, handle
- try:
+ if handle:
+ assert "Command not found:" not in handle, handle
# TODO: Maybe make this less hardcoded
# ConsistentMap Exceptions
assert "org.onosproject.store.service" not in handle
# Node not leader
assert "java.lang.IllegalStateException" not in handle
- except AssertionError:
main.log.error( "Error in processing '" + cmdStr + "' " +
"command: " + str( handle ) )
- return None
return handle
except AssertionError:
- main.log.exception( "" )
+ main.log.exception( "Error in processing '" + cmdStr + "' " +
+ "command: " + str( handle ) )
return None
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
@@ -3198,7 +3197,6 @@
return state
except ( TypeError, ValueError ):
main.log.exception( "{}: Object not as expected: {!r}".format( self.name, output ) )
- main.stop()
return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )