WIP: HA updates, includes network partition
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index 1f41027..473c6fe 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -485,8 +485,11 @@
tmpId = main.ONOScli1.addHostIntent(
host1Id,
host2Id )
- main.log.info( "Added intent with id: " + tmpId )
- intentIds.append( tmpId )
+ if tmpId:
+ main.log.info( "Added intent with id: " + tmpId )
+ intentIds.append( tmpId )
+ else:
+ main.log.error( "addHostIntent reutrned None" )
else:
main.log.error( "Error, getHost() failed" )
main.log.warn( json.dumps( json.loads( main.ONOScli1.hosts() ),
@@ -505,10 +508,13 @@
# Print the intent states
intents = main.ONOScli1.intents()
intentStates = []
+ installedCheck = True
main.log.info( "%-6s%-15s%-15s" % ( 'Count', 'ID', 'State' ) )
count = 0
for intent in json.loads( intents ): # Iter through intents of a node
state = intent.get( 'state', None )
+ if "INSTALLED" not in state:
+ installedCheck = False
intentId = intent.get( 'id', None )
intentStates.append( ( intentId, state ) )
# add submitted intents not in the store
@@ -523,16 +529,28 @@
count += 1
main.log.info( "%-6s%-15s%-15s" %
( str( count ), str( i ), str( s ) ) )
+ main.ONOScli1.leaders()
+ main.ONOScli1.partitions()
+ # for node in nodes:
+ # node.pendingMap()
+ pendingMap = main.ONOScli1.pendingMap()
+ main.ONOScli2.pendingMap()
+ main.ONOScli3.pendingMap()
+ main.ONOScli4.pendingMap()
+ main.ONOScli5.pendingMap()
+ main.ONOScli6.pendingMap()
+ main.ONOScli7.pendingMap()
intentAddResult = bool( pingResult and hostResult and intentAddResult
- and not missingIntents)
+ and not missingIntents and installedCheck )
utilities.assert_equals(
expect=True,
actual=intentAddResult,
onpass="Pushed host intents to ONOS",
onfail="Error in pushing host intents to ONOS" )
- if not intentAddResult:
+ if not intentAddResult or "key" in pendingMap:
import time
+ installedCheck = True
main.log.info( "Sleeping 60 seconds to see if intents are found" )
time.sleep( 60 )
onosIds = main.ONOScli1.getAllIntentsId()
@@ -546,6 +564,8 @@
for intent in json.loads( intents ):
# Iter through intents of a node
state = intent.get( 'state', None )
+ if "INSTALLED" not in state:
+ installedCheck = False
intentId = intent.get( 'id', None )
intentStates.append( ( intentId, state ) )
# add submitted intents not in the store
@@ -558,6 +578,14 @@
count += 1
main.log.info( "%-6s%-15s%-15s" %
( str( count ), str( i ), str( s ) ) )
+ main.ONOScli1.leaders()
+ main.ONOScli1.pendingMap()
+ main.ONOScli2.pendingMap()
+ main.ONOScli3.pendingMap()
+ main.ONOScli4.pendingMap()
+ main.ONOScli5.pendingMap()
+ main.ONOScli6.pendingMap()
+ main.ONOScli7.pendingMap()
def CASE4( self, main ):
"""
@@ -595,6 +623,8 @@
actual=PingResult,
onpass="Intents have been installed correctly and pings work",
onfail="Intents have not been installed correctly, pings failed." )
+
+ installedCheck = True
if PingResult is not main.TRUE:
# Print the intent states
intents = main.ONOScli1.intents()
@@ -604,6 +634,8 @@
# Iter through intents of a node
for intent in json.loads( intents ):
state = intent.get( 'state', None )
+ if "INSTALLED" not in state:
+ installedCheck = False
intentId = intent.get( 'id', None )
intentStates.append( ( intentId, state ) )
intentStates.sort()
@@ -611,6 +643,44 @@
count += 1
main.log.info( "%-6s%-15s%-15s" %
( str( count ), str( i ), str( s ) ) )
+ main.ONOScli1.leaders()
+ main.ONOScli1.partitions()
+ main.ONOScli1.pendingMap()
+ main.ONOScli2.pendingMap()
+ main.ONOScli3.pendingMap()
+ main.ONOScli4.pendingMap()
+ main.ONOScli5.pendingMap()
+ main.ONOScli6.pendingMap()
+ main.ONOScli7.pendingMap()
+ if not installedCheck:
+ main.log.info( "Waiting 60 seconds to see if intent states change" )
+ time.sleep( 60 )
+ # Print the intent states
+ intents = main.ONOScli1.intents()
+ intentStates = []
+ main.log.info( "%-6s%-15s%-15s" % ( 'Count', 'ID', 'State' ) )
+ count = 0
+ # Iter through intents of a node
+ for intent in json.loads( intents ):
+ state = intent.get( 'state', None )
+ if "INSTALLED" not in state:
+ installedCheck = False
+ intentId = intent.get( 'id', None )
+ intentStates.append( ( intentId, state ) )
+ intentStates.sort()
+ for i, s in intentStates:
+ count += 1
+ main.log.info( "%-6s%-15s%-15s" %
+ ( str( count ), str( i ), str( s ) ) )
+ main.ONOScli1.leaders()
+ main.ONOScli1.partitions()
+ main.ONOScli1.pendingMap()
+ main.ONOScli2.pendingMap()
+ main.ONOScli3.pendingMap()
+ main.ONOScli4.pendingMap()
+ main.ONOScli5.pendingMap()
+ main.ONOScli6.pendingMap()
+ main.ONOScli7.pendingMap()
def CASE5( self, main ):
"""
@@ -1876,7 +1946,7 @@
linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
description = "Restore a link to ensure that Link Discovery is " + \
- "working properly"
+ "working properly"
main.log.report( description )
main.case( description )
@@ -2162,7 +2232,11 @@
"Leader for the election app should be an ONOS node," +
"instead got '" + str( leader ) + "'" )
leaderResult = main.FALSE
- withdrawResult = oldLeader.electionTestWithdraw()
+ oldLeader = None
+ else:
+ main.log.error( "Leader election --- why am I HERE?!?")
+ if oldLeader:
+ withdrawResult = oldLeader.electionTestWithdraw()
utilities.assert_equals(
expect=main.TRUE,
actual=withdrawResult,
@@ -2215,7 +2289,10 @@
main.step( "Run for election on old leader( just so everyone " +
"is in the hat )" )
- runResult = oldLeader.electionTestRun()
+ if oldLeader:
+ runResult = oldLeader.electionTestRun()
+ else:
+ runResult = main.FALSE
utilities.assert_equals(
expect=main.TRUE,
actual=runResult,