diff --git a/openstack/load_balancer/v2/health_monitor.py b/openstack/load_balancer/v2/health_monitor.py index 4cca0262d..01f5fbee1 100644 --- a/openstack/load_balancer/v2/health_monitor.py +++ b/openstack/load_balancer/v2/health_monitor.py @@ -13,7 +13,7 @@ from openstack import resource -class HealthMonitor(resource.Resource): +class HealthMonitor(resource.Resource, resource.TagMixin): resource_key = 'healthmonitor' resources_key = 'healthmonitors' base_path = '/lbaas/healthmonitors' @@ -30,6 +30,7 @@ class HealthMonitor(resource.Resource): 'http_method', 'max_retries', 'max_retries_down', 'pool_id', 'provisioning_status', 'operating_status', 'timeout', 'project_id', 'type', 'url_path', is_admin_state_up='admin_state_up', + **resource.TagMixin._tag_query_parameters ) #: Properties diff --git a/openstack/load_balancer/v2/l7_policy.py b/openstack/load_balancer/v2/l7_policy.py index 099b176da..4b099dc22 100644 --- a/openstack/load_balancer/v2/l7_policy.py +++ b/openstack/load_balancer/v2/l7_policy.py @@ -13,7 +13,7 @@ from openstack import resource -class L7Policy(resource.Resource): +class L7Policy(resource.Resource, resource.TagMixin): resource_key = 'l7policy' resources_key = 'l7policies' base_path = '/lbaas/l7policies' @@ -28,7 +28,9 @@ class L7Policy(resource.Resource): _query_mapping = resource.QueryParameters( 'action', 'description', 'listener_id', 'name', 'position', 'redirect_pool_id', 'redirect_url', 'provisioning_status', - 'operating_status', is_admin_state_up='admin_state_up', + 'operating_status', 'redirect_prefix', 'project_id', + is_admin_state_up='admin_state_up', + **resource.TagMixin._tag_query_parameters ) #: Properties @@ -54,6 +56,8 @@ class L7Policy(resource.Resource): provisioning_status = resource.Body('provisioning_status') #: The ID of the pool to which the requests will be redirected redirect_pool_id = resource.Body('redirect_pool_id') + #: The URL prefix to which the requests should be redirected + redirect_prefix = resource.Body('redirect_prefix') #: The URL to which the requests should be redirected redirect_url = resource.Body('redirect_url') #: The list of L7Rules associated with the l7policy diff --git a/openstack/load_balancer/v2/l7_rule.py b/openstack/load_balancer/v2/l7_rule.py index be5c118f5..ee8400e75 100644 --- a/openstack/load_balancer/v2/l7_rule.py +++ b/openstack/load_balancer/v2/l7_rule.py @@ -13,7 +13,7 @@ from openstack import resource -class L7Rule(resource.Resource): +class L7Rule(resource.Resource, resource.TagMixin): resource_key = 'rule' resources_key = 'rules' base_path = '/lbaas/l7policies/%(l7policy_id)s/rules' @@ -29,7 +29,7 @@ class L7Rule(resource.Resource): 'compare_type', 'created_at', 'invert', 'key', 'project_id', 'provisioning_status', 'type', 'updated_at', 'rule_value', 'operating_status', is_admin_state_up='admin_state_up', - l7_policy_id='l7policy_id', + l7_policy_id='l7policy_id', **resource.TagMixin._tag_query_parameters ) #: Properties diff --git a/openstack/load_balancer/v2/listener.py b/openstack/load_balancer/v2/listener.py index 6ea5d74bb..e55bcde48 100644 --- a/openstack/load_balancer/v2/listener.py +++ b/openstack/load_balancer/v2/listener.py @@ -13,7 +13,7 @@ from openstack import resource -class Listener(resource.Resource): +class Listener(resource.Resource, resource.TagMixin): resource_key = 'listener' resources_key = 'listeners' base_path = '/lbaas/listeners' @@ -33,6 +33,7 @@ class Listener(resource.Resource): 'timeout_client_data', 'timeout_member_connect', 'timeout_member_data', 'timeout_tcp_inspect', is_admin_state_up='admin_state_up', + **resource.TagMixin._tag_query_parameters ) # Properties diff --git a/openstack/load_balancer/v2/load_balancer.py b/openstack/load_balancer/v2/load_balancer.py index 9b36f7e5f..3c8379338 100644 --- a/openstack/load_balancer/v2/load_balancer.py +++ b/openstack/load_balancer/v2/load_balancer.py @@ -13,7 +13,7 @@ from openstack import resource -class LoadBalancer(resource.Resource): +class LoadBalancer(resource.Resource, resource.TagMixin): resource_key = 'loadbalancer' resources_key = 'loadbalancers' base_path = '/lbaas/loadbalancers' @@ -26,10 +26,11 @@ class LoadBalancer(resource.Resource): allow_list = True _query_mapping = resource.QueryParameters( - 'description', 'flavor', 'name', 'project_id', 'provider', + 'description', 'flavor_id', 'name', 'project_id', 'provider', 'vip_address', 'vip_network_id', 'vip_port_id', 'vip_subnet_id', 'vip_qos_policy_id', 'provisioning_status', 'operating_status', - is_admin_state_up='admin_state_up' + is_admin_state_up='admin_state_up', + **resource.TagMixin._tag_query_parameters ) #: Properties @@ -39,8 +40,8 @@ class LoadBalancer(resource.Resource): created_at = resource.Body('created_at') #: The load balancer description description = resource.Body('description') - #: The load balancer flavor - flavor = resource.Body('flavor') + #: The load balancer flavor ID + flavor_id = resource.Body('flavor_id') #: List of listeners associated with this load balancer listeners = resource.Body('listeners', type=list) #: The load balancer name diff --git a/openstack/load_balancer/v2/member.py b/openstack/load_balancer/v2/member.py index f67ad3b74..3f4201be7 100644 --- a/openstack/load_balancer/v2/member.py +++ b/openstack/load_balancer/v2/member.py @@ -13,7 +13,7 @@ from openstack import resource -class Member(resource.Resource): +class Member(resource.Resource, resource.TagMixin): resource_key = 'member' resources_key = 'members' base_path = '/lbaas/pools/%(pool_id)s/members' @@ -30,6 +30,7 @@ class Member(resource.Resource): 'created_at', 'updated_at', 'provisioning_status', 'operating_status', 'project_id', 'monitor_address', 'monitor_port', 'backup', is_admin_state_up='admin_state_up', + **resource.TagMixin._tag_query_parameters ) # Properties diff --git a/openstack/load_balancer/v2/pool.py b/openstack/load_balancer/v2/pool.py index 9bbc13bf0..8794e9ce1 100644 --- a/openstack/load_balancer/v2/pool.py +++ b/openstack/load_balancer/v2/pool.py @@ -13,7 +13,7 @@ from openstack import resource -class Pool(resource.Resource): +class Pool(resource.Resource, resource.TagMixin): resource_key = 'pool' resources_key = 'pools' base_path = '/lbaas/pools' @@ -29,7 +29,8 @@ class Pool(resource.Resource): 'health_monitor_id', 'lb_algorithm', 'listener_id', 'loadbalancer_id', 'description', 'name', 'project_id', 'protocol', 'created_at', 'updated_at', 'provisioning_status', 'operating_status', - is_admin_state_up='admin_state_up' + is_admin_state_up='admin_state_up', + **resource.TagMixin._tag_query_parameters ) #: Properties diff --git a/openstack/tests/unit/load_balancer/test_health_monitor.py b/openstack/tests/unit/load_balancer/test_health_monitor.py index 710a8e79b..7bfd72c33 100644 --- a/openstack/tests/unit/load_balancer/test_health_monitor.py +++ b/openstack/tests/unit/load_balancer/test_health_monitor.py @@ -72,3 +72,30 @@ class TestPoolHealthMonitor(base.TestCase): self.assertEqual(EXAMPLE['type'], test_hm.type) self.assertEqual(EXAMPLE['updated_at'], test_hm.updated_at) self.assertEqual(EXAMPLE['url_path'], test_hm.url_path) + + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + 'created_at': 'created_at', + 'updated_at': 'updated_at', + 'name': 'name', + 'project_id': 'project_id', + 'tags': 'tags', + 'any_tags': 'tags-any', + 'not_tags': 'not-tags', + 'not_any_tags': 'not-tags-any', + 'operating_status': 'operating_status', + 'provisioning_status': 'provisioning_status', + 'is_admin_state_up': 'admin_state_up', + + 'delay': 'delay', + 'expected_codes': 'expected_codes', + 'http_method': 'http_method', + 'max_retries': 'max_retries', + 'max_retries_down': 'max_retries_down', + 'pool_id': 'pool_id', + 'timeout': 'timeout', + 'type': 'type', + 'url_path': 'url_path' + }, + test_hm._query_mapping._mapping) diff --git a/openstack/tests/unit/load_balancer/test_l7policy.py b/openstack/tests/unit/load_balancer/test_l7policy.py index f8001ad69..a3194f93c 100644 --- a/openstack/tests/unit/load_balancer/test_l7policy.py +++ b/openstack/tests/unit/load_balancer/test_l7policy.py @@ -28,6 +28,7 @@ EXAMPLE = { 'project_id': uuid.uuid4(), 'provisioning_status': 'ACTIVE', 'redirect_pool_id': uuid.uuid4(), + 'redirect_prefix': 'https://www.example.com', 'redirect_url': '/test_url', 'rules': [{'id': uuid.uuid4()}], 'updated_at': '2017-07-17T12:16:57.233772', @@ -64,6 +65,31 @@ class TestL7Policy(base.TestCase): test_l7_policy.provisioning_status) self.assertEqual(EXAMPLE['redirect_pool_id'], test_l7_policy.redirect_pool_id) + self.assertEqual(EXAMPLE['redirect_prefix'], + test_l7_policy.redirect_prefix) self.assertEqual(EXAMPLE['redirect_url'], test_l7_policy.redirect_url) self.assertEqual(EXAMPLE['rules'], test_l7_policy.rules) self.assertEqual(EXAMPLE['updated_at'], test_l7_policy.updated_at) + + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + 'name': 'name', + 'description': 'description', + 'project_id': 'project_id', + 'tags': 'tags', + 'any_tags': 'tags-any', + 'not_tags': 'not-tags', + 'not_any_tags': 'not-tags-any', + 'operating_status': 'operating_status', + 'provisioning_status': 'provisioning_status', + 'is_admin_state_up': 'admin_state_up', + + 'action': 'action', + 'listener_id': 'listener_id', + 'position': 'position', + 'redirect_pool_id': 'redirect_pool_id', + 'redirect_url': 'redirect_url', + 'redirect_prefix': 'redirect_prefix' + }, + test_l7_policy._query_mapping._mapping) diff --git a/openstack/tests/unit/load_balancer/test_l7rule.py b/openstack/tests/unit/load_balancer/test_l7rule.py index c67615a5c..3d93703f2 100644 --- a/openstack/tests/unit/load_balancer/test_l7rule.py +++ b/openstack/tests/unit/load_balancer/test_l7rule.py @@ -63,3 +63,26 @@ class TestL7Rule(base.TestCase): self.assertEqual(EXAMPLE['type'], test_l7rule.type) self.assertEqual(EXAMPLE['updated_at'], test_l7rule.updated_at) self.assertEqual(EXAMPLE['value'], test_l7rule.rule_value) + + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + 'created_at': 'created_at', + 'updated_at': 'updated_at', + 'project_id': 'project_id', + 'tags': 'tags', + 'any_tags': 'tags-any', + 'not_tags': 'not-tags', + 'not_any_tags': 'not-tags-any', + 'operating_status': 'operating_status', + 'provisioning_status': 'provisioning_status', + 'is_admin_state_up': 'admin_state_up', + + 'compare_type': 'compare_type', + 'invert': 'invert', + 'key': 'key', + 'type': 'type', + 'rule_value': 'rule_value', + 'l7_policy_id': 'l7policy_id' + }, + test_l7rule._query_mapping._mapping) diff --git a/openstack/tests/unit/load_balancer/test_listener.py b/openstack/tests/unit/load_balancer/test_listener.py index 93aad261b..5ea719d87 100644 --- a/openstack/tests/unit/load_balancer/test_listener.py +++ b/openstack/tests/unit/load_balancer/test_listener.py @@ -93,3 +93,34 @@ class TestListener(base.TestCase): test_listener.timeout_member_data) self.assertEqual(EXAMPLE['timeout_tcp_inspect'], test_listener.timeout_tcp_inspect) + + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + 'created_at': 'created_at', + 'updated_at': 'updated_at', + 'description': 'description', + 'name': 'name', + 'project_id': 'project_id', + 'tags': 'tags', + 'any_tags': 'tags-any', + 'not_tags': 'not-tags', + 'not_any_tags': 'not-tags-any', + 'operating_status': 'operating_status', + 'provisioning_status': 'provisioning_status', + 'is_admin_state_up': 'admin_state_up', + + 'connection_limit': 'connection_limit', + 'default_pool_id': 'default_pool_id', + 'default_tls_container_ref': 'default_tls_container_ref', + 'sni_container_refs': 'sni_container_refs', + 'insert_headers': 'insert_headers', + 'load_balancer_id': 'load_balancer_id', + 'protocol': 'protocol', + 'protocol_port': 'protocol_port', + 'timeout_client_data': 'timeout_client_data', + 'timeout_member_connect': 'timeout_member_connect', + 'timeout_member_data': 'timeout_member_data', + 'timeout_tcp_inspect': 'timeout_tcp_inspect', + }, + test_listener._query_mapping._mapping) diff --git a/openstack/tests/unit/load_balancer/test_load_balancer.py b/openstack/tests/unit/load_balancer/test_load_balancer.py index 4c2ae6d59..427ad8184 100644 --- a/openstack/tests/unit/load_balancer/test_load_balancer.py +++ b/openstack/tests/unit/load_balancer/test_load_balancer.py @@ -21,7 +21,7 @@ EXAMPLE = { 'admin_state_up': True, 'created_at': '2017-07-17T12:14:57.233772', 'description': 'fake_description', - 'flavor': uuid.uuid4(), + 'flavor_id': uuid.uuid4(), 'id': IDENTIFIER, 'listeners': [{'id', uuid.uuid4()}], 'name': 'test_load_balancer', @@ -59,7 +59,7 @@ class TestLoadBalancer(base.TestCase): self.assertEqual(EXAMPLE['created_at'], test_load_balancer.created_at), self.assertEqual(EXAMPLE['description'], test_load_balancer.description) - self.assertEqual(EXAMPLE['flavor'], test_load_balancer.flavor) + self.assertEqual(EXAMPLE['flavor_id'], test_load_balancer.flavor_id) self.assertEqual(EXAMPLE['id'], test_load_balancer.id) self.assertEqual(EXAMPLE['listeners'], test_load_balancer.listeners) self.assertEqual(EXAMPLE['name'], test_load_balancer.name) @@ -82,6 +82,29 @@ class TestLoadBalancer(base.TestCase): self.assertEqual(EXAMPLE['vip_qos_policy_id'], test_load_balancer.vip_qos_policy_id) + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + 'description': 'description', + 'flavor_id': 'flavor_id', + 'name': 'name', + 'project_id': 'project_id', + 'provider': 'provider', + 'operating_status': 'operating_status', + 'provisioning_status': 'provisioning_status', + 'is_admin_state_up': 'admin_state_up', + 'vip_address': 'vip_address', + 'vip_network_id': 'vip_network_id', + 'vip_port_id': 'vip_port_id', + 'vip_subnet_id': 'vip_subnet_id', + 'vip_qos_policy_id': 'vip_qos_policy_id', + 'tags': 'tags', + 'any_tags': 'tags-any', + 'not_tags': 'not-tags', + 'not_any_tags': 'not-tags-any', + }, + test_load_balancer._query_mapping._mapping) + def test_delete_non_cascade(self): sess = mock.Mock() resp = mock.Mock() diff --git a/openstack/tests/unit/load_balancer/test_member.py b/openstack/tests/unit/load_balancer/test_member.py index 4efcadc40..a99a2858d 100644 --- a/openstack/tests/unit/load_balancer/test_member.py +++ b/openstack/tests/unit/load_balancer/test_member.py @@ -61,3 +61,28 @@ class TestPoolMember(base.TestCase): self.assertEqual(EXAMPLE['subnet_id'], test_member.subnet_id) self.assertEqual(EXAMPLE['weight'], test_member.weight) self.assertFalse(test_member.backup) + + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + 'created_at': 'created_at', + 'updated_at': 'updated_at', + 'name': 'name', + 'project_id': 'project_id', + 'tags': 'tags', + 'any_tags': 'tags-any', + 'not_tags': 'not-tags', + 'not_any_tags': 'not-tags-any', + 'operating_status': 'operating_status', + 'provisioning_status': 'provisioning_status', + 'is_admin_state_up': 'admin_state_up', + + 'address': 'address', + 'protocol_port': 'protocol_port', + 'subnet_id': 'subnet_id', + 'weight': 'weight', + 'monitor_address': 'monitor_address', + 'monitor_port': 'monitor_port', + 'backup': 'backup' + }, + test_member._query_mapping._mapping) diff --git a/openstack/tests/unit/load_balancer/test_pool.py b/openstack/tests/unit/load_balancer/test_pool.py index 5465798fe..efecf5b2d 100644 --- a/openstack/tests/unit/load_balancer/test_pool.py +++ b/openstack/tests/unit/load_balancer/test_pool.py @@ -81,3 +81,27 @@ class TestPool(base.TestCase): self.assertEqual(EXAMPLE['health_monitor_id'], test_pool.health_monitor_id) self.assertEqual(EXAMPLE['members'], test_pool.members) + + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + 'created_at': 'created_at', + 'updated_at': 'updated_at', + 'description': 'description', + 'name': 'name', + 'project_id': 'project_id', + 'tags': 'tags', + 'any_tags': 'tags-any', + 'not_tags': 'not-tags', + 'not_any_tags': 'not-tags-any', + 'operating_status': 'operating_status', + 'provisioning_status': 'provisioning_status', + 'is_admin_state_up': 'admin_state_up', + + 'health_monitor_id': 'health_monitor_id', + 'lb_algorithm': 'lb_algorithm', + 'listener_id': 'listener_id', + 'loadbalancer_id': 'loadbalancer_id', + 'protocol': 'protocol', + }, + test_pool._query_mapping._mapping) diff --git a/releasenotes/notes/add-octavia-tags-support-1c1cf94184e6ebb7.yaml b/releasenotes/notes/add-octavia-tags-support-1c1cf94184e6ebb7.yaml new file mode 100644 index 000000000..5eb3c85e8 --- /dev/null +++ b/releasenotes/notes/add-octavia-tags-support-1c1cf94184e6ebb7.yaml @@ -0,0 +1,10 @@ +--- +features: + - Add tags support for the Octavia (load_balancer) objects. + - | + Added support for the Octavia (load_balancer) L7 Policy "redirect_prefix" + capability. +fixes: + - | + Fixed the Octavia (load_balancer) load balancer objects to have + "flavor_id" instead of the nonexistent "flavor" field.