Add lb_find() method to lbaas driver
This is to help LB policy for validating LB ID/name. Change-Id: Iddea8f68cf425b5c55d7f68b3652e6d2f33edf98
This commit is contained in:
parent
52811c7e9e
commit
3ff67ebe6b
|
@ -177,6 +177,9 @@ class LoadBalancerDriver(base.DriverBase):
|
|||
|
||||
return True, result
|
||||
|
||||
def lb_find(self, name_or_id, ignore_missing=False):
|
||||
return self.nc().loadbalancer_get(name_or_id, ignore_missing)
|
||||
|
||||
def lb_delete(self, **kwargs):
|
||||
"""Delete a Neutron lbaas instance
|
||||
|
||||
|
|
|
@ -343,6 +343,11 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
|
|||
msg = _('Failed in creating lb health monitor: CREATE FAILED.')
|
||||
self.assertEqual(msg, res)
|
||||
|
||||
@mock.patch.object(neutron_v2, 'NeutronClient')
|
||||
def test_lb_find(self, mock_neutron):
|
||||
self.lb_driver.lb_find("FAKELB")
|
||||
self.nc.loadbalancer_get.assert_called_once_with("FAKELB", False)
|
||||
|
||||
def test_lb_delete(self):
|
||||
kwargs = {
|
||||
'loadbalancer': 'LB_ID',
|
||||
|
|
Loading…
Reference in New Issue