diff --git a/ocs_ci/ocs/resources/mcg.py b/ocs_ci/ocs/resources/mcg.py index f0cc2942d16..d9947ca562d 100644 --- a/ocs_ci/ocs/resources/mcg.py +++ b/ocs_ci/ocs/resources/mcg.py @@ -757,18 +757,25 @@ def cli_create_bucketclass_over_namespacestores( namespacestore.name for namespacestore in namespacestores ] namestores_name_str = f"{','.join(namestores_name_list)}" + namespace_policy_type = namespace_policy["type"].lower() - if namespace_policy_type != constants.NAMESPACE_POLICY_TYPE_SINGLE.lower(): + cmd = f"bucketclass create namespace-bucketclass {namespace_policy_type} {name}" + + if namespace_policy_type == constants.NAMESPACE_POLICY_TYPE_SINGLE.lower(): + cmd += f" --resource={namestores_name_str}" + self.exec_mcg_cmd(cmd) + elif namespace_policy_type == constants.NAMESPACE_POLICY_TYPE_CACHE.lower(): + cmd += f" --hub-resource={namestores_name_str}" + cmd += " --backingstores=constants.DEFAULT_NOOBAA_BACKINGSTORE" + if "ttl" in namespace_policy: + cmd += f" --ttl=={namespace_policy['ttl']}" + self.exec_mcg_cmd(cmd) + else: raise NotImplementedError( f"Cli creating of bucketclass on namespacestore " f"with policy {namespace_policy_type} is not implemented yet" ) - self.exec_mcg_cmd( - f"bucketclass create namespace-bucketclass {namespace_policy_type} " - f"--resource={namestores_name_str} {name}" - ) - def check_if_mirroring_is_done(self, bucket_name, timeout=300): """ Check whether all object chunks in a bucket diff --git a/tests/functional/object/mcg/test_namespace_crd.py b/tests/functional/object/mcg/test_namespace_crd.py index 4d4a5227d90..a1a37ac5e56 100644 --- a/tests/functional/object/mcg/test_namespace_crd.py +++ b/tests/functional/object/mcg/test_namespace_crd.py @@ -143,7 +143,24 @@ def deprecated_test_namespace_store_creation_crd( marks=[ tier1, on_prem_platform_required, - pytest.mark.polarion_id("OCS-2407"), + pytest.mark.polarion_id("OCS-6339"), + ], + ), + pytest.param( + { + "interface": "CLI", + "namespace_policy_dict": { + "type": "Cache", + "ttl": 300000, + "namespacestore_dict": { + "rgw": [(1, None)], + }, + }, + }, + marks=[ + tier1, + on_prem_platform_required, + pytest.mark.polarion_id("OCS-6338"), ], ), pytest.param( @@ -218,6 +235,7 @@ def deprecated_test_namespace_store_creation_crd( "Azure-OC-Single", "RGW-OC-Single", "RGW-CLI-Single", + "RGW-CLI-Cache", "IBM-OC-Single", "AWS+Azure-OC-Multi", "AWS+AWS-OC-Multi",