summaryrefslogtreecommitdiffstats
path: root/snaps/openstack/tests
diff options
context:
space:
mode:
Diffstat (limited to 'snaps/openstack/tests')
-rw-r--r--snaps/openstack/tests/create_instance_tests.py92
-rw-r--r--snaps/openstack/tests/create_network_tests.py98
-rw-r--r--snaps/openstack/tests/create_router_tests.py29
-rw-r--r--snaps/openstack/tests/openstack_tests.py8
4 files changed, 114 insertions, 113 deletions
diff --git a/snaps/openstack/tests/create_instance_tests.py b/snaps/openstack/tests/create_instance_tests.py
index c7a6c83..f806100 100644
--- a/snaps/openstack/tests/create_instance_tests.py
+++ b/snaps/openstack/tests/create_instance_tests.py
@@ -24,20 +24,20 @@ from neutronclient.common.exceptions import InvalidIpForSubnetClient
from novaclient.exceptions import BadRequest
from snaps import file_utils
-from snaps.config.volume import VolumeConfig
-from snaps.config.router import RouterConfig
+from snaps.config.flavor import FlavorConfig
+from snaps.config.image import ImageConfig
from snaps.config.keypair import KeypairConfig
+from snaps.config.network import PortConfig, NetworkConfig, SubnetConfig
+from snaps.config.router import RouterConfig
+from snaps.config.volume import VolumeConfig
from snaps.openstack import create_network, create_router
-from snaps.config.flavor import FlavorConfig
from snaps.openstack.create_flavor import OpenStackFlavor
-from snaps.config.image import ImageConfig
from snaps.openstack.create_image import OpenStackImage
from snaps.openstack.create_instance import (
VmInstanceSettings, OpenStackVmInstance, FloatingIpSettings,
VmInstanceSettingsError, FloatingIpSettingsError)
from snaps.openstack.create_keypairs import OpenStackKeypair
-from snaps.openstack.create_network import (
- OpenStackNetwork, PortSettings, NetworkSettings, SubnetSettings)
+from snaps.openstack.create_network import OpenStackNetwork
from snaps.openstack.create_router import OpenStackRouter
from snaps.openstack.create_security_group import (
SecurityGroupSettings, OpenStackSecurityGroup, SecurityGroupRuleSettings,
@@ -85,7 +85,7 @@ class VmInstanceSettingsUnitTests(unittest.TestCase):
VmInstanceSettings(config={'name': 'foo', 'flavor': 'bar'})
def test_name_flavor_port_only(self):
- port_settings = PortSettings(name='foo-port', network_name='bar-net')
+ port_settings = PortConfig(name='foo-port', network_name='bar-net')
settings = VmInstanceSettings(name='foo', flavor='bar',
port_settings=[port_settings])
self.assertEqual('foo', settings.name)
@@ -103,7 +103,7 @@ class VmInstanceSettingsUnitTests(unittest.TestCase):
self.assertIsNone(settings.volume_names)
def test_config_with_name_flavor_port_only(self):
- port_settings = PortSettings(name='foo-port', network_name='bar-net')
+ port_settings = PortConfig(name='foo-port', network_name='bar-net')
settings = VmInstanceSettings(
**{'name': 'foo', 'flavor': 'bar', 'ports': [port_settings]})
self.assertEqual('foo', settings.name)
@@ -121,7 +121,7 @@ class VmInstanceSettingsUnitTests(unittest.TestCase):
self.assertIsNone(settings.volume_names)
def test_all(self):
- port_settings = PortSettings(name='foo-port', network_name='bar-net')
+ port_settings = PortConfig(name='foo-port', network_name='bar-net')
fip_settings = FloatingIpSettings(name='foo-fip', port_name='bar-port',
router_name='foo-bar-router')
@@ -153,7 +153,7 @@ class VmInstanceSettingsUnitTests(unittest.TestCase):
self.assertEqual('vol1', settings.volume_names[0])
def test_config_all(self):
- port_settings = PortSettings(name='foo-port', network_name='bar-net')
+ port_settings = PortConfig(name='foo-port', network_name='bar-net')
fip_settings = FloatingIpSettings(name='foo-fip', port_name='bar-port',
router_name='foo-bar-router')
@@ -303,7 +303,7 @@ class SimpleHealthCheck(OSIntegrationTestCase):
self.priv_net_config = openstack_tests.get_priv_net_config(
net_name=guid + '-priv-net', subnet_name=guid + '-priv-subnet')
- self.port_settings = PortSettings(
+ self.port_settings = PortConfig(
name=self.port_1_name,
network_name=self.priv_net_config.network_settings.name)
@@ -442,7 +442,7 @@ class CreateInstanceSimpleTests(OSIntegrationTestCase):
self.os_creds, net_config.network_settings)
self.network_creator.create()
- self.port_settings = PortSettings(
+ self.port_settings = PortConfig(
name=guid + '-port',
network_name=net_config.network_settings.name)
@@ -668,7 +668,7 @@ class CreateInstanceSingleNetworkTests(OSIntegrationTestCase):
"""
ip_1 = '10.55.1.100'
sub_settings = self.pub_net_config.network_settings.subnet_settings
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.pub_net_config.network_settings.name,
ip_addrs=[
@@ -698,7 +698,7 @@ class CreateInstanceSingleNetworkTests(OSIntegrationTestCase):
Tests the ability to access a VM via SSH and a floating IP when it has
been assigned prior to being active.
"""
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.pub_net_config.network_settings.name)
@@ -733,7 +733,7 @@ class CreateInstanceSingleNetworkTests(OSIntegrationTestCase):
Tests the ability to access a VM via SSH and a floating IP when it has
been assigned prior to being active.
"""
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.pub_net_config.network_settings.name)
@@ -770,7 +770,7 @@ class CreateInstanceSingleNetworkTests(OSIntegrationTestCase):
Tests the ability to access a VM via SSH and a floating IP via a
creator that is identical to the original creator.
"""
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.pub_net_config.network_settings.name)
@@ -945,10 +945,10 @@ class CreateInstanceIPv6NetworkTests(OSIntegrationTestCase):
Tests the ability to assign an IPv4 floating IP to an IPv6 overlay
network when the external network does not have an IPv6 subnet.
"""
- subnet_settings = SubnetSettings(
+ subnet_settings = SubnetConfig(
name=self.guid + '-subnet', cidr='1:1:0:0:0:0:0:0/64',
ip_version=6)
- network_settings = NetworkSettings(
+ network_settings = NetworkConfig(
name=self.guid + '-net', subnet_settings=[subnet_settings])
router_settings = RouterConfig(
name=self.guid + '-router', external_gateway=self.ext_net_name,
@@ -964,7 +964,7 @@ class CreateInstanceIPv6NetworkTests(OSIntegrationTestCase):
self.os_creds, router_settings)
self.router_creator.create()
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port1_name, network_name=network_settings.name)
instance_settings = VmInstanceSettings(
@@ -989,13 +989,13 @@ class CreateInstanceIPv6NetworkTests(OSIntegrationTestCase):
Tests the ability to assign an IPv4 floating IP to an IPv6 overlay
network when the external network does not have an IPv6 subnet.
"""
- subnet4_settings = SubnetSettings(
+ subnet4_settings = SubnetConfig(
name=self.guid + '-subnet4', cidr='10.0.1.0/24',
ip_version=4)
- subnet6_settings = SubnetSettings(
+ subnet6_settings = SubnetConfig(
name=self.guid + '-subnet6', cidr='1:1:0:0:0:0:0:0/64',
ip_version=6)
- network_settings = NetworkSettings(
+ network_settings = NetworkConfig(
name=self.guid + '-net',
subnet_settings=[subnet4_settings, subnet6_settings])
router_settings = RouterConfig(
@@ -1012,7 +1012,7 @@ class CreateInstanceIPv6NetworkTests(OSIntegrationTestCase):
self.os_creds, router_settings)
self.router_creator.create()
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port1_name, network_name=network_settings.name)
instance_settings = VmInstanceSettings(
@@ -1130,7 +1130,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
"""
ip = '10.55.0.101'
sub_settings = self.net_config.network_settings.subnet_settings
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
ip_addrs=[{'subnet_name': sub_settings[0].name, 'ip': ip}])
@@ -1157,7 +1157,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
"""
ip = '10.66.0.101'
sub_settings = self.net_config.network_settings.subnet_settings
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
ip_addrs=[{'subnet_name': sub_settings[0].name, 'ip': ip}])
@@ -1180,7 +1180,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
the MAC address is assigned.
"""
mac_addr = '0a:1b:2c:3d:4e:5f'
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
mac_address=mac_addr)
@@ -1204,7 +1204,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
invalid MAC address value is being
assigned. This should raise an Exception
"""
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
mac_address='foo')
@@ -1229,7 +1229,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
ip = '10.55.0.101'
mac_addr = '0a:1b:2c:3d:4e:5f'
sub_settings = self.net_config.network_settings.subnet_settings
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
mac_address=mac_addr,
@@ -1260,7 +1260,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
ip = '10.55.0.101'
mac_addr = '0a:1b:2c:3d:4e:5f'
pair = {'ip_address': ip, 'mac_address': mac_addr}
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
allowed_address_pairs=[pair])
@@ -1292,7 +1292,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
pair = {'ip_address': ip, 'mac_address': mac_addr}
pairs = set()
pairs.add((ip, mac_addr))
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
allowed_address_pairs=[pair])
@@ -1318,7 +1318,7 @@ class CreateInstancePortManipulationTests(OSIntegrationTestCase):
pair = {'ip_address': ip, 'mac_address': mac_addr}
pairs = set()
pairs.add((ip, mac_addr))
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_1_name,
network_name=self.net_config.network_settings.name,
allowed_address_pairs=[pair])
@@ -1435,7 +1435,7 @@ class CreateInstanceOnComputeHost(OSIntegrationTestCase):
for zone in zone_hosts:
inst_name = self.vm_inst_name + '-' + zone
ctr += 1
- port_settings = PortSettings(
+ port_settings = PortConfig(
name=self.port_base_name + '-' + str(ctr),
network_name=self.priv_net_config.network_settings.name)
@@ -1647,7 +1647,7 @@ class CreateInstancePubPrivNetTests(OSIntegrationTestCase):
ports_settings = []
ctr = 1
for network_creator in self.network_creators:
- ports_settings.append(PortSettings(
+ ports_settings.append(PortConfig(
name=self.guid + '-port-' + str(ctr),
network_name=network_creator.network_settings.name))
ctr += 1
@@ -1739,7 +1739,7 @@ class InstanceSecurityGroupTests(OSIntegrationTestCase):
metadata=self.flavor_metadata))
self.flavor_creator.create()
- self.port_settings = PortSettings(
+ self.port_settings = PortConfig(
name=self.guid + '-port',
network_name=net_config.network_settings.name)
except Exception as e:
@@ -2077,7 +2077,7 @@ class CreateInstanceFromThreePartImage(OSIntegrationTestCase):
self.os_creds, net_config.network_settings)
self.network_creator.create()
- self.port_settings = PortSettings(
+ self.port_settings = PortConfig(
name=guid + '-port',
network_name=net_config.network_settings.name)
except Exception as e:
@@ -2172,7 +2172,7 @@ class CreateInstanceMockOfflineTests(OSComponentTestCase):
self.priv_net_config = openstack_tests.get_priv_net_config(
net_name=self.guid + '-priv-net',
subnet_name=self.guid + '-priv-subnet')
- self.port_settings = PortSettings(
+ self.port_settings = PortConfig(
name=self.port_1_name,
network_name=self.priv_net_config.network_settings.name)
@@ -2670,16 +2670,16 @@ class CreateInstanceTwoNetTests(OSIntegrationTestCase):
self.vm_inst2_name = self.guid + '-inst2'
self.port_1_name = self.guid + '-vm1-port'
self.port_2_name = self.guid + '-vm2-port'
- self.net_config_1 = NetworkSettings(
+ self.net_config_1 = NetworkConfig(
name=self.guid + '-net1',
subnet_settings=[
- create_network.SubnetSettings(
+ create_network.SubnetConfig(
cidr=cidr1, name=self.guid + '-subnet1',
gateway_ip=static_gateway_ip1)])
- self.net_config_2 = NetworkSettings(
+ self.net_config_2 = NetworkConfig(
name=self.guid + '-net2',
subnet_settings=[
- create_network.SubnetSettings(
+ create_network.SubnetConfig(
cidr=cidr2, name=self.guid + '-subnet2',
gateway_ip=static_gateway_ip2)])
@@ -2703,7 +2703,7 @@ class CreateInstanceTwoNetTests(OSIntegrationTestCase):
network_creator.create()
port_settings = [
- create_network.PortSettings(
+ create_network.PortConfig(
name=self.guid + '-router-port1',
ip_addrs=[{
'subnet_name':
@@ -2712,7 +2712,7 @@ class CreateInstanceTwoNetTests(OSIntegrationTestCase):
}],
network_name=self.net_config_1.name,
project_name=self.os_creds.project_name),
- create_network.PortSettings(
+ create_network.PortConfig(
name=self.guid + '-router-port2',
ip_addrs=[{
'subnet_name':
@@ -2813,7 +2813,7 @@ class CreateInstanceTwoNetTests(OSIntegrationTestCase):
ports_settings = []
ctr = 1
for network_creator in self.network_creators:
- ports_settings.append(PortSettings(
+ ports_settings.append(PortConfig(
name=self.guid + '-port-' + str(ctr),
network_name=network_creator.network_settings.name))
ctr += 1
@@ -2823,7 +2823,7 @@ class CreateInstanceTwoNetTests(OSIntegrationTestCase):
name=self.vm_inst1_name,
flavor=self.flavor_creator.flavor_settings.name,
userdata=_get_ping_userdata(self.ip2),
- port_settings=[PortSettings(
+ port_settings=[PortConfig(
name=self.port_1_name,
ip_addrs=[{
'subnet_name':
@@ -2835,7 +2835,7 @@ class CreateInstanceTwoNetTests(OSIntegrationTestCase):
name=self.vm_inst2_name,
flavor=self.flavor_creator.flavor_settings.name,
userdata=_get_ping_userdata(self.ip1),
- port_settings=[PortSettings(
+ port_settings=[PortConfig(
name=self.port_2_name,
ip_addrs=[{
'subnet_name':
@@ -2919,7 +2919,7 @@ class CreateInstanceVolumeTests(OSIntegrationTestCase):
self.os_creds, net_config.network_settings)
self.network_creator.create()
- self.port_settings = PortSettings(
+ self.port_settings = PortConfig(
name=guid + '-port',
network_name=net_config.network_settings.name)
diff --git a/snaps/openstack/tests/create_network_tests.py b/snaps/openstack/tests/create_network_tests.py
index 3d0a102..ac0aad1 100644
--- a/snaps/openstack/tests/create_network_tests.py
+++ b/snaps/openstack/tests/create_network_tests.py
@@ -15,15 +15,18 @@
import unittest
import uuid
+from snaps.config.network import (
+ NetworkConfig, SubnetConfig, SubnetConfigError, NetworkConfigError,
+ PortConfigError, IPv6Mode)
from snaps.openstack import create_router
from snaps.openstack.create_network import (
- OpenStackNetwork, NetworkSettings, SubnetSettings, PortSettings,
- NetworkSettingsError, SubnetSettingsError, PortSettingsError, IPv6Mode)
+ OpenStackNetwork, NetworkSettings, SubnetSettings, PortSettings)
from snaps.openstack.tests import openstack_tests
from snaps.openstack.tests.os_source_file_test import (
OSIntegrationTestCase, OSComponentTestCase)
from snaps.openstack.utils import neutron_utils
from snaps.openstack.utils.tests import neutron_utils_tests
+from snaps.openstack.create_network import IPv6Mode as IPv6Mode_old
__author__ = 'spisarski'
@@ -34,11 +37,11 @@ class NetworkSettingsUnitTests(unittest.TestCase):
"""
def test_no_params(self):
- with self.assertRaises(NetworkSettingsError):
+ with self.assertRaises(NetworkConfigError):
NetworkSettings()
def test_empty_config(self):
- with self.assertRaises(NetworkSettingsError):
+ with self.assertRaises(NetworkConfigError):
NetworkSettings(**dict())
def test_name_only(self):
@@ -109,19 +112,19 @@ class SubnetSettingsUnitTests(unittest.TestCase):
"""
def test_no_params(self):
- with self.assertRaises(SubnetSettingsError):
+ with self.assertRaises(SubnetConfigError):
SubnetSettings()
def test_empty_config(self):
- with self.assertRaises(SubnetSettingsError):
+ with self.assertRaises(SubnetConfigError):
SubnetSettings(**dict())
def test_name_only(self):
- with self.assertRaises(SubnetSettingsError):
+ with self.assertRaises(SubnetConfigError):
SubnetSettings(name='foo')
def test_config_with_name_only(self):
- with self.assertRaises(SubnetSettingsError):
+ with self.assertRaises(SubnetConfigError):
SubnetSettings(**{'name': 'foo'})
def test_name_cidr_only(self):
@@ -161,16 +164,13 @@ class SubnetSettingsUnitTests(unittest.TestCase):
def test_all_string_enums(self):
host_routes = {'destination': '0.0.0.0/0', 'nexthop': '123.456.78.9'}
- settings = SubnetSettings(name='foo', cidr='10.0.0.0/24', ip_version=6,
- project_name='bar-project',
- start='10.0.0.2', end='10.0.0.101',
- gateway_ip='10.0.0.1', enable_dhcp=False,
- dns_nameservers=['8.8.8.8'],
- host_routes=[host_routes],
- destination='dest',
- nexthop='hop',
- ipv6_ra_mode='dhcpv6-stateful',
- ipv6_address_mode='slaac')
+ settings = SubnetSettings(
+ name='foo', cidr='10.0.0.0/24', ip_version=6,
+ project_name='bar-project', start='10.0.0.2', end='10.0.0.101',
+ gateway_ip='10.0.0.1', enable_dhcp=False,
+ dns_nameservers=['8.8.8.8'], host_routes=[host_routes],
+ destination='dest', nexthop='hop', ipv6_ra_mode='dhcpv6-stateful',
+ ipv6_address_mode='slaac')
self.assertEqual('foo', settings.name)
self.assertEqual('10.0.0.0/24', settings.cidr)
self.assertEqual(6, settings.ip_version)
@@ -185,21 +185,21 @@ class SubnetSettingsUnitTests(unittest.TestCase):
self.assertEqual(host_routes, settings.host_routes[0])
self.assertEqual('dest', settings.destination)
self.assertEqual('hop', settings.nexthop)
- self.assertEqual(IPv6Mode.stateful, settings.ipv6_ra_mode)
- self.assertEqual(IPv6Mode.slaac, settings.ipv6_address_mode)
+ self.assertEqual(IPv6Mode_old.stateful.value,
+ settings.ipv6_ra_mode.value)
+ self.assertEqual(IPv6Mode_old.slaac.value,
+ settings.ipv6_address_mode.value)
def test_all_type_enums(self):
host_routes = {'destination': '0.0.0.0/0', 'nexthop': '123.456.78.9'}
- settings = SubnetSettings(name='foo', cidr='10.0.0.0/24', ip_version=6,
- project_name='bar-project',
- start='10.0.0.2', end='10.0.0.101',
- gateway_ip='10.0.0.1', enable_dhcp=False,
- dns_nameservers=['8.8.8.8'],
- host_routes=[host_routes],
- destination='dest',
- nexthop='hop',
- ipv6_ra_mode=IPv6Mode.stateful,
- ipv6_address_mode=IPv6Mode.slaac)
+ settings = SubnetSettings(
+ name='foo', cidr='10.0.0.0/24', ip_version=6,
+ project_name='bar-project', start='10.0.0.2', end='10.0.0.101',
+ gateway_ip='10.0.0.1', enable_dhcp=False,
+ dns_nameservers=['8.8.8.8'], host_routes=[host_routes],
+ destination='dest', nexthop='hop',
+ ipv6_ra_mode=IPv6Mode_old.stateful,
+ ipv6_address_mode=IPv6Mode.slaac)
self.assertEqual('foo', settings.name)
self.assertEqual('10.0.0.0/24', settings.cidr)
self.assertEqual(6, settings.ip_version)
@@ -214,8 +214,9 @@ class SubnetSettingsUnitTests(unittest.TestCase):
self.assertEqual(host_routes, settings.host_routes[0])
self.assertEqual('dest', settings.destination)
self.assertEqual('hop', settings.nexthop)
- self.assertEqual(IPv6Mode.stateful, settings.ipv6_ra_mode)
- self.assertEqual(IPv6Mode.slaac, settings.ipv6_address_mode)
+ self.assertEqual(IPv6Mode.stateful.value, settings.ipv6_ra_mode.value)
+ self.assertEqual(IPv6Mode.slaac.value,
+ settings.ipv6_address_mode.value)
def test_config_all(self):
host_routes = {'destination': '0.0.0.0/0', 'nexthop': '123.456.78.9'}
@@ -242,8 +243,9 @@ class SubnetSettingsUnitTests(unittest.TestCase):
self.assertEqual(host_routes, settings.host_routes[0])
self.assertEqual('dest', settings.destination)
self.assertEqual('hop', settings.nexthop)
- self.assertEqual(IPv6Mode.stateless, settings.ipv6_ra_mode)
- self.assertEqual(IPv6Mode.slaac, settings.ipv6_address_mode)
+ self.assertEqual(IPv6Mode.stateless.value, settings.ipv6_ra_mode.value)
+ self.assertEqual(IPv6Mode.slaac.value,
+ settings.ipv6_address_mode.value)
class PortSettingsUnitTests(unittest.TestCase):
@@ -252,19 +254,19 @@ class PortSettingsUnitTests(unittest.TestCase):
"""
def test_no_params(self):
- with self.assertRaises(PortSettingsError):
+ with self.assertRaises(PortConfigError):
PortSettings()
def test_empty_config(self):
- with self.assertRaises(PortSettingsError):
+ with self.assertRaises(PortConfigError):
PortSettings(**dict())
def test_name_only(self):
- with self.assertRaises(PortSettingsError):
+ with self.assertRaises(PortConfigError):
PortSettings(name='foo')
def test_config_name_only(self):
- with self.assertRaises(PortSettingsError):
+ with self.assertRaises(PortConfigError):
PortSettings(**{'name': 'foo'})
def test_name_netname_only(self):
@@ -566,10 +568,10 @@ class CreateNetworkIPv6Tests(OSIntegrationTestCase):
Tests the creation of an OpenStack network without a router.
"""
# Create Network
- subnet_settings = SubnetSettings(
+ subnet_settings = SubnetConfig(
name=self.guid + '-subnet', cidr='1:1:0:0:0:0:0:0/64',
ip_version=6)
- network_settings = NetworkSettings(
+ network_settings = NetworkConfig(
name=self.guid + '-net', subnet_settings=[subnet_settings])
self.net_creator = OpenStackNetwork(self.os_creds, network_settings)
@@ -594,13 +596,13 @@ class CreateNetworkIPv6Tests(OSIntegrationTestCase):
Tests the creation of an OpenStack network without a router.
"""
# Create Network
- subnet4_settings = SubnetSettings(
+ subnet4_settings = SubnetConfig(
name=self.guid + '-subnet4', cidr='10.0.1.0/24', ip_version=4)
- subnet6_settings = SubnetSettings(
+ subnet6_settings = SubnetConfig(
name=self.guid + '-subnet6', cidr='1:1:0:0:0:0:0:0/64',
ip_version=6)
- network_settings = NetworkSettings(
+ network_settings = NetworkConfig(
name=self.guid + '-net',
subnet_settings=[subnet4_settings, subnet6_settings])
@@ -666,7 +668,7 @@ class CreateNetworkTypeTests(OSComponentTestCase):
"""
# Create Network
network_type = 'vlan'
- net_settings = NetworkSettings(
+ net_settings = NetworkConfig(
name=self.net_config.network_settings.name,
subnet_settings=self.net_config.network_settings.subnet_settings,
network_type=network_type)
@@ -693,7 +695,7 @@ class CreateNetworkTypeTests(OSComponentTestCase):
physical_network = 'datacentre'
segmentation_id = 2366
- net_settings = NetworkSettings(
+ net_settings = NetworkConfig(
name=self.net_config.network_settings.name,
subnet_settings=self.net_config.network_settings.subnet_settings,
network_type=network_type,
@@ -716,7 +718,7 @@ class CreateNetworkTypeTests(OSComponentTestCase):
"""
# Create Network
network_type = 'vxlan'
- net_settings = NetworkSettings(
+ net_settings = NetworkConfig(
name=self.net_config.network_settings.name,
subnet_settings=self.net_config.network_settings.subnet_settings,
network_type=network_type)
@@ -741,7 +743,7 @@ class CreateNetworkTypeTests(OSComponentTestCase):
# This value must be variable to work on all OpenStack pods
physical_network = 'datacentre'
- net_settings = NetworkSettings(
+ net_settings = NetworkConfig(
name=self.net_config.network_settings.name,
subnet_settings=self.net_config.network_settings.subnet_settings,
network_type=network_type, physical_network=physical_network)
@@ -761,7 +763,7 @@ class CreateNetworkTypeTests(OSComponentTestCase):
"""
# Create Network
network_type = 'foo'
- net_settings = NetworkSettings(
+ net_settings = NetworkConfig(
name=self.net_config.network_settings.name,
subnet_settings=self.net_config.network_settings.subnet_settings,
network_type=network_type)
diff --git a/snaps/openstack/tests/create_router_tests.py b/snaps/openstack/tests/create_router_tests.py
index 70dbd6d..5c34037 100644
--- a/snaps/openstack/tests/create_router_tests.py
+++ b/snaps/openstack/tests/create_router_tests.py
@@ -15,11 +15,10 @@
import unittest
import uuid
+from snaps.config.network import PortConfig, NetworkConfig
from snaps.config.router import RouterConfigError, RouterConfig
from snaps.openstack import create_network
from snaps.openstack import create_router
-from snaps.openstack.create_network import (
- NetworkSettings, PortSettings)
from snaps.openstack.create_network import OpenStackNetwork
from snaps.openstack.create_router import RouterSettings
from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
@@ -75,7 +74,7 @@ class RouterSettingsUnitTests(unittest.TestCase):
self.assertEqual(0, len(settings.port_settings))
def test_all(self):
- port_settings = PortSettings(name='foo', network_name='bar')
+ port_settings = PortConfig(name='foo', network_name='bar')
settings = RouterSettings(
name='foo', project_name='bar', external_gateway='foo_gateway',
admin_state_up=True, enable_snat=False,
@@ -108,9 +107,9 @@ class RouterSettingsUnitTests(unittest.TestCase):
self.assertTrue(isinstance(settings.internal_subnets, list))
self.assertEqual(1, len(settings.internal_subnets))
self.assertEqual(['10.0.0.1/24'], settings.internal_subnets)
- self.assertEqual([PortSettings(**{'name': 'foo-port',
- 'network_name': 'bar-net'})],
- settings.port_settings)
+ self.assertEqual(
+ [PortConfig(**{'name': 'foo-port', 'network_name': 'bar-net'})],
+ settings.port_settings)
class CreateRouterSuccessTests(OSIntegrationTestCase):
@@ -275,16 +274,16 @@ class CreateRouterSuccessTests(OSIntegrationTestCase):
Test creation of a router connected with two private networks and no
external gateway
"""
- network_settings1 = NetworkSettings(
+ network_settings1 = NetworkConfig(
name=self.guid + '-pub-net1',
subnet_settings=[
- create_network.SubnetSettings(
+ create_network.SubnetConfig(
cidr=cidr1, name=self.guid + '-pub-subnet1',
gateway_ip=static_gateway_ip1)])
- network_settings2 = NetworkSettings(
+ network_settings2 = NetworkConfig(
name=self.guid + '-pub-net2',
subnet_settings=[
- create_network.SubnetSettings(
+ create_network.SubnetConfig(
cidr=cidr2, name=self.guid + '-pub-subnet2',
gateway_ip=static_gateway_ip2)])
@@ -297,7 +296,7 @@ class CreateRouterSuccessTests(OSIntegrationTestCase):
self.network_creator2.create()
port_settings = [
- create_network.PortSettings(
+ create_network.PortConfig(
name=self.guid + '-port1',
ip_addrs=[{
'subnet_name':
@@ -306,7 +305,7 @@ class CreateRouterSuccessTests(OSIntegrationTestCase):
}],
network_name=network_settings1.name,
project_name=self.os_creds.project_name),
- create_network.PortSettings(
+ create_network.PortConfig(
name=self.guid + '-port2',
ip_addrs=[{
'subnet_name': network_settings2.subnet_settings[0].name,
@@ -340,10 +339,10 @@ class CreateRouterSuccessTests(OSIntegrationTestCase):
Test creation of a router connected to an external network and a
private network.
"""
- network_settings = NetworkSettings(
+ network_settings = NetworkConfig(
name=self.guid + '-pub-net1',
subnet_settings=[
- create_network.SubnetSettings(
+ create_network.SubnetConfig(
cidr=cidr1, name=self.guid + '-pub-subnet1',
gateway_ip=static_gateway_ip1)])
self.network_creator1 = OpenStackNetwork(self.os_creds,
@@ -351,7 +350,7 @@ class CreateRouterSuccessTests(OSIntegrationTestCase):
self.network_creator1.create()
port_settings = [
- create_network.PortSettings(
+ create_network.PortConfig(
name=self.guid + '-port1',
ip_addrs=[{
'subnet_name': network_settings.subnet_settings[0].name,
diff --git a/snaps/openstack/tests/openstack_tests.py b/snaps/openstack/tests/openstack_tests.py
index ff64af5..78e8601 100644
--- a/snaps/openstack/tests/openstack_tests.py
+++ b/snaps/openstack/tests/openstack_tests.py
@@ -18,8 +18,8 @@ import re
import pkg_resources
from snaps import file_utils
from snaps.config.image import ImageConfig
+from snaps.config.network import NetworkConfig, SubnetConfig
from snaps.config.router import RouterConfig
-from snaps.openstack.create_network import NetworkSettings, SubnetSettings
from snaps.openstack.os_credentials import OSCreds, ProxySettings
__author__ = 'spisarski'
@@ -338,11 +338,11 @@ class OSNetworkConfig:
router_name=None, external_gateway=None):
if subnet_name and subnet_cidr:
- self.network_settings = NetworkSettings(
+ self.network_settings = NetworkConfig(
name=net_name, subnet_settings=[
- SubnetSettings(cidr=subnet_cidr, name=subnet_name)])
+ SubnetConfig(cidr=subnet_cidr, name=subnet_name)])
else:
- self.network_settings = NetworkSettings(name=net_name)
+ self.network_settings = NetworkConfig(name=net_name)
if router_name:
if subnet_name: