aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-19 04:47:09 -0700
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-19 04:47:09 -0700
commita71704c7833da2b64e21fa27e7b43c3c69416698 (patch)
treedab073ce843865020e820aec3e8cc73a6b36b1ce /test/mocks
parenta89abf819ed802c3aedc98eae281066d4c5b50dd (diff)
Add a method to enumerate bootstrapped simulator instances
Change-Id: Ifbafc748a47b1db3fabfb337b44a66523c9ef80f Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks')
-rwxr-xr-xtest/mocks/mass-pnf-sim/MassPnfSim.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/mocks/mass-pnf-sim/MassPnfSim.py b/test/mocks/mass-pnf-sim/MassPnfSim.py
index 5c01704d3..2bbb1aa1e 100755
--- a/test/mocks/mass-pnf-sim/MassPnfSim.py
+++ b/test/mocks/mass-pnf-sim/MassPnfSim.py
@@ -7,6 +7,7 @@ from sys import exit
from os import chdir, getcwd, path
from shutil import copytree
from json import dumps
+from glob import glob
from requests import get
from requests.exceptions import MissingSchema, InvalidSchema, InvalidURL, ConnectionError, ConnectTimeout
@@ -105,6 +106,7 @@ class MassPnfSim:
self.logger.setLevel(self.log_lvl)
self.sim_dirname_pattern = "pnf-sim-lw-"
self.mvn_build_cmd = 'mvn clean package docker:build -Dcheckstyle.skip'
+ self.existing_sim_instances = self._enum_sim_instances()
def _run_cmd(self, cmd, dir_context='.'):
if self.args.verbose == 'debug':
@@ -119,6 +121,10 @@ class MassPnfSim:
except subprocess.CalledProcessError as e:
exit(e.returncode)
+ def _enum_sim_instances(self):
+ '''Helper method that returns bootstraped simulator instances count'''
+ return len(glob(f"{self.sim_dirname_pattern}[0-9]*"))
+
def bootstrap(self):
self.logger.info("Bootstrapping PNF instances")