Add missing reload method in amphora noop driver
The reload method was also missing in the abstract class. Task: 40140 Story: 2007847 Change-Id: I2328b3dc4d5b95c8771a305d3d4bb1dee6019117
This commit is contained in:
parent
e475734b2a
commit
89123c0fc1
@ -64,6 +64,20 @@ class AmphoraLoadBalancerDriver(object, metaclass=abc.ABCMeta):
|
|||||||
add more function along with the development.
|
add more function along with the development.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def reload(self, loadbalancer, amphora):
|
||||||
|
"""Reload the listeners on the amphora.
|
||||||
|
|
||||||
|
:param loadbalancer: loadbalancer object to reload listeners
|
||||||
|
:type loadbalancer: octavia.db.models.LoadBalancer
|
||||||
|
:param amphora: Amphora to start. If None, reload on all amphora
|
||||||
|
:type amphora: octavia.db.models.Amphora
|
||||||
|
:returns: return a value list (listener, vip, status flag--enable)
|
||||||
|
|
||||||
|
At this moment, we just build the basic structure for testing, will
|
||||||
|
add more function along with the development.
|
||||||
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def delete(self, listener):
|
def delete(self, listener):
|
||||||
"""Delete the listener on the vip.
|
"""Delete the listener on the vip.
|
||||||
|
@ -64,6 +64,13 @@ class NoopManager(object):
|
|||||||
(loadbalancer.id, amphora.id)] = (loadbalancer, amphora,
|
(loadbalancer.id, amphora.id)] = (loadbalancer, amphora,
|
||||||
'start')
|
'start')
|
||||||
|
|
||||||
|
def reload(self, loadbalancer, amphora=None):
|
||||||
|
LOG.debug("Amphora %s no-op, reload listeners, lb %s, amp %s",
|
||||||
|
self.__class__.__name__, loadbalancer.id, amphora)
|
||||||
|
self.amphoraconfig[
|
||||||
|
(loadbalancer.id, amphora.id)] = (loadbalancer, amphora,
|
||||||
|
'reload')
|
||||||
|
|
||||||
def delete(self, listener):
|
def delete(self, listener):
|
||||||
LOG.debug("Amphora %s no-op, delete listener %s, vip %s",
|
LOG.debug("Amphora %s no-op, delete listener %s, vip %s",
|
||||||
self.__class__.__name__,
|
self.__class__.__name__,
|
||||||
@ -142,6 +149,10 @@ class NoopAmphoraLoadBalancerDriver(
|
|||||||
|
|
||||||
self.driver.start(loadbalancer, amphora)
|
self.driver.start(loadbalancer, amphora)
|
||||||
|
|
||||||
|
def reload(self, loadbalancer, amphora=None):
|
||||||
|
|
||||||
|
self.driver.reload(loadbalancer, amphora)
|
||||||
|
|
||||||
def delete(self, listener):
|
def delete(self, listener):
|
||||||
|
|
||||||
self.driver.delete(listener)
|
self.driver.delete(listener)
|
||||||
|
@ -95,6 +95,14 @@ class TestNoopAmphoraLoadBalancerDriver(base.TestCase):
|
|||||||
self.driver.driver.amphoraconfig[(
|
self.driver.driver.amphoraconfig[(
|
||||||
self.load_balancer.id, '321')])
|
self.load_balancer.id, '321')])
|
||||||
|
|
||||||
|
def test_reload(self):
|
||||||
|
mock_amphora = mock.MagicMock()
|
||||||
|
mock_amphora.id = '321'
|
||||||
|
self.driver.reload(self.load_balancer, amphora=mock_amphora)
|
||||||
|
self.assertEqual((self.load_balancer, mock_amphora, 'reload'),
|
||||||
|
self.driver.driver.amphoraconfig[(
|
||||||
|
self.load_balancer.id, '321')])
|
||||||
|
|
||||||
def test_delete(self):
|
def test_delete(self):
|
||||||
self.driver.delete(self.listener)
|
self.driver.delete(self.listener)
|
||||||
self.assertEqual((self.listener, self.vip, 'delete'),
|
self.assertEqual((self.listener, self.vip, 'delete'),
|
||||||
|
Loading…
Reference in New Issue
Block a user