[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] f52c759e5c

Change-Id: If2df2a0a3c6f8209a2e2d8d59a152bf3d685b0f1
This commit is contained in:
Roman Popelka 2022-04-13 08:33:41 +02:00
parent c96f065ff1
commit 2ef30675e5
2 changed files with 2 additions and 46 deletions

View File

@ -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 @@ class ScenarioTest(manager.NetworkScenarioTest):
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.

View File

@ -1259,7 +1259,8 @@ class TestBGPVPNBasic(base.BaseBgpvpnTest, manager.NetworkScenarioTest):
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):