- # Level 3: Mandatory params: Check if cpus is a valid integer:
- try:
- cpus = int(self.traffic_profile["cpus"])
- if cpus < 1:
- raise ValueError
- self.traffic_profile["cpus"] = cpus
- except ValueError:
- logger.error("The parameter 'cpus' must be an integer greater than "
- "1.")
- is_valid = False
-
- # Level 3: Mandatory params: Check if first-cpu is a valid integer:
- try:
- first_cpu = int(self.traffic_profile["first-cpu"])
- if first_cpu < 0:
- raise ValueError
- self.traffic_profile["first-cpu"] = first_cpu
- except ValueError:
- logger.error("The parameter 'first-cpu' must be an integer greater "
- "than 1.")
- is_valid = False
-
- # Level 3: Mandatory params: Check if duration is a valid integer:
- try:
- duration = int(self.traffic_profile["duration"])
- if duration < 1:
- raise ValueError
- self.traffic_profile["duration"] = duration
- except ValueError:
- logger.error("The parameter 'duration' must be an integer "
- "greater than 1.")
- is_valid = False
-
- # Level 3: Mandatory params: Check if nr-of-threads is a valid integer:
- try:
- nr_of_threads = int(self.traffic_profile["nr-of-threads"])
- if nr_of_threads < 1:
- raise ValueError
- self.traffic_profile["nr-of-threads"] = nr_of_threads
- except ValueError:
- logger.error("The parameter 'nr-of-threads' must be an integer "
- "greater than 1.")
- is_valid = False
+ # Level 3: Mandatory params: Check if integers are not below minimum
+ for param, minimum in self.INTEGER_PARAMS:
+ if not self._validate_int_param(param, minimum):
+ is_valid = False
+ return is_valid