def ovs_3188_verify_namespace_test(): """ Verify namespaces """ nr_of_disks_to_create = 5 namespace_prefix = 'ovs_3188-' compression = 'none' encryption = 'none' preset_name = 'be_preset_02' policies = [[1, 1, 1, 2]] backend = GeneralBackend.get_by_name(TestALBA.backend_name) if backend is None: backend = GeneralAlba.add_alba_backend(TestALBA.backend_name).backend GeneralAlba.add_preset(backend.alba_backend, preset_name, policies, compression, encryption) for x in range(nr_of_disks_to_create): namespace_name = namespace_prefix + str(x) GeneralAlba.execute_alba_cli_action(backend.alba_backend, 'create-namespace', [namespace_name, preset_name], False) GeneralAlba.upload_file(backend.alba_backend, namespace_name, 1024 * 1024 * 1) AlbaScheduledTaskController.verify_namespaces() GeneralAlba.remove_alba_namespaces(backend.alba_backend) GeneralAlba.remove_preset(backend.alba_backend, preset_name)
def ovs_3490_add_remove_preset_test(): """ Adds and removes a preset with encryption to an existing alba backend """ backend = GeneralBackend.get_by_name(TestALBA.backend_name) if backend is None: backend = GeneralAlba.add_alba_backend(TestALBA.backend_name).backend name = 'ovs-3490' policies = [[1, 1, 1, 2]] compression = 'none' encryption = 'aes-cbc-256' status, message = GeneralAlba.add_preset(backend.alba_backend, name, policies, compression, encryption) assert status, "Add preset failed with: {0}".format(message) TestALBA.verify_policies_for_preset(name, policies, compression, encryption) status, message = GeneralAlba.remove_preset(backend.alba_backend, name) assert status, "Remove preset failed with: {0}".format(message) assert not TestALBA.is_preset_present(name), "Preset with name {0} is not present".format(name)
def add_validate_remove_preset(name, compression, encryption, policies, remove_when_finished=True): """ Add a preset, validate the preset and remove it :param name: Name of the preset :param compression: Compression used by the preset :param encryption: Encryption used by the preset :param policies: Policies used by the preset :param remove_when_finished: Remove after validation :return: None """ backend = GeneralBackend.get_by_name(TestALBA.backend_name) status, message = GeneralAlba.add_preset(backend.alba_backend, name, policies, compression, encryption) assert status, "Add preset failed with: {0}".format(message) assert TestALBA.is_preset_present(name), "Preset with name {0} is not present".format(name) TestALBA.verify_policies_for_preset(name, policies, compression, encryption) if remove_when_finished: status, message = GeneralAlba.remove_preset(backend.alba_backend, name, ) assert status, "Remove preset failed with: {0}".format(message) assert not TestALBA.is_preset_present(name), "Preset with name {0} is not present".format(name)