Drop unnecessary import
generate_uuid is only ever useful if you have code that needs to process uuids also numerically. In our case it only adds indirection and another source of dependency on oslo utils. Change-Id: I92fbf002c2bd8c7a3fc7f7aee7d1197dc6a7dc87 Signed-off-by: Antoni Segura Puimedon <celebdor@gmail.com>
This commit is contained in:
parent
1f77857b75
commit
ef00f3480b
@ -13,6 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import uuid
|
||||||
|
|
||||||
from kuryr_kubernetes.controller.drivers import sriov as sriov_drivers
|
from kuryr_kubernetes.controller.drivers import sriov as sriov_drivers
|
||||||
from kuryr_kubernetes.tests import base as test_base
|
from kuryr_kubernetes.tests import base as test_base
|
||||||
@ -23,7 +24,6 @@ from kuryr_kubernetes import os_vif_util as ovu
|
|||||||
from kuryr_kubernetes import utils
|
from kuryr_kubernetes import utils
|
||||||
|
|
||||||
from oslo_config import cfg as oslo_cfg
|
from oslo_config import cfg as oslo_cfg
|
||||||
from oslo_utils import uuidutils
|
|
||||||
|
|
||||||
|
|
||||||
class TestSriovVIFDriver(test_base.TestCase):
|
class TestSriovVIFDriver(test_base.TestCase):
|
||||||
@ -71,7 +71,7 @@ class TestSriovVIFDriver(test_base.TestCase):
|
|||||||
fixed_ips = mock.sentinel.fixed_ips
|
fixed_ips = mock.sentinel.fixed_ips
|
||||||
m_to_fips.return_value = fixed_ips
|
m_to_fips.return_value = fixed_ips
|
||||||
network = mock.sentinel.Network
|
network = mock.sentinel.Network
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
subnets = {subnet_id: network}
|
subnets = {subnet_id: network}
|
||||||
security_groups = mock.sentinel.security_groups
|
security_groups = mock.sentinel.security_groups
|
||||||
port_fixed_ips = mock.sentinel.port_fixed_ips
|
port_fixed_ips = mock.sentinel.port_fixed_ips
|
||||||
@ -102,7 +102,7 @@ class TestSriovVIFDriver(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
project_id = mock.sentinel.project_id
|
project_id = mock.sentinel.project_id
|
||||||
network = mock.sentinel.Network
|
network = mock.sentinel.Network
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
subnets = {subnet_id: network}
|
subnets = {subnet_id: network}
|
||||||
security_groups = mock.sentinel.security_groups
|
security_groups = mock.sentinel.security_groups
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class TestSriovVIFDriver(test_base.TestCase):
|
|||||||
cls = sriov_drivers.SriovVIFDriver
|
cls = sriov_drivers.SriovVIFDriver
|
||||||
m_driver = mock.Mock(spec=cls)
|
m_driver = mock.Mock(spec=cls)
|
||||||
|
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
oslo_cfg.CONF.set_override('default_physnet_subnets',
|
oslo_cfg.CONF.set_override('default_physnet_subnets',
|
||||||
'physnet10_4:'+str(subnet_id),
|
'physnet10_4:'+str(subnet_id),
|
||||||
group='sriov')
|
group='sriov')
|
||||||
@ -142,7 +142,7 @@ class TestSriovVIFDriver(test_base.TestCase):
|
|||||||
cls = sriov_drivers.SriovVIFDriver
|
cls = sriov_drivers.SriovVIFDriver
|
||||||
m_driver = mock.Mock(spec=cls)
|
m_driver = mock.Mock(spec=cls)
|
||||||
|
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
m_driver._physnet_mapping = {subnet_id: 'physnet10_4'}
|
m_driver._physnet_mapping = {subnet_id: 'physnet10_4'}
|
||||||
|
|
||||||
physnet = cls._get_physnet_for_subnet_id(m_driver, subnet_id)
|
physnet = cls._get_physnet_for_subnet_id(m_driver, subnet_id)
|
||||||
@ -152,7 +152,7 @@ class TestSriovVIFDriver(test_base.TestCase):
|
|||||||
cls = sriov_drivers.SriovVIFDriver
|
cls = sriov_drivers.SriovVIFDriver
|
||||||
m_driver = mock.Mock(spec=cls)
|
m_driver = mock.Mock(spec=cls)
|
||||||
|
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
m_driver._physnet_mapping = {}
|
m_driver._physnet_mapping = {}
|
||||||
|
|
||||||
self.assertRaises(KeyError, cls._get_physnet_for_subnet_id,
|
self.assertRaises(KeyError, cls._get_physnet_for_subnet_id,
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
import collections
|
import collections
|
||||||
import ddt
|
import ddt
|
||||||
import mock
|
import mock
|
||||||
|
import uuid
|
||||||
|
|
||||||
from neutronclient.common import exceptions as n_exc
|
from neutronclient.common import exceptions as n_exc
|
||||||
from oslo_config import cfg as oslo_cfg
|
from oslo_config import cfg as oslo_cfg
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import uuidutils
|
|
||||||
|
|
||||||
from os_vif.objects import vif as osv_vif
|
from os_vif.objects import vif as osv_vif
|
||||||
|
|
||||||
@ -119,9 +119,9 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
m_driver = mock.MagicMock(spec=cls)
|
m_driver = mock.MagicMock(spec=cls)
|
||||||
|
|
||||||
pod = get_pod_obj()
|
pod = get_pod_obj()
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
subnets = {subnet_id: network}
|
subnets = {subnet_id: network}
|
||||||
security_groups = [mock.sentinel.security_groups]
|
security_groups = [mock.sentinel.security_groups]
|
||||||
@ -147,9 +147,9 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
pod_status.__getitem__.return_value = host_addr
|
pod_status.__getitem__.return_value = host_addr
|
||||||
pod = mock.MagicMock()
|
pod = mock.MagicMock()
|
||||||
pod.__getitem__.return_value = pod_status
|
pod.__getitem__.return_value = pod_status
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
subnets = {subnet_id: network}
|
subnets = {subnet_id: network}
|
||||||
security_groups = [mock.sentinel.security_groups]
|
security_groups = [mock.sentinel.security_groups]
|
||||||
@ -165,7 +165,7 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
m_driver = mock.MagicMock(spec=cls)
|
m_driver = mock.MagicMock(spec=cls)
|
||||||
|
|
||||||
pod = get_pod_obj()
|
pod = get_pod_obj()
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
security_groups = [mock.sentinel.security_groups]
|
security_groups = [mock.sentinel.security_groups]
|
||||||
m_driver._get_host_addr.side_effect = KeyError
|
m_driver._get_host_addr.side_effect = KeyError
|
||||||
@ -185,7 +185,7 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
m_driver._drv_vif = vif_driver
|
m_driver._drv_vif = vif_driver
|
||||||
|
|
||||||
pod = mock.sentinel.pod
|
pod = mock.sentinel.pod
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
security_groups = [mock.sentinel.security_groups]
|
security_groups = [mock.sentinel.security_groups]
|
||||||
pool_key = (mock.sentinel.host_addr, project_id,
|
pool_key = (mock.sentinel.host_addr, project_id,
|
||||||
@ -216,7 +216,7 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
m_driver = mock.MagicMock(spec=cls)
|
m_driver = mock.MagicMock(spec=cls)
|
||||||
|
|
||||||
pod = mock.sentinel.pod
|
pod = mock.sentinel.pod
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
security_groups = [mock.sentinel.security_groups]
|
security_groups = [mock.sentinel.security_groups]
|
||||||
pool_key = (mock.sentinel.host_addr, project_id,
|
pool_key = (mock.sentinel.host_addr, project_id,
|
||||||
@ -242,7 +242,7 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
m_driver._drv_vif = vif_driver
|
m_driver._drv_vif = vif_driver
|
||||||
|
|
||||||
pod = mock.sentinel.pod
|
pod = mock.sentinel.pod
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
security_groups = [mock.sentinel.security_groups]
|
security_groups = [mock.sentinel.security_groups]
|
||||||
pool_key = (mock.sentinel.host_addr, project_id,
|
pool_key = (mock.sentinel.host_addr, project_id,
|
||||||
@ -270,7 +270,7 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
pod = get_pod_obj()
|
pod = get_pod_obj()
|
||||||
project_id = mock.sentinel.project_id
|
project_id = mock.sentinel.project_id
|
||||||
security_groups = [mock.sentinel.security_groups]
|
security_groups = [mock.sentinel.security_groups]
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
vif = osv_vif.VIFOpenVSwitch(id='0fa0e837-d34e-4580-a6c4-04f5f607d93e',
|
vif = osv_vif.VIFOpenVSwitch(id='0fa0e837-d34e-4580-a6c4-04f5f607d93e',
|
||||||
network=network)
|
network=network)
|
||||||
@ -287,7 +287,7 @@ class BaseVIFPool(test_base.TestCase):
|
|||||||
|
|
||||||
kubernetes = self.useFixture(k_fix.MockK8sClient()).client
|
kubernetes = self.useFixture(k_fix.MockK8sClient()).client
|
||||||
pod = get_pod_obj()
|
pod = get_pod_obj()
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pod_vif = osv_vif.VIFBase(id=port_id)
|
pod_vif = osv_vif.VIFBase(id=port_id)
|
||||||
pod_state = vif.PodState(default_vif=pod_vif)
|
pod_state = vif.PodState(default_vif=pod_vif)
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = mock.sentinel.pool_key
|
pool_key = mock.sentinel.pool_key
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = mock.sentinel.port
|
port = mock.sentinel.port
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = mock.sentinel.pool_key
|
pool_key = mock.sentinel.pool_key
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = mock.sentinel.port
|
port = mock.sentinel.port
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 5
|
pool_length = 5
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
@ -474,7 +474,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 5
|
pool_length = 5
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
@ -500,7 +500,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 10
|
pool_length = 10
|
||||||
vif = mock.sentinel.vif
|
vif = mock.sentinel.vif
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 5
|
pool_length = 5
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
@ -563,7 +563,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 10
|
pool_length = 10
|
||||||
vif = mock.sentinel.vif
|
vif = mock.sentinel.vif
|
||||||
|
|
||||||
@ -589,7 +589,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 10
|
pool_length = 10
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
@ -620,7 +620,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
m_driver._existing_vifs = {}
|
m_driver._existing_vifs = {}
|
||||||
m_driver._available_ports_pools = {}
|
m_driver._available_ports_pools = {}
|
||||||
|
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = get_port_obj(port_id=port_id)
|
port = get_port_obj(port_id=port_id)
|
||||||
filtered_ports = [port]
|
filtered_ports = [port]
|
||||||
m_driver._get_ports_by_attrs.return_value = filtered_ports
|
m_driver._get_ports_by_attrs.return_value = filtered_ports
|
||||||
@ -632,7 +632,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
group='kubernetes')
|
group='kubernetes')
|
||||||
|
|
||||||
subnet_id = port['fixed_ips'][0]['subnet_id']
|
subnet_id = port['fixed_ips'][0]['subnet_id']
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
subnet = {subnet_id: network}
|
subnet = {subnet_id: network}
|
||||||
m_get_subnet.return_value = network
|
m_get_subnet.return_value = network
|
||||||
@ -680,7 +680,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
|
|
||||||
net_id = mock.sentinel.net_id
|
net_id = mock.sentinel.net_id
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
m_driver._available_ports_pools = {pool_key: [port_id]}
|
m_driver._available_ports_pools = {pool_key: [port_id]}
|
||||||
m_driver._existing_vifs = {port_id: mock.sentinel.vif}
|
m_driver._existing_vifs = {port_id: mock.sentinel.vif}
|
||||||
|
|
||||||
@ -700,7 +700,7 @@ class NeutronVIFPool(test_base.TestCase):
|
|||||||
|
|
||||||
net_id = mock.sentinel.net_id
|
net_id = mock.sentinel.net_id
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
m_driver._available_ports_pools = {pool_key: [port_id]}
|
m_driver._available_ports_pools = {pool_key: [port_id]}
|
||||||
m_driver._existing_vifs = {}
|
m_driver._existing_vifs = {}
|
||||||
neutron.delete_port.side_effect = n_exc.PortNotFoundClient
|
neutron.delete_port.side_effect = n_exc.PortNotFoundClient
|
||||||
@ -760,7 +760,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = mock.sentinel.pool_key
|
pool_key = mock.sentinel.pool_key
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = mock.sentinel.port
|
port = mock.sentinel.port
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
|
|
||||||
@ -801,7 +801,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = mock.sentinel.pool_key
|
pool_key = mock.sentinel.pool_key
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = mock.sentinel.port
|
port = mock.sentinel.port
|
||||||
subnets = mock.sentinel.subnets
|
subnets = mock.sentinel.subnets
|
||||||
|
|
||||||
@ -856,7 +856,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 5
|
pool_length = 5
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
@ -890,7 +890,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 5
|
pool_length = 5
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
@ -919,11 +919,11 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
m_driver._drv_vif = vif_driver
|
m_driver._drv_vif = vif_driver
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 10
|
pool_length = 10
|
||||||
vif = mock.MagicMock()
|
vif = mock.MagicMock()
|
||||||
vif.vlan_id = mock.sentinel.vlan_id
|
vif.vlan_id = mock.sentinel.vlan_id
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
m_driver._available_ports_pools = {}
|
m_driver._available_ports_pools = {}
|
||||||
@ -952,7 +952,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 5
|
pool_length = 5
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
@ -989,11 +989,11 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
m_driver._drv_vif = vif_driver
|
m_driver._drv_vif = vif_driver
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 10
|
pool_length = 10
|
||||||
vif = mock.MagicMock()
|
vif = mock.MagicMock()
|
||||||
vif.vlan_id = mock.sentinel.vlan_id
|
vif.vlan_id = mock.sentinel.vlan_id
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
m_driver._available_ports_pools = {}
|
m_driver._available_ports_pools = {}
|
||||||
@ -1026,9 +1026,9 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
m_driver._drv_vif = vif_driver
|
m_driver._drv_vif = vif_driver
|
||||||
|
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
pool_length = 10
|
pool_length = 10
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
|
|
||||||
m_driver._recyclable_ports = {port_id: pool_key}
|
m_driver._recyclable_ports = {port_id: pool_key}
|
||||||
m_driver._available_ports_pools = {}
|
m_driver._available_ports_pools = {}
|
||||||
@ -1056,7 +1056,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
m_driver = mock.MagicMock(spec=cls)
|
m_driver = mock.MagicMock(spec=cls)
|
||||||
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
neutron = self.useFixture(k_fix.MockNeutronClient()).client
|
||||||
|
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
ip_address = mock.sentinel.ip_address
|
ip_address = mock.sentinel.ip_address
|
||||||
|
|
||||||
port_obj = get_port_obj(ip_address=ip_address)
|
port_obj = get_port_obj(ip_address=ip_address)
|
||||||
@ -1070,9 +1070,9 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
cls = vif_pool.NestedVIFPool
|
cls = vif_pool.NestedVIFPool
|
||||||
m_driver = mock.MagicMock(spec=cls)
|
m_driver = mock.MagicMock(spec=cls)
|
||||||
|
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
trunk_port = get_port_obj(port_id=port_id)
|
trunk_port = get_port_obj(port_id=port_id)
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
trunk_details = {
|
trunk_details = {
|
||||||
'trunk_id': trunk_id,
|
'trunk_id': trunk_id,
|
||||||
'sub_ports': [{
|
'sub_ports': [{
|
||||||
@ -1081,7 +1081,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
'segmentation_id': 4056}]}
|
'segmentation_id': 4056}]}
|
||||||
trunk_port['trunk_details'] = trunk_details
|
trunk_port['trunk_details'] = trunk_details
|
||||||
|
|
||||||
subport_id = uuidutils.generate_uuid()
|
subport_id = str(uuid.uuid4())
|
||||||
subport = get_port_obj(port_id=subport_id,
|
subport = get_port_obj(port_id=subport_id,
|
||||||
device_owner='trunk:subport')
|
device_owner='trunk:subport')
|
||||||
m_driver._get_ports_by_attrs.return_value = [trunk_port, subport]
|
m_driver._get_ports_by_attrs.return_value = [trunk_port, subport]
|
||||||
@ -1118,7 +1118,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
cls = vif_pool.NestedVIFPool
|
cls = vif_pool.NestedVIFPool
|
||||||
m_driver = mock.MagicMock(spec=cls)
|
m_driver = mock.MagicMock(spec=cls)
|
||||||
|
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = get_port_obj(port_id=port_id)
|
port = get_port_obj(port_id=port_id)
|
||||||
port = get_port_obj(port_id=port_id, device_owner='compute:nova')
|
port = get_port_obj(port_id=port_id, device_owner='compute:nova')
|
||||||
m_driver._get_ports_by_attrs.return_value = [port]
|
m_driver._get_ports_by_attrs.return_value = [port]
|
||||||
@ -1144,15 +1144,15 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
True,
|
True,
|
||||||
group='kubernetes')
|
group='kubernetes')
|
||||||
|
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
trunk_obj = self._get_trunk_obj(port_id=trunk_id, subport_id=port_id)
|
trunk_obj = self._get_trunk_obj(port_id=trunk_id, subport_id=port_id)
|
||||||
port = get_port_obj(port_id=port_id, device_owner='trunk:subport')
|
port = get_port_obj(port_id=port_id, device_owner='trunk:subport')
|
||||||
|
|
||||||
p_ports = self._get_parent_ports([trunk_obj])
|
p_ports = self._get_parent_ports([trunk_obj])
|
||||||
a_subports = {port_id: port}
|
a_subports = {port_id: port}
|
||||||
subnet_id = port['fixed_ips'][0]['subnet_id']
|
subnet_id = port['fixed_ips'][0]['subnet_id']
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
subnets = {subnet_id: {subnet_id: network}}
|
subnets = {subnet_id: {subnet_id: network}}
|
||||||
m_driver._get_trunks_info.return_value = (p_ports, a_subports,
|
m_driver._get_trunks_info.return_value = (p_ports, a_subports,
|
||||||
@ -1184,15 +1184,15 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
True,
|
True,
|
||||||
group='kubernetes')
|
group='kubernetes')
|
||||||
|
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
trunk_obj = self._get_trunk_obj(port_id=trunk_id, subport_id=port_id)
|
trunk_obj = self._get_trunk_obj(port_id=trunk_id, subport_id=port_id)
|
||||||
port = get_port_obj(port_id=port_id, device_owner='trunk:subport')
|
port = get_port_obj(port_id=port_id, device_owner='trunk:subport')
|
||||||
|
|
||||||
p_ports = self._get_parent_ports([trunk_obj])
|
p_ports = self._get_parent_ports([trunk_obj])
|
||||||
a_subports = {port_id: port}
|
a_subports = {port_id: port}
|
||||||
subnet_id = port['fixed_ips'][0]['subnet_id']
|
subnet_id = port['fixed_ips'][0]['subnet_id']
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
subnets = {subnet_id: {subnet_id: network}}
|
subnets = {subnet_id: {subnet_id: network}}
|
||||||
m_driver._get_trunks_info.return_value = (p_ports, a_subports,
|
m_driver._get_trunks_info.return_value = (p_ports, a_subports,
|
||||||
@ -1228,17 +1228,17 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
True,
|
True,
|
||||||
group='kubernetes')
|
group='kubernetes')
|
||||||
|
|
||||||
port_id1 = uuidutils.generate_uuid()
|
port_id1 = str(uuid.uuid4())
|
||||||
trunk_id1 = uuidutils.generate_uuid()
|
trunk_id1 = str(uuid.uuid4())
|
||||||
|
|
||||||
port_id2 = uuidutils.generate_uuid()
|
port_id2 = str(uuid.uuid4())
|
||||||
trunk_id2 = uuidutils.generate_uuid()
|
trunk_id2 = str(uuid.uuid4())
|
||||||
|
|
||||||
trunk_obj1 = self._get_trunk_obj(port_id=trunk_id1,
|
trunk_obj1 = self._get_trunk_obj(port_id=trunk_id1,
|
||||||
subport_id=port_id1)
|
subport_id=port_id1)
|
||||||
trunk_obj2 = self._get_trunk_obj(port_id=trunk_id2,
|
trunk_obj2 = self._get_trunk_obj(port_id=trunk_id2,
|
||||||
subport_id=port_id2,
|
subport_id=port_id2,
|
||||||
trunk_id=uuidutils.generate_uuid())
|
trunk_id=str(uuid.uuid4()))
|
||||||
|
|
||||||
port1 = get_port_obj(port_id=port_id1, device_owner='trunk:subport')
|
port1 = get_port_obj(port_id=port_id1, device_owner='trunk:subport')
|
||||||
port2 = get_port_obj(port_id=port_id2, device_owner='trunk:subport')
|
port2 = get_port_obj(port_id=port_id2, device_owner='trunk:subport')
|
||||||
@ -1246,7 +1246,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
p_ports = self._get_parent_ports([trunk_obj1, trunk_obj2])
|
p_ports = self._get_parent_ports([trunk_obj1, trunk_obj2])
|
||||||
a_subports = {port_id1: port1, port_id2: port2}
|
a_subports = {port_id1: port1, port_id2: port2}
|
||||||
subnet_id = port1['fixed_ips'][0]['subnet_id']
|
subnet_id = port1['fixed_ips'][0]['subnet_id']
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
subnets = {subnet_id: {subnet_id: network}}
|
subnets = {subnet_id: {subnet_id: network}}
|
||||||
|
|
||||||
@ -1276,9 +1276,9 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
True,
|
True,
|
||||||
group='kubernetes')
|
group='kubernetes')
|
||||||
|
|
||||||
port_id1 = uuidutils.generate_uuid()
|
port_id1 = str(uuid.uuid4())
|
||||||
port_id2 = uuidutils.generate_uuid()
|
port_id2 = str(uuid.uuid4())
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
trunk_obj = self._get_trunk_obj(port_id=trunk_id,
|
trunk_obj = self._get_trunk_obj(port_id=trunk_id,
|
||||||
subport_id=port_id1)
|
subport_id=port_id1)
|
||||||
trunk_obj['sub_ports'].append({'port_id': port_id2,
|
trunk_obj['sub_ports'].append({'port_id': port_id2,
|
||||||
@ -1290,7 +1290,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
p_ports = self._get_parent_ports([trunk_obj])
|
p_ports = self._get_parent_ports([trunk_obj])
|
||||||
a_subports = {port_id1: port1, port_id2: port2}
|
a_subports = {port_id1: port1, port_id2: port2}
|
||||||
subnet_id = port1['fixed_ips'][0]['subnet_id']
|
subnet_id = port1['fixed_ips'][0]['subnet_id']
|
||||||
net_id = uuidutils.generate_uuid()
|
net_id = str(uuid.uuid4())
|
||||||
network = ovu.neutron_to_osvif_network({'id': net_id})
|
network = ovu.neutron_to_osvif_network({'id': net_id})
|
||||||
subnets = {subnet_id: {subnet_id: network}}
|
subnets = {subnet_id: {subnet_id: network}}
|
||||||
|
|
||||||
@ -1353,7 +1353,7 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
True,
|
True,
|
||||||
group='kubernetes')
|
group='kubernetes')
|
||||||
|
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = get_port_obj(port_id=port_id, device_owner='trunk:subport')
|
port = get_port_obj(port_id=port_id, device_owner='trunk:subport')
|
||||||
|
|
||||||
p_ports = {}
|
p_ports = {}
|
||||||
@ -1381,8 +1381,8 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
|
|
||||||
net_id = mock.sentinel.net_id
|
net_id = mock.sentinel.net_id
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
vif = mock.MagicMock()
|
vif = mock.MagicMock()
|
||||||
vlan_id = mock.sentinel.vlan_id
|
vlan_id = mock.sentinel.vlan_id
|
||||||
vif.vlan_id = vlan_id
|
vif.vlan_id = vlan_id
|
||||||
@ -1414,8 +1414,8 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
|
|
||||||
net_id = mock.sentinel.net_id
|
net_id = mock.sentinel.net_id
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
vif = mock.MagicMock()
|
vif = mock.MagicMock()
|
||||||
vlan_id = mock.sentinel.vlan_id
|
vlan_id = mock.sentinel.vlan_id
|
||||||
vif.vlan_id = vlan_id
|
vif.vlan_id = vlan_id
|
||||||
@ -1449,8 +1449,8 @@ class NestedVIFPool(test_base.TestCase):
|
|||||||
|
|
||||||
net_id = mock.sentinel.net_id
|
net_id = mock.sentinel.net_id
|
||||||
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
pool_key = ('node_ip', 'project_id', tuple(['security_group']))
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
trunk_id = uuidutils.generate_uuid()
|
trunk_id = str(uuid.uuid4())
|
||||||
vif = mock.MagicMock()
|
vif = mock.MagicMock()
|
||||||
vlan_id = mock.sentinel.vlan_id
|
vlan_id = mock.sentinel.vlan_id
|
||||||
vif.vlan_id = vlan_id
|
vif.vlan_id = vlan_id
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo_utils import uuidutils
|
import uuid
|
||||||
|
|
||||||
from kuryr_kubernetes.controller.handlers import ingress_lbaas as h_ing_lbaas
|
from kuryr_kubernetes.controller.handlers import ingress_lbaas as h_ing_lbaas
|
||||||
from kuryr_kubernetes.objects import lbaas as obj_lbaas
|
from kuryr_kubernetes.objects import lbaas as obj_lbaas
|
||||||
@ -129,8 +129,8 @@ class TestIngressLoadBalancerHandler(t_lbaas.TestLoadBalancerHandler):
|
|||||||
'.LBaaSDriver.get_instance')
|
'.LBaaSDriver.get_instance')
|
||||||
def test__sync_lbaas_route_members(self, m_get_drv_lbaas,
|
def test__sync_lbaas_route_members(self, m_get_drv_lbaas,
|
||||||
m_get_drv_project, m_get_drv_subnets):
|
m_get_drv_project, m_get_drv_subnets):
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
current_ip = '1.1.1.1'
|
current_ip = '1.1.1.1'
|
||||||
current_targets = {
|
current_targets = {
|
||||||
'1.1.1.101': (1001, 1001),
|
'1.1.1.101': (1001, 1001),
|
||||||
@ -164,8 +164,8 @@ class TestIngressLoadBalancerHandler(t_lbaas.TestLoadBalancerHandler):
|
|||||||
|
|
||||||
def test_on_deleted(self):
|
def test_on_deleted(self):
|
||||||
endpoints = mock.sentinel.endpoints
|
endpoints = mock.sentinel.endpoints
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
|
|
||||||
m_handler = mock.Mock(spec=h_ing_lbaas.IngressLoadBalancerHandler)
|
m_handler = mock.Mock(spec=h_ing_lbaas.IngressLoadBalancerHandler)
|
||||||
m_handler._l7_router = t_lbaas.FakeLBaaSDriver().ensure_loadbalancer(
|
m_handler._l7_router = t_lbaas.FakeLBaaSDriver().ensure_loadbalancer(
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import mock
|
import mock
|
||||||
|
import uuid
|
||||||
|
|
||||||
import os_vif.objects.network as osv_network
|
import os_vif.objects.network as osv_network
|
||||||
import os_vif.objects.subnet as osv_subnet
|
import os_vif.objects.subnet as osv_subnet
|
||||||
from oslo_utils import uuidutils
|
|
||||||
|
|
||||||
from kuryr_kubernetes import constants as k_const
|
from kuryr_kubernetes import constants as k_const
|
||||||
from kuryr_kubernetes.controller.drivers import base as drv_base
|
from kuryr_kubernetes.controller.drivers import base as drv_base
|
||||||
@ -356,7 +357,7 @@ class FakeLBaaSDriver(drv_base.LBaaSDriver):
|
|||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
subnet_id=subnet_id,
|
subnet_id=subnet_id,
|
||||||
ip=ip,
|
ip=ip,
|
||||||
id=uuidutils.generate_uuid())
|
id=str(uuid.uuid4()))
|
||||||
|
|
||||||
def ensure_listener(self, loadbalancer, protocol, port,
|
def ensure_listener(self, loadbalancer, protocol, port,
|
||||||
service_type='ClusterIP'):
|
service_type='ClusterIP'):
|
||||||
@ -369,7 +370,7 @@ class FakeLBaaSDriver(drv_base.LBaaSDriver):
|
|||||||
loadbalancer_id=loadbalancer.id,
|
loadbalancer_id=loadbalancer.id,
|
||||||
protocol=protocol,
|
protocol=protocol,
|
||||||
port=port,
|
port=port,
|
||||||
id=uuidutils.generate_uuid())
|
id=str(uuid.uuid4()))
|
||||||
|
|
||||||
def ensure_pool(self, loadbalancer, listener):
|
def ensure_pool(self, loadbalancer, listener):
|
||||||
return obj_lbaas.LBaaSPool(name=listener.name,
|
return obj_lbaas.LBaaSPool(name=listener.name,
|
||||||
@ -377,7 +378,7 @@ class FakeLBaaSDriver(drv_base.LBaaSDriver):
|
|||||||
loadbalancer_id=loadbalancer.id,
|
loadbalancer_id=loadbalancer.id,
|
||||||
listener_id=listener.id,
|
listener_id=listener.id,
|
||||||
protocol=listener.protocol,
|
protocol=listener.protocol,
|
||||||
id=uuidutils.generate_uuid())
|
id=str(uuid.uuid4()))
|
||||||
|
|
||||||
def ensure_member(self, loadbalancer, pool, subnet_id, ip, port,
|
def ensure_member(self, loadbalancer, pool, subnet_id, ip, port,
|
||||||
target_ref_namespace, target_ref_name
|
target_ref_namespace, target_ref_name
|
||||||
@ -389,7 +390,7 @@ class FakeLBaaSDriver(drv_base.LBaaSDriver):
|
|||||||
subnet_id=subnet_id,
|
subnet_id=subnet_id,
|
||||||
ip=ip,
|
ip=ip,
|
||||||
port=port,
|
port=port,
|
||||||
id=uuidutils.generate_uuid())
|
id=str(uuid.uuid4()))
|
||||||
|
|
||||||
def release_loadbalancer(self, loadbalancer):
|
def release_loadbalancer(self, loadbalancer):
|
||||||
pass
|
pass
|
||||||
@ -429,7 +430,7 @@ class FakeLBaaSDriver(drv_base.LBaaSDriver):
|
|||||||
|
|
||||||
def ensure_pool_attached_to_lb(self, loadbalancer, namespace,
|
def ensure_pool_attached_to_lb(self, loadbalancer, namespace,
|
||||||
svc_name, protocol):
|
svc_name, protocol):
|
||||||
return obj_lbaas.LBaaSPool(id=uuidutils.generate_uuid(),
|
return obj_lbaas.LBaaSPool(id=str(uuid.uuid4()),
|
||||||
loadbalancer_id=loadbalancer.id,
|
loadbalancer_id=loadbalancer.id,
|
||||||
project_id=loadbalancer.project_id,
|
project_id=loadbalancer.project_id,
|
||||||
protocol=protocol)
|
protocol=protocol)
|
||||||
@ -758,8 +759,8 @@ class TestLoadBalancerHandler(test_base.TestCase):
|
|||||||
def test_sync_lbaas_members(self, m_get_drv_lbaas, m_get_drv_project,
|
def test_sync_lbaas_members(self, m_get_drv_lbaas, m_get_drv_project,
|
||||||
m_get_drv_subnets):
|
m_get_drv_subnets):
|
||||||
# REVISIT(ivc): test methods separately and verify ensure/release
|
# REVISIT(ivc): test methods separately and verify ensure/release
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
current_ip = '1.1.1.1'
|
current_ip = '1.1.1.1'
|
||||||
current_targets = {
|
current_targets = {
|
||||||
'1.1.1.101': (1001, 10001),
|
'1.1.1.101': (1001, 10001),
|
||||||
@ -792,8 +793,8 @@ class TestLoadBalancerHandler(test_base.TestCase):
|
|||||||
def test_sync_lbaas_members_udp(self, m_get_drv_lbaas,
|
def test_sync_lbaas_members_udp(self, m_get_drv_lbaas,
|
||||||
m_get_drv_project, m_get_drv_subnets):
|
m_get_drv_project, m_get_drv_subnets):
|
||||||
# REVISIT(ivc): test methods separately and verify ensure/release
|
# REVISIT(ivc): test methods separately and verify ensure/release
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
current_ip = '1.1.1.1'
|
current_ip = '1.1.1.1'
|
||||||
current_targets = {
|
current_targets = {
|
||||||
'1.1.1.101': (1001, 10001),
|
'1.1.1.101': (1001, 10001),
|
||||||
@ -826,8 +827,8 @@ class TestLoadBalancerHandler(test_base.TestCase):
|
|||||||
def test_sync_lbaas_members_svc_listener_port_edit(
|
def test_sync_lbaas_members_svc_listener_port_edit(
|
||||||
self, m_get_drv_lbaas, m_get_drv_project, m_get_drv_subnets):
|
self, m_get_drv_lbaas, m_get_drv_project, m_get_drv_subnets):
|
||||||
# REVISIT(ivc): test methods separately and verify ensure/release
|
# REVISIT(ivc): test methods separately and verify ensure/release
|
||||||
project_id = uuidutils.generate_uuid()
|
project_id = str(uuid.uuid4())
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
current_ip = '1.1.1.1'
|
current_ip = '1.1.1.1'
|
||||||
current_targets = {
|
current_targets = {
|
||||||
'1.1.1.101': (1001, 10001)}
|
'1.1.1.101': (1001, 10001)}
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import uuid
|
||||||
|
|
||||||
from os_vif.objects import fixed_ip as osv_fixed_ip
|
from os_vif.objects import fixed_ip as osv_fixed_ip
|
||||||
from os_vif.objects import network as osv_network
|
from os_vif.objects import network as osv_network
|
||||||
from os_vif.objects import route as osv_route
|
from os_vif.objects import route as osv_route
|
||||||
from os_vif.objects import subnet as osv_subnet
|
from os_vif.objects import subnet as osv_subnet
|
||||||
from oslo_config import cfg as o_cfg
|
from oslo_config import cfg as o_cfg
|
||||||
from oslo_utils import uuidutils
|
|
||||||
|
|
||||||
from kuryr_kubernetes import constants as const
|
from kuryr_kubernetes import constants as const
|
||||||
from kuryr_kubernetes import exceptions as k_exc
|
from kuryr_kubernetes import exceptions as k_exc
|
||||||
@ -33,7 +33,7 @@ from kuryr_kubernetes.tests import base as test_base
|
|||||||
|
|
||||||
class TestOSVIFUtils(test_base.TestCase):
|
class TestOSVIFUtils(test_base.TestCase):
|
||||||
def test_neutron_to_osvif_network(self):
|
def test_neutron_to_osvif_network(self):
|
||||||
network_id = uuidutils.generate_uuid()
|
network_id = str(uuid.uuid4())
|
||||||
network_name = 'test-net'
|
network_name = 'test-net'
|
||||||
network_mtu = 1500
|
network_mtu = 1500
|
||||||
neutron_network = {
|
neutron_network = {
|
||||||
@ -49,7 +49,7 @@ class TestOSVIFUtils(test_base.TestCase):
|
|||||||
self.assertEqual(network_mtu, network.mtu)
|
self.assertEqual(network_mtu, network.mtu)
|
||||||
|
|
||||||
def test_neutron_to_osvif_network_no_name(self):
|
def test_neutron_to_osvif_network_no_name(self):
|
||||||
network_id = uuidutils.generate_uuid()
|
network_id = str(uuid.uuid4())
|
||||||
network_mtu = 1500
|
network_mtu = 1500
|
||||||
neutron_network = {
|
neutron_network = {
|
||||||
'id': network_id,
|
'id': network_id,
|
||||||
@ -61,7 +61,7 @@ class TestOSVIFUtils(test_base.TestCase):
|
|||||||
self.assertFalse(network.obj_attr_is_set('label'))
|
self.assertFalse(network.obj_attr_is_set('label'))
|
||||||
|
|
||||||
def test_neutron_to_osvif_network_no_mtu(self):
|
def test_neutron_to_osvif_network_no_mtu(self):
|
||||||
network_id = uuidutils.generate_uuid()
|
network_id = str(uuid.uuid4())
|
||||||
network_name = 'test-net'
|
network_name = 'test-net'
|
||||||
neutron_network = {
|
neutron_network = {
|
||||||
'id': network_id,
|
'id': network_id,
|
||||||
@ -350,7 +350,7 @@ class TestOSVIFUtils(test_base.TestCase):
|
|||||||
|
|
||||||
def test_neutron_to_osvif_vif_ovs_no_bridge(self):
|
def test_neutron_to_osvif_vif_ovs_no_bridge(self):
|
||||||
vif_plugin = 'ovs'
|
vif_plugin = 'ovs'
|
||||||
port = {'id': uuidutils.generate_uuid()}
|
port = {'id': str(uuid.uuid4())}
|
||||||
subnets = {}
|
subnets = {}
|
||||||
|
|
||||||
self.assertRaises(o_cfg.RequiredOptError,
|
self.assertRaises(o_cfg.RequiredOptError,
|
||||||
@ -358,7 +358,7 @@ class TestOSVIFUtils(test_base.TestCase):
|
|||||||
vif_plugin, port, subnets)
|
vif_plugin, port, subnets)
|
||||||
|
|
||||||
def test_get_ovs_hybrid_bridge_name(self):
|
def test_get_ovs_hybrid_bridge_name(self):
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = str(uuid.uuid4())
|
||||||
port = {'id': port_id}
|
port = {'id': port_id}
|
||||||
|
|
||||||
self.assertEqual("qbr" + port_id[:11],
|
self.assertEqual("qbr" + port_id[:11],
|
||||||
@ -488,9 +488,9 @@ class TestOSVIFUtils(test_base.TestCase):
|
|||||||
ip11 = '1.1.1.1'
|
ip11 = '1.1.1.1'
|
||||||
ip12 = '2.2.2.2'
|
ip12 = '2.2.2.2'
|
||||||
ip3 = '3.3.3.3'
|
ip3 = '3.3.3.3'
|
||||||
subnet_id_1 = uuidutils.generate_uuid()
|
subnet_id_1 = str(uuid.uuid4())
|
||||||
subnet_id_2 = uuidutils.generate_uuid()
|
subnet_id_2 = str(uuid.uuid4())
|
||||||
subnet_id_3 = uuidutils.generate_uuid()
|
subnet_id_3 = str(uuid.uuid4())
|
||||||
|
|
||||||
subnet_1 = osv_subnet.Subnet(ips=osv_fixed_ip.FixedIPList(
|
subnet_1 = osv_subnet.Subnet(ips=osv_fixed_ip.FixedIPList(
|
||||||
objects=[osv_fixed_ip.FixedIP(address=ip11),
|
objects=[osv_fixed_ip.FixedIP(address=ip11),
|
||||||
@ -522,7 +522,7 @@ class TestOSVIFUtils(test_base.TestCase):
|
|||||||
sorted(ret, key=_sort_key))
|
sorted(ret, key=_sort_key))
|
||||||
|
|
||||||
def test_osvif_to_neutron_fixed_ips_invalid(self):
|
def test_osvif_to_neutron_fixed_ips_invalid(self):
|
||||||
subnet_id = uuidutils.generate_uuid()
|
subnet_id = str(uuid.uuid4())
|
||||||
|
|
||||||
subnet_1 = osv_subnet.Subnet()
|
subnet_1 = osv_subnet.Subnet()
|
||||||
subnet_2 = osv_subnet.Subnet()
|
subnet_2 = osv_subnet.Subnet()
|
||||||
|
Loading…
Reference in New Issue
Block a user