diff --git a/test/functional/api/cas/cache.py b/test/functional/api/cas/cache.py index aa17e69..34eaef4 100644 --- a/test/functional/api/cas/cache.py +++ b/test/functional/api/cas/cache.py @@ -144,7 +144,8 @@ class Cache: def set_seq_cutoff_parameters(self, seq_cutoff_param: SeqCutOffParameters): return casadm.set_param_cutoff(self.cache_id, threshold=seq_cutoff_param.threshold, - policy=seq_cutoff_param.policy) + policy=seq_cutoff_param.policy, + promotion_count=seq_cutoff_param.promotion_count) def set_seq_cutoff_threshold(self, threshold: Size): return casadm.set_param_cutoff(self.cache_id, diff --git a/test/functional/api/cas/cache_config.py b/test/functional/api/cas/cache_config.py index 7cfcc23..9668254 100644 --- a/test/functional/api/cas/cache_config.py +++ b/test/functional/api/cas/cache_config.py @@ -215,22 +215,25 @@ class FlushParametersAcp: class SeqCutOffParameters: - def __init__(self, policy=None, threshold=None): + def __init__(self, policy=None, threshold=None, promotion_count=None): self.policy = policy self.threshold = threshold + self.promotion_count = promotion_count def __eq__(self, other): return ( self.policy == other.policy and self.threshold == other.threshold + and self.promotion_count == other.promotion_count ) @staticmethod def default_seq_cut_off_params(): - seq_cut_off_params = SeqCutOffParameters() - seq_cut_off_params.policy = SeqCutOffPolicy.full - seq_cut_off_params.threshold = Size(1024, Unit.KibiByte) - return seq_cut_off_params + return SeqCutOffParameters( + threshold=Size(1024, Unit.KibiByte), + policy=SeqCutOffPolicy.full, + promotion_count=8 + ) class PromotionParametersNhit: diff --git a/test/functional/api/cas/casadm.py b/test/functional/api/cas/casadm.py index a0ba2cf..7c29454 100644 --- a/test/functional/api/cas/casadm.py +++ b/test/functional/api/cas/casadm.py @@ -286,12 +286,18 @@ def get_param_cleaning_acp(cache_id: int, output_format: OutputFormat = None, def set_param_cutoff(cache_id: int, core_id: int = None, threshold: Size = None, - policy: SeqCutOffPolicy = None): + policy: SeqCutOffPolicy = None, promotion_count: int = None): _core_id = None if core_id is None else str(core_id) _threshold = None if threshold is None else str(int(threshold.get_value(Unit.KibiByte))) _policy = None if policy is None else policy.name + _promotion_count = None if promotion_count is None else str(promotion_count) command = set_param_cutoff_cmd( - cache_id=str(cache_id), core_id=_core_id, threshold=_threshold, policy=_policy) + cache_id=str(cache_id), + core_id=_core_id, + threshold=_threshold, + policy=_policy, + promotion_count=_promotion_count + ) output = TestRun.executor.run(command) if output.exit_code != 0: raise CmdException("Error while setting sequential cut-off params.", output) diff --git a/test/functional/api/cas/casadm_parser.py b/test/functional/api/cas/casadm_parser.py index 30f780c..1bfa46e 100644 --- a/test/functional/api/cas/casadm_parser.py +++ b/test/functional/api/cas/casadm_parser.py @@ -260,10 +260,12 @@ def get_seq_cut_off_parameters(cache_id: int, core_id: int): cache_id, core_id, casadm.OutputFormat.csv).stdout.splitlines() seq_cut_off_params = SeqCutOffParameters() for line in casadm_output: - if 'threshold' in line: + if 'Sequential cutoff threshold' in line: seq_cut_off_params.threshold = Size(int(line.split(',')[1]), Unit.KibiByte) - if 'policy' in line: + if 'Sequential cutoff policy' in line: seq_cut_off_params.policy = SeqCutOffPolicy.from_name(line.split(',')[1]) + if 'Sequential cutoff promotion request count threshold' in line: + seq_cut_off_params.promotion_count = int(line.split(',')[1]) return seq_cut_off_params diff --git a/test/functional/api/cas/cli.py b/test/functional/api/cas/cli.py index 17bb4c6..a76f36f 100644 --- a/test/functional/api/cas/cli.py +++ b/test/functional/api/cas/cli.py @@ -221,7 +221,7 @@ def _set_param_cmd(namespace: str, cache_id: str, additional_params: str = None, def set_param_cutoff_cmd(cache_id: str, core_id: str = None, threshold: str = None, - policy: str = None, shortcut: bool = False): + policy: str = None, promotion_count: str = None, shortcut: bool = False): add_params = "" if core_id is not None: add_params += (" -j " if shortcut else " --core-id ") + str(core_id) @@ -229,6 +229,8 @@ def set_param_cutoff_cmd(cache_id: str, core_id: str = None, threshold: str = No add_params += (" -t " if shortcut else " --threshold ") + str(threshold) if policy is not None: add_params += (" -p " if shortcut else " --policy ") + policy + if promotion_count is not None: + add_params += " --promotion-count " + str(promotion_count) return _set_param_cmd(namespace="seq-cutoff", cache_id=cache_id, additional_params=add_params, shortcut=shortcut) diff --git a/test/functional/api/cas/core.py b/test/functional/api/cas/core.py index 601975f..09035c5 100644 --- a/test/functional/api/cas/core.py +++ b/test/functional/api/cas/core.py @@ -118,18 +118,22 @@ class Core(Device): def set_seq_cutoff_parameters(self, seq_cutoff_param: SeqCutOffParameters): return casadm.set_param_cutoff(self.cache_id, self.core_id, - seq_cutoff_param.threshold, seq_cutoff_param.policy) + seq_cutoff_param.threshold, + seq_cutoff_param.policy, + seq_cutoff_param.promotion_count) def set_seq_cutoff_threshold(self, threshold: Size): return casadm.set_param_cutoff(self.cache_id, self.core_id, - threshold=threshold, - policy=None) + threshold=threshold) def set_seq_cutoff_policy(self, policy: SeqCutOffPolicy): return casadm.set_param_cutoff(self.cache_id, self.core_id, - threshold=None, policy=policy) + def set_seq_cutoff_promotion_count(self, promotion_count: int): + return casadm.set_param_cutoff(self.cache_id, self.core_id, + promotion_count=promotion_count) + def check_if_is_present_in_os(self, should_be_visible=True): device_in_system_message = "CAS device exists in OS." device_not_in_system_message = "CAS device does not exist in OS." diff --git a/test/functional/tests/cli/test_set_get_params.py b/test/functional/tests/cli/test_set_get_params.py index 5359ee8..6dfef99 100644 --- a/test/functional/tests/cli/test_set_get_params.py +++ b/test/functional/tests/cli/test_set_get_params.py @@ -231,13 +231,11 @@ def cache_prepare(cache_mode, cache_dev, core_dev): def new_seqcutoff_parameters_random_values(): - threshold_random_value = Size(random.randrange(1, 1000000), Unit.KibiByte) - policy_random_value = random.choice(list(SeqCutOffPolicy)) - seqcutoff_params = SeqCutOffParameters() - seqcutoff_params.threshold = threshold_random_value - seqcutoff_params.policy = policy_random_value - - return seqcutoff_params + return SeqCutOffParameters( + threshold = Size(random.randrange(1, 1000000), Unit.KibiByte), + policy = random.choice(list(SeqCutOffPolicy)), + promotion_count = random.randrange(1, 65535) + ) def new_cleaning_parameters_random_values(cleaning_policy):