Merge "Adds list pool stat test case"

This commit is contained in:
Jenkins 2014-02-20 01:30:49 +00:00 committed by Gerrit Code Review
commit 1cee3c662a
3 changed files with 23 additions and 0 deletions

View File

@ -221,6 +221,17 @@ class LoadBalancerTestJSON(base.BaseNetworkTest):
(self.health_monitor['id'], self.pool['id']))
self.assertEqual('204', resp['status'])
@test.attr(type='smoke')
def test_get_lb_pool_stats(self):
# Verify the details of pool stats
resp, body = self.client.list_lb_pool_stats(self.pool['id'])
self.assertEqual('200', resp['status'])
stats = body['stats']
self.assertIn("bytes_in", stats)
self.assertIn("total_connections", stats)
self.assertIn("active_connections", stats)
self.assertIn("bytes_out", stats)
class LoadBalancerTestXML(LoadBalancerTestJSON):
_interface = 'xml'

View File

@ -375,3 +375,9 @@ class NetworkClientJSON(network_client_base.NetworkClientBase):
resp, body = self.put(uri, body)
body = json.loads(body)
return resp, body
def list_lb_pool_stats(self, pool_id):
uri = '%s/lb/pools/%s/stats' % (self.uri_prefix, pool_id)
resp, body = self.get(uri)
body = json.loads(body)
return resp, body

View File

@ -285,6 +285,12 @@ class NetworkClientXML(client_base.NetworkClientBase):
resp, body = self.delete(uri)
return resp, body
def list_lb_pool_stats(self, pool_id):
uri = '%s/lb/pools/%s/stats' % (self.uri_prefix, pool_id)
resp, body = self.get(uri)
body = _root_tag_fetcher_and_xml_to_json_parse(body)
return resp, body
def _root_tag_fetcher_and_xml_to_json_parse(xml_returned_body):
body = ET.fromstring(xml_returned_body)