Test external port using Ubuntu minimal image
Change-Id: Ib25841648947877b21e7627f26d7b7fc179de29d
This commit is contained in:
parent
f13aa0fbc9
commit
3255164a4d
|
@ -79,6 +79,7 @@ UbuntuImageFixture = _ubuntu.UbuntuImageFixture
|
||||||
UbuntuMinimalImageFixture = _ubuntu.UbuntuMinimalImageFixture
|
UbuntuMinimalImageFixture = _ubuntu.UbuntuMinimalImageFixture
|
||||||
UbuntuServerStackFixture = _ubuntu.UbuntuServerStackFixture
|
UbuntuServerStackFixture = _ubuntu.UbuntuServerStackFixture
|
||||||
UbuntuMinimalServerStackFixture = _ubuntu.UbuntuMinimalServerStackFixture
|
UbuntuMinimalServerStackFixture = _ubuntu.UbuntuMinimalServerStackFixture
|
||||||
|
UbuntuExternalServerStackFixture = _ubuntu.UbuntuExternalServerStackFixture
|
||||||
|
|
||||||
OctaviaLoadbalancerStackFixture = _octavia.OctaviaLoadbalancerStackFixture
|
OctaviaLoadbalancerStackFixture = _octavia.OctaviaLoadbalancerStackFixture
|
||||||
OctaviaListenerStackFixture = _octavia.OctaviaListenerStackFixture
|
OctaviaListenerStackFixture = _octavia.OctaviaListenerStackFixture
|
||||||
|
|
|
@ -98,7 +98,12 @@ class ServerStackFixture(heat.HeatStackFixture, abc.ABC):
|
||||||
network_stack = tobiko.required_setup_fixture(_neutron.NetworkStackFixture)
|
network_stack = tobiko.required_setup_fixture(_neutron.NetworkStackFixture)
|
||||||
|
|
||||||
#: whenever the server relies only on DHCP for address assignation
|
#: whenever the server relies only on DHCP for address assignation
|
||||||
need_dhcp = False
|
@property
|
||||||
|
def need_dhcp(self) -> bool:
|
||||||
|
return not self.config_drive
|
||||||
|
|
||||||
|
#: whenever the server will use config-drive to get metadata
|
||||||
|
config_drive = False
|
||||||
|
|
||||||
def create_stack(self, retry=None):
|
def create_stack(self, retry=None):
|
||||||
self.ensure_quota_limits()
|
self.ensure_quota_limits()
|
||||||
|
@ -172,6 +177,13 @@ class ServerStackFixture(heat.HeatStackFixture, abc.ABC):
|
||||||
password=self.password,
|
password=self.password,
|
||||||
connection_timeout=self.connection_timeout)
|
connection_timeout=self.connection_timeout)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def peer_ssh_client(self) -> typing.Optional[ssh.SSHClientFixture]:
|
||||||
|
"""Nearest SSH client to an host that can see server fixed IPs ports
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.ssh_client
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ssh_command(self) -> sh.ShellCommand:
|
def ssh_command(self) -> sh.ShellCommand:
|
||||||
return ssh.ssh_command(host=self.ip_address,
|
return ssh.ssh_command(host=self.ip_address,
|
||||||
|
@ -386,6 +398,8 @@ class ExternalServerStackFixture(ServerStackFixture, abc.ABC):
|
||||||
|
|
||||||
config_drive = True
|
config_drive = True
|
||||||
|
|
||||||
|
peer_ssh_client = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def floating_network(self):
|
def floating_network(self):
|
||||||
return self.network_stack.network_id
|
return self.network_stack.network_id
|
||||||
|
@ -408,7 +422,11 @@ class PeerServerStackFixture(ServerStackFixture, abc.ABC):
|
||||||
username=self.username,
|
username=self.username,
|
||||||
password=self.password,
|
password=self.password,
|
||||||
connection_timeout=self.connection_timeout,
|
connection_timeout=self.connection_timeout,
|
||||||
proxy_jump=self.peer_stack.ssh_client)
|
proxy_jump=self.peer_ssh_client)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def peer_ssh_client(self) -> ssh.SSHClientFixture:
|
||||||
|
return self.peer_stack.ssh_client
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ssh_command(self) -> sh.ShellCommand:
|
def ssh_command(self) -> sh.ShellCommand:
|
||||||
|
|
|
@ -80,3 +80,8 @@ class UbuntuMinimalServerStackFixture(UbuntuServerStackFixture):
|
||||||
|
|
||||||
#: Setup SWAP file in bytes
|
#: Setup SWAP file in bytes
|
||||||
swap_maxsize = 512 * 1024 * 1024 # 500 MB
|
swap_maxsize = 512 * 1024 * 1024 # 500 MB
|
||||||
|
|
||||||
|
|
||||||
|
class UbuntuExternalServerStackFixture(UbuntuMinimalServerStackFixture,
|
||||||
|
_nova.ExternalServerStackFixture):
|
||||||
|
pass
|
||||||
|
|
|
@ -64,9 +64,10 @@ class PortTest(testtools.TestCase):
|
||||||
except self.failureException:
|
except self.failureException:
|
||||||
attempt.check_limits()
|
attempt.check_limits()
|
||||||
elif ip_version:
|
elif ip_version:
|
||||||
self.skipTest(f"No port IPv{ip_version} addresses found")
|
self.skipTest(f"Server has any port IPv{ip_version} address to be"
|
||||||
|
" tested")
|
||||||
else:
|
else:
|
||||||
self.skipTest("No port IP addresses found")
|
self.skipTest("Server has any port IP address to be tested")
|
||||||
|
|
||||||
def test_port_network(self):
|
def test_port_network(self):
|
||||||
self.assertEqual(self.stack.network_stack.network_id,
|
self.assertEqual(self.stack.network_stack.network_id,
|
||||||
|
@ -93,21 +94,19 @@ class PortTest(testtools.TestCase):
|
||||||
|
|
||||||
def test_ping_port(self, network_id=None, device_id=None, ip_version=None):
|
def test_ping_port(self, network_id=None, device_id=None, ip_version=None):
|
||||||
"""Checks server can ping its own port"""
|
"""Checks server can ping its own port"""
|
||||||
device_ips = neutron.list_device_ip_addresses(
|
port_ips = neutron.list_device_ip_addresses(
|
||||||
device_id=device_id or self.stack.server_id,
|
device_id=device_id or self.stack.server_id,
|
||||||
network_id=network_id or self.stack.network_stack.network_id,
|
network_id=network_id or self.stack.network_stack.network_id,
|
||||||
enable_dhcp=True, ip_version=ip_version)
|
need_dhcp=self.stack.need_dhcp, ip_version=ip_version)
|
||||||
server_ips = ip.list_ip_addresses(scope='global',
|
|
||||||
ssh_client=self.stack.ssh_client)
|
|
||||||
# Remove IPs that hasn't been assigned to server
|
|
||||||
port_ips = tobiko.Selection(set(device_ips) & set(server_ips))
|
|
||||||
if port_ips:
|
if port_ips:
|
||||||
ping.assert_reachable_hosts(port_ips,
|
ping.assert_reachable_hosts(port_ips,
|
||||||
ssh_client=self.stack.ssh_client)
|
timeout=600.,
|
||||||
|
ssh_client=self.stack.peer_ssh_client)
|
||||||
elif ip_version:
|
elif ip_version:
|
||||||
self.skipTest(f"No port IPv{ip_version} addresses found")
|
self.skipTest(f"Server has any port IPv{ip_version} address to be"
|
||||||
|
" tested")
|
||||||
else:
|
else:
|
||||||
self.skipTest("No port IP addresses found")
|
self.skipTest("Server has any port IP address to be tested")
|
||||||
|
|
||||||
|
|
||||||
# --- Test opening ports on external network ----------------------------------
|
# --- Test opening ports on external network ----------------------------------
|
||||||
|
@ -130,6 +129,15 @@ class CentosExternalPortTest(PortTest):
|
||||||
stacks.CentosExternalServerStackFixture)
|
stacks.CentosExternalServerStackFixture)
|
||||||
|
|
||||||
|
|
||||||
|
@stacks.skip_unless_has_external_network
|
||||||
|
class UbuntuExternalPortTest(PortTest):
|
||||||
|
"""Test Neutron ports"""
|
||||||
|
|
||||||
|
#: Resources stack with Nova server to send messages to
|
||||||
|
stack = tobiko.required_setup_fixture(
|
||||||
|
stacks.UbuntuExternalServerStackFixture)
|
||||||
|
|
||||||
|
|
||||||
# --- Test la-h3 extension ----------------------------------------------------
|
# --- Test la-h3 extension ----------------------------------------------------
|
||||||
|
|
||||||
@neutron.skip_if_missing_networking_extensions('l3-ha')
|
@neutron.skip_if_missing_networking_extensions('l3-ha')
|
||||||
|
|
Loading…
Reference in New Issue