Introduce L7Rule for Octavia (load balancing)
Co-Authored-By: Michael Johnson <johnsomor@gmail.com> Change-Id: I19d2ec8e2f71527c4c7a1f4df043f5b28a5355c9
This commit is contained in:
parent
9a4bd69aa9
commit
317cfe6e69
@ -81,3 +81,15 @@ L7 Policy Operations
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.get_l7_policy
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.l7_policies
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.update_l7_policy
|
||||
|
||||
L7 Rule Operations
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: openstack.load_balancer.v2._proxy.Proxy
|
||||
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.create_l7_rule
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.delete_l7_rule
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.find_l7_rule
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.get_l7_rule
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.l7_rules
|
||||
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.update_l7_rule
|
||||
|
@ -10,3 +10,4 @@ Load Balancer Resources
|
||||
v2/member
|
||||
v2/health_monitor
|
||||
v2/l7_policy
|
||||
v2/l7_rule
|
||||
|
12
doc/source/users/resources/load_balancer/v2/l7_rule.rst
Normal file
12
doc/source/users/resources/load_balancer/v2/l7_rule.rst
Normal file
@ -0,0 +1,12 @@
|
||||
openstack.load_balancer.v2.l7_rule
|
||||
====================================
|
||||
|
||||
.. automodule:: openstack.load_balancer.v2.l7_rule
|
||||
|
||||
The L7Rule Class
|
||||
------------------
|
||||
|
||||
The ``L7Rule`` class inherits from :class:`~openstack.resource.Resource`.
|
||||
|
||||
.. autoclass:: openstack.load_balancer.v2.l7_rule.L7Rule
|
||||
:members:
|
@ -12,6 +12,7 @@
|
||||
|
||||
from openstack.load_balancer.v2 import health_monitor as _hm
|
||||
from openstack.load_balancer.v2 import l7_policy as _l7policy
|
||||
from openstack.load_balancer.v2 import l7_rule as _l7rule
|
||||
from openstack.load_balancer.v2 import listener as _listener
|
||||
from openstack.load_balancer.v2 import load_balancer as _lb
|
||||
from openstack.load_balancer.v2 import member as _member
|
||||
@ -488,7 +489,7 @@ class Proxy(proxy2.BaseProxy):
|
||||
def delete_l7_policy(self, l7_policy, ignore_missing=True):
|
||||
"""Delete a l7policy
|
||||
|
||||
:param l7policy: The value can be either the ID of a l7policy or a
|
||||
:param l7_policy: The value can be either the ID of a l7policy or a
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy` instance.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||
@ -520,7 +521,7 @@ class Proxy(proxy2.BaseProxy):
|
||||
def get_l7_policy(self, l7_policy):
|
||||
"""Get a single l7policy
|
||||
|
||||
:param l7policy: The value can be the ID of a l7policy or a
|
||||
:param l7_policy: The value can be the ID of a l7policy or a
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance.
|
||||
|
||||
@ -544,7 +545,7 @@ class Proxy(proxy2.BaseProxy):
|
||||
def update_l7_policy(self, l7_policy, **attrs):
|
||||
"""Update a l7policy
|
||||
|
||||
:param l7policy: Either the id of a l7policy or a
|
||||
:param l7_policy: Either the id of a l7policy or a
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance.
|
||||
:param dict attrs: The attributes to update on the l7policy
|
||||
@ -554,3 +555,115 @@ class Proxy(proxy2.BaseProxy):
|
||||
:rtype: :class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
"""
|
||||
return self._update(_l7policy.L7Policy, l7_policy, **attrs)
|
||||
|
||||
def create_l7_rule(self, l7_policy, **attrs):
|
||||
"""Create a new l7rule from attributes
|
||||
|
||||
:param l7_policy: The l7_policy can be either the ID of a l7policy or
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance that the l7rule will be created in.
|
||||
:param dict attrs: Keyword arguments which will be used to create
|
||||
a :class:`~openstack.load_balancer.v2.l7_rule.L7Rule`,
|
||||
comprised of the properties on the L7Rule class.
|
||||
|
||||
:returns: The results of l7rule creation
|
||||
:rtype: :class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
|
||||
"""
|
||||
l7policyobj = self._get_resource(_l7policy.L7Policy, l7_policy)
|
||||
return self._create(_l7rule.L7Rule, l7policy_id=l7policyobj.id,
|
||||
**attrs)
|
||||
|
||||
def delete_l7_rule(self, l7rule, l7_policy, ignore_missing=True):
|
||||
"""Delete a l7rule
|
||||
|
||||
:param l7rule:
|
||||
The l7rule can be either the ID of a l7rule or a
|
||||
:class:`~openstack.load_balancer.v2.l7_rule.L7Rule` instance.
|
||||
:param l7_policy: The l7_policy can be either the ID of a l7policy or
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance that the l7rule belongs to.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||
raised when the l7rule does not exist.
|
||||
When set to ``True``, no exception will be set when
|
||||
attempting to delete a nonexistent l7rule.
|
||||
|
||||
:returns: ``None``
|
||||
"""
|
||||
l7policyobj = self._get_resource(_l7policy.L7Policy, l7_policy)
|
||||
self._delete(_l7rule.L7Rule, l7rule,
|
||||
ignore_missing=ignore_missing, l7policy_id=l7policyobj.id)
|
||||
|
||||
def find_l7_rule(self, name_or_id, l7_policy, ignore_missing=True):
|
||||
"""Find a single l7rule
|
||||
|
||||
:param str name_or_id: The name or ID of a l7rule.
|
||||
:param l7_policy: The l7_policy can be either the ID of a l7policy or
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance that the l7rule belongs to.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||
raised when the resource does not exist.
|
||||
When set to ``True``, None will be returned when
|
||||
attempting to find a nonexistent resource.
|
||||
|
||||
:returns: One :class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
|
||||
or None
|
||||
"""
|
||||
l7policyobj = self._get_resource(_l7policy.L7Policy, l7_policy)
|
||||
return self._find(_l7rule.L7Rule, name_or_id,
|
||||
ignore_missing=ignore_missing,
|
||||
l7policy_id=l7policyobj.id)
|
||||
|
||||
def get_l7_rule(self, l7rule, l7_policy):
|
||||
"""Get a single l7rule
|
||||
|
||||
:param l7rule: The l7rule can be the ID of a l7rule or a
|
||||
:class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
|
||||
instance.
|
||||
:param l7_policy: The l7_policy can be either the ID of a l7policy or
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance that the l7rule belongs to.
|
||||
|
||||
:returns: One :class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound`
|
||||
when no resource can be found.
|
||||
"""
|
||||
l7policyobj = self._get_resource(_l7policy.L7Policy, l7_policy)
|
||||
return self._get(_l7rule.L7Rule, l7rule,
|
||||
l7policy_id=l7policyobj.id)
|
||||
|
||||
def l7_rules(self, l7_policy, **query):
|
||||
"""Return a generator of l7rules
|
||||
|
||||
:param l7_policy: The l7_policy can be either the ID of a l7_policy or
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance that the l7rule belongs to.
|
||||
:param dict query: Optional query parameters to be sent to limit
|
||||
the resources being returned. Valid parameters are:
|
||||
|
||||
:returns: A generator of l7rule objects
|
||||
:rtype: :class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
|
||||
"""
|
||||
l7policyobj = self._get_resource(_l7policy.L7Policy, l7_policy)
|
||||
return self._list(_l7rule.L7Rule, paginated=True,
|
||||
l7policy_id=l7policyobj.id, **query)
|
||||
|
||||
def update_l7_rule(self, l7rule, l7_policy, **attrs):
|
||||
"""Update a l7rule
|
||||
|
||||
:param l7rule: Either the ID of a l7rule or a
|
||||
:class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
|
||||
instance.
|
||||
:param l7_policy: The l7_policy can be either the ID of a l7policy or
|
||||
:class:`~openstack.load_balancer.v2.l7_policy.L7Policy`
|
||||
instance that the l7rule belongs to.
|
||||
:param dict attrs: The attributes to update on the l7rule
|
||||
represented by ``l7rule``.
|
||||
|
||||
:returns: The updated l7rule
|
||||
:rtype: :class:`~openstack.load_balancer.v2.l7_rule.L7Rule`
|
||||
"""
|
||||
l7policyobj = self._get_resource(_l7policy.L7Policy, l7_policy)
|
||||
return self._update(_l7rule.L7Rule, l7rule,
|
||||
l7policy_id=l7policyobj.id, **attrs)
|
||||
|
61
openstack/load_balancer/v2/l7_rule.py
Normal file
61
openstack/load_balancer/v2/l7_rule.py
Normal file
@ -0,0 +1,61 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack.load_balancer import load_balancer_service as lb_service
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class L7Rule(resource.Resource):
|
||||
resource_key = 'l7rule'
|
||||
resources_key = 'l7rules'
|
||||
base_path = '/l7policies/%(l7_policy_id)s/rules'
|
||||
service = lb_service.LoadBalancerService()
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_list = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'compare_type', 'created_at', 'invert', 'key', 'l7_policy_id',
|
||||
'project_id', 'provisioning_status', 'type', 'updated_at', 'value',
|
||||
'operating_status', is_admin_state_up='admin_state_up',
|
||||
)
|
||||
|
||||
#: Properties
|
||||
#: The administrative state of the l7policy *Type: bool*
|
||||
is_admin_state_up = resource.Body('admin_state_up', type=bool)
|
||||
#: comparison type to be used with the value in this L7 rule.
|
||||
compare_type = resource.Body('compare_type')
|
||||
#: Timestamp when the L7 rule was created.
|
||||
created_at = resource.Body('created_at')
|
||||
#: inverts the logic of the rule if True
|
||||
# (ie. perform a logical NOT on the rule)
|
||||
invert = resource.Body('invert', type=bool)
|
||||
#: The key to use for the comparison.
|
||||
key = resource.Body('key')
|
||||
#: The ID of the associated l7 policy
|
||||
l7_policy_id = resource.Body('l7policy_id')
|
||||
#: The operating status of this l7rule
|
||||
operating_status = resource.Body('operating_status')
|
||||
#: The ID of the project this l7policy is associated with.
|
||||
project_id = resource.Body('project_id')
|
||||
#: The provisioning status of this l7policy
|
||||
provisioning_status = resource.Body('provisioning_status')
|
||||
#: The type of L7 rule
|
||||
type = resource.Body('type')
|
||||
#: Timestamp when the L7 rule was updated.
|
||||
updated_at = resource.Body('updated_at')
|
||||
#: value to be compared with
|
||||
value = resource.Body('value')
|
@ -15,6 +15,7 @@ import uuid
|
||||
|
||||
from openstack.load_balancer.v2 import health_monitor
|
||||
from openstack.load_balancer.v2 import l7_policy
|
||||
from openstack.load_balancer.v2 import l7_rule
|
||||
from openstack.load_balancer.v2 import listener
|
||||
from openstack.load_balancer.v2 import load_balancer
|
||||
from openstack.load_balancer.v2 import member
|
||||
@ -53,6 +54,9 @@ class TestLoadBalancer(lb_base.BaseLBFunctionalTest):
|
||||
HM_TYPE = 'HTTP'
|
||||
ACTION = 'REDIRECT_TO_URL'
|
||||
REDIRECT_URL = 'http://www.example.com'
|
||||
COMPARE_TYPE = 'CONTAINS'
|
||||
L7RULE_TYPE = 'HOST_NAME'
|
||||
L7RULE_VALUE = 'example'
|
||||
|
||||
# Note: Creating load balancers can be slow on some hosts due to nova
|
||||
# instance boot times (up to ten minutes) so we are consolidating
|
||||
@ -119,11 +123,24 @@ class TestLoadBalancer(lb_base.BaseLBFunctionalTest):
|
||||
cls.lb_wait_for_status(test_lb, status='ACTIVE',
|
||||
failures=['ERROR'])
|
||||
|
||||
test_l7rule = cls.conn.load_balancer.create_l7_rule(
|
||||
l7_policy=cls.L7POLICY_ID, compare_type=cls.COMPARE_TYPE,
|
||||
type=cls.L7RULE_TYPE, value=cls.L7RULE_VALUE)
|
||||
assert isinstance(test_l7rule, l7_rule.L7Rule)
|
||||
cls.assertIs(cls.COMPARE_TYPE, test_l7rule.compare_type)
|
||||
cls.L7RULE_ID = test_l7rule.id
|
||||
cls.lb_wait_for_status(test_lb, status='ACTIVE',
|
||||
failures=['ERROR'])
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
test_lb = cls.conn.load_balancer.get_load_balancer(cls.LB_ID)
|
||||
cls.lb_wait_for_status(test_lb, status='ACTIVE', failures=['ERROR'])
|
||||
|
||||
cls.conn.load_balancer.delete_l7_rule(
|
||||
cls.L7RULE_ID, ignore_missing=False)
|
||||
cls.lb_wait_for_status(test_lb, status='ACTIVE', failures=['ERROR'])
|
||||
|
||||
cls.conn.load_balancer.delete_l7_policy(
|
||||
cls.L7POLICY_ID, ignore_missing=False)
|
||||
cls.lb_wait_for_status(test_lb, status='ACTIVE', failures=['ERROR'])
|
||||
@ -337,3 +354,38 @@ class TestLoadBalancer(lb_base.BaseLBFunctionalTest):
|
||||
test_l7_policy = self.conn.load_balancer.get_l7_policy(
|
||||
self.L7POLICY_ID)
|
||||
self.assertEqual(self.L7POLICY_NAME, test_l7_policy.name)
|
||||
|
||||
def test_l7_rule_find(self):
|
||||
test_l7_rule = self.conn.load_balancer.find_l7_rule(
|
||||
self.L7RULE_ID)
|
||||
self.assertEqual(self.L7RULE_ID, test_l7_rule.id)
|
||||
self.assertEqual(self.L7RULE_TYPE, test_l7_rule.type)
|
||||
|
||||
def test_l7_rule_get(self):
|
||||
test_l7_rule = self.conn.load_balancer.get_l7_rule(
|
||||
self.L7RULE_ID)
|
||||
self.assertEqual(self.L7RULE_ID, test_l7_rule.id)
|
||||
self.assertEqual(self.COMPARE_TYPE, test_l7_rule.compare_type)
|
||||
self.assertEqual(self.L7RULE_TYPE, test_l7_rule.type)
|
||||
self.assertEqual(self.L7RULE_VALUE, test_l7_rule.value)
|
||||
|
||||
def test_l7_rule_list(self):
|
||||
ids = [l7.id for l7 in self.conn.load_balancer.l7_rules()]
|
||||
self.assertIn(self.L7RULE_ID, ids)
|
||||
|
||||
def test_l7_rule_update(self):
|
||||
test_lb = self.conn.load_balancer.get_load_balancer(self.LB_ID)
|
||||
|
||||
self.conn.load_balancer.update_l7_rule(
|
||||
self.L7RULE_ID, value=self.UPDATE_NAME)
|
||||
self.lb_wait_for_status(test_lb, status='ACTIVE', failures=['ERROR'])
|
||||
test_l7_rule = self.conn.load_balancer.get_l7_rule(
|
||||
self.L7RULE_ID)
|
||||
self.assertEqual(self.UPDATE_NAME, test_l7_rule.value)
|
||||
|
||||
self.conn.load_balancer.update_l7_policy(self.L7POLICY_ID,
|
||||
value=self.L7RULE_VALUE)
|
||||
self.lb_wait_for_status(test_lb, status='ACTIVE', failures=['ERROR'])
|
||||
test_l7_rule = self.conn.load_balancer.get_l7_rule(
|
||||
self.L7RULE_ID)
|
||||
self.assertEqual(self.L7RULE_VALUE, test_l7_rule.value)
|
||||
|
66
openstack/tests/unit/load_balancer/test_l7rule.py
Normal file
66
openstack/tests/unit/load_balancer/test_l7rule.py
Normal file
@ -0,0 +1,66 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import testtools
|
||||
import uuid
|
||||
|
||||
from openstack.load_balancer.v2 import l7_rule
|
||||
|
||||
EXAMPLE = {
|
||||
'admin_state_up': True,
|
||||
'compare_type': 'REGEX',
|
||||
'created_at': '2017-08-17T12:14:57.233772',
|
||||
'id': uuid.uuid4(),
|
||||
'invert': False,
|
||||
'key': 'my_cookie',
|
||||
'l7_policy_id': uuid.uuid4(),
|
||||
'operating_status': 'ONLINE',
|
||||
'project_id': uuid.uuid4(),
|
||||
'provisioning_status': 'ACTIVE',
|
||||
'type': 'COOKIE',
|
||||
'updated_at': '2017-08-17T12:16:57.233772',
|
||||
'value': 'chocolate'
|
||||
}
|
||||
|
||||
|
||||
class TestL7Rule(testtools.TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
test_l7rule = l7_rule.L7Rule()
|
||||
self.assertEqual('l7rule', test_l7rule.resource_key)
|
||||
self.assertEqual('l7rules', test_l7rule.resources_key)
|
||||
self.assertEqual('/l7policies/%(l7_policy_id)s/rules',
|
||||
test_l7rule.base_path)
|
||||
self.assertEqual('load-balancer', test_l7rule.service.service_type)
|
||||
self.assertTrue(test_l7rule.allow_create)
|
||||
self.assertTrue(test_l7rule.allow_get)
|
||||
self.assertTrue(test_l7rule.allow_update)
|
||||
self.assertTrue(test_l7rule.allow_delete)
|
||||
self.assertTrue(test_l7rule.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
test_l7rule = l7_rule.L7Rule(**EXAMPLE)
|
||||
self.assertTrue(test_l7rule.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE['compare_type'], test_l7rule.compare_type)
|
||||
self.assertEqual(EXAMPLE['created_at'], test_l7rule.created_at)
|
||||
self.assertEqual(EXAMPLE['id'], test_l7rule.id)
|
||||
self.assertEqual(EXAMPLE['invert'], test_l7rule.invert)
|
||||
self.assertEqual(EXAMPLE['key'], test_l7rule.key)
|
||||
self.assertEqual(EXAMPLE['l7_policy_id'], test_l7rule.l7_policy_id)
|
||||
self.assertEqual(EXAMPLE['operating_status'],
|
||||
test_l7rule.operating_status)
|
||||
self.assertEqual(EXAMPLE['project_id'], test_l7rule.project_id)
|
||||
self.assertEqual(EXAMPLE['provisioning_status'],
|
||||
test_l7rule.provisioning_status)
|
||||
self.assertEqual(EXAMPLE['type'], test_l7rule.type)
|
||||
self.assertEqual(EXAMPLE['updated_at'], test_l7rule.updated_at)
|
||||
self.assertEqual(EXAMPLE['value'], test_l7rule.value)
|
@ -15,6 +15,7 @@ import uuid
|
||||
from openstack.load_balancer.v2 import _proxy
|
||||
from openstack.load_balancer.v2 import health_monitor
|
||||
from openstack.load_balancer.v2 import l7_policy
|
||||
from openstack.load_balancer.v2 import l7_rule
|
||||
from openstack.load_balancer.v2 import listener
|
||||
from openstack.load_balancer.v2 import load_balancer as lb
|
||||
from openstack.load_balancer.v2 import member
|
||||
@ -25,6 +26,7 @@ from openstack.tests.unit import test_proxy_base2
|
||||
class TestLoadBalancerProxy(test_proxy_base2.TestProxyBase):
|
||||
|
||||
POOL_ID = uuid.uuid4()
|
||||
L7_POLICY_ID = uuid.uuid4()
|
||||
|
||||
def setUp(self):
|
||||
super(TestLoadBalancerProxy, self).setUp()
|
||||
@ -195,3 +197,44 @@ class TestLoadBalancerProxy(test_proxy_base2.TestProxyBase):
|
||||
def test_l7_policy_update(self):
|
||||
self.verify_update(self.proxy.update_l7_policy,
|
||||
l7_policy.L7Policy)
|
||||
|
||||
def test_l7_rules(self):
|
||||
self.verify_list(self.proxy.l7_rules,
|
||||
l7_rule.L7Rule,
|
||||
paginated=True,
|
||||
method_kwargs={'l7_policy': self.L7_POLICY_ID},
|
||||
expected_kwargs={'l7policy_id': self.L7_POLICY_ID})
|
||||
|
||||
def test_l7_rule_get(self):
|
||||
self.verify_get(self.proxy.get_l7_rule,
|
||||
l7_rule.L7Rule,
|
||||
method_kwargs={'l7_policy': self.L7_POLICY_ID},
|
||||
expected_kwargs={'l7policy_id': self.L7_POLICY_ID})
|
||||
|
||||
def test_l7_rule_create(self):
|
||||
self.verify_create(self.proxy.create_l7_rule,
|
||||
l7_rule.L7Rule,
|
||||
method_kwargs={'l7_policy': self.L7_POLICY_ID},
|
||||
expected_kwargs={'l7policy_id': self.L7_POLICY_ID})
|
||||
|
||||
def test_l7_rule_delete(self):
|
||||
self.verify_delete(self.proxy.delete_l7_rule,
|
||||
l7_rule.L7Rule,
|
||||
True,
|
||||
method_kwargs={'l7_policy': self.L7_POLICY_ID},
|
||||
expected_kwargs={'l7policy_id': self.L7_POLICY_ID})
|
||||
|
||||
def test_l7_rule_find(self):
|
||||
self._verify2('openstack.proxy2.BaseProxy._find',
|
||||
self.proxy.find_l7_rule,
|
||||
method_args=["RULE", self.L7_POLICY_ID],
|
||||
expected_args=[l7_rule.L7Rule, "RULE"],
|
||||
expected_kwargs={"l7policy_id": self.L7_POLICY_ID,
|
||||
"ignore_missing": True})
|
||||
|
||||
def test_l7_rule_update(self):
|
||||
self._verify2('openstack.proxy2.BaseProxy._update',
|
||||
self.proxy.update_l7_rule,
|
||||
method_args=["RULE", self.L7_POLICY_ID],
|
||||
expected_args=[l7_rule.L7Rule, "RULE"],
|
||||
expected_kwargs={"l7policy_id": self.L7_POLICY_ID})
|
||||
|
Loading…
x
Reference in New Issue
Block a user