Create functional test case for NetworkStackFixture

Change-Id: I2bd5b17578c15213dbc5c3fd13e56579e4abd6cc
This commit is contained in:
Federico Ressi 2019-06-11 14:14:04 +02:00
parent 2e3559c9d1
commit d037d9e913
2 changed files with 33 additions and 0 deletions

View File

@ -164,6 +164,10 @@ outputs:
description: Network ID
value: {get_resource: network}
port_security_enabled:
description: whenever port security has been enabled on created network
value: {get_attr: [network, port_security_enabled]}
ipv4_subnet_id:
description: IPv4 subnet ID
value: {get_resource: ipv4_subnet}

View File

@ -18,11 +18,40 @@ from __future__ import absolute_import
import testtools
import tobiko
from tobiko.openstack import neutron
from tobiko.openstack import stacks
from tobiko.shell import ping
from tobiko.shell import sh
class NetworkTestCase(testtools.TestCase):
"""Tests network creation"""
#: Stack of resources with a server attached to a floating IP
stack = tobiko.required_setup_fixture(stacks.NetworkStackFixture)
@property
def network_details(self):
return neutron.get_neutron_client().show_network(
self.stack.network_id)['network']
@neutron.skip_if_missing_networking_extensions('port-security')
def test_port_security_enabled(self):
port_security_enabled = self.stack.port_security_enabled
self.assertEqual(port_security_enabled,
self.network_details['port_security_enabled'])
self.assertEqual(port_security_enabled,
self.stack.outputs.port_security_enabled)
@neutron.skip_if_missing_networking_extensions('net-mtu')
def test_net_mtu(self):
self.assertEqual(self.network_details['mtu'], self.stack.outputs.mtu)
@neutron.skip_if_missing_networking_extensions('net-mtu-write')
def test_net_mtu_write(self):
self.assertEqual(self.stack.mtu, self.stack.outputs.mtu)
class FloatingIpServerTest(testtools.TestCase):
"""Tests connectivity to Nova instances via floating IPs"""