aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest/mocks/mass-pnf-sim/MassPnfSim.py16
-rw-r--r--test/mocks/mass-pnf-sim/test_lifecycle.py9
2 files changed, 14 insertions, 11 deletions
diff --git a/test/mocks/mass-pnf-sim/MassPnfSim.py b/test/mocks/mass-pnf-sim/MassPnfSim.py
index 19aee6b15..77076a6e2 100755
--- a/test/mocks/mass-pnf-sim/MassPnfSim.py
+++ b/test/mocks/mass-pnf-sim/MassPnfSim.py
@@ -177,10 +177,15 @@ class MassPnfSim:
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]
+ if hasattr(self.args, 'count'):
+ if not self.args.count:
+ return [self.existing_sim_instances]
+ else:
+ return [self.args.count]
+ elif hasattr(self.args, 'triggerstart'):
+ return [self.args.triggerstart, self.args.triggerend + 1]
else:
- return [self.args.count]
+ return [self.existing_sim_instances]
def bootstrap(self):
self.logger.info("Bootstrapping PNF instances")
@@ -338,6 +343,5 @@ class MassPnfSim:
except TypeError:
self.logger.error(f' Could not load JSON data from {self.sim_dirname_pattern}{i}/{self.sim_msg_config}')
- @_MassPnfSim_Decorators.do_action('Triggering', './simulator.sh trigger-simulator')
- def trigger_custom(self):
- self.logger.info("Triggering VES sending by a range of simulators:")
+ # Make the 'trigger_custom' an alias to the 'trigger' method
+ trigger_custom = trigger
diff --git a/test/mocks/mass-pnf-sim/test_lifecycle.py b/test/mocks/mass-pnf-sim/test_lifecycle.py
index 5ddb93943..d3b452bbd 100644
--- a/test/mocks/mass-pnf-sim/test_lifecycle.py
+++ b/test/mocks/mass-pnf-sim/test_lifecycle.py
@@ -120,16 +120,15 @@ def test_trigger_idempotence(args_trigger, caplog):
assert 'Simulator started' not in caplog.text
caplog.clear()
-def test_trigger_custom(args_trigger_custom, caplog, capfd):
+def test_trigger_custom(args_trigger_custom, caplog):
MassPnfSim(args_trigger_custom).trigger_custom()
- msg = capfd.readouterr()
for instance in range(SIM_INSTANCES):
instance_ip_offset = instance * 16
ip_offset = 2
assert f'Triggering 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 'Simulator started' not in msg.out
- assert "Cannot start simulator since it's already running" in msg.out
+ assert f'PNF-Sim IP: {str(ip_address(IPSTART) + ip_offset + instance_ip_offset)}' in caplog.text
+ assert 'Simulator started' not in caplog.text
+ assert "Cannot start simulator since it's already running" in caplog.text
caplog.clear()
def test_stop(args_stop, caplog):