[bgpvpn] Remove get_remote_client
As tempest.scenario.manager was announced stable interface in Tempest
27.0.0[1] it can be now reused in plugins.
Replaced methods:
* get_remote_client
There is a slight difference between tempest's
get_remote_client and the deleted one. See related
patch[2].
Etherpad concerning this effort:
https://etherpad.opendev.org/p/tempest-scenario-manager-cleanup
[1] https://docs.openstack.org/releasenotes/tempest/v27.0.0.html#release-notes-27-0-0
[2] https://opendev.org/openstack/tempest/commit/f52c759e5cc6da962ad63831c55dc140d05a2373
Change-Id: If2df2a0a3c6f8209a2e2d8d59a152bf3d685b0f1
diff --git a/neutron_tempest_plugin/bgpvpn/scenario/manager.py b/neutron_tempest_plugin/bgpvpn/scenario/manager.py
index e78d1d8..90c2bb1 100644
--- a/neutron_tempest_plugin/bgpvpn/scenario/manager.py
+++ b/neutron_tempest_plugin/bgpvpn/scenario/manager.py
@@ -17,7 +17,6 @@
from oslo_log import log
from tempest.common import utils
-from tempest.common.utils.linux import remote_client
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
@@ -34,50 +33,6 @@
credentials = ['primary']
- # ## Test functions library
- #
- # The create_[resource] functions only return body and discard the
- # resp part which is not used in scenario tests
-
- def get_remote_client(self, ip_address, username=None, private_key=None):
- """Get a SSH client to a remote server
-
- @param ip_address the server floating or fixed IP address to use
- for ssh validation
- @param username name of the Linux account on the remote server
- @param private_key the SSH private key to use
- @return a RemoteClient object
- """
-
- if username is None:
- username = CONF.validation.image_ssh_user
- # Set this with 'keypair' or others to log in with keypair or
- # username/password.
- if CONF.validation.auth_method == 'keypair':
- password = None
- if private_key is None:
- private_key = self.keypair['private_key']
- else:
- password = CONF.validation.image_ssh_password
- private_key = None
- linux_client = remote_client.RemoteClient(ip_address, username,
- pkey=private_key,
- password=password)
- try:
- linux_client.validate_authentication()
- except Exception as e:
- message = ('Initializing SSH connection to %(ip)s failed. '
- 'Error: %(error)s' % {'ip': ip_address,
- 'error': e})
- caller = test_utils.find_test_caller()
- if caller:
- message = '(%s) %s' % (caller, message)
- LOG.exception(message)
- self.log_console_output()
- raise
-
- return linux_client
-
class NetworkScenarioTest(ScenarioTest):
"""Base class for network scenario tests.
diff --git a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
index 186c638..0142045 100644
--- a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
+++ b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
@@ -1259,7 +1259,8 @@
private_key = self.servers_keypairs[server['id']][
'private_key']
ssh_client = self.get_remote_client(server_fip,
- private_key=private_key)
+ private_key=private_key,
+ server=server)
return ssh_client
def _setup_http_server(self, server_index):