LBaaS: Add status and stats APIs
Since nsxv3 platform just added support for status and stats APIs, expose those API from vmware-nsxlib as well. Two new methods have been added to LB Service class: - get_status - get_stats Change-Id: Id58ea03fe920619839093143bfad86cee5c80927
This commit is contained in:
parent
ca16f72286
commit
17189ca1b1
@ -346,6 +346,20 @@ class TestService(nsxlib_testcase.NsxClientTestCase):
|
||||
get.assert_called_with(
|
||||
'loadbalancer/services/%s' % fake_service['id'])
|
||||
|
||||
def test_get_stats(self):
|
||||
with mock.patch.object(self.nsxlib.client, 'get') as get:
|
||||
fake_service = consts.FAKE_SERVICE.copy()
|
||||
self.nsxlib.load_balancer.service.get_stats(fake_service['id'])
|
||||
get.assert_called_with(
|
||||
'loadbalancer/services/%s/statistics' % fake_service['id'])
|
||||
|
||||
def test_get_status(self):
|
||||
with mock.patch.object(self.nsxlib.client, 'get') as get:
|
||||
fake_service = consts.FAKE_SERVICE.copy()
|
||||
self.nsxlib.load_balancer.service.get_status(fake_service['id'])
|
||||
get.assert_called_with(
|
||||
'loadbalancer/services/%s/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()
|
||||
|
@ -257,6 +257,14 @@ class Service(LoadBalancerBase):
|
||||
'target_type': 'LogicalRouter'}
|
||||
return self.client.update(object_url, body)
|
||||
|
||||
def get_status(self, service_id):
|
||||
object_url = '%s/%s/%s' % (self.resource, service_id, 'status')
|
||||
return self.client.get(object_url)
|
||||
|
||||
def get_stats(self, service_id):
|
||||
object_url = '%s/%s/%s' % (self.resource, service_id, 'statistics')
|
||||
return self.client.get(object_url)
|
||||
|
||||
|
||||
class LoadBalancer(object):
|
||||
"""This is the class that have all load balancer resource clients"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user