Use t3-troubleshoot-simple in SR tests for dual-homed hosts
Change-Id: I4ac9ddf6af4c248282e078a2620d589198aa580e
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 439ba80..83374b6 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -6443,12 +6443,15 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
- def composeT3Command( self, sAddr, dAddr, ipv6=False, verbose=True ):
+ def composeT3Command( self, sAddr, dAddr, ipv6=False, verbose=True, simple=False ):
"""
Compose and return t3-troubleshoot cli command for given source and destination addresses
Options:
sAddr: IP address of the source host
dAddr: IP address of the destination host
+ ipv6: True if hosts are IPv6
+ verbose: return verbose t3 output if True
+ simple: compose command for t3-troubleshoot-simple if True
"""
try:
# Collect information of both hosts from onos
@@ -6465,21 +6468,25 @@
break
assert sHost, "Not able to find host with IP {}".format( sAddr )
cmdStr = "t3-troubleshoot"
+ if simple:
+ cmdStr += "-simple"
if verbose:
cmdStr += " -vv"
- cmdStr += " -s " + str( sAddr )
- # TODO: collect t3 for all locations of source host?
- cmdStr += " -sp " + str( sHost[ "locations" ][ 0 ][ "elementId" ] ) + "/" + str( sHost[ "locations" ][ 0 ][ "port" ] )
- cmdStr += " -sm " + str( sHost[ "mac" ] )
- if sHost[ "vlan" ] != "None":
- cmdStr += " -vid " + sHost[ "vlan" ]
- cmdStr += " -d " + str( dAddr )
- netcfg = self.netcfg( args="devices {}".format( sHost[ "locations" ][ 0 ][ "elementId" ] ) )
- netcfg = json.loads( netcfg )
- assert netcfg, "Failed to get netcfg"
- cmdStr += " -dm " + str( netcfg[ "segmentrouting" ][ "routerMac" ] )
if ipv6:
cmdStr += " -et ipv6"
+ if simple:
+ cmdStr += " {}/{} {}/{}".format( sHost[ "mac" ], sHost[ "vlan" ], dHost[ "mac" ], dHost[ "vlan" ] )
+ else:
+ cmdStr += " -s " + str( sAddr )
+ cmdStr += " -sp " + str( sHost[ "locations" ][ 0 ][ "elementId" ] ) + "/" + str( sHost[ "locations" ][ 0 ][ "port" ] )
+ cmdStr += " -sm " + str( sHost[ "mac" ] )
+ if sHost[ "vlan" ] != "None":
+ cmdStr += " -vid " + sHost[ "vlan" ]
+ cmdStr += " -d " + str( dAddr )
+ netcfg = self.netcfg( args="devices {}".format( sHost[ "locations" ][ 0 ][ "elementId" ] ) )
+ netcfg = json.loads( netcfg )
+ assert netcfg, "Failed to get netcfg"
+ cmdStr += " -dm " + str( netcfg[ "segmentrouting" ][ "routerMac" ] )
return cmdStr
except AssertionError:
main.log.exception( "" )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 4051231..7fc7164 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -1159,7 +1159,7 @@
except ( NameError, AttributeError ):
main.topo = Topology()
main.step( stepMsg )
- pingResult = main.topo.ping( srcList, dstList, ipv6, expect, wait, acceptableFailed, skipOnFail )
+ pingResult = main.topo.ping( srcList, dstList, ipv6, expect, wait, acceptableFailed, skipOnFail, True )
utilities.assert_equals( expect=main.TRUE,
actual=pingResult,
onpass="{}: Pass".format( stepMsg ),
diff --git a/TestON/tests/dependencies/topology.py b/TestON/tests/dependencies/topology.py
index 4d3bafb..c0e1e7a 100644
--- a/TestON/tests/dependencies/topology.py
+++ b/TestON/tests/dependencies/topology.py
@@ -228,7 +228,7 @@
onfail="ONOS incorrectly discovered the topology" )
return topoResults
- def ping( self, srcList, dstList, ipv6=False, expect=True, wait=1, acceptableFailed=0, collectT3=True ):
+ def ping( self, srcList, dstList, ipv6=False, expect=True, wait=1, acceptableFailed=0, collectT3=True, t3Simple=False ):
"""
Description:
Ping from every host in srcList to every host in dstList and
@@ -241,6 +241,7 @@
acceptableFailed: maximum number of failed pings acceptable for
each src-dst host pair
collectT3: save t3-troubleshoot output for src and dst host that failed to ping
+ t3Simple: use t3-troubleshoot-simple command when collecting t3 output
Returns:
main.TRUE if all ping results are expected, otherwise main.FALSE
"""
@@ -291,7 +292,7 @@
srcIp = unexpectedPing[ 0 ]
dstIp = unexpectedPing[ 1 ]
main.log.debug( "Collecting t3 with source {} and destination {}".format( srcIp, dstIp ) )
- cmd = main.Cluster.active( 0 ).CLI.composeT3Command( srcIp, dstIp, ipv6 )
+ cmd = main.Cluster.active( 0 ).CLI.composeT3Command( srcIp, dstIp, ipv6, True, t3Simple )
main.log.debug( "t3 command: {}".format( cmd ) )
if cmd:
main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress, cmd, main.logdir,