Merge "Adds list pool stat test case"

changes/61/72561/5
Jenkins 9 years ago committed by Gerrit Code Review
commit 1cee3c662a
  1. 11
      tempest/api/network/test_load_balancer.py
  2. 6
      tempest/services/network/json/network_client.py
  3. 6
      tempest/services/network/xml/network_client.py

@ -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'

@ -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

@ -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)

Loading…
Cancel
Save