aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks')
-rwxr-xr-xtest/mocks/mass-pnf-sim/MassPnfSim.py13
-rw-r--r--test/mocks/mass-pnf-sim/test_lifecycle.py15
2 files changed, 18 insertions, 10 deletions
diff --git a/test/mocks/mass-pnf-sim/MassPnfSim.py b/test/mocks/mass-pnf-sim/MassPnfSim.py
index 023c4cbf4..c8d255fd5 100755
--- a/test/mocks/mass-pnf-sim/MassPnfSim.py
+++ b/test/mocks/mass-pnf-sim/MassPnfSim.py
@@ -296,9 +296,18 @@ class MassPnfSim:
for sim_id in range(self.existing_sim_instances):
rmtree(f"{self.sim_dirname_pattern}{sim_id}")
- @_MassPnfSim_Decorators.do_action('Starting', './simulator.sh start')
def start(self):
- pass
+ for i in range(*self._get_iter_range()):
+ # If container is not running
+ if f"{self.sim_container_name}-{i}" not in self._get_docker_containers():
+ self.logger.info(f'Starting {self.sim_dirname_pattern}{i} instance:')
+ self.logger.info(f' PNF-Sim IP: {self._get_sim_instance_data(i)}')
+ #Move logs to archive
+ self._archive_logs(self.sim_dirname_pattern + str(i))
+ self.logger.info(' Starting simulator containers using netconf model specified in config/netconf.env')
+ self._run_cmd('docker-compose up -d', self.sim_dirname_pattern + str(i))
+ else:
+ self.logger.warning(f'Instance {self.sim_dirname_pattern}{i} containers are already up')
def status(self):
for i in range(*self._get_iter_range()):
diff --git a/test/mocks/mass-pnf-sim/test_lifecycle.py b/test/mocks/mass-pnf-sim/test_lifecycle.py
index 9bfb3dc7a..dcd89c440 100644
--- a/test/mocks/mass-pnf-sim/test_lifecycle.py
+++ b/test/mocks/mass-pnf-sim/test_lifecycle.py
@@ -71,15 +71,14 @@ def test_bootstrap_status(args_status, caplog):
assert 'Simulator response' not in caplog.text
caplog.clear()
-def test_start(args_start, caplog, capfd):
+def test_start(args_start, caplog):
MassPnfSim(args_start).start()
- msg = capfd.readouterr()
for instance in range(SIM_INSTANCES):
instance_ip_offset = instance * 16
ip_offset = 2
assert f'Starting pnf-sim-lw-{instance} instance:' in caplog.text
- assert f'PNF-Sim IP: {str(ip_address(IPSTART) + ip_offset + instance_ip_offset)}' in msg.out
- assert 'Starting simulator containers' in msg.out
+ assert f'PNF-Sim IP: {str(ip_address(IPSTART) + ip_offset + instance_ip_offset)}' in caplog.text
+ assert 'Starting simulator containers' in caplog.text
caplog.clear()
def test_start_status(args_status, docker_containers, caplog):
@@ -91,12 +90,12 @@ def test_start_status(args_status, docker_containers, caplog):
assert f"{PNF_SIM_CONTAINER_NAME}{instance}" in docker_containers
caplog.clear()
-def test_start_idempotence(args_start, capfd):
+def test_start_idempotence(args_start, caplog):
'''Verify start idempotence'''
MassPnfSim(args_start).start()
- msg = capfd.readouterr()
- assert 'Simulator containers are already up' in msg.out
- assert 'Starting simulator containers' not in msg.out
+ assert 'containers are already up' in caplog.text
+ assert 'Starting simulator containers' not in caplog.text
+ caplog.clear()
def test_trigger(args_trigger, caplog):
MassPnfSim(args_trigger).trigger()