From 420a01903789e174a0b9d3a03835c5a4dd01029e Mon Sep 17 00:00:00 2001
From: zhufl <zhu.fanglei@zte.com.cn>
Date: Thu, 28 Sep 2017 11:04:50 +0800
Subject: [PATCH] Refactor of _check_tenant_network_connectivity

This is to make the following changes of _check_tenant_network_
connectivity:
1. remove the leading underscore in opencos_base._check_tenant_
   network_connectivity for it's not an internal helper.
2. remove the helper with same name _check_tenant_network_
   connectivity in TestNetworkBasicOps, which unnecessary adds
   the hierachy depth.

Change-Id: Iaced16610f39ebb0efc822b25cda519794a846f3
---
 tempest/scenario/manager.py                          | 10 +++++-----
 tempest/scenario/test_network_advanced_server_ops.py |  2 +-
 tempest/scenario/test_network_basic_ops.py           | 16 ++++++----------
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 00c9b6174..b19bf8942 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -883,11 +883,11 @@ class NetworkScenarioTest(ScenarioTest):
         LOG.info("FloatingIP: {fp} is at status: {st}"
                  .format(fp=floating_ip, st=status))
 
-    def _check_tenant_network_connectivity(self, server,
-                                           username,
-                                           private_key,
-                                           should_connect=True,
-                                           servers_for_debug=None):
+    def check_tenant_network_connectivity(self, server,
+                                          username,
+                                          private_key,
+                                          should_connect=True,
+                                          servers_for_debug=None):
         if not CONF.network.project_networks_reachable:
             msg = 'Tenant networks not configured to be reachable.'
             LOG.info(msg)
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 340c3c997..7c404ad6e 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -83,7 +83,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
                                     should_connect=True):
         username = CONF.validation.image_ssh_user
         private_key = keypair['private_key']
-        self._check_tenant_network_connectivity(
+        self.check_tenant_network_connectivity(
             server, username, private_key,
             should_connect=should_connect,
             servers_for_debug=[server])
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 0c3bf23b1..7ce7b2888 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -117,7 +117,12 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
             self.ports.append({'port': port_id})
 
         server = self._create_server(self.network, port_id)
-        self._check_tenant_network_connectivity()
+        ssh_login = CONF.validation.image_ssh_user
+        for server in self.servers:
+            # call the common method in the parent class
+            self.check_tenant_network_connectivity(
+                server, ssh_login, self._get_server_key(server),
+                servers_for_debug=self.servers)
 
         floating_ip = self.create_floating_ip(server)
         self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server)
@@ -170,15 +175,6 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
     def _get_server_key(self, server):
         return self.keypairs[server['key_name']]['private_key']
 
-    def _check_tenant_network_connectivity(self):
-        ssh_login = CONF.validation.image_ssh_user
-        for server in self.servers:
-            # call the common method in the parent class
-            super(TestNetworkBasicOps, self).\
-                _check_tenant_network_connectivity(
-                    server, ssh_login, self._get_server_key(server),
-                    servers_for_debug=self.servers)
-
     def check_public_network_connectivity(
             self, should_connect=True, msg=None,
             should_check_floating_ip_status=True, mtu=None):
-- 
2.16.3

