Merge "Refactor network fakes to sdk properties PART 3"
This commit is contained in:
commit
fe165ef76f
@ -22,10 +22,13 @@ from openstack.network.v2 import address_group as _address_group
|
||||
from openstack.network.v2 import address_scope as _address_scope
|
||||
from openstack.network.v2 import auto_allocated_topology as allocated_topology
|
||||
from openstack.network.v2 import availability_zone as _availability_zone
|
||||
from openstack.network.v2 import flavor as _flavor
|
||||
from openstack.network.v2 import local_ip as _local_ip
|
||||
from openstack.network.v2 import local_ip_association as _local_ip_association
|
||||
from openstack.network.v2 import network as _network
|
||||
from openstack.network.v2 import network_ip_availability as _ip_availability
|
||||
from openstack.network.v2 import network_segment_range as _segment_range
|
||||
from openstack.network.v2 import segment as _segment
|
||||
|
||||
from openstackclient.tests.unit import fakes
|
||||
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes_v3
|
||||
@ -125,186 +128,6 @@ class FakeExtension(object):
|
||||
return extension
|
||||
|
||||
|
||||
class FakeNetworkFlavor(object):
|
||||
"""Fake Network Flavor."""
|
||||
|
||||
@staticmethod
|
||||
def create_one_network_flavor(attrs=None):
|
||||
"""Create a fake network flavor.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:return:
|
||||
A FakeResource object faking the network flavor
|
||||
"""
|
||||
attrs = attrs or {}
|
||||
|
||||
fake_uuid = uuid.uuid4().hex
|
||||
network_flavor_attrs = {
|
||||
'description': 'network-flavor-description-' + fake_uuid,
|
||||
'enabled': True,
|
||||
'id': 'network-flavor-id-' + fake_uuid,
|
||||
'name': 'network-flavor-name-' + fake_uuid,
|
||||
'service_type': 'vpn',
|
||||
'project_id': 'project-id-' + uuid.uuid4().hex,
|
||||
'location': 'MUNCHMUNCHMUNCH',
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
network_flavor_attrs.update(attrs)
|
||||
|
||||
network_flavor = fakes.FakeResource(
|
||||
info=copy.deepcopy(network_flavor_attrs),
|
||||
loaded=True
|
||||
)
|
||||
|
||||
network_flavor.is_enabled = network_flavor_attrs['enabled']
|
||||
|
||||
return network_flavor
|
||||
|
||||
@staticmethod
|
||||
def create_flavor(attrs=None, count=2):
|
||||
"""Create multiple fake network flavors.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:param int count:
|
||||
The number of network flavors to fake
|
||||
:return:
|
||||
A list of FakeResource objects faking the network falvors
|
||||
"""
|
||||
network_flavors = []
|
||||
for i in range(0, count):
|
||||
network_flavors.append(
|
||||
FakeNetworkFlavor.create_one_network_flavor(attrs)
|
||||
)
|
||||
return network_flavors
|
||||
|
||||
@staticmethod
|
||||
def get_flavor(network_flavors=None, count=2):
|
||||
"""Get a list of flavors."""
|
||||
if network_flavors is None:
|
||||
network_flavors = (FakeNetworkFlavor.create_flavor(count))
|
||||
return mock.Mock(side_effect=network_flavors)
|
||||
|
||||
|
||||
class FakeNetworkSegment(object):
|
||||
"""Fake one or more network segments."""
|
||||
|
||||
@staticmethod
|
||||
def create_one_network_segment(attrs=None):
|
||||
"""Create a fake network segment.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:return:
|
||||
A FakeResource object faking the network segment
|
||||
"""
|
||||
attrs = attrs or {}
|
||||
|
||||
# Set default attributes.
|
||||
fake_uuid = uuid.uuid4().hex
|
||||
network_segment_attrs = {
|
||||
'description': 'network-segment-description-' + fake_uuid,
|
||||
'id': 'network-segment-id-' + fake_uuid,
|
||||
'name': 'network-segment-name-' + fake_uuid,
|
||||
'network_id': 'network-id-' + fake_uuid,
|
||||
'network_type': 'vlan',
|
||||
'physical_network': 'physical-network-name-' + fake_uuid,
|
||||
'segmentation_id': 1024,
|
||||
'location': 'MUNCHMUNCHMUNCH',
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
network_segment_attrs.update(attrs)
|
||||
|
||||
network_segment = fakes.FakeResource(
|
||||
info=copy.deepcopy(network_segment_attrs),
|
||||
loaded=True
|
||||
)
|
||||
|
||||
return network_segment
|
||||
|
||||
@staticmethod
|
||||
def create_network_segments(attrs=None, count=2):
|
||||
"""Create multiple fake network segments.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:param int count:
|
||||
The number of network segments to fake
|
||||
:return:
|
||||
A list of FakeResource objects faking the network segments
|
||||
"""
|
||||
network_segments = []
|
||||
for i in range(0, count):
|
||||
network_segments.append(
|
||||
FakeNetworkSegment.create_one_network_segment(attrs)
|
||||
)
|
||||
return network_segments
|
||||
|
||||
|
||||
class FakeNetworkSegmentRange(object):
|
||||
"""Fake one or more network segment ranges."""
|
||||
|
||||
@staticmethod
|
||||
def create_one_network_segment_range(attrs=None):
|
||||
"""Create a fake network segment range.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:return:
|
||||
A FakeResource object faking the network segment range
|
||||
"""
|
||||
attrs = attrs or {}
|
||||
|
||||
# Set default attributes.
|
||||
fake_uuid = uuid.uuid4().hex
|
||||
network_segment_range_attrs = {
|
||||
'id': 'network-segment-range-id-' + fake_uuid,
|
||||
'name': 'network-segment-name-' + fake_uuid,
|
||||
'default': False,
|
||||
'shared': False,
|
||||
'project_id': 'project-id-' + fake_uuid,
|
||||
'network_type': 'vlan',
|
||||
'physical_network': 'physical-network-name-' + fake_uuid,
|
||||
'minimum': 100,
|
||||
'maximum': 106,
|
||||
'used': {104: '3312e4ba67864b2eb53f3f41432f8efc',
|
||||
106: '3312e4ba67864b2eb53f3f41432f8efc'},
|
||||
'available': [100, 101, 102, 103, 105],
|
||||
'location': 'MUNCHMUNCHMUNCH',
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
network_segment_range_attrs.update(attrs)
|
||||
|
||||
network_segment_range = fakes.FakeResource(
|
||||
info=copy.deepcopy(network_segment_range_attrs),
|
||||
loaded=True
|
||||
)
|
||||
|
||||
return network_segment_range
|
||||
|
||||
@staticmethod
|
||||
def create_network_segment_ranges(attrs=None, count=2):
|
||||
"""Create multiple fake network segment ranges.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:param int count:
|
||||
The number of network segment ranges to fake
|
||||
:return:
|
||||
A list of FakeResource objects faking the network segment ranges
|
||||
"""
|
||||
network_segment_ranges = []
|
||||
for i in range(0, count):
|
||||
network_segment_ranges.append(
|
||||
FakeNetworkSegmentRange.create_one_network_segment_range(attrs)
|
||||
)
|
||||
return network_segment_ranges
|
||||
|
||||
|
||||
class FakePort(object):
|
||||
"""Fake one or more ports."""
|
||||
|
||||
@ -1996,6 +1819,159 @@ def get_networks(networks=None, count=2):
|
||||
return mock.Mock(side_effect=networks)
|
||||
|
||||
|
||||
def create_one_network_flavor(attrs=None):
|
||||
"""Create a fake network flavor.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:return:
|
||||
A Flavor object faking the network flavor
|
||||
"""
|
||||
attrs = attrs or {}
|
||||
|
||||
fake_uuid = uuid.uuid4().hex
|
||||
network_flavor_attrs = {
|
||||
'description': 'network-flavor-description-' + fake_uuid,
|
||||
'is_enabled': True,
|
||||
'id': 'network-flavor-id-' + fake_uuid,
|
||||
'name': 'network-flavor-name-' + fake_uuid,
|
||||
'service_type': 'vpn',
|
||||
'location': 'MUNCHMUNCHMUNCH',
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
network_flavor_attrs.update(attrs)
|
||||
|
||||
network_flavor = _flavor.Flavor(**network_flavor_attrs)
|
||||
|
||||
return network_flavor
|
||||
|
||||
|
||||
def create_flavor(attrs=None, count=2):
|
||||
"""Create multiple fake network flavors.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:param int count:
|
||||
The number of network flavors to fake
|
||||
:return:
|
||||
A list of Flavor objects faking the network falvors
|
||||
"""
|
||||
network_flavors = []
|
||||
for i in range(0, count):
|
||||
network_flavors.append(create_one_network_flavor(attrs))
|
||||
|
||||
return network_flavors
|
||||
|
||||
|
||||
def get_flavor(network_flavors=None, count=2):
|
||||
"""Get a list of flavors."""
|
||||
if network_flavors is None:
|
||||
network_flavors = create_flavor(count)
|
||||
return mock.Mock(side_effect=network_flavors)
|
||||
|
||||
|
||||
def create_one_network_segment(attrs=None):
|
||||
"""Create a fake network segment.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:return:
|
||||
An Segment object faking the network segment
|
||||
"""
|
||||
attrs = attrs or {}
|
||||
|
||||
# Set default attributes.
|
||||
fake_uuid = uuid.uuid4().hex
|
||||
network_segment_attrs = {
|
||||
'description': 'network-segment-description-' + fake_uuid,
|
||||
'id': 'network-segment-id-' + fake_uuid,
|
||||
'name': 'network-segment-name-' + fake_uuid,
|
||||
'network_id': 'network-id-' + fake_uuid,
|
||||
'network_type': 'vlan',
|
||||
'physical_network': 'physical-network-name-' + fake_uuid,
|
||||
'segmentation_id': 1024,
|
||||
'location': 'MUNCHMUNCHMUNCH',
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
network_segment_attrs.update(attrs)
|
||||
|
||||
network_segment = _segment.Segment(**network_segment_attrs)
|
||||
|
||||
return network_segment
|
||||
|
||||
|
||||
def create_network_segments(attrs=None, count=2):
|
||||
"""Create multiple fake network segments.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:param int count:
|
||||
The number of network segments to fake
|
||||
:return:
|
||||
A list of Segment objects faking the network segments
|
||||
"""
|
||||
network_segments = []
|
||||
for i in range(0, count):
|
||||
network_segments.append(create_one_network_segment(attrs))
|
||||
return network_segments
|
||||
|
||||
|
||||
def create_one_network_segment_range(attrs=None):
|
||||
"""Create a fake network segment range.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:return:
|
||||
A NetworkSegmentRange object faking the network segment range
|
||||
"""
|
||||
attrs = attrs or {}
|
||||
|
||||
# Set default attributes.
|
||||
fake_uuid = uuid.uuid4().hex
|
||||
network_segment_range_attrs = {
|
||||
'id': 'network-segment-range-id-' + fake_uuid,
|
||||
'name': 'network-segment-name-' + fake_uuid,
|
||||
'default': False,
|
||||
'shared': False,
|
||||
'project_id': 'project-id-' + fake_uuid,
|
||||
'network_type': 'vlan',
|
||||
'physical_network': 'physical-network-name-' + fake_uuid,
|
||||
'minimum': 100,
|
||||
'maximum': 106,
|
||||
'used': {104: '3312e4ba67864b2eb53f3f41432f8efc',
|
||||
106: '3312e4ba67864b2eb53f3f41432f8efc'},
|
||||
'available': [100, 101, 102, 103, 105],
|
||||
'location': 'MUNCHMUNCHMUNCH',
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
network_segment_range_attrs.update(attrs)
|
||||
|
||||
network_segment_range = (
|
||||
_segment_range.NetworkSegmentRange(**network_segment_range_attrs))
|
||||
|
||||
return network_segment_range
|
||||
|
||||
|
||||
def create_network_segment_ranges(attrs=None, count=2):
|
||||
"""Create multiple fake network segment ranges.
|
||||
|
||||
:param Dictionary attrs:
|
||||
A dictionary with all attributes
|
||||
:param int count:
|
||||
The number of network segment ranges to fake
|
||||
:return:
|
||||
A list of NetworkSegmentRange objects faking
|
||||
the network segment ranges
|
||||
"""
|
||||
network_segment_ranges = []
|
||||
for i in range(0, count):
|
||||
network_segment_ranges.append(create_one_network_segment_range(attrs))
|
||||
return network_segment_ranges
|
||||
|
||||
|
||||
def create_one_local_ip(attrs=None):
|
||||
"""Create a fake local ip.
|
||||
|
||||
|
@ -39,8 +39,7 @@ class TestNetworkFlavor(network_fakes.TestNetworkV2):
|
||||
|
||||
class TestAddNetworkFlavorToProfile(TestNetworkFlavor):
|
||||
|
||||
network_flavor = \
|
||||
network_fakes.FakeNetworkFlavor.create_one_network_flavor()
|
||||
network_flavor = network_fakes.create_one_network_flavor()
|
||||
service_profile = \
|
||||
network_fakes.FakeNetworkFlavorProfile.create_one_service_profile()
|
||||
|
||||
@ -84,23 +83,22 @@ class TestCreateNetworkFlavor(TestNetworkFlavor):
|
||||
project = identity_fakes_v3.FakeProject.create_one_project()
|
||||
domain = identity_fakes_v3.FakeDomain.create_one_domain()
|
||||
# The new network flavor created.
|
||||
new_network_flavor = (
|
||||
network_fakes.FakeNetworkFlavor.create_one_network_flavor())
|
||||
new_network_flavor = network_fakes.create_one_network_flavor()
|
||||
columns = (
|
||||
'description',
|
||||
'enabled',
|
||||
'id',
|
||||
'name',
|
||||
'project_id',
|
||||
'service_type'
|
||||
'service_type',
|
||||
'service_profile_ids',
|
||||
)
|
||||
data = (
|
||||
new_network_flavor.description,
|
||||
new_network_flavor.enabled,
|
||||
new_network_flavor.is_enabled,
|
||||
new_network_flavor.id,
|
||||
new_network_flavor.name,
|
||||
new_network_flavor.project_id,
|
||||
new_network_flavor.service_type,
|
||||
new_network_flavor.service_profile_ids,
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
@ -139,14 +137,14 @@ class TestCreateNetworkFlavor(TestNetworkFlavor):
|
||||
'service_type': self.new_network_flavor.service_type,
|
||||
'name': self.new_network_flavor.name,
|
||||
})
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
self.assertEqual(set(self.columns), set(columns))
|
||||
self.assertEqual(set(self.data), set(data))
|
||||
|
||||
def test_create_all_options(self):
|
||||
arglist = [
|
||||
'--description', self.new_network_flavor.description,
|
||||
'--enable',
|
||||
'--project', self.new_network_flavor.project_id,
|
||||
'--project', self.project.id,
|
||||
'--project-domain', self.domain.name,
|
||||
'--service-type', self.new_network_flavor.service_type,
|
||||
self.new_network_flavor.name,
|
||||
@ -154,7 +152,7 @@ class TestCreateNetworkFlavor(TestNetworkFlavor):
|
||||
verifylist = [
|
||||
('description', self.new_network_flavor.description),
|
||||
('enable', True),
|
||||
('project', self.new_network_flavor.project_id),
|
||||
('project', self.project.id),
|
||||
('project_domain', self.domain.name),
|
||||
('service_type', self.new_network_flavor.service_type),
|
||||
('name', self.new_network_flavor.name),
|
||||
@ -170,8 +168,8 @@ class TestCreateNetworkFlavor(TestNetworkFlavor):
|
||||
'service_type': self.new_network_flavor.service_type,
|
||||
'name': self.new_network_flavor.name,
|
||||
})
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
self.assertEqual(set(self.columns), set(columns))
|
||||
self.assertEqual(set(self.data), set(data))
|
||||
|
||||
def test_create_disable(self):
|
||||
arglist = [
|
||||
@ -193,23 +191,20 @@ class TestCreateNetworkFlavor(TestNetworkFlavor):
|
||||
'service_type': self.new_network_flavor.service_type,
|
||||
'name': self.new_network_flavor.name,
|
||||
})
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
self.assertEqual(set(self.columns), set(columns))
|
||||
self.assertEqual(set(self.data), set(data))
|
||||
|
||||
|
||||
class TestDeleteNetworkFlavor(TestNetworkFlavor):
|
||||
|
||||
# The network flavor to delete.
|
||||
_network_flavors = (
|
||||
network_fakes.FakeNetworkFlavor.create_flavor(count=2))
|
||||
_network_flavors = network_fakes.create_flavor(count=2)
|
||||
|
||||
def setUp(self):
|
||||
super(TestDeleteNetworkFlavor, self).setUp()
|
||||
self.network.delete_flavor = mock.Mock(return_value=None)
|
||||
self.network.find_flavor = (
|
||||
network_fakes.FakeNetworkFlavor.get_flavor(
|
||||
network_flavors=self._network_flavors)
|
||||
)
|
||||
self.network.find_flavor = network_fakes.get_flavor(
|
||||
network_flavors=self._network_flavors)
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = network_flavor.DeleteNetworkFlavor(self.app, self.namespace)
|
||||
@ -284,8 +279,7 @@ class TestDeleteNetworkFlavor(TestNetworkFlavor):
|
||||
class TestListNetworkFlavor(TestNetworkFlavor):
|
||||
|
||||
# The network flavors to list up.
|
||||
_network_flavors = (
|
||||
network_fakes.FakeNetworkFlavor.create_flavor(count=2))
|
||||
_network_flavors = network_fakes.create_flavor(count=2)
|
||||
columns = (
|
||||
'ID',
|
||||
'Name',
|
||||
@ -298,7 +292,7 @@ class TestListNetworkFlavor(TestNetworkFlavor):
|
||||
data.append((
|
||||
flavor.id,
|
||||
flavor.name,
|
||||
flavor.enabled,
|
||||
flavor.is_enabled,
|
||||
flavor.service_type,
|
||||
flavor.description,
|
||||
))
|
||||
@ -319,14 +313,13 @@ class TestListNetworkFlavor(TestNetworkFlavor):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.network.flavors.assert_called_once_with(**{})
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(set(self.columns), set(columns))
|
||||
self.assertEqual(self.data, list(data))
|
||||
|
||||
|
||||
class TestRemoveNetworkFlavorFromProfile(TestNetworkFlavor):
|
||||
|
||||
network_flavor = \
|
||||
network_fakes.FakeNetworkFlavor.create_one_network_flavor()
|
||||
network_flavor = network_fakes.create_one_network_flavor()
|
||||
service_profile = \
|
||||
network_fakes.FakeNetworkFlavorProfile.create_one_service_profile()
|
||||
|
||||
@ -368,23 +361,22 @@ class TestRemoveNetworkFlavorFromProfile(TestNetworkFlavor):
|
||||
class TestShowNetworkFlavor(TestNetworkFlavor):
|
||||
|
||||
# The network flavor to show.
|
||||
new_network_flavor = (
|
||||
network_fakes.FakeNetworkFlavor.create_one_network_flavor())
|
||||
new_network_flavor = network_fakes.create_one_network_flavor()
|
||||
columns = (
|
||||
'description',
|
||||
'enabled',
|
||||
'id',
|
||||
'name',
|
||||
'project_id',
|
||||
'service_type'
|
||||
'service_type',
|
||||
'service_profile_ids',
|
||||
)
|
||||
data = (
|
||||
new_network_flavor.description,
|
||||
new_network_flavor.enabled,
|
||||
new_network_flavor.is_enabled,
|
||||
new_network_flavor.id,
|
||||
new_network_flavor.name,
|
||||
new_network_flavor.project_id,
|
||||
new_network_flavor.service_type,
|
||||
new_network_flavor.service_profile_ids,
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
@ -416,15 +408,15 @@ class TestShowNetworkFlavor(TestNetworkFlavor):
|
||||
|
||||
self.network.find_flavor.assert_called_once_with(
|
||||
self.new_network_flavor.name, ignore_missing=False)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
self.assertEqual(set(self.columns), set(columns))
|
||||
self.assertEqual(set(self.data), set(data))
|
||||
|
||||
|
||||
class TestSetNetworkFlavor(TestNetworkFlavor):
|
||||
|
||||
# The network flavor to set.
|
||||
new_network_flavor = (
|
||||
network_fakes.FakeNetworkFlavor.create_one_network_flavor())
|
||||
network_fakes.create_one_network_flavor())
|
||||
|
||||
def setUp(self):
|
||||
super(TestSetNetworkFlavor, self).setUp()
|
||||
|
@ -33,8 +33,7 @@ class TestNetworkSegment(network_fakes.TestNetworkV2):
|
||||
class TestCreateNetworkSegment(TestNetworkSegment):
|
||||
|
||||
# The network segment to create along with associated network.
|
||||
_network_segment = \
|
||||
network_fakes.FakeNetworkSegment.create_one_network_segment()
|
||||
_network_segment = network_fakes.create_one_network_segment()
|
||||
_network = network_fakes.create_one_network({
|
||||
'id': _network_segment.network_id,
|
||||
})
|
||||
@ -156,8 +155,7 @@ class TestCreateNetworkSegment(TestNetworkSegment):
|
||||
class TestDeleteNetworkSegment(TestNetworkSegment):
|
||||
|
||||
# The network segments to delete.
|
||||
_network_segments = \
|
||||
network_fakes.FakeNetworkSegment.create_network_segments()
|
||||
_network_segments = network_fakes.create_network_segments()
|
||||
|
||||
def setUp(self):
|
||||
super(TestDeleteNetworkSegment, self).setUp()
|
||||
@ -241,8 +239,7 @@ class TestDeleteNetworkSegment(TestNetworkSegment):
|
||||
|
||||
class TestListNetworkSegment(TestNetworkSegment):
|
||||
_network = network_fakes.create_one_network()
|
||||
_network_segments = \
|
||||
network_fakes.FakeNetworkSegment.create_network_segments(count=3)
|
||||
_network_segments = network_fakes.create_network_segments(count=3)
|
||||
|
||||
columns = (
|
||||
'ID',
|
||||
@ -338,8 +335,7 @@ class TestListNetworkSegment(TestNetworkSegment):
|
||||
class TestSetNetworkSegment(TestNetworkSegment):
|
||||
|
||||
# The network segment to show.
|
||||
_network_segment = \
|
||||
network_fakes.FakeNetworkSegment.create_one_network_segment()
|
||||
_network_segment = network_fakes.create_one_network_segment()
|
||||
|
||||
def setUp(self):
|
||||
super(TestSetNetworkSegment, self).setUp()
|
||||
@ -398,8 +394,7 @@ class TestSetNetworkSegment(TestNetworkSegment):
|
||||
class TestShowNetworkSegment(TestNetworkSegment):
|
||||
|
||||
# The network segment to show.
|
||||
_network_segment = \
|
||||
network_fakes.FakeNetworkSegment.create_one_network_segment()
|
||||
_network_segment = network_fakes.create_one_network_segment()
|
||||
|
||||
columns = (
|
||||
'description',
|
||||
|
@ -50,8 +50,7 @@ class TestNetworkSegmentRange(network_fakes.TestNetworkV2):
|
||||
class TestCreateNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
|
||||
# The network segment range to create.
|
||||
_network_segment_range = network_fakes.FakeNetworkSegmentRange.\
|
||||
create_one_network_segment_range()
|
||||
_network_segment_range = network_fakes.create_one_network_segment_range()
|
||||
|
||||
columns = (
|
||||
'available',
|
||||
@ -310,8 +309,7 @@ class TestCreateNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
class TestDeleteNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
|
||||
# The network segment ranges to delete.
|
||||
_network_segment_ranges = \
|
||||
network_fakes.FakeNetworkSegmentRange.create_network_segment_ranges()
|
||||
_network_segment_ranges = network_fakes.create_network_segment_ranges()
|
||||
|
||||
def setUp(self):
|
||||
super(TestDeleteNetworkSegmentRange, self).setUp()
|
||||
@ -396,8 +394,8 @@ class TestDeleteNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
|
||||
|
||||
class TestListNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
_network_segment_ranges = network_fakes.FakeNetworkSegmentRange.\
|
||||
create_network_segment_ranges(count=3)
|
||||
_network_segment_ranges = (
|
||||
network_fakes.create_network_segment_ranges(count=3))
|
||||
|
||||
columns = (
|
||||
'ID',
|
||||
@ -496,14 +494,13 @@ class TestListNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
class TestSetNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
|
||||
# The network segment range to set.
|
||||
_network_segment_range = network_fakes.FakeNetworkSegmentRange.\
|
||||
create_one_network_segment_range()
|
||||
_network_segment_range = network_fakes.create_one_network_segment_range()
|
||||
# The network segment range updated.
|
||||
minimum_updated = _network_segment_range.minimum - 5
|
||||
maximum_updated = _network_segment_range.maximum + 5
|
||||
available_updated = (list(range(minimum_updated, 104)) + [105] +
|
||||
list(range(107, maximum_updated + 1)))
|
||||
_network_segment_range_updated = network_fakes.FakeNetworkSegmentRange.\
|
||||
_network_segment_range_updated = network_fakes.\
|
||||
create_one_network_segment_range(
|
||||
attrs={'minimum': minimum_updated,
|
||||
'maximum': maximum_updated,
|
||||
@ -577,8 +574,7 @@ class TestSetNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
class TestShowNetworkSegmentRange(TestNetworkSegmentRange):
|
||||
|
||||
# The network segment range to show.
|
||||
_network_segment_range = network_fakes.FakeNetworkSegmentRange.\
|
||||
create_one_network_segment_range()
|
||||
_network_segment_range = network_fakes.create_one_network_segment_range()
|
||||
|
||||
columns = (
|
||||
'available',
|
||||
|
@ -103,7 +103,7 @@ class TestCreateSubnet(TestSubnet):
|
||||
|
||||
# The network segment to be returned from find_segment
|
||||
self._network_segment = \
|
||||
network_fakes.FakeNetworkSegment.create_one_network_segment(
|
||||
network_fakes.create_one_network_segment(
|
||||
attrs={
|
||||
'network_id': self._subnet.network_id,
|
||||
}
|
||||
@ -1186,7 +1186,7 @@ class TestSetSubnet(TestSubnet):
|
||||
|
||||
def test_set_segment(self):
|
||||
_net = network_fakes.create_one_network()
|
||||
_segment = network_fakes.FakeNetworkSegment.create_one_network_segment(
|
||||
_segment = network_fakes.create_one_network_segment(
|
||||
attrs={'network_id': _net.id})
|
||||
_subnet = network_fakes.FakeSubnet.create_one_subnet(
|
||||
{'host_routes': [{'destination': '10.20.20.0/24',
|
||||
|
Loading…
x
Reference in New Issue
Block a user