Merge "Adds list pool stat test case"
This commit is contained in:
commit
1cee3c662a
|
@ -221,6 +221,17 @@ class LoadBalancerTestJSON(base.BaseNetworkTest):
|
||||||
(self.health_monitor['id'], self.pool['id']))
|
(self.health_monitor['id'], self.pool['id']))
|
||||||
self.assertEqual('204', resp['status'])
|
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):
|
class LoadBalancerTestXML(LoadBalancerTestJSON):
|
||||||
_interface = 'xml'
|
_interface = 'xml'
|
||||||
|
|
|
@ -375,3 +375,9 @@ class NetworkClientJSON(network_client_base.NetworkClientBase):
|
||||||
resp, body = self.put(uri, body)
|
resp, body = self.put(uri, body)
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
return resp, 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
|
||||||
|
|
|
@ -285,6 +285,12 @@ class NetworkClientXML(client_base.NetworkClientBase):
|
||||||
resp, body = self.delete(uri)
|
resp, body = self.delete(uri)
|
||||||
return resp, 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 = _root_tag_fetcher_and_xml_to_json_parse(body)
|
||||||
|
return resp, body
|
||||||
|
|
||||||
|
|
||||||
def _root_tag_fetcher_and_xml_to_json_parse(xml_returned_body):
|
def _root_tag_fetcher_and_xml_to_json_parse(xml_returned_body):
|
||||||
body = ET.fromstring(xml_returned_body)
|
body = ET.fromstring(xml_returned_body)
|
||||||
|
|
Loading…
Reference in New Issue