Merge "New api for getting the LB virtual servers status"

This commit is contained in:
Zuul 2018-08-16 20:51:38 +00:00 committed by Gerrit Code Review
commit ca13303116
2 changed files with 14 additions and 0 deletions

View File

@ -545,6 +545,15 @@ class TestService(nsxlib_testcase.NsxClientTestCase):
get.assert_called_with(
'loadbalancer/services/%s/status' % fake_service['id'])
def test_get_virtual_servers_status(self):
with mock.patch.object(self.nsxlib.client, 'get') as get:
fake_service = consts.FAKE_SERVICE.copy()
self.nsxlib.load_balancer.service.get_virtual_servers_status(
fake_service['id'])
get.assert_called_with(
'loadbalancer/services/%s/virtual-servers/status' %
fake_service['id'])
def test_delete_service(self):
with mock.patch.object(self.nsxlib.client, 'delete') as delete:
fake_service = consts.FAKE_SERVICE.copy()

View File

@ -454,6 +454,11 @@ class Service(LoadBalancerBase):
object_url = '%s/%s/%s' % (self.resource, service_id, 'status')
return self.client.get(object_url)
def get_virtual_servers_status(self, service_id):
object_url = '%s/%s/%s/%s' % (self.resource, service_id,
'virtual-servers', 'status')
return self.client.get(object_url)
def get_stats(self, service_id, source='realtime'):
object_url = '%s/%s/%s?source=%s' % (self.resource, service_id,
'statistics', source)