Fix network no-op driver get_network_configs
The network no-op driver was not returning the required data for a get_network_configs call which causes load balancer failover tests to fail when using the no-op driver. Change-Id: I52b5651a7b33aae42760b850f913b6b591367207
This commit is contained in:
parent
a6896f2633
commit
d1e9c56128
@ -187,6 +187,22 @@ class NoopManager(object):
|
||||
self.networkconfigconfig[(loadbalancer.id)] = (
|
||||
loadbalancer, 'get_network_configs')
|
||||
|
||||
amp_configs = {}
|
||||
for amp in loadbalancer.amphorae:
|
||||
vrrp_port = self.get_port(amp.vrrp_port_id)
|
||||
ha_port = self.get_port(amp.ha_port_id)
|
||||
amp_configs[amp.id] = network_models.AmphoraNetworkConfig(
|
||||
amphora=amp,
|
||||
vip_subnet=self.get_subnet(loadbalancer.vip.subnet_id),
|
||||
vip_port=self.get_port(loadbalancer.vip.port_id),
|
||||
vrrp_subnet=self.get_subnet(
|
||||
vrrp_port.get_subnet_id(amp.vrrp_ip)),
|
||||
vrrp_port=vrrp_port,
|
||||
ha_subnet=self.get_subnet(
|
||||
ha_port.get_subnet_id(amp.ha_ip)),
|
||||
ha_port=ha_port)
|
||||
return amp_configs
|
||||
|
||||
def wait_for_port_detach(self, amphora):
|
||||
LOG.debug("failover %s no-op, wait_for_port_detach, amphora id %s",
|
||||
self.__class__.__name__, amphora.id)
|
||||
|
@ -44,6 +44,8 @@ class TestNoopNetworkDriver(base.TestCase):
|
||||
|
||||
self.vip = models.Vip()
|
||||
self.vip.ip_address = "10.0.0.1"
|
||||
self.vip.subnet_id = uuidutils.generate_uuid()
|
||||
self.vip.port_id = uuidutils.generate_uuid()
|
||||
self.amphora_id = self.FAKE_UUID_1
|
||||
self.compute_id = self.FAKE_UUID_2
|
||||
self.subnet_id = self.FAKE_UUID_3
|
||||
@ -51,6 +53,21 @@ class TestNoopNetworkDriver(base.TestCase):
|
||||
self.qos_policy_id = self.FAKE_UUID_5
|
||||
self.vrrp_port_id = self.FAKE_UUID_6
|
||||
|
||||
self.amphora1 = models.Amphora()
|
||||
self.amphora1.id = uuidutils.generate_uuid()
|
||||
self.amphora1.vrrp_port_id = uuidutils.generate_uuid()
|
||||
self.amphora1.ha_port_id = uuidutils.generate_uuid()
|
||||
self.amphora1.vrrp_ip = '10.0.1.10'
|
||||
self.amphora1.ha_ip = '10.0.1.11'
|
||||
self.amphora2 = models.Amphora()
|
||||
self.amphora2.id = uuidutils.generate_uuid()
|
||||
self.amphora2.vrrp_port_id = uuidutils.generate_uuid()
|
||||
self.amphora2.ha_port_id = uuidutils.generate_uuid()
|
||||
self.amphora2.vrrp_ip = '10.0.2.10'
|
||||
self.amphora2.ha_ip = '10.0.2.11'
|
||||
self.load_balancer.amphorae = [self.amphora1, self.amphora2]
|
||||
self.load_balancer.vip = self.vip
|
||||
|
||||
def test_allocate_vip(self):
|
||||
self.driver.allocate_vip(self.load_balancer)
|
||||
self.assertEqual(
|
||||
@ -169,11 +186,14 @@ class TestNoopNetworkDriver(base.TestCase):
|
||||
)
|
||||
|
||||
def test_get_network_configs(self):
|
||||
self.driver.get_network_configs(self.load_balancer)
|
||||
amp_config = self.driver.get_network_configs(self.load_balancer)
|
||||
self.assertEqual(
|
||||
(self.load_balancer, 'get_network_configs'),
|
||||
self.driver.driver.networkconfigconfig[self.load_balancer.id]
|
||||
)
|
||||
self.assertEqual(2, len(amp_config))
|
||||
self.assertEqual(self.amphora1, amp_config[self.amphora1.id].amphora)
|
||||
self.assertEqual(self.amphora2, amp_config[self.amphora2.id].amphora)
|
||||
|
||||
def test_get_qos_policy(self):
|
||||
self.driver.get_qos_policy(self.qos_policy_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user