Fix _check_network_external_connectivity in test_network_basic_ops

TestNetworkBasicOps.test_network_basic_ops failed when there were
more than one ipv4 subnets in public network. This patch is to fix
it.

Change-Id: I1d385528afb600b8e6131cb59905ba1e8eff130d
Closes-Bug: #1637050
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index f9aa3e7..a5411bf 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -321,8 +321,11 @@
         # We ping the external IP from the instance using its floating IP
         # which is always IPv4, so we must only test connectivity to
         # external IPv4 IPs if the external network is dualstack.
+        ext_ips = self.router['external_gateway_info']['external_fixed_ips']
+        subnet_ids = [sub['subnet_id'] for sub in ext_ips]
         v4_subnets = [s for s in self._list_subnets(
-            network_id=CONF.network.public_network_id) if s['ip_version'] == 4]
+            network_id=CONF.network.public_network_id)
+            if s['ip_version'] == 4 and s['id'] in subnet_ids]
         self.assertEqual(1, len(v4_subnets),
                          "Found %d IPv4 subnets" % len(v4_subnets))