Merge "[ONOS-7501] Investigate and fix the issue with jenkins publishing confluence to Wiki"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 580b3b5..d962e92 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -491,13 +491,13 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
- def pingIpv6Hosts( self, hostList, prefix='1000::', wait=1 ):
+ def pingIpv6Hosts( self, hostList, wait=1, acceptableFailed=0 ):
"""
- IPv6 ping all hosts in hostList. If no prefix passed this will use
- default prefix of 1000::
+ IPv6 ping all hosts in hostList.
+
+ acceptableFailed: max number of acceptable failed pings
Returns main.TRUE if all hosts specified can reach each other
-
Returns main.FALSE if one or more of hosts specified cannot reach each other
"""
try:
@@ -506,7 +506,7 @@
wait = int( wait )
cmd = " ping6 -c 1 -i 1 -W " + str( wait ) + " "
pingResponse = "IPv6 Pingall output:\n"
- failedPings = 0
+ failedPingsTotal = 0
for host in hostList:
listIndex = hostList.index( host )
# List of hosts to ping other than itself
@@ -517,19 +517,26 @@
for temp in pingList:
# Current host pings all other hosts specified
+ failedPings = 0
pingCmd = str( host ) + cmd + str( self.getIPAddress( temp, proto='IPv6' ) )
- self.handle.sendline( pingCmd )
- self.handle.expect( "mininet>", timeout=wait + 1 )
- response = self.handle.before
- if re.search( ',\s0\%\spacket\sloss', response ):
- pingResponse += str( " h" + str( temp[ 1: ] ) )
- else:
- pingResponse += " X"
+ while failedPings <= acceptableFailed:
+ main.log.debug( "Pinging from " + str( host ) + " to " + str( temp ) )
+ self.handle.sendline( pingCmd )
+ self.handle.expect( "mininet>", timeout=wait + 1 )
+ response = self.handle.before
+ if re.search( ',\s0\%\spacket\sloss', response ):
+ pingResponse += str( " h" + str( temp[ 1: ] ) )
+ break
+ else:
+ failedPings += 1
+ time.sleep(1)
+ if failedPings > acceptableFailed:
# One of the host to host pair is unreachable
+ pingResponse += " X"
isReachable = main.FALSE
- failedPings += 1
+ failedPingsTotal += 1
pingResponse += "\n"
- main.log.info( pingResponse + "Failed pings: " + str( failedPings ) )
+ main.log.info( pingResponse + "Failed pings: " + str( failedPingsTotal ) )
return isReachable
except pexpect.TIMEOUT:
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
index b1c8ea1..7566ff4 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -73,7 +73,7 @@
time.sleep(60)
# ping hosts
- run.pingAllBasedOnIp( main, 'CASE%02d' % test_idx )
+ run.pingAll( main, 'CASE%02d' % test_idx, acceptableFailed=5, basedOnIp=True )
if hasattr(main, 'Mininet1'):
run.cleanup(main)
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index bc021c6..c5271f5 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -286,7 +286,11 @@
onfail="Flow count looks wrong: " + count )
@staticmethod
- def pingAllBasedOnIp( main, tag="", dumpflows=True ):
+ def pingAll( main, tag="", dumpflows=True, acceptableFailed=0, basedOnIp=False ):
+ '''
+ acceptableFailed: max number of acceptable failed pings. Only works for ping6
+ basedOnIp: if True, run ping or ping6 based on suffix of host names
+ '''
main.log.report( "Check full connectivity" )
print main.pingChart
if tag == "":
@@ -300,16 +304,22 @@
expect = main.FALSE
main.step( "Connectivity for %s %s" % ( str( hosts ), tag ) )
- if ("v4" in hosts[0]):
+ if basedOnIp:
+ if ("v4" in hosts[0]):
+ pa = main.Network.pingallHosts( hosts )
+ utilities.assert_equals( expect=expect, actual=pa,
+ onpass="IPv4 connectivity successfully tested",
+ onfail="IPv4 connectivity failed" )
+ if ("v6" in hosts[0]):
+ pa = main.Network.pingIpv6Hosts( hosts, acceptableFailed=acceptableFailed )
+ utilities.assert_equals( expect=expect, actual=pa,
+ onpass="IPv6 connectivity successfully tested",
+ onfail="IPv6 connectivity failed" )
+ else:
pa = main.Network.pingallHosts( hosts )
utilities.assert_equals( expect=expect, actual=pa,
- onpass="IPv4 connectivity successfully tested",
- onfail="IPv4 connectivity failed" )
- if ("v6" in hosts[0]):
- pa = main.Network.pingIpv6Hosts( hosts )
- utilities.assert_equals( expect=expect, actual=pa,
- onpass="IPv6 connectivity successfully tested",
- onfail="IPv6 connectivity failed" )
+ onpass="IP connectivity successfully tested",
+ onfail="IP connectivity failed" )
if dumpflows:
main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress,
@@ -322,35 +332,6 @@
tag + "_GroupsOn" )
@staticmethod
- def pingAll( main, tag="", dumpflows=True ):
- main.log.report( "Check full connectivity" )
- print main.pingChart
- if tag == "":
- tag = 'CASE%d' % main.CurrentTestCaseNumber
- for entry in main.pingChart.itervalues():
- print entry
- hosts, expect = entry[ 'hosts' ], entry[ 'expect' ]
- try:
- expect = main.TRUE if str(expect).lower() == 'true' else main.FALSE
- except:
- expect = main.FALSE
- main.step( "Connectivity for %s %s" % ( str( hosts ), tag ) )
- pa = main.Network.pingallHosts( hosts )
-
- utilities.assert_equals( expect=expect, actual=pa,
- onpass="IP connectivity successfully tested",
- onfail="IP connectivity failed" )
- if dumpflows:
- main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress,
- "flows",
- main.logdir,
- tag + "_FlowsOn" )
- main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress,
- "groups",
- main.logdir,
- tag + "_GroupsOn" )
-
- @staticmethod
def killLink( main, end1, end2, switches, links ):
"""
end1,end2: identify the switches, ex.: 'leaf1', 'spine1'