Browse Source

Add l7policy and l7rule to octavia quota

Story: 2003382
Task: 24457

Depends-On: https://review.opendev.org/#/c/590620/
Change-Id: I1e3e60d5d326ff37a1ba53abd767c893748c2774
changes/68/591568/10
Yang JianFeng 3 years ago
parent
commit
674541e583
6 changed files with 57 additions and 7 deletions
  1. +4
    -0
      octaviaclient/osc/v2/constants.py
  2. +25
    -1
      octaviaclient/osc/v2/quota.py
  3. +2
    -0
      octaviaclient/osc/v2/utils.py
  4. +2
    -0
      octaviaclient/tests/unit/osc/v2/constants.py
  5. +21
    -6
      octaviaclient/tests/unit/osc/v2/test_quota.py
  6. +3
    -0
      releasenotes/notes/add-l7policy-and-l7rule-quota-support-73098a090b252901.yaml

+ 4
- 0
octaviaclient/osc/v2/constants.py View File

@ -236,6 +236,8 @@ QUOTA_ROWS = (
'pool',
'health_monitor',
'member',
'l7policy',
'l7rule',
)
QUOTA_COLUMNS = (
@ -245,6 +247,8 @@ QUOTA_COLUMNS = (
'pool',
'health_monitor',
'member',
'l7policy',
'l7rule',
)
AMPHORA_ROWS = (


+ 25
- 1
octaviaclient/osc/v2/quota.py View File

@ -101,7 +101,7 @@ class SetQuota(command.ShowOne):
@staticmethod
def _check_attrs(attrs):
args = ['health_monitor', 'listener', 'load_balancer', 'member',
'pool']
'pool', 'l7policy', 'l7rule']
if not any(arg in attrs for arg in args):
args = [arg.replace('_', '') for arg in args]
@ -150,6 +150,20 @@ class SetQuota(command.ShowOne):
'unlimited.')
)
quota_group.add_argument(
'--l7policy',
metavar='<l7policy>',
help=('New value for the l7policy quota limit. Value -1 means '
'unlimited.')
)
quota_group.add_argument(
'--l7rule',
metavar='<l7rule>',
help=('New value for the l7rule quota limit. Value -1 means '
'unlimited.')
)
parser.add_argument(
'project',
metavar='<project>',
@ -232,6 +246,16 @@ class UnsetQuota(command.Command):
action='store_true',
help="Reset the health monitor quota to the default."
)
parser.add_argument(
'--l7policy',
action='store_true',
help="Reset the l7policy quota to the default."
)
parser.add_argument(
'--l7rule',
action='store_true',
help="Reset the l7rule quota to the default."
)
return parser
def take_action(self, parsed_args):


+ 2
- 0
octaviaclient/osc/v2/utils.py View File

@ -440,6 +440,8 @@ def get_quota_attrs(client_manager, parsed_args):
'load_balancer': ('load_balancer', int),
'member': ('member', int),
'pool': ('pool', int),
'l7policy': ('l7policy', int),
'l7rule': ('l7rule', int),
'project': (
'project_id',
'project',


+ 2
- 0
octaviaclient/tests/unit/osc/v2/constants.py View File

@ -165,6 +165,8 @@ QUOTA_ATTRS = {
"load_balancer": 5,
"member": 50,
"pool": None,
"l7policy": 20,
"l7rule": 30,
"project_id": uuidutils.generate_uuid(dashed=True),
}


+ 21
- 6
octaviaclient/tests/unit/osc/v2/test_quota.py View File

@ -90,7 +90,9 @@ class TestQuotaDefaultsShow(TestQuota):
"listener": 2,
"load_balancer": 3,
"member": 4,
"pool": 5
"pool": 5,
"l7policy": 6,
"l7rule": 7
}
def setUp(self):
@ -136,17 +138,22 @@ class TestQuotaSet(TestQuota):
'listener': '1',
'load_balancer': '2',
'member': '3',
'pool': '4'
'pool': '4',
'l7policy': '5',
'l7rule': '6',
}
arglist = [self._qt.project_id, '--healthmonitor', '-1', '--listener',
'1', '--loadbalancer', '2', '--member', '3', '--pool', '4']
'1', '--loadbalancer', '2', '--member', '3', '--pool', '4',
'--l7policy', '5', '--l7rule', '6']
verifylist = [
('project', self._qt.project_id),
('health_monitor', '-1'),
('listener', '1'),
('load_balancer', '2'),
('member', '3'),
('pool', '4')
('pool', '4'),
('l7policy', '5'),
('l7rule', '6')
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -156,7 +163,9 @@ class TestQuotaSet(TestQuota):
'listener': '1',
'load_balancer': '2',
'member': '3',
'pool': '4'}})
'pool': '4',
'l7policy': '5',
'l7rule': '6'}})
@mock.patch('octaviaclient.osc.v2.utils.get_quota_attrs')
def test_quota_set_no_args(self, mock_attrs):
@ -201,7 +210,7 @@ class TestQuotaReset(TestQuota):
class TestQuotaUnset(TestQuota):
PARAMETERS = ('loadbalancer', 'listener', 'pool',
'member', 'healthmonitor')
'member', 'healthmonitor', 'l7policy', 'l7rule')
def setUp(self):
super(TestQuotaUnset, self).setUp()
@ -222,6 +231,12 @@ class TestQuotaUnset(TestQuota):
def test_quota_unset_member(self):
self._test_quota_unset_param('member')
def test_quota_unset_l7policy(self):
self._test_quota_unset_param('l7policy')
def test_quota_unset_l7rule(self):
self._test_quota_unset_param('l7rule')
@mock.patch('octaviaclient.osc.v2.utils.get_resource_id')
def _test_quota_unset_param(self, param, mock_get_resource):
self.api_mock.quota_set.reset_mock()


+ 3
- 0
releasenotes/notes/add-l7policy-and-l7rule-quota-support-73098a090b252901.yaml View File

@ -0,0 +1,3 @@
---
features:
- Add l7policy and l7rule's quota support to octaviaclient.

Loading…
Cancel
Save