Merge branch 'master' of https://github.com/opennetworkinglab/ONLabTest
diff --git a/TestON/dependencies/Jenkins_getresult_HA.py b/TestON/dependencies/Jenkins_getresult_HA.py
index f3ea459..859612d 100755
--- a/TestON/dependencies/Jenkins_getresult_HA.py
+++ b/TestON/dependencies/Jenkins_getresult_HA.py
@@ -101,7 +101,9 @@
f.close()
#https://wiki.onosproject.org/display/OST/Test+Results+-+HA#Test+Results+-+HA
#Example anchor on new wiki: #TestResults-HA-TestHATestSanity
- page_name = "TestResults-HA-Test"
+ page_name = "Master+-+HA"
+ if "ONOS-HA-Maint" in job:
+ page_name = "1.0+-+HA"
header += "<li><a href=\'#" + str(page_name) + str(test) + "\'> " + str(test) + " - Results: " + str(passes) + " Passed, " + str(fails) + " Failed</a></li>"
diff --git a/TestON/dependencies/onos.properties.proactive b/TestON/dependencies/onos.properties.proactive
deleted file mode 100644
index 2b5150a..0000000
--- a/TestON/dependencies/onos.properties.proactive
+++ /dev/null
@@ -1,16 +0,0 @@
-floodlight.modules = net.floodlightcontroller.core.FloodlightProvider,\
-net.floodlightcontroller.threadpool.ThreadPool,\
-net.onrc.onos.core.topology.TopologyPublisher, \
-net.onrc.onos.core.datagrid.HazelcastDatagrid,\
-net.onrc.onos.core.flowprogrammer.FlowProgrammer,\
-net.onrc.onos.core.intent.runtime.PathCalcRuntimeModule,\
-net.onrc.onos.core.intent.runtime.PlanInstallModule,\
-net.onrc.onos.core.registry.ZookeeperRegistry
-net.floodlightcontroller.restserver.RestApiServer.port = 8080
-net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
-net.floodlightcontroller.core.FloodlightProvider.workerthreads = 16
-net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
-net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
-net.onrc.onos.core.datagrid.HazelcastDatagrid.datagridConfig = conf/hazelcast.xml
-net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = conf/ramcloud.conf
-net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.graph_db_store = ramcloud
diff --git a/TestON/dependencies/onos.properties.reactive b/TestON/dependencies/onos.properties.reactive
deleted file mode 100644
index 8d78222..0000000
--- a/TestON/dependencies/onos.properties.reactive
+++ /dev/null
@@ -1,19 +0,0 @@
-floodlight.modules = net.floodlightcontroller.core.FloodlightProvider,\
-net.floodlightcontroller.threadpool.ThreadPool,\
-net.onrc.onos.core.topology.TopologyPublisher, \
-net.onrc.onos.core.datagrid.HazelcastDatagrid,\
-net.onrc.onos.core.flowprogrammer.FlowProgrammer,\
-net.onrc.onos.core.intent.runtime.PathCalcRuntimeModule,\
-net.onrc.onos.core.intent.runtime.PlanInstallModule,\
-net.onrc.onos.core.registry.ZookeeperRegistry,\
-net.onrc.onos.apps.proxyarp.ProxyArpManager,\
-net.onrc.onos.core.main.config.DefaultConfiguration,\
-net.onrc.onos.apps.forwarding.Forwarding
-net.floodlightcontroller.restserver.RestApiServer.port = 8080
-net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
-net.floodlightcontroller.core.FloodlightProvider.workerthreads = 16
-net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
-net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
-net.onrc.onos.core.datagrid.HazelcastDatagrid.datagridConfig = conf/hazelcast.xml
-net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = conf/ramcloud.conf
-net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.graph_db_store = ramcloud
diff --git a/TestON/dependencies/pyintents.py b/TestON/dependencies/pyintents.py
deleted file mode 100755
index b593845..0000000
--- a/TestON/dependencies/pyintents.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#! /usr/bin/env python
-'''
-This file creates the ONOS intents for the sanity 4 nodes tests. These intents will be translated into flows by ONOS and pushed to the switches.
-'''
-
-import json
-import requests
-
-url = 'http://127.0.0.1:8080/wm/onos/datagrid/add/intents/json'
-headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
-
-
-'''response
-[{'intent_id':'5','status':'CREATED','log':['created, time:73268214932534']}]
-'''
-
-
-
-for i in range(6,16):
- #intent = [{'intent_id': '%d' %i,'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':'8249','srcPort':1,'srcMac':'00:00:00:00:00:01','dstSwitch':'4103','dstPort':1,'dstMac':'00:00:00:00:00:02'}]
- srcMac = '00:00:00:00:00:'+ str(hex(i)[2:]).zfill(2)
- dstMac = '00:00:00:00:00:'+ str(hex(i+10)[2:])
- srcSwitch = '00:00:00:00:00:00:10:'+ str(i).zfill(2)
- dstSwitch = '00:00:00:00:00:00:20:'+ str(i+25)
- srcPort = 1
- dstPort = 1
-
- intent = [{'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}]
-
-
- print json.dumps(intent, sort_keys = True)
-
-
- #r = requests.post(url, data=json.dumps(iid, sort_keys=True)+json.dumps(intent, sort_keys=True), headers = headers)
- r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
- print r
- print r.content
-
-
-
- intent = [{'intent_id': '%d' %(i+10),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':dstSwitch,'srcPort':dstPort,'srcMac':dstMac,'dstSwitch':srcSwitch,'dstPort':srcPort,'dstMac':srcMac}]
- print json.dumps(intent, sort_keys = True)
- r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
- print r
- print r.content
-
diff --git a/TestON/dependencies/rmpyintents.py b/TestON/dependencies/rmpyintents.py
deleted file mode 100755
index 10bb5d4..0000000
--- a/TestON/dependencies/rmpyintents.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#! /usr/bin/env python
-
-'''
-This file removes the ONOS intents for the sanity 4 nodes tests. The flows associated with these intents should be deleted from the switches.
-'''
-
-import json
-import requests
-
-
-
-url = 'http://127.0.0.1:8080/wm/onos/datagrid/add/intents/json'
-headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
-
-
-'''response
-[{'intent_id':'5','status':'CREATED','log':['created, time:73268214932534']}]
-'''
-
-
-
-for i in range(6,16):
- #intent = [{'intent_id': '%d' %i,'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':'8249','srcPort':1,'srcMac':'00:00:00:00:00:01','dstSwitch':'4103','dstPort':1,'dstMac':'00:00:00:00:00:02'}]
- srcMac = '00:00:00:00:00:'+ str(hex(i)[2:]).zfill(2)
- dstMac = '00:00:00:00:00:'+ str(hex(i+10)[2:])
- srcSwitch = '00:00:00:00:00:00:10:'+ str(i).zfill(2)
- dstSwitch = '00:00:00:00:00:00:20:'+ str(i+25)
- srcPort = 1
- dstPort = 1
-
- intent = [{'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}]
-
-
- print json.dumps(intent, sort_keys = True)
-
-
- #r = requests.post(url, data=json.dumps(iid, sort_keys=True)+json.dumps(intent, sort_keys=True), headers = headers)
- r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
- print r
- print r.content
-
-
-
- intent = [{'intent_id': '%d' %(i+10),'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':dstSwitch,'srcPort':dstPort,'srcMac':dstMac,'dstSwitch':srcSwitch,'dstPort':srcPort,'dstMac':srcMac}]
- print json.dumps(intent, sort_keys = True)
- r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
- print r
- print r.content
-
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 097a303..5deb911 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -19,7 +19,6 @@
import sys
import pexpect
import re
-import traceback
sys.path.append( "../" )
from drivers.common.clidriver import CLI
@@ -60,15 +59,16 @@
else:
main.log.info( "NO ONOS HANDLE" )
return main.FALSE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + ":::::::::::::::::::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( ":::::::::::::::::::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -90,11 +90,14 @@
self.handle.sendline( "exit" )
self.handle.expect( "closed" )
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
except:
- main.log.error( self.name + ": Connection failed to the host" )
+ main.log.exception( self.name + ": Connection failed to the host" )
response = main.FALSE
return response
@@ -113,6 +116,9 @@
elif i == 1:
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": eof exception found" )
main.log.error( self.name + ": " +
@@ -120,9 +126,7 @@
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -155,15 +159,16 @@
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": eof exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -232,15 +237,16 @@
str( ONOSIp ) + " timeout" )
return main.FALSE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -277,15 +283,16 @@
return output
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -316,15 +323,16 @@
else:
main.log.info( "Node " + str( ONOSIp ) + " added" )
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -343,15 +351,16 @@
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -365,15 +374,16 @@
cmdStr = "nodes"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -388,15 +398,16 @@
handle = self.sendline( cmdStr )
main.log.info( "onos:topology returned: " + str( handle ) )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -410,6 +421,9 @@
self.sendline( cmdStr )
# TODO: Check for possible error responses from karaf
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
@@ -418,11 +432,9 @@
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.log.report( "Failed to install feature" )
main.log.report( "Exiting test" )
- main.log.info( self.name + " ::::::" )
main.cleanup()
main.exit()
@@ -436,15 +448,16 @@
self.sendline( cmdStr )
# TODO: Check for possible error responses from karaf
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -478,15 +491,16 @@
cmdStr = "devices"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -501,15 +515,16 @@
self.sendline( cmdStr )
# TODO: Check for error responses from ONOS
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -543,15 +558,16 @@
cmdStr = "links"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -586,15 +602,16 @@
cmdStr = "ports"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -631,15 +648,16 @@
cmdStr = "roles"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -667,16 +685,16 @@
if str( deviceId ) in device[ 'id' ]:
return device
return None
-
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -698,15 +716,16 @@
return main.FALSE
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -725,15 +744,16 @@
path = handle.split( ";" )[ 0 ]
cost = handle.split( ";" )[ 1 ]
return ( path, cost )
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return ( handle, "Error" )
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -767,15 +787,16 @@
cmdStr = "hosts"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -799,18 +820,21 @@
# search json for the host with mac then return the device
for host in hostsJson:
# print "%s in %s?" % ( mac, host[ 'id' ] )
- if mac in host[ 'id' ]:
+ if not host:
+ pass
+ elif mac in host[ 'id' ]:
return host
return None
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -843,15 +867,16 @@
return onosHostList
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -876,15 +901,16 @@
str( hostIdOne ) + " and " + str( hostIdTwo ) )
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -905,15 +931,16 @@
return handle
else:
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1024,15 +1051,16 @@
return main.FALSE
else:
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1171,15 +1199,16 @@
return self.handle
else:
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1200,15 +1229,16 @@
else:
# TODO: Should this be main.TRUE
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1231,15 +1261,16 @@
cmdStr = "routes"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1260,15 +1291,16 @@
cmdStr = "intents"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1292,15 +1324,16 @@
main.log.error( self.name + ".flows() response: " +
str( handle ) )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1350,15 +1383,16 @@
return latResult
else:
return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1379,15 +1413,16 @@
cmdStr = "intents-events-metrics"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1408,15 +1443,16 @@
cmdStr = "topology-events-metrics"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1459,15 +1495,16 @@
return intentIdList
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1504,15 +1541,16 @@
idList.append( arg.split( "id=" )[ 1 ] )
return idList
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1543,15 +1581,16 @@
return idList
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1574,15 +1613,16 @@
if dpid in device[ 'id' ]:
return device
return None
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1639,15 +1679,16 @@
else:
main.log.info( output )
return result
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1681,15 +1722,16 @@
main.log.error( "Invalid 'role' given to device_role(). " +
"Value was '" + str(role) + "'." )
return main.FALSE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1723,15 +1765,16 @@
cmdStr = "clusters"
handle = self.sendline( cmdStr )
return handle
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1774,15 +1817,16 @@
"unexpected response" )
main.log.error( repr( response ) )
return main.FALSE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.FALSE
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1814,15 +1858,16 @@
"unexpected response" )
main.log.error( repr( response ) )
return main.FALSE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.FALSE
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1854,15 +1899,16 @@
"unexpected response" )
main.log.error( repr( response ) )
return main.FALSE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.FALSE
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1879,15 +1925,16 @@
return ( output, "Error" )
else:
return output
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return ( output, "Error" )
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1904,15 +1951,16 @@
return ( output, "Error " )
else:
return output
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return ( output, "Error " )
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
@@ -1928,14 +1976,36 @@
return ( output, "Error" )
else:
return output
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return ( output, "Error" )
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
main.cleanup()
main.exit()
except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
+ def testExceptions( self, obj ):
+ """
+ Test exception logging
+ """
+ # FIXME: Remove this before you commit
+
+ try:
+ return obj[ 'dedf' ]
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index 791d55c..ff38cfe 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -104,6 +104,9 @@
cleanInstallResult = main.TRUE
gitPullResult = main.TRUE
+ main.step( "Starting Mininet" )
+ main.Mininet1.startNet( )
+
main.step( "Compiling the latest version of ONOS" )
if PULLCODE:
# TODO Configure branch in params
@@ -116,7 +119,7 @@
else:
main.log.warn( "Did not pull new code so skipping mvn " +
"clean install" )
- main.ONOSbench.getVersion( report=True )
+ main.ONOSbench.getVersion( report=True )
main.step( "Creating ONOS package" )
packageResult = main.ONOSbench.onosPackage()
@@ -436,19 +439,36 @@
str( hex( i )[ 2: ] ).zfill( 2 ).upper()
host2 = "00:00:00:00:00:" + \
str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
- host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
- host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
- # NOTE: get host can return None
+ # NOTE: getHost can return None
+ host1Dict = main.ONOScli1.getHost( host1 )
+ host2Dict = main.ONOScli1.getHost( host2 )
+ host1Id = None
+ host2Id = None
+ if host1Dict and host2Dict:
+ host1Id = host1Dict.get( 'id', None )
+ host2Id = host2Dict.get( 'id', None )
if host1Id and host2Id:
tmpResult = main.ONOScli1.addHostIntent(
host1Id,
host2Id )
else:
main.log.error( "Error, getHost() failed" )
+ main.log.warn( json.dumps( json.loads( main.ONOScli1.hosts() ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
tmpResult = main.FALSE
intentAddResult = bool( pingResult and intentAddResult
and tmpResult )
# TODO Check that intents were added?
+ # Print the intent states
+ intents = main.ONOScli1.intents( )
+ intentStates = []
+ for intent in json.loads( intents ): # Iter through intents of a node
+ intentStates.append( intent.get( 'state', None ) )
+ out = [ (i, intentStates.count( i ) ) for i in set( intentStates ) ]
+ main.log.info( dict( out ) )
+
utilities.assert_equals(
expect=True,
actual=intentAddResult,
@@ -1290,6 +1310,24 @@
actual=intentCheck,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents" )
+ # Print the intent states
+ intents = []
+ intents.append( ONOS1Intents )
+ intents.append( ONOS2Intents )
+ intents.append( ONOS3Intents )
+ intents.append( ONOS4Intents )
+ intents.append( ONOS5Intents )
+ intents.append( ONOS6Intents )
+ intents.append( ONOS7Intents )
+ intentStates = []
+ for node in intents: # Iter through ONOS nodes
+ nodeStates = []
+ for intent in json.loads( node ): # Iter through intents of a node
+ nodeStates.append( intent[ 'state' ] )
+ intentStates.append( nodeStates )
+ out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
+ main.log.info( dict( out ) )
+
# NOTE: Hazelcast has no durability, so intents are lost across system
# restarts
@@ -1297,7 +1335,8 @@
main.step( "Compare current intents with intents before the failure" )
# NOTE: this requires case 5 to pass for intentState to be set.
# maybe we should stop the test if that fails?
- if intentState == ONOS1Intents:
+ sameIntents = main.TRUE
+ if intentState and intentState == ONOS1Intents:
sameIntents = main.TRUE
main.log.report( "Intents are consistent with before failure" )
# TODO: possibly the states have changed? we may need to figure out
@@ -1486,7 +1525,6 @@
for controller in range( 0, len( hosts ) ):
controllerStr = str( controller + 1 )
for host in hosts[ controller ]:
- host
if host[ 'ips' ] == []:
main.log.error(
"DEBUG:Error with host ips on controller" +
@@ -1639,7 +1677,7 @@
note = "note it takes about " + str( int( cliTime ) ) + \
" seconds for the test to make all the cli calls to fetch " +\
"the topology from each ONOS instance"
- main.log.report(
+ main.log.info(
"Very crass estimate for topology discovery/convergence( " +
str( note ) + " ): " + str( elapsed ) + " seconds, " +
str( count ) + " tries" )
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index 6cca54b..3d9adc7 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -104,6 +104,9 @@
cleanInstallResult = main.TRUE
gitPullResult = main.TRUE
+ main.step( "Starting Mininet" )
+ main.Mininet1.startNet( )
+
main.step( "Compiling the latest version of ONOS" )
if PULLCODE:
# TODO Configure branch in params
@@ -434,19 +437,37 @@
str( hex( i )[ 2: ] ).zfill( 2 ).upper()
host2 = "00:00:00:00:00:" + \
str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
- host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
- host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
- # NOTE: get host can return None
+ # NOTE: getHost can return None
+ host1Dict = main.ONOScli1.getHost( host1 )
+ host2Dict = main.ONOScli1.getHost( host2 )
+ host1Id = None
+ host2Id = None
+ if host1Dict and host2Dict:
+ host1Id = host1Dict.get( 'id', None )
+ host2Id = host2Dict.get( 'id', None )
if host1Id and host2Id:
- tmpResult = main.ONOScli1.addHostIntent(
+ #Changed onos node to test something
+ tmpResult = main.ONOScli4.addHostIntent(
host1Id,
host2Id )
else:
main.log.error( "Error, getHost() failed" )
+ main.log.warn( json.dumps( json.loads( main.ONOScli1.hosts() ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
tmpResult = main.FALSE
intentAddResult = bool( pingResult and intentAddResult
and tmpResult )
# TODO Check that intents were added?
+ # Print the intent states
+ intents = main.ONOScli1.intents( )
+ intentStates = []
+ for intent in json.loads( intents ): # Iter through intents of a node
+ intentStates.append( intent.get( 'state', None ) )
+ out = [ (i, intentStates.count( i ) ) for i in set( intentStates ) ]
+ main.log.info( dict( out ) )
+
utilities.assert_equals(
expect=True,
actual=intentAddResult,
@@ -906,12 +927,6 @@
hosts.append( main.ONOScli5.hosts() )
hosts.append( main.ONOScli6.hosts() )
hosts.append( main.ONOScli7.hosts() )
- for controller in range( 0, len( hosts ) ):
- controllerStr = str( controller + 1 )
- for host in hosts[ controller ]:
- if host[ 'ips' ] == []:
- main.log.error( "DEBUG:Error with host ips on controller" +
- controllerStr + ": " + str( host ) )
ports = []
ports.append( main.ONOScli1.ports() )
ports.append( main.ONOScli2.ports() )
@@ -1287,13 +1302,32 @@
actual=intentCheck,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents" )
+ # Print the intent states
+ intents = []
+ intents.append( ONOS1Intents )
+ intents.append( ONOS2Intents )
+ intents.append( ONOS3Intents )
+ intents.append( ONOS4Intents )
+ intents.append( ONOS5Intents )
+ intents.append( ONOS6Intents )
+ intents.append( ONOS7Intents )
+ intentStates = []
+ for node in intents: # Iter through ONOS nodes
+ nodeStates = []
+ for intent in json.loads( node ): # Iter through intents of a node
+ nodeStates.append( intent[ 'state' ] )
+ intentStates.append( nodeStates )
+ out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
+ main.log.info( dict( out ) )
+
# NOTE: Hazelcast has no durability, so intents are lost across system
# restarts
main.step( "Compare current intents with intents before the failure" )
# NOTE: this requires case 5 to pass for intentState to be set.
# maybe we should stop the test if that fails?
- if intentState == ONOS1Intents:
+ sameIntents = main.TRUE
+ if intentState and intentState == ONOS1Intents:
sameIntents = main.TRUE
main.log.report( "Intents are consistent with before failure" )
# TODO: possibly the states have changed? we may need to figure out
@@ -1487,7 +1521,6 @@
for controller in range( 0, len( hosts ) ):
controllerStr = str( controller + 1 )
for host in hosts[ controller ]:
- host
if host[ 'ips' ] == []:
main.log.error(
"DEBUG:Error with host ips on controller" +
@@ -1640,7 +1673,7 @@
note = "note it takes about " + str( int( cliTime ) ) + \
" seconds for the test to make all the cli calls to fetch " +\
"the topology from each ONOS instance"
- main.log.report(
+ main.log.info(
"Very crass estimate for topology discovery/convergence( " +
str( note ) + " ): " + str( elapsed ) + " seconds, " +
str( count ) + " tries" )
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 9a95e78..58f9954 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -104,6 +104,9 @@
cleanInstallResult = main.TRUE
gitPullResult = main.TRUE
+ main.step( "Starting Mininet" )
+ main.Mininet1.startNet( )
+
main.step( "Compiling the latest version of ONOS" )
if PULLCODE:
# TODO Configure branch in params
@@ -434,19 +437,36 @@
str( hex( i )[ 2: ] ).zfill( 2 ).upper()
host2 = "00:00:00:00:00:" + \
str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
- host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
- host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
- # NOTE: get host can return None
+ # NOTE: getHost can return None
+ host1Dict = main.ONOScli1.getHost( host1 )
+ host2Dict = main.ONOScli1.getHost( host2 )
+ host1Id = None
+ host2Id = None
+ if host1Dict and host2Dict:
+ host1Id = host1Dict.get( 'id', None )
+ host2Id = host2Dict.get( 'id', None )
if host1Id and host2Id:
tmpResult = main.ONOScli1.addHostIntent(
host1Id,
host2Id )
else:
main.log.error( "Error, getHost() failed" )
+ main.log.warn( json.dumps( json.loads( main.ONOScli1.hosts() ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
tmpResult = main.FALSE
intentAddResult = bool( pingResult and intentAddResult
and tmpResult )
# TODO Check that intents were added?
+ # Print the intent states
+ intents = main.ONOScli1.intents( )
+ intentStates = []
+ for intent in json.loads( intents ): # Iter through intents of a node
+ intentStates.append( intent.get( 'state', None ) )
+ out = [ (i, intentStates.count( i ) ) for i in set( intentStates ) ]
+ main.log.info( dict( out ) )
+
utilities.assert_equals(
expect=True,
actual=intentAddResult,
@@ -1258,13 +1278,32 @@
actual=intentCheck,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents" )
+ # Print the intent states
+ intents = []
+ intents.append( ONOS1Intents )
+ intents.append( ONOS2Intents )
+ intents.append( ONOS3Intents )
+ intents.append( ONOS4Intents )
+ intents.append( ONOS5Intents )
+ intents.append( ONOS6Intents )
+ intents.append( ONOS7Intents )
+ intentStates = []
+ for node in intents: # Iter through ONOS nodes
+ nodeStates = []
+ for intent in json.loads( node ): # Iter through intents of a node
+ nodeStates.append( intent[ 'state' ] )
+ intentStates.append( nodeStates )
+ out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
+ main.log.info( dict( out ) )
+
# NOTE: Hazelcast has no durability, so intents are lost across system
# restarts
main.step( "Compare current intents with intents before the failure" )
# NOTE: this requires case 5 to pass for intentState to be set.
# maybe we should stop the test if that fails?
- if intentState == ONOS1Intents:
+ sameIntents = main.TRUE
+ if intentState and intentState == ONOS1Intents:
sameIntents = main.TRUE
main.log.report( "Intents are consistent with before failure" )
# TODO: possibly the states have changed? we may need to figure out
@@ -1454,7 +1493,6 @@
for controller in range( 0, len( hosts ) ):
controllerStr = str( controller + 1 )
for host in hosts[ controller ]:
- host
if host[ 'ips' ] == []:
main.log.error(
"DEBUG:Error with host ips on controller" +
@@ -1608,7 +1646,7 @@
note = "note it takes about " + str( int( cliTime ) ) + \
" seconds for the test to make all the cli calls to fetch " +\
"the topology from each ONOS instance"
- main.log.report(
+ main.log.info(
"Very crass estimate for topology discovery/convergence( " +
str( note ) + " ): " + str( elapsed ) + " seconds, " +
str( count ) + " tries" )
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
index 39ce920..4b9b287 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -104,6 +104,9 @@
cleanInstallResult = main.TRUE
gitPullResult = main.TRUE
+ main.step( "Starting Mininet" )
+ main.Mininet1.startNet( )
+
main.step( "Compiling the latest version of ONOS" )
if PULLCODE:
# TODO Configure branch in params
@@ -236,19 +239,36 @@
str( hex( i )[ 2: ] ).zfill( 2 ).upper()
host2 = "00:00:00:00:00:" + \
str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
- host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
- host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
- # NOTE: get host can return None
+ # NOTE: getHost can return None
+ host1Dict = main.ONOScli1.getHost( host1 )
+ host2Dict = main.ONOScli1.getHost( host2 )
+ host1Id = None
+ host2Id = None
+ if host1Dict and host2Dict:
+ host1Id = host1Dict.get( 'id', None )
+ host2Id = host2Dict.get( 'id', None )
if host1Id and host2Id:
tmpResult = main.ONOScli1.addHostIntent(
host1Id,
host2Id )
else:
main.log.error( "Error, getHost() failed" )
+ main.log.warn( json.dumps( json.loads( main.ONOScli1.hosts() ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
tmpResult = main.FALSE
intentAddResult = bool( pingResult and intentAddResult
and tmpResult )
# TODO Check that intents were added?
+ # Print the intent states
+ intents = main.ONOScli1.intents( )
+ intentStates = []
+ for intent in json.loads( intents ): # Iter through intents of a node
+ intentStates.append( intent.get( 'state', None ) )
+ out = [ (i, intentStates.count( i ) ) for i in set( intentStates ) ]
+ main.log.info( dict( out ) )
+
utilities.assert_equals(
expect=True,
actual=intentAddResult,
@@ -562,6 +582,18 @@
actual=intentCheck,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents" )
+ # Print the intent states
+ intents = []
+ intents.append( ONOS1Intents )
+ intentStates = []
+ for node in intents: # Iter through ONOS nodes
+ nodeStates = []
+ for intent in json.loads( node ): # Iter through intents of a node
+ nodeStates.append( intent[ 'state' ] )
+ intentStates.append( nodeStates )
+ out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
+ main.log.info( dict( out ) )
+
# NOTE: Hazelcast has no durability, so intents are lost across system
# restarts
@@ -569,7 +601,8 @@
main.step( "Compare current intents with intents before the failure" )
# NOTE: this requires case 5 to pass for intentState to be set.
# maybe we should stop the test if that fails?
- if intentState == ONOS1Intents:
+ sameIntents = main.TRUE
+ if intentState and intentState == ONOS1Intents:
sameIntents = main.TRUE
main.log.report( "Intents are consistent with before failure" )
# TODO: possibly the states have changed? we may need to figure out
@@ -770,7 +803,7 @@
note = "note it takes about " + str( int( cliTime ) ) + \
" seconds for the test to make all the cli calls to fetch " +\
"the topology from each ONOS instance"
- main.log.report(
+ main.log.info(
"Very crass estimate for topology discovery/convergence( " +
str( note ) + " ): " + str( elapsed ) + " seconds, " +
str( count ) + " tries" )