changes for failing tests in nightly tests

Change-Id: Ib9c475f56e0444498b3ace5b86c22c8d782eaf3a
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index 3bc103c..678bc50 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -495,7 +495,7 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def pingallHosts( self, hostList, ipv6=False, wait=1, useScapy=False ):
+    def pingallHosts( self, hostList, ipv6=False, wait=1, useScapy=False, returnResult=False ):
         """
             Ping all specified IPv4 hosts
 
@@ -518,6 +518,7 @@
             pingResponse = "IPv4 ping across specified hosts\n"
             failedPings = 0
             hostPairs = itertools.permutations( list( hostComponentList ), 2 )
+            resultList = []
             for hostPair in list( hostPairs ):
                 ipDst = hostPair[ 1 ].options.get( 'ip6', hostPair[ 1 ].options[ 'ip' ] ) if ipv6 else hostPair[ 1 ].options[ 'ip' ]
                 srcIface = hostPair[ 0 ].interfaces[0].get( 'name' )
@@ -532,6 +533,7 @@
                     main.log.debug( srcVLANs )
                     for VLAN in srcVLANs:
                         pingResponse += hostPair[ 0 ].options[ 'shortName' ]
+                        # returnResult.append({ "src": hostPair[0].shortName, "vlan": VLAN, "dst": hostPair[1].shortName, "result": pingResult})
                         if VLAN:
                             pingResponse += "." + str( VLAN )
                         pingResponse += " -> "
@@ -571,6 +573,7 @@
                             main.log.debug( hostPair[ 1 ].handle.before )
                             # One of the host to host pair is unreachable
                             pingResult = main.FALSE
+                        resultList.append({ "src": hostPair[0].shortName, "vlan": str(VLAN), "dst": hostPair[1].shortName, "result": pingResult})
                         hostPair[ 0 ].stopScapy()
                         hostPair[ 1 ].stopScapy()
                         if pingResult:
@@ -586,6 +589,7 @@
                 else:
                     pingResponse += hostPair[ 0 ].options[ 'shortName' ] + " -> "
                     pingResult = hostPair[ 0 ].ping( ipDst, interface=srcIface, wait=int( wait ) )
+                    resultList.append({ "src": hostPair[0].shortName, "vlan": str(VLAN), "dst": hostPair[1].shortName, "result": pingResult})
                     if pingResult:
                         pingResponse += hostPair[ 1 ].options[ 'shortName' ]
                         if VLAN:
@@ -597,7 +601,10 @@
                         failedPings += 1
                     pingResponse += "\n"
             main.log.info( pingResponse + "Failed pings: " + str( failedPings ) )
-            return isReachable
+            if returnResult:
+                return resultList
+            else:
+                return isReachable
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
index 098db74..ee04e89 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
@@ -74,7 +74,7 @@
                     run.loadJson( main, suffix=suf )
                 else:
                     run.loadJson( main )
-            run.loadChart( main )  # stores hosts to ping and expected results
+            run.loadChart( main, suf )  # stores hosts to ping and expected results
             if hasattr( main, 'Mininet1' ):
                 run.mnDockerSetup( main )  # optionally create and setup docker image
 
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE06.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE06.chart.tucson
new file mode 100644
index 0000000..f5b2a09
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE06.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"],
+    "vlans":{"None":"True"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE16.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE16.chart.tucson
new file mode 100644
index 0000000..42d4a6a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE16.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"],
+    "vlans":{"111":"True"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE26.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE26.chart.tucson
new file mode 100644
index 0000000..361d69f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE26.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"],
+    "vlans":{"None": "True", "120": "True"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE36.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE36.chart.tucson
new file mode 100644
index 0000000..570bfe2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE36.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"],
+    "vlans":{"None":"True", "120":"False"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE46.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE46.chart.tucson
new file mode 100644
index 0000000..e078e31
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE46.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"],
+    "vlans":{"None":"True", "111":"True"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE56.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE56.chart.tucson
new file mode 100644
index 0000000..83a7b48
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE56.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"],
+    "vlans":{"None":"False"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE66.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE66.chart.tucson
new file mode 100644
index 0000000..80e1b7d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE66.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"],
+    "vlans":{"111":"False", "120":"False"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE76.chart.tucson b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE76.chart.tucson
new file mode 100644
index 0000000..79233ae
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE76.chart.tucson
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"],
+    "vlans":{"None":"False", "120":"False"}
+  }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 4ff3a85..c338588 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -244,10 +244,10 @@
                 main.Cluster.active( 0 ).REST.setXconnectJson( xconnect )
 
     @staticmethod
-    def loadChart( main ):
+    def loadChart( main, suffix='' ):
         try:
-            filename = "%s%s.chart" % ( main.configPath + main.forChart,
-                                        main.cfgName )
+            filename = "%s%s.chart%s" % ( main.configPath + main.forChart,
+                                        main.cfgName, suffix )
             with open( filename ) as chart:
                 main.pingChart = json.load( chart )
         except IOError:
@@ -738,8 +738,22 @@
                                                  onpass="IPv6 connectivity successfully tested",
                                                  onfail="IPv6 connectivity failed" )
                 elif main.physicalNet:
-                    pa = main.Network.pingallHosts( hosts, ipv6=True, useScapy=useScapy )
-                    utilities.assert_equals( expect=expect, actual=pa,
+                    pa = main.Network.pingallHosts( hosts, ipv6=True, useScapy=useScapy, returnResult=True )
+                    combinedResult = True
+                    for result in pa:
+                        expectedResult = None
+                        for ping in main.pingChart.values():
+                            if result["src"] in ping["hosts"] and result["dst"] in ping["hosts"]:
+                                # Check if the vlan in ping is the same as in the result. If true, set the expected result to result at expect
+                                # If expected result is not the same as the actual result, then the combined result is false
+                                # if we cannot find the expected result, then expect should be the default between the hosts
+                                if str(result["vlan"]) in ping.get("vlans", [] ):
+                                    expectedResult = ping["vlans"].get(str(result["vlan"]))
+                        if expectedResult is None:
+                            expectedRresult = expect
+                        if expectedResult != result["result"]:
+                            combinedResult = False
+                    utilities.assert_equals( expect=True, actual=combinedResult,
                                              onpass="IP connectivity successfully tested",
                                              onfail="IP connectivity failed" )
                 else: