Rearrange some cases to make more sense
Change-Id: I458c739409271bbc7814dca17239b3f5eaf6a06f
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HAclusterRestart/HAclusterRestart.py
index 03c14f1..cb40b4f 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.py
@@ -250,27 +250,6 @@
intf=main.params[ 'MNtcpdump' ][ 'intf' ],
port=main.params[ 'MNtcpdump' ][ 'port' ] )
- main.step( "App Ids check" )
- appCheck = main.TRUE
- threads = []
- for i in main.activeNodes:
- t = main.Thread( target=main.CLIs[i].appToIDCheck,
- name="appToIDCheck-" + str( i ),
- args=[] )
- threads.append( t )
- t.start()
-
- for t in threads:
- t.join()
- appCheck = appCheck and t.result
- if appCheck != main.TRUE:
- node = main.activeNodes[0]
- main.log.warn( main.CLIs[node].apps() )
- main.log.warn( main.CLIs[node].appIDs() )
- utilities.assert_equals( expect=main.TRUE, actual=appCheck,
- onpass="App Ids seem to be correct",
- onfail="Something is wrong with app Ids" )
-
main.step( "Checking ONOS nodes" )
nodesOutput = []
nodeResults = main.TRUE
@@ -361,6 +340,27 @@
else:
main.log.warn( "No configurations were specified to be changed after startup" )
+ main.step( "App Ids check" )
+ appCheck = main.TRUE
+ threads = []
+ for i in main.activeNodes:
+ t = main.Thread( target=main.CLIs[i].appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ appCheck = appCheck and t.result
+ if appCheck != main.TRUE:
+ node = main.activeNodes[0]
+ main.log.warn( main.CLIs[node].apps() )
+ main.log.warn( main.CLIs[node].appIDs() )
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+
def CASE2( self, main ):
"""
Assign devices to controllers
@@ -970,37 +970,6 @@
main.caseExplanation = "Ping across added host intents to check " +\
"functionality and check the state of " +\
"the intent"
- main.step( "Ping across added host intents" )
- onosCli = main.CLIs[ main.activeNodes[0] ]
- PingResult = main.TRUE
- for i in range( 8, 18 ):
- ping = main.Mininet1.pingHost( src="h" + str( i ),
- target="h" + str( i + 10 ) )
- PingResult = PingResult and ping
- if ping == main.FALSE:
- main.log.warn( "Ping failed between h" + str( i ) +
- " and h" + str( i + 10 ) )
- elif ping == main.TRUE:
- main.log.info( "Ping test passed!" )
- # Don't set PingResult or you'd override failures
- if PingResult == main.FALSE:
- main.log.error(
- "Intents have not been installed correctly, pings failed." )
- # TODO: pretty print
- main.log.warn( "ONOS1 intents: " )
- try:
- tmpIntents = onosCli.intents()
- main.log.warn( json.dumps( json.loads( tmpIntents ),
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) ) )
- except ( ValueError, TypeError ):
- main.log.warn( repr( tmpIntents ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=PingResult,
- onpass="Intents have been installed correctly and pings work",
- onfail="Intents have not been installed correctly, pings failed." )
main.step( "Check Intent state" )
installedCheck = False
@@ -1036,6 +1005,38 @@
onfail="Intents are not all in " +
"INSTALLED state" )
+ main.step( "Ping across added host intents" )
+ onosCli = main.CLIs[ main.activeNodes[0] ]
+ PingResult = main.TRUE
+ for i in range( 8, 18 ):
+ ping = main.Mininet1.pingHost( src="h" + str( i ),
+ target="h" + str( i + 10 ) )
+ PingResult = PingResult and ping
+ if ping == main.FALSE:
+ main.log.warn( "Ping failed between h" + str( i ) +
+ " and h" + str( i + 10 ) )
+ elif ping == main.TRUE:
+ main.log.info( "Ping test passed!" )
+ # Don't set PingResult or you'd override failures
+ if PingResult == main.FALSE:
+ main.log.error(
+ "Intents have not been installed correctly, pings failed." )
+ # TODO: pretty print
+ main.log.warn( "ONOS1 intents: " )
+ try:
+ tmpIntents = onosCli.intents()
+ main.log.warn( json.dumps( json.loads( tmpIntents ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
+ except ( ValueError, TypeError ):
+ main.log.warn( repr( tmpIntents ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=PingResult,
+ onpass="Intents have been installed correctly and pings work",
+ onfail="Intents have not been installed correctly, pings failed." )
+
main.step( "Check leadership of topics" )
leaders = onosCli.leaders()
topicCheck = main.TRUE
diff --git a/TestON/tests/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HAfullNetPartition/HAfullNetPartition.py
index 47fb895..12d8bbb 100644
--- a/TestON/tests/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HAfullNetPartition/HAfullNetPartition.py
@@ -275,27 +275,6 @@
intf=main.params[ 'MNtcpdump' ][ 'intf' ],
port=main.params[ 'MNtcpdump' ][ 'port' ] )
- main.step( "App Ids check" )
- appCheck = main.TRUE
- threads = []
- for i in main.activeNodes:
- t = main.Thread( target=main.CLIs[i].appToIDCheck,
- name="appToIDCheck-" + str( i ),
- args=[] )
- threads.append( t )
- t.start()
-
- for t in threads:
- t.join()
- appCheck = appCheck and t.result
- if appCheck != main.TRUE:
- node = main.activeNodes[0]
- main.log.warn( main.CLIs[node].apps() )
- main.log.warn( main.CLIs[node].appIDs() )
- utilities.assert_equals( expect=main.TRUE, actual=appCheck,
- onpass="App Ids seem to be correct",
- onfail="Something is wrong with app Ids" )
-
main.step( "Checking ONOS nodes" )
nodesOutput = []
nodeResults = main.TRUE
@@ -386,6 +365,27 @@
else:
main.log.warn( "No configurations were specified to be changed after startup" )
+ main.step( "App Ids check" )
+ appCheck = main.TRUE
+ threads = []
+ for i in main.activeNodes:
+ t = main.Thread( target=main.CLIs[i].appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ appCheck = appCheck and t.result
+ if appCheck != main.TRUE:
+ node = main.activeNodes[0]
+ main.log.warn( main.CLIs[node].apps() )
+ main.log.warn( main.CLIs[node].appIDs() )
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+
def CASE2( self, main ):
"""
Assign devices to controllers
@@ -972,37 +972,6 @@
main.caseExplanation = "Ping across added host intents to check " +\
"functionality and check the state of " +\
"the intent"
- main.step( "Ping across added host intents" )
- onosCli = main.CLIs[ main.activeNodes[0] ]
- PingResult = main.TRUE
- for i in range( 8, 18 ):
- ping = main.Mininet1.pingHost( src="h" + str( i ),
- target="h" + str( i + 10 ) )
- PingResult = PingResult and ping
- if ping == main.FALSE:
- main.log.warn( "Ping failed between h" + str( i ) +
- " and h" + str( i + 10 ) )
- elif ping == main.TRUE:
- main.log.info( "Ping test passed!" )
- # Don't set PingResult or you'd override failures
- if PingResult == main.FALSE:
- main.log.error(
- "Intents have not been installed correctly, pings failed." )
- # TODO: pretty print
- main.log.warn( "ONOS1 intents: " )
- try:
- tmpIntents = onosCli.intents()
- main.log.warn( json.dumps( json.loads( tmpIntents ),
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) ) )
- except ( ValueError, TypeError ):
- main.log.warn( repr( tmpIntents ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=PingResult,
- onpass="Intents have been installed correctly and pings work",
- onfail="Intents have not been installed correctly, pings failed." )
main.step( "Check Intent state" )
installedCheck = False
@@ -1038,6 +1007,38 @@
onfail="Intents are not all in " +
"INSTALLED state" )
+ main.step( "Ping across added host intents" )
+ onosCli = main.CLIs[ main.activeNodes[0] ]
+ PingResult = main.TRUE
+ for i in range( 8, 18 ):
+ ping = main.Mininet1.pingHost( src="h" + str( i ),
+ target="h" + str( i + 10 ) )
+ PingResult = PingResult and ping
+ if ping == main.FALSE:
+ main.log.warn( "Ping failed between h" + str( i ) +
+ " and h" + str( i + 10 ) )
+ elif ping == main.TRUE:
+ main.log.info( "Ping test passed!" )
+ # Don't set PingResult or you'd override failures
+ if PingResult == main.FALSE:
+ main.log.error(
+ "Intents have not been installed correctly, pings failed." )
+ # TODO: pretty print
+ main.log.warn( "ONOS1 intents: " )
+ try:
+ tmpIntents = onosCli.intents()
+ main.log.warn( json.dumps( json.loads( tmpIntents ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
+ except ( ValueError, TypeError ):
+ main.log.warn( repr( tmpIntents ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=PingResult,
+ onpass="Intents have been installed correctly and pings work",
+ onfail="Intents have not been installed correctly, pings failed." )
+
main.step( "Check leadership of topics" )
leaders = onosCli.leaders()
topicCheck = main.TRUE
diff --git a/TestON/tests/HAkillNodes/HAkillNodes.py b/TestON/tests/HAkillNodes/HAkillNodes.py
index 2d1eb25..92d2fd5 100644
--- a/TestON/tests/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HAkillNodes/HAkillNodes.py
@@ -282,27 +282,6 @@
intf=main.params[ 'MNtcpdump' ][ 'intf' ],
port=main.params[ 'MNtcpdump' ][ 'port' ] )
- main.step( "App Ids check" )
- appCheck = main.TRUE
- threads = []
- for i in main.activeNodes:
- t = main.Thread( target=main.CLIs[i].appToIDCheck,
- name="appToIDCheck-" + str( i ),
- args=[] )
- threads.append( t )
- t.start()
-
- for t in threads:
- t.join()
- appCheck = appCheck and t.result
- if appCheck != main.TRUE:
- node = main.activeNodes[0]
- main.log.warn( main.CLIs[node].apps() )
- main.log.warn( main.CLIs[node].appIDs() )
- utilities.assert_equals( expect=main.TRUE, actual=appCheck,
- onpass="App Ids seem to be correct",
- onfail="Something is wrong with app Ids" )
-
main.step( "Clean up ONOS service changes" )
handle.sendline( "git checkout -- tools/package/init/onos.conf" )
handle.expect( "\$" )
@@ -397,6 +376,27 @@
else:
main.log.warn( "No configurations were specified to be changed after startup" )
+ main.step( "App Ids check" )
+ appCheck = main.TRUE
+ threads = []
+ for i in main.activeNodes:
+ t = main.Thread( target=main.CLIs[i].appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ appCheck = appCheck and t.result
+ if appCheck != main.TRUE:
+ node = main.activeNodes[0]
+ main.log.warn( main.CLIs[node].apps() )
+ main.log.warn( main.CLIs[node].appIDs() )
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+
def CASE2( self, main ):
"""
Assign devices to controllers
@@ -993,37 +993,6 @@
main.caseExplanation = "Ping across added host intents to check " +\
"functionality and check the state of " +\
"the intent"
- main.step( "Ping across added host intents" )
- onosCli = main.CLIs[ main.activeNodes[0] ]
- PingResult = main.TRUE
- for i in range( 8, 18 ):
- ping = main.Mininet1.pingHost( src="h" + str( i ),
- target="h" + str( i + 10 ) )
- PingResult = PingResult and ping
- if ping == main.FALSE:
- main.log.warn( "Ping failed between h" + str( i ) +
- " and h" + str( i + 10 ) )
- elif ping == main.TRUE:
- main.log.info( "Ping test passed!" )
- # Don't set PingResult or you'd override failures
- if PingResult == main.FALSE:
- main.log.error(
- "Intents have not been installed correctly, pings failed." )
- # TODO: pretty print
- main.log.warn( "ONOS1 intents: " )
- try:
- tmpIntents = onosCli.intents()
- main.log.warn( json.dumps( json.loads( tmpIntents ),
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) ) )
- except ( ValueError, TypeError ):
- main.log.warn( repr( tmpIntents ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=PingResult,
- onpass="Intents have been installed correctly and pings work",
- onfail="Intents have not been installed correctly, pings failed." )
main.step( "Check Intent state" )
installedCheck = False
@@ -1059,6 +1028,38 @@
onfail="Intents are not all in " +
"INSTALLED state" )
+ main.step( "Ping across added host intents" )
+ onosCli = main.CLIs[ main.activeNodes[0] ]
+ PingResult = main.TRUE
+ for i in range( 8, 18 ):
+ ping = main.Mininet1.pingHost( src="h" + str( i ),
+ target="h" + str( i + 10 ) )
+ PingResult = PingResult and ping
+ if ping == main.FALSE:
+ main.log.warn( "Ping failed between h" + str( i ) +
+ " and h" + str( i + 10 ) )
+ elif ping == main.TRUE:
+ main.log.info( "Ping test passed!" )
+ # Don't set PingResult or you'd override failures
+ if PingResult == main.FALSE:
+ main.log.error(
+ "Intents have not been installed correctly, pings failed." )
+ # TODO: pretty print
+ main.log.warn( "ONOS1 intents: " )
+ try:
+ tmpIntents = onosCli.intents()
+ main.log.warn( json.dumps( json.loads( tmpIntents ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
+ except ( ValueError, TypeError ):
+ main.log.warn( repr( tmpIntents ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=PingResult,
+ onpass="Intents have been installed correctly and pings work",
+ onfail="Intents have not been installed correctly, pings failed." )
+
main.step( "Check leadership of topics" )
leaders = onosCli.leaders()
topicCheck = main.TRUE
diff --git a/TestON/tests/HAsanity/HAsanity.py b/TestON/tests/HAsanity/HAsanity.py
index ed8bfee..0295b3b 100644
--- a/TestON/tests/HAsanity/HAsanity.py
+++ b/TestON/tests/HAsanity/HAsanity.py
@@ -251,27 +251,6 @@
intf=main.params[ 'MNtcpdump' ][ 'intf' ],
port=main.params[ 'MNtcpdump' ][ 'port' ] )
- main.step( "App Ids check" )
- appCheck = main.TRUE
- threads = []
- for i in main.activeNodes:
- t = main.Thread( target=main.CLIs[i].appToIDCheck,
- name="appToIDCheck-" + str( i ),
- args=[] )
- threads.append( t )
- t.start()
-
- for t in threads:
- t.join()
- appCheck = appCheck and t.result
- if appCheck != main.TRUE:
- node = main.activeNodes[0]
- main.log.warn( main.CLIs[node].apps() )
- main.log.warn( main.CLIs[node].appIDs() )
- utilities.assert_equals( expect=main.TRUE, actual=appCheck,
- onpass="App Ids seem to be correct",
- onfail="Something is wrong with app Ids" )
-
main.step( "Checking ONOS nodes" )
nodesOutput = []
nodeResults = main.TRUE
@@ -362,6 +341,27 @@
else:
main.log.warn( "No configurations were specified to be changed after startup" )
+ main.step( "App Ids check" )
+ appCheck = main.TRUE
+ threads = []
+ for i in main.activeNodes:
+ t = main.Thread( target=main.CLIs[i].appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ appCheck = appCheck and t.result
+ if appCheck != main.TRUE:
+ node = main.activeNodes[0]
+ main.log.warn( main.CLIs[node].apps() )
+ main.log.warn( main.CLIs[node].appIDs() )
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+
def CASE2( self, main ):
"""
Assign devices to controllers
@@ -958,37 +958,6 @@
main.caseExplanation = "Ping across added host intents to check " +\
"functionality and check the state of " +\
"the intent"
- main.step( "Ping across added host intents" )
- onosCli = main.CLIs[ main.activeNodes[0] ]
- PingResult = main.TRUE
- for i in range( 8, 18 ):
- ping = main.Mininet1.pingHost( src="h" + str( i ),
- target="h" + str( i + 10 ) )
- PingResult = PingResult and ping
- if ping == main.FALSE:
- main.log.warn( "Ping failed between h" + str( i ) +
- " and h" + str( i + 10 ) )
- elif ping == main.TRUE:
- main.log.info( "Ping test passed!" )
- # Don't set PingResult or you'd override failures
- if PingResult == main.FALSE:
- main.log.error(
- "Intents have not been installed correctly, pings failed." )
- # TODO: pretty print
- main.log.warn( "ONOS1 intents: " )
- try:
- tmpIntents = onosCli.intents()
- main.log.warn( json.dumps( json.loads( tmpIntents ),
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) ) )
- except ( ValueError, TypeError ):
- main.log.warn( repr( tmpIntents ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=PingResult,
- onpass="Intents have been installed correctly and pings work",
- onfail="Intents have not been installed correctly, pings failed." )
main.step( "Check Intent state" )
installedCheck = False
@@ -1024,6 +993,38 @@
onfail="Intents are not all in " +
"INSTALLED state" )
+ main.step( "Ping across added host intents" )
+ onosCli = main.CLIs[ main.activeNodes[0] ]
+ PingResult = main.TRUE
+ for i in range( 8, 18 ):
+ ping = main.Mininet1.pingHost( src="h" + str( i ),
+ target="h" + str( i + 10 ) )
+ PingResult = PingResult and ping
+ if ping == main.FALSE:
+ main.log.warn( "Ping failed between h" + str( i ) +
+ " and h" + str( i + 10 ) )
+ elif ping == main.TRUE:
+ main.log.info( "Ping test passed!" )
+ # Don't set PingResult or you'd override failures
+ if PingResult == main.FALSE:
+ main.log.error(
+ "Intents have not been installed correctly, pings failed." )
+ # TODO: pretty print
+ main.log.warn( "ONOS1 intents: " )
+ try:
+ tmpIntents = onosCli.intents()
+ main.log.warn( json.dumps( json.loads( tmpIntents ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
+ except ( ValueError, TypeError ):
+ main.log.warn( repr( tmpIntents ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=PingResult,
+ onpass="Intents have been installed correctly and pings work",
+ onfail="Intents have not been installed correctly, pings failed." )
+
main.step( "Check leadership of topics" )
leaders = onosCli.leaders()
topicCheck = main.TRUE
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index a3865db..6c2b01f 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -240,27 +240,6 @@
intf=main.params[ 'MNtcpdump' ][ 'intf' ],
port=main.params[ 'MNtcpdump' ][ 'port' ] )
- main.step( "App Ids check" )
- appCheck = main.TRUE
- threads = []
- for i in main.activeNodes:
- t = main.Thread( target=main.CLIs[i].appToIDCheck,
- name="appToIDCheck-" + str( i ),
- args=[] )
- threads.append( t )
- t.start()
-
- for t in threads:
- t.join()
- appCheck = appCheck and t.result
- if appCheck != main.TRUE:
- node = main.activeNodes[0]
- main.log.warn( main.CLIs[node].apps() )
- main.log.warn( main.CLIs[node].appIDs() )
- utilities.assert_equals( expect=main.TRUE, actual=appCheck,
- onpass="App Ids seem to be correct",
- onfail="Something is wrong with app Ids" )
-
main.step( "Checking ONOS nodes" )
nodesOutput = []
nodeResults = main.TRUE
@@ -351,6 +330,27 @@
else:
main.log.warn( "No configurations were specified to be changed after startup" )
+ main.step( "App Ids check" )
+ appCheck = main.TRUE
+ threads = []
+ for i in main.activeNodes:
+ t = main.Thread( target=main.CLIs[i].appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ appCheck = appCheck and t.result
+ if appCheck != main.TRUE:
+ node = main.activeNodes[0]
+ main.log.warn( main.CLIs[node].apps() )
+ main.log.warn( main.CLIs[node].appIDs() )
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+
def CASE2( self, main ):
"""
Assign devices to controllers
@@ -918,6 +918,35 @@
main.caseExplanation = "Ping across added host intents to check " +\
"functionality and check the state of " +\
"the intent"
+
+ main.step( "Check Intent state" )
+ installedCheck = True
+ # 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
+ try:
+ 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 ) )
+ except ( ValueError, TypeError ):
+ main.log.exception( "Error parsing intents." )
+ # Print states
+ intentStates.sort()
+ for i, s in intentStates:
+ count += 1
+ main.log.info( "%-6s%-15s%-15s" %
+ ( str( count ), str( i ), str( s ) ) )
+ utilities.assert_equals( expect=True, actual=installedCheck,
+ onpass="Intents are all INSTALLED",
+ onfail="Intents are not all in " +
+ "INSTALLED state" )
+
main.step( "Ping across added host intents" )
onosCli = main.CLIs[ main.activeNodes[0] ]
PingResult = main.TRUE
@@ -950,34 +979,6 @@
onpass="Intents have been installed correctly and pings work",
onfail="Intents have not been installed correctly, pings failed." )
- main.step( "Check Intent state" )
- installedCheck = True
- # 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
- try:
- 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 ) )
- except ( ValueError, TypeError ):
- main.log.exception( "Error parsing intents." )
- # Print states
- intentStates.sort()
- for i, s in intentStates:
- count += 1
- main.log.info( "%-6s%-15s%-15s" %
- ( str( count ), str( i ), str( s ) ) )
- utilities.assert_equals( expect=True, actual=installedCheck,
- onpass="Intents are all INSTALLED",
- onfail="Intents are not all in " +
- "INSTALLED state" )
-
main.step( "Check leadership of topics" )
leaders = onosCli.leaders()
topicCheck = main.TRUE
diff --git a/TestON/tests/HAstopNodes/HAstopNodes.py b/TestON/tests/HAstopNodes/HAstopNodes.py
index 6622075..a09a3fc 100644
--- a/TestON/tests/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HAstopNodes/HAstopNodes.py
@@ -275,27 +275,6 @@
intf=main.params[ 'MNtcpdump' ][ 'intf' ],
port=main.params[ 'MNtcpdump' ][ 'port' ] )
- main.step( "App Ids check" )
- appCheck = main.TRUE
- threads = []
- for i in main.activeNodes:
- t = main.Thread( target=main.CLIs[i].appToIDCheck,
- name="appToIDCheck-" + str( i ),
- args=[] )
- threads.append( t )
- t.start()
-
- for t in threads:
- t.join()
- appCheck = appCheck and t.result
- if appCheck != main.TRUE:
- node = main.activeNodes[0]
- main.log.warn( main.CLIs[node].apps() )
- main.log.warn( main.CLIs[node].appIDs() )
- utilities.assert_equals( expect=main.TRUE, actual=appCheck,
- onpass="App Ids seem to be correct",
- onfail="Something is wrong with app Ids" )
-
main.step( "Checking ONOS nodes" )
nodesOutput = []
nodeResults = main.TRUE
@@ -386,6 +365,27 @@
else:
main.log.warn( "No configurations were specified to be changed after startup" )
+ main.step( "App Ids check" )
+ appCheck = main.TRUE
+ threads = []
+ for i in main.activeNodes:
+ t = main.Thread( target=main.CLIs[i].appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ appCheck = appCheck and t.result
+ if appCheck != main.TRUE:
+ node = main.activeNodes[0]
+ main.log.warn( main.CLIs[node].apps() )
+ main.log.warn( main.CLIs[node].appIDs() )
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+
def CASE2( self, main ):
"""
Assign devices to controllers
@@ -972,37 +972,6 @@
main.caseExplanation = "Ping across added host intents to check " +\
"functionality and check the state of " +\
"the intent"
- main.step( "Ping across added host intents" )
- onosCli = main.CLIs[ main.activeNodes[0] ]
- PingResult = main.TRUE
- for i in range( 8, 18 ):
- ping = main.Mininet1.pingHost( src="h" + str( i ),
- target="h" + str( i + 10 ) )
- PingResult = PingResult and ping
- if ping == main.FALSE:
- main.log.warn( "Ping failed between h" + str( i ) +
- " and h" + str( i + 10 ) )
- elif ping == main.TRUE:
- main.log.info( "Ping test passed!" )
- # Don't set PingResult or you'd override failures
- if PingResult == main.FALSE:
- main.log.error(
- "Intents have not been installed correctly, pings failed." )
- # TODO: pretty print
- main.log.warn( "ONOS1 intents: " )
- try:
- tmpIntents = onosCli.intents()
- main.log.warn( json.dumps( json.loads( tmpIntents ),
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) ) )
- except ( ValueError, TypeError ):
- main.log.warn( repr( tmpIntents ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=PingResult,
- onpass="Intents have been installed correctly and pings work",
- onfail="Intents have not been installed correctly, pings failed." )
main.step( "Check Intent state" )
installedCheck = False
@@ -1038,6 +1007,38 @@
onfail="Intents are not all in " +
"INSTALLED state" )
+ main.step( "Ping across added host intents" )
+ onosCli = main.CLIs[ main.activeNodes[0] ]
+ PingResult = main.TRUE
+ for i in range( 8, 18 ):
+ ping = main.Mininet1.pingHost( src="h" + str( i ),
+ target="h" + str( i + 10 ) )
+ PingResult = PingResult and ping
+ if ping == main.FALSE:
+ main.log.warn( "Ping failed between h" + str( i ) +
+ " and h" + str( i + 10 ) )
+ elif ping == main.TRUE:
+ main.log.info( "Ping test passed!" )
+ # Don't set PingResult or you'd override failures
+ if PingResult == main.FALSE:
+ main.log.error(
+ "Intents have not been installed correctly, pings failed." )
+ # TODO: pretty print
+ main.log.warn( "ONOS1 intents: " )
+ try:
+ tmpIntents = onosCli.intents()
+ main.log.warn( json.dumps( json.loads( tmpIntents ),
+ sort_keys=True,
+ indent=4,
+ separators=( ',', ': ' ) ) )
+ except ( ValueError, TypeError ):
+ main.log.warn( repr( tmpIntents ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=PingResult,
+ onpass="Intents have been installed correctly and pings work",
+ onfail="Intents have not been installed correctly, pings failed." )
+
main.step( "Check leadership of topics" )
leaders = onosCli.leaders()
topicCheck = main.TRUE