Cleanup noop network driver to fix py3x
Change-Id: I52258116122ff64373ef709d3d43d1ee9563e2a5
This commit is contained in:
parent
e8c6f4e90f
commit
c26697898c
@ -27,15 +27,15 @@ class NoopManager(object):
|
||||
super(NoopManager, self).__init__()
|
||||
self.networkconfigconfig = {}
|
||||
|
||||
def allocate_vip(self, load_balancer):
|
||||
LOG.debug("Network %s no-op, allocate_vip load_balancer %s",
|
||||
self.__class__.__name__, load_balancer)
|
||||
self.networkconfigconfig[load_balancer] = (
|
||||
load_balancer, 'allocate_vip')
|
||||
def allocate_vip(self, loadbalancer):
|
||||
LOG.debug("Network %s no-op, allocate_vip loadbalancer %s",
|
||||
self.__class__.__name__, loadbalancer)
|
||||
self.networkconfigconfig[loadbalancer.id] = (
|
||||
loadbalancer, 'allocate_vip')
|
||||
return data_models.Vip(ip_address='198.51.100.1',
|
||||
subnet_id=uuidutils.generate_uuid(),
|
||||
port_id=uuidutils.generate_uuid(),
|
||||
load_balancer_id=load_balancer.id)
|
||||
load_balancer_id=loadbalancer.id)
|
||||
|
||||
def deallocate_vip(self, vip):
|
||||
LOG.debug("Network %s no-op, deallocate_vip vip %s",
|
||||
@ -43,15 +43,15 @@ class NoopManager(object):
|
||||
self.networkconfigconfig[vip.ip_address] = (vip,
|
||||
'deallocate_vip')
|
||||
|
||||
def plug_vip(self, load_balancer, vip):
|
||||
LOG.debug("Network %s no-op, plug_vip load_balancer %s, vip %s",
|
||||
def plug_vip(self, loadbalancer, vip):
|
||||
LOG.debug("Network %s no-op, plug_vip loadbalancer %s, vip %s",
|
||||
self.__class__.__name__,
|
||||
load_balancer.id, vip.ip_address)
|
||||
self.networkconfigconfig[(load_balancer.id,
|
||||
vip.ip_address)] = (load_balancer, vip,
|
||||
loadbalancer.id, vip.ip_address)
|
||||
self.networkconfigconfig[(loadbalancer.id,
|
||||
vip.ip_address)] = (loadbalancer, vip,
|
||||
'plug_vip')
|
||||
amps = []
|
||||
for amphora in load_balancer.amphorae:
|
||||
for amphora in loadbalancer.amphorae:
|
||||
amps.append(data_models.Amphora(
|
||||
id=amphora.id,
|
||||
compute_id=amphora.compute_id,
|
||||
@ -62,12 +62,12 @@ class NoopManager(object):
|
||||
))
|
||||
return amps
|
||||
|
||||
def unplug_vip(self, load_balancer, vip):
|
||||
LOG.debug("Network %s no-op, unplug_vip load_balancer %s, vip %s",
|
||||
def unplug_vip(self, loadbalancer, vip):
|
||||
LOG.debug("Network %s no-op, unplug_vip loadbalancer %s, vip %s",
|
||||
self.__class__.__name__,
|
||||
load_balancer.id, vip.ip_address)
|
||||
self.networkconfigconfig[(load_balancer.id,
|
||||
vip.ip_address)] = (load_balancer, vip,
|
||||
loadbalancer.id, vip.ip_address)
|
||||
self.networkconfigconfig[(loadbalancer.id,
|
||||
vip.ip_address)] = (loadbalancer, vip,
|
||||
'unplug_vip')
|
||||
|
||||
def plug_network(self, compute_id, network_id, ip_address=None):
|
||||
@ -98,10 +98,11 @@ class NoopManager(object):
|
||||
compute_id, 'get_plugged_networks')
|
||||
return []
|
||||
|
||||
def update_vip(self, load_balancer):
|
||||
LOG.debug("Network %s no-op, update_vip load_balancer %s",
|
||||
self.__class__.__name__, load_balancer)
|
||||
self.networkconfigconfig[load_balancer] = (load_balancer, 'update_vip')
|
||||
def update_vip(self, loadbalancer):
|
||||
LOG.debug("Network %s no-op, update_vip loadbalancer %s",
|
||||
self.__class__.__name__, loadbalancer)
|
||||
self.networkconfigconfig[loadbalancer.id] = (
|
||||
loadbalancer, 'update_vip')
|
||||
|
||||
def get_network(self, network_id):
|
||||
LOG.debug("Network %s no-op, get_network network_id %s",
|
||||
@ -162,7 +163,7 @@ class NoopManager(object):
|
||||
def get_network_configs(self, loadbalancer):
|
||||
LOG.debug("Network %s no-op, get_network_configs loadbalancer id %s ",
|
||||
self.__class__.__name__, loadbalancer.id)
|
||||
self.networkconfigconfig[(loadbalancer)] = (
|
||||
self.networkconfigconfig[(loadbalancer.id)] = (
|
||||
loadbalancer, 'get_network_configs')
|
||||
|
||||
def wait_for_port_detach(self, amphora):
|
||||
@ -175,17 +176,17 @@ class NoopNetworkDriver(driver_base.AbstractNetworkDriver):
|
||||
super(NoopNetworkDriver, self).__init__()
|
||||
self.driver = NoopManager()
|
||||
|
||||
def allocate_vip(self, load_balancer):
|
||||
return self.driver.allocate_vip(load_balancer)
|
||||
def allocate_vip(self, loadbalancer):
|
||||
return self.driver.allocate_vip(loadbalancer)
|
||||
|
||||
def deallocate_vip(self, vip):
|
||||
self.driver.deallocate_vip(vip)
|
||||
|
||||
def plug_vip(self, load_balancer, vip):
|
||||
return self.driver.plug_vip(load_balancer, vip)
|
||||
def plug_vip(self, loadbalancer, vip):
|
||||
return self.driver.plug_vip(loadbalancer, vip)
|
||||
|
||||
def unplug_vip(self, load_balancer, vip):
|
||||
self.driver.unplug_vip(load_balancer, vip)
|
||||
def unplug_vip(self, loadbalancer, vip):
|
||||
self.driver.unplug_vip(loadbalancer, vip)
|
||||
|
||||
def plug_network(self, amphora_id, network_id, ip_address=None):
|
||||
return self.driver.plug_network(amphora_id, network_id, ip_address)
|
||||
@ -197,8 +198,8 @@ class NoopNetworkDriver(driver_base.AbstractNetworkDriver):
|
||||
def get_plugged_networks(self, amphora_id):
|
||||
return self.driver.get_plugged_networks(amphora_id)
|
||||
|
||||
def update_vip(self, load_balancer):
|
||||
self.driver.update_vip(load_balancer)
|
||||
def update_vip(self, loadbalancer):
|
||||
self.driver.update_vip(loadbalancer)
|
||||
|
||||
def get_network(self, network_id):
|
||||
return self.driver.get_network(network_id)
|
||||
|
@ -51,7 +51,7 @@ class TestNoopNetworkDriver(base.TestCase):
|
||||
self.driver.allocate_vip(self.load_balancer)
|
||||
self.assertEqual(
|
||||
(self.load_balancer, 'allocate_vip'),
|
||||
self.driver.driver.networkconfigconfig[self.load_balancer])
|
||||
self.driver.driver.networkconfigconfig[self.load_balancer.id])
|
||||
|
||||
def test_deallocate_vip(self):
|
||||
self.driver.deallocate_vip(self.vip)
|
||||
@ -102,7 +102,7 @@ class TestNoopNetworkDriver(base.TestCase):
|
||||
self.driver.update_vip(self.load_balancer)
|
||||
self.assertEqual((self.load_balancer, 'update_vip'),
|
||||
self.driver.driver.networkconfigconfig[(
|
||||
self.load_balancer
|
||||
self.load_balancer.id
|
||||
)])
|
||||
|
||||
def test_get_network(self):
|
||||
@ -168,5 +168,5 @@ class TestNoopNetworkDriver(base.TestCase):
|
||||
self.driver.get_network_configs(self.load_balancer)
|
||||
self.assertEqual(
|
||||
(self.load_balancer, 'get_network_configs'),
|
||||
self.driver.driver.networkconfigconfig[self.load_balancer]
|
||||
self.driver.driver.networkconfigconfig[self.load_balancer.id]
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user