diff --git a/test/mocks/mass-pnf-sim/.gitignore b/test/mocks/mass-pnf-sim/.gitignore
index 7111c7f..6732c15 100644
--- a/test/mocks/mass-pnf-sim/.gitignore
+++ b/test/mocks/mass-pnf-sim/.gitignore
@@ -2,3 +2,4 @@
 .env/
 pnf-sim-lightweight/logs/*
 files/onap/*
+__pycache__
diff --git a/test/mocks/mass-pnf-sim/MassPnfSim.py b/test/mocks/mass-pnf-sim/MassPnfSim.py
new file mode 100755
index 0000000..1901cb0
--- /dev/null
+++ b/test/mocks/mass-pnf-sim/MassPnfSim.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python3
+import logging
+import subprocess
+import time
+from json import dumps
+
+class MassPnfSim():
+
+    log_lvl = logging.INFO
+
+    def __init__(self, args):
+        self.args = args
+        self.logger = logging.getLogger(__name__)
+        self.logger.setLevel(self.log_lvl)
+
+    def bootstrap(self):
+        self.logger.info("Bootstrapping PNF instances")
+
+        start_port = 2000
+        ftps_pasv_port_start = 8000
+        ftps_pasv_port_num_of_ports = 10
+
+        ftps_pasv_port_end = ftps_pasv_port_start + ftps_pasv_port_num_of_ports
+
+        for i in range(self.args.count):
+            self.logger.info(f"PNF simulator instance: {i}")
+
+            # The IP ranges are in distance of 16 compared to each other.
+            # This is matching the /28 subnet mask used in the dockerfile inside.
+            instance_ip_offset = i * 16
+            ip_properties = [
+                      'subnet',
+                      'gw',
+                      'PnfSim',
+                      'ftps',
+                      'sftp'
+                    ]
+
+            ip_offset = 0
+            ip = {}
+            for prop in ip_properties:
+                ip.update({prop: str(self.args.ipstart + ip_offset + instance_ip_offset)})
+                ip_offset += 1
+
+            self.logger.debug(f'Instance #{i} properties:\n {dumps(ip, indent=4)}')
+
+            PortSftp = start_port + 1
+            PortFtps = start_port + 2
+            start_port += 2
+
+            foldername = f"pnf-sim-lw-{i}"
+            completed = subprocess.run('mkdir ' + foldername, shell=True)
+            self.logger.info(f'\tCreating folder: {completed.stdout}')
+            completed = subprocess.run(
+                'cp -r pnf-sim-lightweight/* ' +
+                foldername,
+                shell=True)
+            self.logger.info(f'\tCloning folder: {completed.stdout}')
+
+            composercmd = " ".join([
+                    "./simulator.sh compose",
+                    ip['gw'],
+                    ip['subnet'],
+                    str(i),
+                    self.args.urlves,
+                    ip['PnfSim'],
+                    str(self.args.ipfileserver),
+                    self.args.typefileserver,
+                    str(PortSftp),
+                    str(PortFtps),
+                    ip['ftps'],
+                    ip['sftp'],
+                    str(ftps_pasv_port_start),
+                    str(ftps_pasv_port_end)
+                ])
+            self.logger.debug(f"Script cmdline: {composercmd}")
+
+            completed = subprocess.run(
+                'set -x; cd ' +
+                foldername +
+                '; ' +
+                composercmd,
+                shell=True)
+            self.logger.info(f'Cloning: {completed.stdout}')
+
+            ftps_pasv_port_start += ftps_pasv_port_num_of_ports + 1
+            ftps_pasv_port_end += ftps_pasv_port_num_of_ports + 1
+
+            self.logger.info(f'Done setting up instance #{i}')
+
+        completed = subprocess.run('set -x; cd pnf-sim-lightweight; ./simulator.sh build ', shell=True)
+        self.logger.info(f"Build docker image: {completed.stdout}")
+
+    def clean(self):
+        completed = subprocess.run('rm -rf ./pnf-sim-lw-*', shell=True)
+        self.logger.info(f'Deleting: {completed.stdout}')
+
+    def start(self):
+        for i in range(self.args.count):
+            foldername = f"pnf-sim-lw-{i}"
+
+            completed = subprocess.run(
+                'set -x ; cd ' +
+                foldername +
+                "; bash -x ./simulator.sh start",
+                shell=True)
+            self.logger.info(f'Starting: {completed.stdout}')
+            time.sleep(5)
+
+    def status(self):
+        for i in range(self.args.count):
+            foldername = f"pnf-sim-lw-{i}"
+
+            completed = subprocess.run(
+                'cd ' +
+                foldername +
+                "; ./simulator.sh status",
+                shell=True)
+            self.logger.info(f'Status: {completed.stdout}')
+
+    def stop(self):
+        for i in range(self.args.count):
+            foldername = f"pnf-sim-lw-{i}"
+
+            completed = subprocess.run(
+                'cd ' +
+                foldername +
+                f"; ./simulator.sh stop {i}",
+                shell=True)
+            self.logger.info(f'Stopping: {completed.stdout}')
+
+    def trigger(self):
+        self.logger.info("Triggering VES sending:")
+
+        for i in range(self.args.count):
+            foldername = f"pnf-sim-lw-{i}"
+
+            completed = subprocess.run(
+                'cd ' +
+                foldername +
+                "; ./simulator.sh trigger-simulator",
+                shell=True)
+            self.logger.info(f'Status: {completed.stdout}')
+
+    def trigger_custom(self):
+        self.logger.info("Triggering VES sending by a range of simulators:")
+
+        for i in range(self.args.triggerstart, self.args.triggerend+1):
+            foldername = f"pnf-sim-lw-{i}"
+            self.logger.info(f"Instance being processed: {i}")
+
+            completed = subprocess.run(
+                'cd ' +
+                foldername +
+                "; ./simulator.sh trigger-simulator",
+                shell=True)
+            self.logger.info(f'Status: {completed.stdout}')
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
index dd2345c..bce0253 100755
--- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py
+++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
@@ -1,12 +1,10 @@
 #!/usr/bin/env python3
 import argparse
 import sys
-import subprocess
-import ipaddress
-import time
 import logging
+import ipaddress
+from MassPnfSim import MassPnfSim
 from requests import get
-from json import dumps
 from requests.exceptions import MissingSchema, InvalidSchema, InvalidURL, ConnectionError, ConnectTimeout
 
 def validate_url(url):
@@ -72,162 +70,32 @@
     # General options parser
     parser.add_argument('--verbose', help='Verbosity level', choices=['info', 'debug'],
                         type=str, default='debug')
-
     return parser
 
 if __name__ == '__main__':
     parser = get_parser()
     args = parser.parse_args()
+    log_lvl = getattr(logging, args.verbose.upper())
 
     logger = logging.getLogger(__name__)
-    logger.setLevel(getattr(logging, args.verbose.upper()))
+    logger.setLevel(log_lvl)
+    MassPnfSim.log_lvl = log_lvl
 
-    if args.subcommand is None:
+    if args.subcommand is not None:
+        sim = MassPnfSim(args)
+        if args.subcommand == 'bootstrap' :
+            sim.bootstrap()
+        if args.subcommand == 'clean':
+            sim.clean()
+        if args.subcommand == 'start':
+            sim.start()
+        if args.subcommand == 'status':
+            sim.status()
+        if args.subcommand == 'stop':
+            sim.stop()
+        if args.subcommand == 'trigger':
+            sim.trigger()
+        if args.subcommand == 'trigger-custom':
+            sim.trigger_custom()
+    else:
         parser.print_usage()
-        sys.exit(0)
-
-    if args.subcommand == 'bootstrap' :
-        logger.info("Bootstrapping PNF instances")
-
-        start_port = 2000
-        ftps_pasv_port_start = 8000
-        ftps_pasv_port_num_of_ports = 10
-
-        ftps_pasv_port_end = ftps_pasv_port_start + ftps_pasv_port_num_of_ports
-
-        for i in range(args.count):
-            logger.info(f"PNF simulator instance: {i}")
-
-            # The IP ranges are in distance of 16 compared to each other.
-            # This is matching the /28 subnet mask used in the dockerfile inside.
-            instance_ip_offset = i * 16
-            ip_properties = [
-                      'subnet',
-                      'gw',
-                      'PnfSim',
-                      'ftps',
-                      'sftp'
-                    ]
-
-            ip_offset = 0
-            ip = {}
-            for prop in ip_properties:
-                ip.update({prop: str(args.ipstart + ip_offset + instance_ip_offset)})
-                ip_offset += 1
-
-            logger.debug(f'Instance #{i} properties:\n {dumps(ip, indent=4)}')
-
-            PortSftp = start_port + 1
-            PortFtps = start_port + 2
-            start_port += 2
-
-            foldername = f"pnf-sim-lw-{i}"
-            completed = subprocess.run('mkdir ' + foldername, shell=True)
-            logger.info(f'\tCreating folder: {completed.stdout}')
-            completed = subprocess.run(
-                'cp -r pnf-sim-lightweight/* ' +
-                foldername,
-                shell=True)
-            logger.info(f'\tCloning folder: {completed.stdout}')
-
-            composercmd = " ".join([
-                    "./simulator.sh compose",
-                    ip['gw'],
-                    ip['subnet'],
-                    str(i),
-                    args.urlves,
-                    ip['PnfSim'],
-                    str(args.ipfileserver),
-                    args.typefileserver,
-                    str(PortSftp),
-                    str(PortFtps),
-                    ip['ftps'],
-                    ip['sftp'],
-                    str(ftps_pasv_port_start),
-                    str(ftps_pasv_port_end)
-                ])
-            logger.debug(f"Script cmdline: {composercmd}")
-
-            completed = subprocess.run(
-                'set -x; cd ' +
-                foldername +
-                '; ' +
-                composercmd,
-                shell=True)
-            logger.info(f'Cloning: {completed.stdout}')
-
-            ftps_pasv_port_start += ftps_pasv_port_num_of_ports + 1
-            ftps_pasv_port_end += ftps_pasv_port_num_of_ports + 1
-
-            logger.info(f'Done setting up instance #{i}')
-
-        completed = subprocess.run('set -x; cd pnf-sim-lightweight; ./simulator.sh build ', shell=True)
-        logger.info(f"Build docker image: {completed.stdout}")
-
-    if args.subcommand == 'clean':
-        completed = subprocess.run('rm -rf ./pnf-sim-lw-*', shell=True)
-        logger.info(f'Deleting: {completed.stdout}')
-
-    if args.subcommand == 'start':
-
-        for i in range(args.count):
-            foldername = f"pnf-sim-lw-{i}"
-
-            completed = subprocess.run(
-                'set -x ; cd ' +
-                foldername +
-                "; bash -x ./simulator.sh start",
-                shell=True)
-            logger.info(f'Starting: {completed.stdout}')
-            time.sleep(5)
-
-    if args.subcommand == 'status':
-
-        for i in range(args.count):
-            foldername = f"pnf-sim-lw-{i}"
-
-            completed = subprocess.run(
-                'cd ' +
-                foldername +
-                "; ./simulator.sh status",
-                shell=True)
-            logger.info(f'Status: {completed.stdout}')
-
-    if args.subcommand == 'stop':
-        for i in range(args.count):
-            foldername = f"pnf-sim-lw-{i}"
-
-            completed = subprocess.run(
-                'cd ' +
-                foldername +
-                f"; ./simulator.sh stop {i}",
-                shell=True)
-            logger.info(f'Stopping: {completed.stdout}')
-
-
-    if args.subcommand == 'trigger':
-        logger.info("Triggering VES sending:")
-
-        for i in range(args.count):
-            foldername = f"pnf-sim-lw-{i}"
-
-            completed = subprocess.run(
-                'cd ' +
-                foldername +
-                "; ./simulator.sh trigger-simulator",
-                shell=True)
-            logger.info(f'Status: {completed.stdout}')
-
-    if args.subcommand == 'trigger-custom':
-        logger.info("Triggering VES sending by a range of simulators:")
-
-        for i in range(args.triggerstart, args.triggerend+1):
-            foldername = f"pnf-sim-lw-{i}"
-            logger.info(f"Instance being processed: {i}")
-
-            completed = subprocess.run(
-                'cd ' +
-                foldername +
-                "; ./simulator.sh trigger-simulator",
-                shell=True)
-            logger.info(f'Status: {completed.stdout}')
