aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-06-02 10:25:11 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2020-06-02 15:13:29 +0000
commit61ed36660a4df5de9a22fa7b7d47fd7d4aab3b2c (patch)
tree186b4d0c60897fc92de2cb3aba24d6b140bd4ee7
parent572f644a9fb2bdfc897aa03774a030e828382d3f (diff)
Add helper routine for getting iter range in lifecycle methods
Change-Id: I3973b7bfd75885bf22154670a6b9f665769470fa Issue-ID: INT-1610 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
-rwxr-xr-xtest/mocks/mass-pnf-sim/MassPnfSim.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/mocks/mass-pnf-sim/MassPnfSim.py b/test/mocks/mass-pnf-sim/MassPnfSim.py
index d10686710..b6a32fe2f 100755
--- a/test/mocks/mass-pnf-sim/MassPnfSim.py
+++ b/test/mocks/mass-pnf-sim/MassPnfSim.py
@@ -174,6 +174,14 @@ class MassPnfSim:
containers.append(container.attrs['Name'][1:])
return containers
+ def _get_iter_range(self):
+ '''Helper routine to get the iteration range
+ for the lifecycle commands'''
+ if not self.args.count:
+ return [self.existing_sim_instances]
+ else:
+ return [self.args.count]
+
def bootstrap(self):
self.logger.info("Bootstrapping PNF instances")
@@ -255,11 +263,7 @@ class MassPnfSim:
pass
def status(self):
- if not self.args.count:
- iter_range = [self.existing_sim_instances]
- else:
- iter_range = [self.args.count]
- for i in range(*iter_range):
+ for i in range(*self._get_iter_range()):
self.logger.info(f'Getting {self.sim_dirname_pattern}{i} instance status:')
if f"{self.sim_container_name}-{i}" in self._get_docker_containers():
try: