Merge "Adds the missing stats command and fixes status"
This commit is contained in:
commit
d024d4262f
|
@ -40,8 +40,9 @@ L7POLICY = 'l7policy'
|
|||
L7POLICY_RULE = 'rule'
|
||||
MEMBER = 'member'
|
||||
HEALTH_MONITOR = 'healthmonitor'
|
||||
STATUS = 'statuses'
|
||||
STATUS = 'status'
|
||||
GRAPH = 'graph'
|
||||
STATS = 'stats'
|
||||
|
||||
OPTS = [
|
||||
cfg.StrOpt(
|
||||
|
@ -188,7 +189,8 @@ class LoadBalancerProxyPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
|
|||
return r[resource_]
|
||||
|
||||
def _get_resources(self, resource, context, filters=None, fields=None,
|
||||
sub_resource=None, resource_id=None):
|
||||
sub_resource=None, resource_id=None,
|
||||
pass_through=False):
|
||||
# not sure how to test that or if we even support sorting/filtering?
|
||||
resource_ = resource if not sub_resource else sub_resource
|
||||
args = {}
|
||||
|
@ -200,7 +202,7 @@ class LoadBalancerProxyPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
|
|||
args['fields'] = fields
|
||||
res = self.get(self._path(resource, sub_resource, resource_id),
|
||||
context.auth_token, args)
|
||||
return res[self.pluralize(resource_)]
|
||||
return res[self.pluralize(resource_)] if not pass_through else res
|
||||
|
||||
def _get_resource(self, resource, context, id, fields=None,
|
||||
sub_resource=None, resource_id=None):
|
||||
|
@ -276,9 +278,6 @@ class LoadBalancerProxyPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
|
|||
def delete_pool(self, context, id):
|
||||
return self._delete_resource(POOL, context, id)
|
||||
|
||||
def stats(self, context, loadbalancer_id):
|
||||
pass
|
||||
|
||||
def get_pool_members(self, context, pool_id,
|
||||
filters=None,
|
||||
fields=None):
|
||||
|
@ -324,7 +323,8 @@ class LoadBalancerProxyPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
|
|||
|
||||
def statuses(self, context, loadbalancer_id):
|
||||
return self._get_resources(LOADBALANCER, context, sub_resource=STATUS,
|
||||
resource_id=loadbalancer_id)
|
||||
resource_id=loadbalancer_id,
|
||||
pass_through=True)
|
||||
|
||||
def get_l7policies(self, context, filters=None, fields=None):
|
||||
return self._get_resources(L7POLICY, context, filters, fields)
|
||||
|
@ -364,3 +364,8 @@ class LoadBalancerProxyPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
|
|||
|
||||
def create_graph(self, context, graph):
|
||||
return self._create_resource(GRAPH, context, graph)
|
||||
|
||||
def stats(self, context, loadbalancer_id):
|
||||
return self._get_resources(LOADBALANCER, context, sub_resource=STATS,
|
||||
resource_id=loadbalancer_id,
|
||||
pass_through=True)
|
||||
|
|
|
@ -1301,7 +1301,7 @@ class TestLbaasHealthMonitorTests(HealthMonitorTestBase):
|
|||
self.assertEqual([expected], body['healthmonitors'])
|
||||
|
||||
|
||||
class LbaasStatusesTest(MemberTestBase):
|
||||
class LbaasStatusesTest(TestLbaasProxyPluginDbTestCase):
|
||||
lb_id = uuidutils.generate_uuid()
|
||||
url = '{}/{}'.format(base_url, 'loadbalancers')
|
||||
|
||||
|
@ -1342,10 +1342,33 @@ class LbaasStatusesTest(MemberTestBase):
|
|||
}
|
||||
m.get('{}/{}'.format(self.url, self.lb_id),
|
||||
json={'loadbalancer': {'id': self.lb_id}})
|
||||
m.get('{}/{}/statuses'.format(self.url, self.lb_id),
|
||||
m.get('{}/{}/status'.format(self.url, self.lb_id),
|
||||
json={'statuses': expected})
|
||||
statuses = self._get_loadbalancer_statuses_api(self.lb_id)[1]
|
||||
self.assertEqual(expected, statuses)
|
||||
self.assertEqual(expected, statuses['statuses'])
|
||||
|
||||
|
||||
class LbaasStatsTest(MemberTestBase):
|
||||
lb_id = uuidutils.generate_uuid()
|
||||
url = '{}/{}'.format(base_url, 'loadbalancers')
|
||||
|
||||
@requests_mock.mock()
|
||||
def test_stats(self, m):
|
||||
expected = {
|
||||
"stats": {
|
||||
"bytes_in": "131342840",
|
||||
"total_connections": "52378345",
|
||||
"active_connections": "97258",
|
||||
"bytes_out": "1549542372",
|
||||
"request_errors": "0"
|
||||
}
|
||||
}
|
||||
m.get('{}/{}'.format(self.url, self.lb_id),
|
||||
json={'loadbalancer': {'id': self.lb_id}})
|
||||
m.get('{}/{}/stats'.format(self.url, self.lb_id),
|
||||
json={'stats': expected})
|
||||
stats = self._get_loadbalancer_stats_api(self.lb_id)[1]
|
||||
self.assertEqual(expected, stats['stats'])
|
||||
|
||||
|
||||
class LbaasGraphTest(MemberTestBase):
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The proxy plugin sends all LBaaS V2 API requests sent to Neutron to Octavia
|
||||
thus byapaasing the Neutron database. The proxy is specified instead of
|
||||
the 'lbaasv2' service plugin and called 'lbaasv2-proxy'. Since the proxy
|
||||
bypasses Neutron any existing LBaaS drivers will be bypassed as well.
|
||||
|
||||
other:
|
||||
- |
|
||||
This finishes the proxy plugin piece which proxies all LBaaS requests to
|
||||
Octavia V2 API. Quotas are enforced on both and so operators are advised to
|
||||
set them on both ends accordingly.
|
||||
|
||||
If any driver other than the Octavia driver is currently used in ths system
|
||||
operators need to perform the necessary migrations and/or wait until the
|
||||
respective driver is availble dor Octavia prior to activating this plugin.
|
Loading…
Reference in New Issue