Merge "Fix the amphora noop driver"

This commit is contained in:
Zuul 2019-02-05 21:44:29 +00:00 committed by Gerrit Code Review
commit ddcae3e229
3 changed files with 13 additions and 10 deletions

View File

@ -73,7 +73,7 @@ class AmphoraLoadBalancerDriver(object):
pass
@abc.abstractmethod
def start(self, listener, vip):
def start(self, listener, vip, amphora):
"""Start the listener on the vip.
:param listener: listener object,
@ -81,6 +81,8 @@ class AmphoraLoadBalancerDriver(object):
:type listener: object
:param vip: vip object, need to use its ip_address property
:type vip: object
:param amphora: Amphora to start. If None, start on all amphora
:type amphora: object
:returns: return a value list (listener, vip, status flag--enable)
At this moment, we just build the basic structure for testing, will

View File

@ -61,12 +61,13 @@ class NoopManager(object):
self.amphoraconfig[(listener.protocol_port,
vip.ip_address)] = (listener, vip, 'stop')
def start(self, listener, vip):
LOG.debug("Amphora %s no-op, start listener %s, vip %s",
def start(self, listener, vip, amphora=None):
LOG.debug("Amphora %s no-op, start listener %s, vip %s, amp %s",
self.__class__.__name__,
listener.protocol_port, vip.ip_address)
listener.protocol_port, vip.ip_address, amphora)
self.amphoraconfig[(listener.protocol_port,
vip.ip_address)] = (listener, vip, 'start')
vip.ip_address, amphora)] = (listener, vip,
amphora, 'start')
def delete(self, listener, vip):
LOG.debug("Amphora %s no-op, delete listener %s, vip %s",
@ -130,9 +131,9 @@ class NoopAmphoraLoadBalancerDriver(
self.driver.stop(listener, vip)
def start(self, listener, vip):
def start(self, listener, vip, amphora=None):
self.driver.start(listener, vip)
self.driver.start(listener, vip, amphora)
def delete(self, listener, vip):

View File

@ -93,11 +93,11 @@ class TestNoopAmphoraLoadBalancerDriver(base.TestCase):
self.vip.ip_address)])
def test_start(self):
self.driver.start(self.listener, self.vip)
self.assertEqual((self.listener, self.vip, 'start'),
self.driver.start(self.listener, self.vip, amphora='amp1')
self.assertEqual((self.listener, self.vip, 'amp1', 'start'),
self.driver.driver.amphoraconfig[(
self.listener.protocol_port,
self.vip.ip_address)])
self.vip.ip_address, 'amp1')])
def test_delete(self):
self.driver.delete(self.listener, self.vip)