Merge "Add tags API tests"
diff --git a/octavia_tempest_plugin/common/constants.py b/octavia_tempest_plugin/common/constants.py
index 0424cc5..0e24283 100644
--- a/octavia_tempest_plugin/common/constants.py
+++ b/octavia_tempest_plugin/common/constants.py
@@ -56,6 +56,7 @@
INSERT_HEADERS = 'insert_headers'
X_FORWARDED_FOR = 'X-Forwarded-For'
X_FORWARDED_PORT = 'X-Forwarded-Port'
+TAGS = 'tags'
TIMEOUT_CLIENT_DATA = 'timeout_client_data'
TIMEOUT_MEMBER_CONNECT = 'timeout_member_connect'
TIMEOUT_MEMBER_DATA = 'timeout_member_data'
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/healthmonitor_client.py b/octavia_tempest_plugin/services/load_balancer/v2/healthmonitor_client.py
index 70dce4c..a7d2e6b 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/healthmonitor_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/healthmonitor_client.py
@@ -27,7 +27,7 @@
resource_name = 'healthmonitor'
def create_healthmonitor(self, pool_id, type, delay, timeout, max_retries,
- max_retries_down=Unset, name=Unset,
+ max_retries_down=Unset, name=Unset, tags=Unset,
http_method=Unset, url_path=Unset,
expected_codes=Unset, admin_state_up=Unset,
return_object_only=True):
@@ -44,6 +44,7 @@
changing the operating status of the member to
ERROR.
:param name: Human-readable name of the resource.
+ :param tags: Human-readable tags of the resource.
:param http_method: The HTTP method that the health monitor uses for
requests.
:param url_path: The HTTP URL path of the request sent by the monitor
@@ -167,7 +168,7 @@
def update_healthmonitor(self, healthmonitor_id, delay=Unset,
timeout=Unset, max_retries=Unset,
- max_retries_down=Unset, name=Unset,
+ max_retries_down=Unset, name=Unset, tags=Unset,
http_method=Unset, url_path=Unset,
expected_codes=Unset, admin_state_up=Unset,
return_object_only=True):
@@ -183,6 +184,7 @@
changing the operating status of the member to
ERROR.
:param name: Human-readable name of the resource.
+ :param tags: Human-readable tags of the resource.
:param http_method: The HTTP method that the health monitor uses for
requests.
:param url_path: The HTTP URL path of the request sent by the monitor
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/l7policy_client.py b/octavia_tempest_plugin/services/load_balancer/v2/l7policy_client.py
index 674ec02..1feb72f 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/l7policy_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/l7policy_client.py
@@ -27,7 +27,7 @@
resource_name = 'l7policy'
def create_l7policy(self, listener_id, action, name=Unset,
- description=Unset, admin_state_up=Unset,
+ description=Unset, tags=Unset, admin_state_up=Unset,
position=Unset, redirect_pool_id=Unset,
redirect_url=Unset, return_object_only=True):
"""Create a l7policy.
@@ -36,6 +36,7 @@
:param action: The l7policy action.
:param name: Human-readable name of the resource.
:param description: A human-readable description for the resource.
+ :param tags: A human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param position: The position of this policy on the listener.
@@ -157,7 +158,7 @@
return_object_only=return_object_only)
def update_l7policy(self, l7policy_id, action=Unset, name=Unset,
- description=Unset, admin_state_up=Unset,
+ description=Unset, tags=Unset, admin_state_up=Unset,
position=Unset, redirect_pool_id=Unset,
redirect_url=Unset, return_object_only=True):
"""Update a l7policy.
@@ -166,6 +167,7 @@
:param action: The l7policy action.
:param name: Human-readable name of the resource.
:param description: A human-readable description for the resource.
+ :param tags: A human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param position: The position of this policy on the listener.
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/l7rule_client.py b/octavia_tempest_plugin/services/load_balancer/v2/l7rule_client.py
index 2ca1c71..be5434d 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/l7rule_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/l7rule_client.py
@@ -38,7 +38,7 @@
object=self.list_root_tag
)
- def create_l7rule(self, l7policy_id, type, value, compare_type,
+ def create_l7rule(self, l7policy_id, type, value, compare_type, tags=Unset,
admin_state_up=Unset, key=Unset, invert=Unset,
return_object_only=True):
"""Create a l7rule.
@@ -47,6 +47,7 @@
:param type: The L7 rule type.
:param value: The value to use for the comparison.
:param compare_type: The comparison type for the L7 rule.
+ :param tags: The tags of the L7 rule.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param key: The key to use for the comparison.
@@ -171,8 +172,8 @@
return_object_only=return_object_only)
def update_l7rule(self, l7rule_id, l7policy_id, type=Unset, value=Unset,
- compare_type=Unset, admin_state_up=Unset, key=Unset,
- invert=Unset, return_object_only=True):
+ compare_type=Unset, tags=Unset, admin_state_up=Unset,
+ key=Unset, invert=Unset, return_object_only=True):
"""Update a l7rule.
:param l7rule_id: The l7rule ID to update.
@@ -180,6 +181,7 @@
:param type: The L7 rule type.
:param value: The value to use for the comparison.
:param compare_type: The comparison type for the L7 rule.
+ :param tags: The tags of the L7 rule.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param key: The key to use for the comparison.
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/listener_client.py b/octavia_tempest_plugin/services/load_balancer/v2/listener_client.py
index 1cc17ff..eb7690a 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/listener_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/listener_client.py
@@ -29,8 +29,9 @@
list_root_tag = 'listeners'
def create_listener(self, protocol, protocol_port, loadbalancer_id,
- name=Unset, description=Unset, admin_state_up=Unset,
- connection_limit=Unset, timeout_client_data=Unset,
+ name=Unset, description=Unset, tags=Unset,
+ admin_state_up=Unset, connection_limit=Unset,
+ timeout_client_data=Unset,
timeout_member_connect=Unset,
timeout_member_data=Unset, timeout_tcp_inspect=Unset,
insert_headers=Unset, default_pool_id=Unset,
@@ -46,6 +47,7 @@
:param loadbalancer_id: The ID of the load balancer.
:param name: Human-readable name of the resource.
:param description: A human-readable description for the resource.
+ :param tags: A human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param connection_limit: The maximum number of connections permitted
@@ -198,8 +200,8 @@
return_object_only=return_object_only)
def update_listener(self, listener_id, name=Unset, description=Unset,
- admin_state_up=Unset, connection_limit=Unset,
- timeout_client_data=Unset,
+ tags=Unset, admin_state_up=Unset,
+ connection_limit=Unset, timeout_client_data=Unset,
timeout_member_connect=Unset,
timeout_member_data=Unset, timeout_tcp_inspect=Unset,
insert_headers=Unset, default_pool_id=Unset,
@@ -213,6 +215,7 @@
:param listener_id: The listener ID to update.
:param name: Human-readable name of the resource.
:param description: A human-readable description for the resource.
+ :param tags: A human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param connection_limit: The maximum number of connections permitted
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/loadbalancer_client.py b/octavia_tempest_plugin/services/load_balancer/v2/loadbalancer_client.py
index 9a287cf..0fafbf2 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/loadbalancer_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/loadbalancer_client.py
@@ -39,7 +39,8 @@
listeners=Unset, project_id=Unset, provider=Unset,
vip_address=Unset, vip_network_id=Unset,
vip_port_id=Unset, vip_qos_policy_id=Unset,
- vip_subnet_id=Unset, return_object_only=True):
+ vip_subnet_id=Unset, return_object_only=True,
+ tags=Unset):
"""Create a loadbalancer.
:param name: Human-readable name of the resource.
@@ -56,6 +57,7 @@
:param vip_qos_policy_id: The ID of the QoS Policy which will apply to
the Virtual IP (VIP).
:param vip_subnet_id: The ID of the subnet for the Virtual IP (VIP).
+ :param tags: A human-readable tags of the resource.
:param return_object_only: If True, the response returns the object
inside the root tag. False returns the full
response from the API.
@@ -170,13 +172,15 @@
return_object_only=return_object_only)
def update_loadbalancer(self, lb_id, name=Unset, description=Unset,
- admin_state_up=Unset, vip_qos_policy_id=Unset,
+ tags=Unset, admin_state_up=Unset,
+ vip_qos_policy_id=Unset,
return_object_only=True):
"""Update a loadbalancer.
:param lb_id: The loadbalancer ID to update.
:param name: Human-readable name of the resource.
:param description: A human-readable description for the resource.
+ :param tags: A human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param vip_qos_policy_id: The ID of the QoS Policy which will apply to
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/member_client.py b/octavia_tempest_plugin/services/load_balancer/v2/member_client.py
index 63e836a..0f0d639 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/member_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/member_client.py
@@ -40,7 +40,8 @@
)
def create_member(self, pool_id, address, protocol_port,
- name=Unset, admin_state_up=Unset, weight=Unset,
+ name=Unset, tags=Unset, admin_state_up=Unset,
+ weight=Unset,
backup=Unset, subnet_id=Unset, monitor_address=Unset,
monitor_port=Unset, return_object_only=True):
"""Create a member.
@@ -49,12 +50,15 @@
:param address: The IP address of the resource.
:param protocol_port: The protocol port number for the resource.
:param name: Human-readable name of the resource.
+ :param tags: Human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param weight: The weight of a member determines the portion of
requests or connections it services compared to the
other members of the pool.
:param backup: Is the member a backup?
+ :param subnet_id: The subnet ID which the member service
+ is accessible from
:param monitor_address: An alternate IP address used for health
monitoring a backend member.
:param monitor_port: An alternate protocol port used for health
@@ -178,7 +182,7 @@
query_params=query_params,
return_object_only=return_object_only)
- def update_member(self, member_id, pool_id, name=Unset,
+ def update_member(self, member_id, pool_id, name=Unset, tags=Unset,
admin_state_up=Unset, weight=Unset, backup=Unset,
monitor_address=Unset, monitor_port=Unset,
return_object_only=True):
@@ -187,6 +191,7 @@
:param member_id: The member ID to update.
:param pool_id: The ID of the pool where the member lives.
:param name: Human-readable name of the resource.
+ :param tags: Human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param weight: The weight of a member determines the portion of
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/pool_client.py b/octavia_tempest_plugin/services/load_balancer/v2/pool_client.py
index 46ec38d..58db1af 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/pool_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/pool_client.py
@@ -28,6 +28,7 @@
def create_pool(self, protocol, lb_algorithm, loadbalancer_id=Unset,
listener_id=Unset, name=Unset, description=Unset,
+ tags=Unset,
admin_state_up=Unset, session_persistence=Unset,
return_object_only=True):
"""Create a pool.
@@ -38,6 +39,7 @@
:param listener_id: The ID of the listener for the pool.
:param name: Human-readable name of the resource.
:param description: A human-readable description for the resource.
+ :param tags: A human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param session_persistence: A JSON object specifying the session
@@ -156,7 +158,7 @@
return_object_only=return_object_only)
def update_pool(self, pool_id, lb_algorithm=Unset, name=Unset,
- description=Unset, admin_state_up=Unset,
+ description=Unset, tags=Unset, admin_state_up=Unset,
session_persistence=Unset, return_object_only=True):
"""Update a pool.
@@ -164,6 +166,7 @@
:param lb_algorithm: The load balancing algorithm for the pool.
:param name: Human-readable name of the resource.
:param description: A human-readable description for the resource.
+ :param tags: A human-readable tags of the resource.
:param admin_state_up: The administrative state of the resource, which
is up (true) or down (false).
:param session_persistence: A JSON object specifying the session
diff --git a/octavia_tempest_plugin/tests/api/v2/test_availability_zone.py b/octavia_tempest_plugin/tests/api/v2/test_availability_zone.py
index 816e00e..29426c2 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_availability_zone.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_availability_zone.py
@@ -127,6 +127,15 @@
self.assertEqual(self.availability_zone_profile_id,
availability_zone[const.AVAILABILITY_ZONE_PROFILE_ID])
+ # Test that availability_zones do not support tags
+ availability_zone_tags = ["Hello", "World"]
+ tags_availability_zone_kwargs = availability_zone_kwargs.copy()
+ tags_availability_zone_kwargs[const.TAGS] = availability_zone_tags
+ self.assertRaises(
+ TypeError,
+ self.lb_admin_availability_zone_client.create_availability_zone,
+ **tags_availability_zone_kwargs)
+
@decorators.idempotent_id('bba84c0c-2832-4c4c-90ff-d28acfe4ae36')
def test_availability_zone_list(self):
"""Tests availability zone list API and field filtering.
diff --git a/octavia_tempest_plugin/tests/api/v2/test_availability_zone_profile.py b/octavia_tempest_plugin/tests/api/v2/test_availability_zone_profile.py
index c062dbe..f5e4b7e 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_availability_zone_profile.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_availability_zone_profile.py
@@ -104,6 +104,17 @@
availability_zone_data_json,
availability_zone_profile[const.AVAILABILITY_ZONE_DATA])
+ # Testing that availability_zone_profiles do not support tags
+ availability_zone_profile_tags = ["Hello", "World"]
+ tags_availability_zone_profile_kwargs = (
+ availability_zone_profile_kwargs.copy())
+ tags_availability_zone_profile_kwargs[const.TAGS] = (
+ availability_zone_profile_tags)
+ az_profile_client = self.lb_admin_availability_zone_profile_client
+ self.assertRaises(TypeError,
+ az_profile_client.create_availability_zone_profile,
+ **tags_availability_zone_profile_kwargs)
+
@decorators.idempotent_id('ef7d1c45-e312-46ce-8dcb-f2fe26295658')
def test_availability_zone_profile_list(self):
"""Tests availability zone profile list API and field filtering.
diff --git a/octavia_tempest_plugin/tests/api/v2/test_flavor.py b/octavia_tempest_plugin/tests/api/v2/test_flavor.py
index be3ac76..4333121 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_flavor.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_flavor.py
@@ -105,6 +105,14 @@
self.assertEqual(self.flavor_profile_id,
flavor[const.FLAVOR_PROFILE_ID])
+ # Test that flavors do not support tags
+ flavor_tags = ["Hello", "World"]
+ tags_flavor_kwargs = flavor_kwargs.copy()
+ tags_flavor_kwargs[const.TAGS] = flavor_tags
+ self.assertRaises(TypeError,
+ self.lb_admin_flavor_client.create_flavor,
+ **tags_flavor_kwargs)
+
@decorators.idempotent_id('3ef040ee-fe7e-457b-a56f-8b152f7afa3b')
def test_flavor_list(self):
"""Tests flavor list API and field filtering.
diff --git a/octavia_tempest_plugin/tests/api/v2/test_flavor_profile.py b/octavia_tempest_plugin/tests/api/v2/test_flavor_profile.py
index 3bd6e54..8f9c7d3 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_flavor_profile.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_flavor_profile.py
@@ -80,6 +80,15 @@
flavor_profile[const.PROVIDER_NAME])
self.assertEqual(flavor_data_json, flavor_profile[const.FLAVOR_DATA])
+ # Testing that flavor_profiles do not support tags
+ flavor_profile_tags = ["Hello", "World"]
+ tags_flavor_profile_kwargs = flavor_profile_kwargs.copy()
+ tags_flavor_profile_kwargs[const.TAGS] = flavor_profile_tags
+ self.assertRaises(
+ TypeError,
+ self.lb_admin_flavor_profile_client.create_flavor_profile,
+ **tags_flavor_profile_kwargs)
+
@decorators.idempotent_id('c4e17fdf-849a-4132-93ae-dfca21ce4444')
def test_flavor_profile_list(self):
"""Tests flavor profile list API and field filtering.
diff --git a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
index 1feb9d9..8001899 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
@@ -107,6 +107,13 @@
const.ADMIN_STATE_UP: True,
}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ hw_tags = ["Hello", "World"]
+ hm_kwargs.update({
+ const.TAGS: hw_tags
+ })
+
# Test that a user without the loadbalancer role cannot
# create a healthmonitor
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
@@ -148,6 +155,10 @@
for item in equal_items:
self.assertEqual(hm_kwargs[item], hm[item])
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(hw_tags, hm[const.TAGS])
+
# Helper functions for test healthmonitor list
def _filter_hms_by_pool_id(self, hms, pool_ids):
return [hm for hm in hms
@@ -250,6 +261,13 @@
const.EXPECTED_CODES: '200-204',
const.ADMIN_STATE_UP: True,
}
+
+ if self.mem_healthmonitor_client.is_version_supported(
+ self.api_version, '2.5'):
+ hm1_tags = ["English", "Mathematics",
+ "Marketing", "Creativity"]
+ hm1_kwargs.update({const.TAGS: hm1_tags})
+
hm1 = self.mem_healthmonitor_client.create_healthmonitor(
**hm1_kwargs)
self.addCleanup(
@@ -286,6 +304,13 @@
const.EXPECTED_CODES: '200-204',
const.ADMIN_STATE_UP: True,
}
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ hm2_tags = ["English", "Spanish",
+ "Soft_skills", "Creativity"]
+ hm2_kwargs.update({const.TAGS: hm2_tags})
+
hm2 = self.mem_healthmonitor_client.create_healthmonitor(
**hm2_kwargs)
self.addCleanup(
@@ -322,6 +347,13 @@
const.EXPECTED_CODES: '200-204',
const.ADMIN_STATE_UP: False,
}
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ hm3_tags = ["English", "Project_management",
+ "Communication", "Creativity"]
+ hm3_kwargs.update({const.TAGS: hm3_tags})
+
hm3 = self.mem_healthmonitor_client.create_healthmonitor(
**hm3_kwargs)
self.addCleanup(
@@ -455,6 +487,28 @@
self.assertEqual(hm1[const.NAME],
hms[0][const.NAME])
+ # Creating a list of 3 healthmonitors, each one contains different tags
+ if self.mem_healthmonitor_client.is_version_supported(
+ self.api_version, '2.5'):
+ list_of_hms = [hm1, hm2, hm3]
+ test_list = []
+ for hm in list_of_hms:
+
+ # If tags "English" and "Creativity" are in the HM's tags
+ # and "Spanish" is not, add the HM to the list
+ if "English" in hm[const.TAGS] and "Creativity" in (
+ hm[const.TAGS]) and "Spanish" not in (
+ hm[const.TAGS]):
+ test_list.append(hm[const.NAME])
+
+ # Tests if only the first and the third ones have those tags
+ self.assertEqual(
+ test_list, [hm1[const.NAME], hm3[const.NAME]])
+
+ # Tests that filtering by an empty tag will return an empty list
+ self.assertTrue(not any(["" in hm[const.TAGS]
+ for hm in list_of_hms]))
+
@decorators.idempotent_id('284e8d3b-7b2d-4697-9e41-580b3423c0b4')
def test_healthmonitor_show(self):
"""Tests healthmonitor show API.
@@ -607,6 +661,13 @@
const.ADMIN_STATE_UP: False,
}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ hw_tags = ["Hello", "World"]
+ hm_kwargs.update({
+ const.TAGS: hw_tags
+ })
+
hm = self.mem_healthmonitor_client.create_healthmonitor(**hm_kwargs)
self.addCleanup(
self.mem_healthmonitor_client.cleanup_healthmonitor,
@@ -643,6 +704,10 @@
for item in equal_items:
self.assertEqual(hm_kwargs[item], hm[item])
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(hw_tags, hm[const.TAGS])
+
# Test that a user, without the loadbalancer member role, cannot
# use this command
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
@@ -685,6 +750,14 @@
const.EXPECTED_CODES: '201,202',
const.ADMIN_STATE_UP: not hm_kwargs[const.ADMIN_STATE_UP],
}
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ hw_new_tags = ["Hola", "Mundo"]
+ hm_update_kwargs.update({
+ const.TAGS: hw_new_tags
+ })
+
hm = self.mem_healthmonitor_client.update_healthmonitor(
hm[const.ID], **hm_update_kwargs)
@@ -712,6 +785,10 @@
const.HTTP_METHOD, const.URL_PATH, const.EXPECTED_CODES,
const.ADMIN_STATE_UP]
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ equal_items.append(const.TAGS)
+
for item in equal_items:
self.assertEqual(hm_update_kwargs[item], hm[item])
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
index b1bccc2..b99706b 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
@@ -134,6 +134,14 @@
const.ADMIN_STATE_UP: True,
const.POSITION: 1,
}
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7_policy_tags = ["Hello", "World"]
+ l7policy_kwargs.update({
+ const.TAGS: l7_policy_tags
+ })
+
if url:
l7policy_kwargs[const.ACTION] = const.REDIRECT_TO_URL
l7policy_kwargs[const.REDIRECT_URL] = url
@@ -202,6 +210,10 @@
self.assertIsNone(l7policy.pop(const.REDIRECT_URL, None))
self.assertIsNone(l7policy.pop(const.REDIRECT_POOL_ID, None))
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(l7_policy_tags, l7policy[const.TAGS])
+
@decorators.idempotent_id('42fa14ba-caf1-465e-ab36-27e7501f95ef')
def test_l7policy_list(self):
"""Tests l7policy list API and field filtering.
@@ -248,6 +260,13 @@
const.POSITION: 1,
const.ACTION: const.REJECT
}
+
+ if self.mem_l7policy_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7policy1_tags = ["English", "Mathematics",
+ "Marketing", "Creativity"]
+ l7policy1_kwargs.update({const.TAGS: l7policy1_tags})
+
l7policy1 = self.mem_l7policy_client.create_l7policy(
**l7policy1_kwargs)
self.addCleanup(
@@ -281,6 +300,13 @@
const.ACTION: const.REDIRECT_TO_POOL,
const.REDIRECT_POOL_ID: self.pool_id
}
+
+ if self.mem_l7policy_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7policy2_tags = ["English", "Spanish",
+ "Soft_skills", "Creativity"]
+ l7policy2_kwargs.update({const.TAGS: l7policy2_tags})
+
l7policy2 = self.mem_l7policy_client.create_l7policy(
**l7policy2_kwargs)
self.addCleanup(
@@ -315,6 +341,13 @@
const.ACTION: const.REDIRECT_TO_URL,
const.REDIRECT_URL: l7_redirect_url
}
+
+ if self.mem_l7policy_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7policy3_tags = ["English", "Project_management",
+ "Communication", "Creativity"]
+ l7policy3_kwargs.update({const.TAGS: l7policy3_tags})
+
l7policy3 = self.mem_l7policy_client.create_l7policy(
**l7policy3_kwargs)
self.addCleanup(
@@ -473,6 +506,28 @@
self.assertEqual(l7policy1[const.DESCRIPTION],
l7policies[0][const.DESCRIPTION])
+ # Creating a list of 3 l7policies, each one contains different tags
+ if self.mem_l7policy_client.is_version_supported(
+ self.api_version, '2.5'):
+ list_of_l7policies = [l7policy1, l7policy2, l7policy3]
+ test_list = []
+ for l7policy in list_of_l7policies:
+
+ # If tags "English" and "Creativity" are in the l7policy's tags
+ # and "Spanish" is not, add the l7policy to the list
+ if "English" in l7policy[const.TAGS] and "Creativity" in (
+ l7policy[const.TAGS]) and "Spanish" not in (
+ l7policy[const.TAGS]):
+ test_list.append(l7policy[const.NAME])
+
+ # Tests if only the first and the third ones have those tags
+ self.assertEqual(
+ test_list, [l7policy1[const.NAME], l7policy3[const.NAME]])
+
+ # Tests that filtering by an empty tag will return an empty list
+ self.assertTrue(not any(["" in l7policy[const.TAGS]
+ for l7policy in list_of_l7policies]))
+
@decorators.idempotent_id('baaa8104-a037-4976-b908-82a0b3e08129')
def test_l7policy_show(self):
"""Tests l7policy show API.
@@ -630,6 +685,13 @@
const.REDIRECT_URL: l7_redirect_url,
}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7_policy_tags = ["Hello", "World"]
+ l7policy_kwargs.update({
+ const.TAGS: l7_policy_tags
+ })
+
l7policy = self.mem_l7policy_client.create_l7policy(**l7policy_kwargs)
self.addClassResourceCleanup(
self.mem_l7policy_client.cleanup_l7policy,
@@ -665,6 +727,10 @@
self.assertEqual(l7_redirect_url, l7policy[const.REDIRECT_URL])
self.assertIsNone(l7policy.pop(const.REDIRECT_POOL_ID, None))
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(l7_policy_tags, l7policy[const.TAGS])
+
# Test that a user, without the load balancer member role, cannot
# use this command
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
@@ -706,6 +772,14 @@
const.ACTION: const.REDIRECT_TO_POOL,
const.REDIRECT_POOL_ID: self.pool_id,
}
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7_policy_new_tags = ["Hola", "Mundo"]
+ l7policy_update_kwargs.update({
+ const.TAGS: l7_policy_new_tags
+ })
+
l7policy = self.mem_l7policy_client.update_l7policy(
l7policy[const.ID], **l7policy_update_kwargs)
@@ -745,6 +819,11 @@
self.assertEqual(self.pool_id, l7policy[const.REDIRECT_POOL_ID])
self.assertIsNone(l7policy.pop(const.REDIRECT_URL, None))
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(l7_policy_new_tags,
+ l7policy[const.TAGS])
+
@decorators.idempotent_id('7925eb4b-94b6-4c28-98c2-fd0b4f0976cc')
def test_l7policy_delete(self):
"""Tests l7policy create and delete APIs.
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
index 9a73034..e954b84 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
@@ -143,6 +143,13 @@
const.INVERT: False,
}
+ if self.mem_l7policy_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7_rule_tags = ["Hello", "World"]
+ l7rule_kwargs.update({
+ const.TAGS: l7_rule_tags
+ })
+
# Test that a user without the load balancer role cannot
# create a l7rule
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
@@ -193,6 +200,10 @@
for item in equal_items:
self.assertEqual(l7rule_kwargs[item], l7rule[item])
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(l7_rule_tags, l7rule[const.TAGS])
+
@decorators.idempotent_id('69095254-f106-4fb6-9f54-7a78cc14fb51')
def test_l7rule_list(self):
"""Tests l7rule list API and field filtering.
@@ -232,6 +243,13 @@
const.COMPARE_TYPE: const.EQUAL_TO,
const.KEY: 'mykey2-list',
}
+
+ if self.mem_lb_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7rule1_tags = ["English", "Mathematics",
+ "Marketing", "Creativity"]
+ l7rule1_kwargs.update({const.TAGS: l7rule1_tags})
+
l7rule1 = self.mem_l7rule_client.create_l7rule(
**l7rule1_kwargs)
self.addCleanup(
@@ -263,6 +281,13 @@
const.COMPARE_TYPE: const.EQUAL_TO,
const.KEY: 'mykey1-list',
}
+
+ if self.mem_lb_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7rule2_tags = ["English", "Spanish",
+ "Soft_skills", "Creativity"]
+ l7rule2_kwargs.update({const.TAGS: l7rule2_tags})
+
l7rule2 = self.mem_l7rule_client.create_l7rule(
**l7rule2_kwargs)
self.addCleanup(
@@ -294,6 +319,13 @@
const.COMPARE_TYPE: const.EQUAL_TO,
const.KEY: 'mykey3-list',
}
+
+ if self.mem_lb_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7rule3_tags = ["English", "Project_management",
+ "Communication", "Creativity"]
+ l7rule3_kwargs.update({const.TAGS: l7rule3_tags})
+
l7rule3 = self.mem_l7rule_client.create_l7rule(
**l7rule3_kwargs)
self.addCleanup(
@@ -414,6 +446,28 @@
self.assertEqual(l7rule1[const.VALUE],
l7rules[0][const.VALUE])
+ # Creating a list of 3 l7rules, each one contains different tags
+ if self.mem_l7rule_client.is_version_supported(
+ self.api_version, '2.5'):
+ list_of_l7rules = [l7rule1, l7rule2, l7rule3]
+ test_list = []
+ for l7rule in list_of_l7rules:
+
+ # If tags "English" and "Creativity" are in the l7rule's tags
+ # and "Spanish" is not, add the l7rule to the list
+ if "English" in l7rule[const.TAGS] and "Creativity" in (
+ l7rule[const.TAGS]) and "Spanish" not in (
+ l7rule[const.TAGS]):
+ test_list.append(l7rule[const.VALUE])
+
+ # Tests if only the first and the third ones have those tags
+ self.assertEqual(
+ [l7rule1[const.VALUE], l7rule3[const.VALUE]], test_list)
+
+ # Tests that filtering by an empty tag will return an empty list
+ self.assertTrue(not any(["" in l7rule[const.TAGS]
+ for l7rule in list_of_l7rules]))
+
@decorators.idempotent_id('b80b34c3-09fc-467b-8027-7350adb17070')
def test_l7rule_show(self):
"""Tests l7rule show API.
@@ -526,6 +580,13 @@
const.INVERT: False,
}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7_rule_tags = ["Hello", "World"]
+ l7rule_kwargs.update({
+ const.TAGS: l7_rule_tags
+ })
+
l7rule = self.mem_l7rule_client.create_l7rule(**l7rule_kwargs)
self.addClassResourceCleanup(
self.mem_l7rule_client.cleanup_l7rule,
@@ -557,6 +618,10 @@
equal_items = [const.ADMIN_STATE_UP, const.TYPE, const.VALUE,
const.COMPARE_TYPE, const.KEY, const.INVERT]
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ equal_items.append(const.TAGS)
+
for item in equal_items:
self.assertEqual(l7rule_kwargs[item], l7rule[item])
@@ -599,6 +664,13 @@
const.KEY: 'mykey-UPDATED',
const.INVERT: True,
}
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ l7rule_update_kwargs.update({
+ const.TAGS: ["Hola", "Mundo"]
+ })
+
l7rule = self.mem_l7rule_client.update_l7rule(
l7rule[const.ID], **l7rule_update_kwargs)
@@ -624,6 +696,11 @@
# Test changed items (which is all of them, for l7rules)
equal_items = [const.ADMIN_STATE_UP, const.TYPE, const.VALUE,
const.COMPARE_TYPE, const.KEY, const.INVERT]
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ equal_items.append(const.TAGS)
+
for item in equal_items:
self.assertEqual(l7rule_update_kwargs[item], l7rule[item])
diff --git a/octavia_tempest_plugin/tests/api/v2/test_listener.py b/octavia_tempest_plugin/tests/api/v2/test_listener.py
index 3a45656..81af3e3 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_listener.py
@@ -102,6 +102,13 @@
const.TIMEOUT_TCP_INSPECT: 50,
})
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ listener_tags = [str(x) for x in range(100)]
+ listener_kwargs.update({
+ const.TAGS: listener_tags
+ })
+
# Test that a user without the load balancer role cannot
# create a listener
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
@@ -135,9 +142,21 @@
CONF.load_balancer.build_interval,
CONF.load_balancer.build_timeout)
- self.assertEqual(listener_name, listener[const.NAME])
- self.assertEqual(listener_description, listener[const.DESCRIPTION])
- self.assertTrue(listener[const.ADMIN_STATE_UP])
+ equal_items = [const.NAME, const.DESCRIPTION,
+ const.ADMIN_STATE_UP,
+ const.PROTOCOL, const.PROTOCOL_PORT,
+ const.CONNECTION_LIMIT]
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.1'):
+ equal_items.append(const.TIMEOUT_CLIENT_DATA)
+ equal_items.append(const.TIMEOUT_MEMBER_CONNECT)
+ equal_items.append(const.TIMEOUT_MEMBER_DATA)
+ equal_items.append(const.TIMEOUT_TCP_INSPECT)
+
+ for item in equal_items:
+ self.assertEqual(listener_kwargs[item], listener[item])
+
parser.parse(listener[const.CREATED_AT])
parser.parse(listener[const.UPDATED_AT])
UUID(listener[const.ID])
@@ -146,20 +165,17 @@
self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
else:
self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
- self.assertEqual(self.protocol, listener[const.PROTOCOL])
- self.assertEqual(80, listener[const.PROTOCOL_PORT])
- self.assertEqual(200, listener[const.CONNECTION_LIMIT])
+
insert_headers = listener[const.INSERT_HEADERS]
self.assertTrue(
strutils.bool_from_string(insert_headers[const.X_FORWARDED_FOR]))
self.assertTrue(
strutils.bool_from_string(insert_headers[const.X_FORWARDED_PORT]))
+
if self.mem_listener_client.is_version_supported(
- self.api_version, '2.1'):
- self.assertEqual(1000, listener[const.TIMEOUT_CLIENT_DATA])
- self.assertEqual(1000, listener[const.TIMEOUT_MEMBER_CONNECT])
- self.assertEqual(1000, listener[const.TIMEOUT_MEMBER_DATA])
- self.assertEqual(50, listener[const.TIMEOUT_TCP_INSPECT])
+ self.api_version, '2.5'):
+ self.assertEqual(sorted(listener_tags),
+ sorted(listener[const.TAGS]))
@decorators.idempotent_id('cceac303-4db5-4d5a-9f6e-ff33780a5f29')
def test_listener_create_on_same_port(self):
@@ -336,6 +352,12 @@
const.PROTOCOL_PORT: 80,
const.LOADBALANCER_ID: lb_id,
}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ listener1_tags = ["English", "Mathematics",
+ "Marketing", "Creativity"]
+ listener1_kwargs.update({const.TAGS: listener1_tags})
+
listener1 = self.mem_listener_client.create_listener(
**listener1_kwargs)
self.addCleanup(
@@ -368,6 +390,12 @@
const.PROTOCOL_PORT: 81,
const.LOADBALANCER_ID: lb_id,
}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ listener2_tags = ["English", "Spanish",
+ "Soft_skills", "Creativity"]
+ listener2_kwargs.update({const.TAGS: listener2_tags})
+
listener2 = self.mem_listener_client.create_listener(
**listener2_kwargs)
self.addCleanup(
@@ -400,6 +428,12 @@
const.PROTOCOL_PORT: 82,
const.LOADBALANCER_ID: lb_id,
}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ listener3_tags = ["English", "Project_management",
+ "Communication", "Creativity"]
+ listener3_kwargs.update({const.TAGS: listener3_tags})
+
listener3 = self.mem_listener_client.create_listener(
**listener3_kwargs)
self.addCleanup(
@@ -542,6 +576,28 @@
self.assertEqual(listener1[const.DESCRIPTION],
listeners[0][const.DESCRIPTION])
+ # Creating a list of 3 listeners, each one contains different tags
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ list_of_listeners = [listener1, listener2, listener3]
+ test_list = []
+ for listener in list_of_listeners:
+
+ # If tags "English" and "Creativity" are in the listener's tags
+ # and "Spanish" is not, add the listener to the list
+ if "English" in listener[const.TAGS] and "Creativity" in (
+ listener[const.TAGS]) and "Spanish" not in (
+ listener[const.TAGS]):
+ test_list.append(listener[const.NAME])
+
+ # Tests if only the first and the third ones have those tags
+ self.assertEqual(
+ test_list, [listener1[const.NAME], listener3[const.NAME]])
+
+ # Tests that filtering by an empty tag will return an empty list
+ self.assertTrue(not any(["" in listener[const.TAGS]
+ for listener in list_of_listeners]))
+
@decorators.idempotent_id('6e299eae-6907-4dfc-89c2-e57709d25d3d')
def test_listener_show(self):
"""Tests listener show API.
@@ -581,6 +637,13 @@
const.TIMEOUT_TCP_INSPECT: 50,
})
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ listener_tags = ["hello", "world"]
+ listener_kwargs.update({
+ const.TAGS: listener_tags
+ })
+
listener = self.mem_listener_client.create_listener(**listener_kwargs)
self.addClassResourceCleanup(
self.mem_listener_client.cleanup_listener,
@@ -605,10 +668,31 @@
const.ONLINE,
CONF.load_balancer.build_interval,
CONF.load_balancer.build_timeout)
+ equal_items = [const.NAME, const.DESCRIPTION,
+ const.ADMIN_STATE_UP,
+ const.PROTOCOL, const.PROTOCOL_PORT,
+ const.CONNECTION_LIMIT]
- self.assertEqual(listener_name, listener[const.NAME])
- self.assertEqual(listener_description, listener[const.DESCRIPTION])
- self.assertTrue(listener[const.ADMIN_STATE_UP])
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.1'):
+ equal_items.append(const.TIMEOUT_CLIENT_DATA)
+ equal_items.append(const.TIMEOUT_MEMBER_CONNECT)
+ equal_items.append(const.TIMEOUT_MEMBER_DATA)
+ equal_items.append(const.TIMEOUT_TCP_INSPECT)
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ equal_items.append(const.TAGS)
+
+ for item in equal_items:
+ self.assertEqual(listener_kwargs[item], listener[item])
+
+ insert_headers = listener[const.INSERT_HEADERS]
+ self.assertTrue(
+ strutils.bool_from_string(insert_headers[const.X_FORWARDED_FOR]))
+ self.assertTrue(
+ strutils.bool_from_string(insert_headers[const.X_FORWARDED_PORT]))
+
parser.parse(listener[const.CREATED_AT])
parser.parse(listener[const.UPDATED_AT])
UUID(listener[const.ID])
@@ -617,21 +701,6 @@
self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
else:
self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
- self.assertEqual(self.protocol, listener[const.PROTOCOL])
- self.assertEqual(81, listener[const.PROTOCOL_PORT])
- self.assertEqual(200, listener[const.CONNECTION_LIMIT])
- insert_headers = listener[const.INSERT_HEADERS]
- self.assertTrue(
- strutils.bool_from_string(insert_headers[const.X_FORWARDED_FOR]))
- self.assertTrue(
- strutils.bool_from_string(insert_headers[const.X_FORWARDED_PORT]))
-
- if self.mem_listener_client.is_version_supported(
- self.api_version, '2.1'):
- self.assertEqual(1000, listener[const.TIMEOUT_CLIENT_DATA])
- self.assertEqual(1000, listener[const.TIMEOUT_MEMBER_CONNECT])
- self.assertEqual(1000, listener[const.TIMEOUT_MEMBER_DATA])
- self.assertEqual(50, listener[const.TIMEOUT_TCP_INSPECT])
# Test that a user with lb_admin role can see the listener
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
@@ -702,6 +771,13 @@
const.TIMEOUT_TCP_INSPECT: 50,
})
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ listener_tags = ["Hello", "World"]
+ listener_kwargs.update({
+ const.TAGS: listener_tags
+ })
+
listener = self.mem_listener_client.create_listener(**listener_kwargs)
self.addClassResourceCleanup(
self.mem_listener_client.cleanup_listener,
@@ -743,6 +819,10 @@
self.assertEqual(1000, listener[const.TIMEOUT_MEMBER_DATA])
self.assertEqual(50, listener[const.TIMEOUT_TCP_INSPECT])
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(listener_tags, listener[const.TAGS])
+
# Test that a user, without the load balancer member role, cannot
# use this command
if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
@@ -799,6 +879,13 @@
const.TIMEOUT_TCP_INSPECT: 100,
})
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ listener_updated_tags = ["Hola", "Mundo"]
+ listener_update_kwargs.update({
+ const.TAGS: listener_updated_tags
+ })
+
listener = self.mem_listener_client.update_listener(
listener[const.ID], **listener_update_kwargs)
@@ -842,6 +929,10 @@
self.assertEqual(2000, listener[const.TIMEOUT_MEMBER_DATA])
self.assertEqual(100, listener[const.TIMEOUT_TCP_INSPECT])
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(listener_updated_tags, listener[const.TAGS])
+
@decorators.idempotent_id('16f11c82-f069-4592-8954-81b35a98e3b7')
def test_listener_delete(self):
"""Tests listener create and delete APIs.
diff --git a/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py b/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
index b4dde1f..409630c 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
@@ -69,6 +69,13 @@
# vip_qos_policy_id=lb_qos_policy_id)
const.NAME: lb_name}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ lb_tags = ["Hello", "World"]
+ lb_kwargs.update({
+ const.TAGS: lb_tags
+ })
+
self._setup_lb_network_kwargs(lb_kwargs, ip_version, use_fixed_ip=True)
# Test that a user without the load balancer role cannot
@@ -139,6 +146,10 @@
except Exception:
pass
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(lb_tags, lb[const.TAGS])
+
@decorators.idempotent_id('643ef031-c800-45f2-b229-3c8f8b37c829')
def test_load_balancer_delete(self):
"""Tests load balancer create and delete APIs.
@@ -263,17 +274,29 @@
lb_name = data_utils.rand_name("lb_member_lb2-list")
lb_description = data_utils.rand_name('B')
+ lb_admin_state_up = True
+ lb_provider = CONF.load_balancer.provider
+ lb_vip_network_id = self.lb_member_vip_net[const.ID]
- lb = self.mem_lb_client.create_loadbalancer(
- admin_state_up=True,
- description=lb_description,
+ lb_kwargs = {
+ const.ADMIN_STATE_UP: lb_admin_state_up,
+ const.DESCRIPTION: lb_description,
# TODO(johnsom) Fix test to use a real flavor
# flavor=lb_flavor,
- provider=CONF.load_balancer.provider,
- name=lb_name,
+ const.PROVIDER: lb_provider,
+ const.NAME: lb_name,
# TODO(johnsom) Add QoS
# vip_qos_policy_id=lb_qos_policy_id)
- vip_network_id=self.lb_member_vip_net[const.ID])
+ const.VIP_NETWORK_ID: lb_vip_network_id
+ }
+
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ lb_tags = ["English", "Mathematics", "Marketing", "Creativity"]
+ lb_kwargs.update({const.TAGS: lb_tags})
+
+ lb = self.mem_lb_client.create_loadbalancer(
+ **lb_kwargs)
+
self.addCleanup(
self.mem_lb_client.cleanup_loadbalancer,
lb[const.ID])
@@ -298,13 +321,25 @@
lb_name = data_utils.rand_name("lb_member_lb1-list")
lb_description = data_utils.rand_name('A')
+ lb_admin_state_up = True
+ lb_provider = CONF.load_balancer.provider
+ lb_vip_network_id = self.lb_member_vip_net[const.ID]
+
+ lb_kwargs = {
+ const.ADMIN_STATE_UP: lb_admin_state_up,
+ const.DESCRIPTION: lb_description,
+ const.PROVIDER: lb_provider,
+ const.NAME: lb_name,
+ const.VIP_NETWORK_ID: lb_vip_network_id,
+ }
+
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ lb_tags = ["English", "Spanish", "Soft_skills", "Creativity"]
+ lb_kwargs.update({const.TAGS: lb_tags})
lb = self.mem_lb_client.create_loadbalancer(
- admin_state_up=True,
- description=lb_description,
- provider=CONF.load_balancer.provider,
- name=lb_name,
- vip_network_id=self.lb_member_vip_net[const.ID])
+ **lb_kwargs)
+
self.addCleanup(
self.mem_lb_client.cleanup_loadbalancer,
lb[const.ID])
@@ -329,13 +364,26 @@
lb_name = data_utils.rand_name("lb_member_lb3-list")
lb_description = data_utils.rand_name('C')
+ lb_admin_state_up = False
+ lb_provider = CONF.load_balancer.provider
+ lb_vip_network_id = self.lb_member_vip_net[const.ID]
+
+ lb_kwargs = {
+ const.ADMIN_STATE_UP: lb_admin_state_up,
+ const.DESCRIPTION: lb_description,
+ const.PROVIDER: lb_provider,
+ const.NAME: lb_name,
+ const.VIP_NETWORK_ID: lb_vip_network_id,
+ }
+
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ lb_tags = ["English", "Project_management",
+ "Communication", "Creativity"]
+ lb_kwargs.update({const.TAGS: lb_tags})
lb = self.mem_lb_client.create_loadbalancer(
- admin_state_up=False,
- description=lb_description,
- provider=CONF.load_balancer.provider,
- name=lb_name,
- vip_network_id=self.lb_member_vip_net[const.ID])
+ **lb_kwargs)
+
self.addCleanup(
self.mem_lb_client.cleanup_loadbalancer,
lb[const.ID])
@@ -442,6 +490,28 @@
self.assertEqual(lb2[const.DESCRIPTION], lbs[1][const.DESCRIPTION])
self.assertEqual(lb1[const.DESCRIPTION], lbs[0][const.DESCRIPTION])
+ # Creating a list of 3 LBs, each one contains different tags
+ if self.mem_lb_client.is_version_supported(
+ self.api_version, '2.5'):
+ list_of_lbs = [lb1, lb2, lb3]
+ test_list = []
+ for lb in list_of_lbs:
+
+ # If tags "English" and "Creativity" are in the LB's tags
+ # and "Spanish" is not, add the LB to the list
+ if "English" in lb[const.TAGS] and "Creativity" in (
+ lb[const.TAGS]) and "Spanish" not in (
+ lb[const.TAGS]):
+ test_list.append(lb[const.NAME])
+
+ # Tests if only the first and the third ones have those tags
+ self.assertEqual(
+ test_list, [lb1[const.NAME], lb3[const.NAME]])
+
+ # Tests that filtering by an empty tag will return an empty list
+ self.assertTrue(not any(["" in lb[const.TAGS]
+ for lb in list_of_lbs]))
+
@decorators.idempotent_id('826ae612-8717-4c64-a8a7-cb9570a85870')
def test_load_balancer_show(self):
"""Tests load balancer show API.
@@ -561,6 +631,13 @@
# vip_qos_policy_id=lb_qos_policy_id)
const.NAME: lb_name}
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ lb_tags = ["Hello", "World"]
+ lb_kwargs.update({
+ const.TAGS: lb_tags
+ })
+
self._setup_lb_network_kwargs(lb_kwargs, 4, use_fixed_ip=True)
lb = self.mem_lb_client.create_loadbalancer(**lb_kwargs)
@@ -594,6 +671,10 @@
self.assertEqual(lb_kwargs[const.VIP_SUBNET_ID],
lb[const.VIP_SUBNET_ID])
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ self.assertEqual(lb_tags, lb[const.TAGS])
+
new_name = data_utils.rand_name("lb_member_lb1-update")
new_description = data_utils.arbitrary_string(size=255,
base_text='new')
@@ -624,13 +705,26 @@
self.assertEqual(const.ACTIVE, lb_check[const.PROVISIONING_STATUS])
self.assertFalse(lb_check[const.ADMIN_STATE_UP])
- lb = self.mem_lb_client.update_loadbalancer(
- lb[const.ID],
- admin_state_up=True,
- description=new_description,
+ admin_state_up = True
+
+ lb_update_kwargs = {
+ # const.ID: lb[const.ID],
+ const.ADMIN_STATE_UP: admin_state_up,
+ const.DESCRIPTION: new_description,
# TODO(johnsom) Add QoS
# vip_qos_policy_id=lb_qos_policy_id)
- name=new_name)
+ const.NAME: new_name
+ }
+
+ if self.mem_listener_client.is_version_supported(
+ self.api_version, '2.5'):
+ new_tags = ["Hola", "Mundo"]
+ lb_update_kwargs.update({
+ const.TAGS: new_tags
+ })
+
+ lb = self.mem_lb_client.update_loadbalancer(
+ lb[const.ID], **lb_update_kwargs)
lb = waiters.wait_for_status(self.mem_lb_client.show_loadbalancer,
lb[const.ID], const.PROVISIONING_STATUS,
@@ -641,6 +735,7 @@
self.assertTrue(lb[const.ADMIN_STATE_UP])
self.assertEqual(new_description, lb[const.DESCRIPTION])
self.assertEqual(new_name, lb[const.NAME])
+ self.assertEqual(new_tags, lb[const.TAGS])
# TODO(johnsom) Add QoS
# Attempt to clean up so that one full test run doesn't start 10+
diff --git a/octavia_tempest_plugin/tests/api/v2/test_member.py b/octavia_tempest_plugin/tests/api/v2/test_member.py
index a279495..f4bd2a8 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_member.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_member.py
@@ -153,6 +153,13 @@
const.BACKUP: False,
})
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ member_tags = ["hello", "world"]
+ member_kwargs.update({
+ const.TAGS: member_tags
+ })
+
if self.lb_member_vip_subnet:
member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
const.ID]
@@ -197,6 +204,10 @@
self.api_version, '2.1'):
equal_items.append(const.BACKUP)
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ equal_items.append(const.TAGS)
+
if monitor:
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
if const.SUBNET_ID in member_kwargs:
@@ -247,6 +258,13 @@
const.ADDRESS: '192.0.2.1',
const.PROTOCOL_PORT: 101,
}
+
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ member1_tags = ["English", "Mathematics",
+ "Marketing", "Creativity"]
+ member1_kwargs.update({const.TAGS: member1_tags})
+
member1 = self.mem_member_client.create_member(
**member1_kwargs)
self.addCleanup(
@@ -278,6 +296,13 @@
const.ADDRESS: '192.0.2.1',
const.PROTOCOL_PORT: 100,
}
+
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ member2_tags = ["English", "Spanish",
+ "Soft_skills", "Creativity"]
+ member2_kwargs.update({const.TAGS: member2_tags})
+
member2 = self.mem_member_client.create_member(
**member2_kwargs)
self.addCleanup(
@@ -309,6 +334,13 @@
const.ADDRESS: '192.0.2.1',
const.PROTOCOL_PORT: 102,
}
+
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ member3_tags = ["English", "Project_management",
+ "Communication", "Creativity"]
+ member3_kwargs.update({const.TAGS: member3_tags})
+
member3 = self.mem_member_client.create_member(
**member3_kwargs)
self.addCleanup(
@@ -433,6 +465,28 @@
self.assertEqual(member1[const.PROTOCOL_PORT],
members[0][const.PROTOCOL_PORT])
+ # Creating a list of 3 members, each one contains different tags
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ list_of_members = [member1, member2, member3]
+ test_list = []
+ for member in list_of_members:
+
+ # If tags "English" and "Creativity" are in the member's tags
+ # and "Spanish" is not, add the member to the list
+ if "English" in member[const.TAGS] and "Creativity" in (
+ member[const.TAGS]) and "Spanish" not in (
+ member[const.TAGS]):
+ test_list.append(member[const.NAME])
+
+ # Tests if only the first and the third ones have those tags
+ self.assertEqual(
+ test_list, [member1[const.NAME], member3[const.NAME]])
+
+ # Tests that filtering by an empty tag will return an empty list
+ self.assertTrue(not any(["" in member[const.TAGS]
+ for member in list_of_members]))
+
@decorators.idempotent_id('7674ae04-7e92-44ef-9adf-40718d7ec705')
def test_member_show(self):
"""Tests member show API.
@@ -563,6 +617,13 @@
const.BACKUP: False,
})
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ member_tags = ["Hello", "World"]
+ member_kwargs.update({
+ const.TAGS: member_tags
+ })
+
if self.lb_member_vip_subnet:
member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
const.ID]
@@ -609,6 +670,10 @@
self.api_version, '2.1'):
equal_items.append(const.BACKUP)
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ equal_items.append(const.TAGS)
+
if monitor:
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
if const.SUBNET_ID in member_kwargs:
@@ -672,6 +737,14 @@
member_update_kwargs.update({
const.BACKUP: not member[const.BACKUP]
})
+
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ new_tags = ["Hola", "Mundo"]
+ member_update_kwargs.update({
+ const.TAGS: new_tags
+ })
+
if monitor:
member_update_kwargs[const.MONITOR_ADDRESS] = '192.0.2.3'
member_update_kwargs[const.MONITOR_PORT] = member[
@@ -709,6 +782,10 @@
self.api_version, '2.1'):
equal_items.append(const.BACKUP)
+ if self.mem_member_client.is_version_supported(
+ self.api_version, '2.5'):
+ equal_items.append(const.TAGS)
+
if monitor:
equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
for item in equal_items:
diff --git a/octavia_tempest_plugin/tests/api/v2/test_pool.py b/octavia_tempest_plugin/tests/api/v2/test_pool.py
index fd3053d..36d1927 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_pool.py
@@ -104,6 +104,13 @@
const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: self.lb_algorithm,
}
+
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ pool_tags = ["Hello", "World"]
+ pool_kwargs.update({
+ const.TAGS: pool_tags
+ })
+
if self.lb_feature_enabled.session_persistence_enabled:
pool_kwargs[const.SESSION_PERSISTENCE] = {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -179,6 +186,8 @@
self.assertEqual(pool_sp_cookie_name,
pool[const.SESSION_PERSISTENCE][
const.COOKIE_NAME])
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ self.assertEqual(pool_tags, pool[const.TAGS])
@decorators.idempotent_id('6959a32e-fb34-4f3e-be68-8880c6450016')
def test_pool_list(self):
@@ -222,6 +231,13 @@
const.LB_ALGORITHM: self.lb_algorithm,
const.LOADBALANCER_ID: lb_id,
}
+
+ if self.mem_pool_client.is_version_supported(
+ self.api_version, '2.5'):
+ pool1_tags = ["English", "Mathematics",
+ "Marketing", "Creativity"]
+ pool1_kwargs.update({const.TAGS: pool1_tags})
+
if self.lb_feature_enabled.session_persistence_enabled:
pool1_kwargs[const.SESSION_PERSISTENCE] = {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -260,6 +276,13 @@
const.LB_ALGORITHM: self.lb_algorithm,
const.LOADBALANCER_ID: lb_id,
}
+
+ if self.mem_pool_client.is_version_supported(
+ self.api_version, '2.5'):
+ pool2_tags = ["English", "Spanish",
+ "Soft_skills", "Creativity"]
+ pool2_kwargs.update({const.TAGS: pool2_tags})
+
if self.lb_feature_enabled.session_persistence_enabled:
pool2_kwargs[const.SESSION_PERSISTENCE] = {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -298,6 +321,13 @@
# No session persistence, just so there's one test for that
const.LOADBALANCER_ID: lb_id,
}
+
+ if self.mem_pool_client.is_version_supported(
+ self.api_version, '2.5'):
+ pool3_tags = ["English", "Project_management",
+ "Communication", "Creativity"]
+ pool3_kwargs.update({const.TAGS: pool3_tags})
+
pool3 = self.mem_pool_client.create_pool(
**pool3_kwargs)
self.addCleanup(
@@ -418,6 +448,28 @@
self.assertEqual(pool1[const.DESCRIPTION],
pools[0][const.DESCRIPTION])
+ # Creating a list of 3 pools, each one contains different tags
+ if self.mem_pool_client.is_version_supported(
+ self.api_version, '2.5'):
+ list_of_pools = [pool1, pool2, pool3]
+ test_list = []
+ for pool in list_of_pools:
+
+ # If tags "English" and "Creativity" are in the pool's tags
+ # and "Spanish" is not, add the pool to the list
+ if "English" in pool[const.TAGS] and "Creativity" in (
+ pool[const.TAGS]) and "Spanish" not in (
+ pool[const.TAGS]):
+ test_list.append(pool[const.NAME])
+
+ # Tests if only the first and the third ones have those tags
+ self.assertEqual(
+ test_list, [pool1[const.NAME], pool3[const.NAME]])
+
+ # Tests that filtering by an empty tag will return an empty list
+ self.assertTrue(not any(["" in pool[const.TAGS]
+ for pool in list_of_pools]))
+
@decorators.idempotent_id('b7932438-1aea-4175-a50c-984fee1c0cad')
def test_pool_show(self):
"""Tests pool show API.
@@ -535,6 +587,13 @@
const.LB_ALGORITHM: self.lb_algorithm,
const.LOADBALANCER_ID: self.lb_id,
}
+
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ pool_tags = ["Hello", "World"]
+ pool_kwargs.update({
+ const.TAGS: pool_tags
+ })
+
if self.lb_feature_enabled.session_persistence_enabled:
pool_kwargs[const.SESSION_PERSISTENCE] = {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -610,6 +669,9 @@
pool_check[const.PROVISIONING_STATUS])
self.assertFalse(pool_check[const.ADMIN_STATE_UP])
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ self.assertEqual(pool_tags, pool[const.TAGS])
+
new_name = data_utils.rand_name("lb_member_pool1-UPDATED")
new_description = data_utils.arbitrary_string(size=255,
base_text='new')
@@ -619,6 +681,13 @@
const.ADMIN_STATE_UP: True,
const.LB_ALGORITHM: self.lb_algorithm,
}
+
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ new_tags = ["Hola", "Mundo"]
+ pool_update_kwargs.update({
+ const.TAGS: new_tags
+ })
+
if self.lb_feature_enabled.session_persistence_enabled:
pool_update_kwargs[const.SESSION_PERSISTENCE] = {
const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE,
@@ -672,6 +741,9 @@
if self.lb_feature_enabled.session_persistence_enabled:
self.assertIsNone(pool.get(const.SESSION_PERSISTENCE))
+ if self.mem_lb_client.is_version_supported(self.api_version, '2.5'):
+ self.assertEqual(new_tags, pool[const.TAGS])
+
@decorators.idempotent_id('35ed3800-7a4a-47a6-9b94-c1033fff1112')
def test_pool_delete(self):
"""Tests pool create and delete APIs.
diff --git a/releasenotes/notes/add-tags-api-tests-1130aab82bb0f7f2.yaml b/releasenotes/notes/add-tags-api-tests-1130aab82bb0f7f2.yaml
new file mode 100644
index 0000000..513a63f
--- /dev/null
+++ b/releasenotes/notes/add-tags-api-tests-1130aab82bb0f7f2.yaml
@@ -0,0 +1,4 @@
+---
+features:
+ - |
+ API tests for tags were added.