Enable black in tox.ini 89/12689/2 release-v13.0-start
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Sun, 13 Nov 2022 23:48:32 +0000 (00:48 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Sun, 13 Nov 2022 23:55:23 +0000 (00:55 +0100)
Change-Id: Icd3d56e7b2eb871ce8d4ef60fbf079ac59b1f117
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
devops-stages/stage-test.sh
osm_pla/cmd/pla_server.py
osm_pla/config/config.py
osm_pla/placement/mznplacement.py
osm_pla/server/server.py
osm_pla/test/test_mznModelGenerator.py
osm_pla/test/test_mznPlacementConductor.py
osm_pla/test/test_mznmodels.py
osm_pla/test/test_nsPlacementDataFactory.py
osm_pla/test/test_server.py
tox.ini

index 2d7b24e..2802151 100755 (executable)
@@ -1,4 +1,7 @@
-#!/bin/sh
+#!/bin/bash
+
+# Copyright 2017 Intel Research and Development Ireland Limited
+
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -12,5 +15,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-OUTPUT=$(TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto)
-printf "$OUTPUT"
+echo "Launching tox"
+TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto
+
index 767e61d..409f14d 100755 (executable)
@@ -24,16 +24,18 @@ from osm_pla.server.server import Server
 
 
 def main():
-    parser = argparse.ArgumentParser(prog='osm-policy-agent')
-    parser.add_argument('--config-file', nargs='?', help='PLA configuration file')
+    parser = argparse.ArgumentParser(prog="osm-policy-agent")
+    parser.add_argument("--config-file", nargs="?", help="PLA configuration file")
     args = parser.parse_args()
     cfg = Config(args.config_file)
 
     root = logging.getLogger()
-    root.setLevel(logging.getLevelName(cfg.get('global', 'loglevel')))
+    root.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
     ch = logging.StreamHandler(sys.stdout)
-    ch.setLevel(logging.getLevelName(cfg.get('global', 'loglevel')))
-    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s', '%m/%d/%Y %I:%M:%S %p')
+    ch.setLevel(logging.getLevelName(cfg.get("global", "loglevel")))
+    formatter = logging.Formatter(
+        "%(asctime)s - %(name)s - %(levelname)s - %(message)s", "%m/%d/%Y %I:%M:%S %p"
+    )
     ch.setFormatter(formatter)
     root.addHandler(ch)
 
@@ -45,5 +47,5 @@ def main():
     server.run()
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     main()
index 114fc5f..13ff43b 100644 (file)
@@ -25,14 +25,14 @@ logger = logging.getLogger(__name__)
 
 
 class Config:
-    def __init__(self, config_file: str = ''):
+    def __init__(self, config_file: str = ""):
         self.conf = {}
         self._read_config_file(config_file)
         self._read_env()
 
     def _read_config_file(self, config_file):
         if not config_file:
-            path = 'pla.yaml'
+            path = "pla.yaml"
             config_file = pkg_resources.resource_filename(__name__, path)
         with open(config_file) as f:
             self.conf = yaml.load(f)
@@ -45,10 +45,12 @@ class Config:
             if len(elements) < 3:
                 logger.warning(
                     "Environment variable %s=%s does not comply with required format. Section and/or field missing.",
-                    env, os.getenv(env))
+                    env,
+                    os.getenv(env),
+                )
                 continue
             section = elements[1]
-            field = '_'.join(elements[2:])
+            field = "_".join(elements[2:])
             value = os.getenv(env)
             if section not in self.conf:
                 self.conf[section] = {}
index bbb3ddd..d507bbd 100755 (executable)
@@ -25,14 +25,17 @@ class MznPlacementConductor(object):
     """
     Knows how to process placement req using minizinc
     """
-    if platform.system() == 'Windows':
-        default_mzn_path = 'C:\\Program Files\\MiniZinc IDE (bundled)\\minizinc.exe'
+
+    if platform.system() == "Windows":
+        default_mzn_path = "C:\\Program Files\\MiniZinc IDE (bundled)\\minizinc.exe"
     else:
-        default_mzn_path = '/minizinc/bin/minizinc'
+        default_mzn_path = "/minizinc/bin/minizinc"
 
     def __init__(self, log, mzn_path=default_mzn_path):
-        pymzn.config['minizinc'] = mzn_path
-        self.log = log  # FIXME what to log (besides forwarding it to MznModelGenerator) here?
+        pymzn.config["minizinc"] = mzn_path
+        self.log = (
+            log  # FIXME what to log (besides forwarding it to MznModelGenerator) here?
+        )
 
     def _run_placement_model(self, mzn_model, ns_desc, mzn_model_data={}):
         """
@@ -51,23 +54,31 @@ class MznPlacementConductor(object):
         :return: list of dicts formatted as {'vimAccountId': '<account id>', 'member-vnf-index': <'index'>}
         or formatted as [{}] if unsatisfiable model
         """
-        solns = pymzn.minizinc(mzn_model, data=mzn_model_data, output_mode='item')
+        solns = pymzn.minizinc(mzn_model, data=mzn_model_data, output_mode="item")
 
-        if 'UNSATISFIABLE' in str(solns):
+        if "UNSATISFIABLE" in str(solns):
             return [{}]
 
         solns_as_str = str(solns[0])
 
         # make it easier to extract the desired information by cleaning from newline, whitespace etc.
-        solns_as_str = solns_as_str.replace('\n', '').replace(' ', '').rstrip(';')
+        solns_as_str = solns_as_str.replace("\n", "").replace(" ", "").rstrip(";")
 
-        vnf_vim_mapping = (e.split('=') for e in solns_as_str.split(';'))
+        vnf_vim_mapping = (e.split("=") for e in solns_as_str.split(";"))
 
-        res = [{'vimAccountId': e[1][3:].replace('_', '-'), 'member-vnf-index': e[0][3:]} for e in
-               vnf_vim_mapping]
+        res = [
+            {"vimAccountId": e[1][3:].replace("_", "-"), "member-vnf-index": e[0][3:]}
+            for e in vnf_vim_mapping
+        ]
         # add any pinned VNFs
-        pinned = [{'vimAccountId': e['vim_account'][3:].replace('_', '-'), 'member-vnf-index': e['vnf_id']} for e in
-                  ns_desc if 'vim_account' in e.keys()]
+        pinned = [
+            {
+                "vimAccountId": e["vim_account"][3:].replace("_", "-"),
+                "member-vnf-index": e["vnf_id"],
+            }
+            for e in ns_desc
+            if "vim_account" in e.keys()
+        ]
 
         return res + pinned
 
@@ -79,41 +90,47 @@ class MznPlacementConductor(object):
         :return: see _run_placement_model
         """
         mzn_model = MznModelGenerator(self.log).create_model(nspd)
-        return self._run_placement_model(mzn_model, nspd['ns_desc'])
+        return self._run_placement_model(mzn_model, nspd["ns_desc"])
 
 
 class MznModelGenerator(object):
-    '''
+    """
     Has the capability to generate minizinc models from information contained in
     NsPlacementData objects. Uses jinja2 as templating language for the model
-    '''
+    """
+
     default_j2_template = "osm_pla_dynamic_template.j2"
-    template_search_path = ['osm_pla/placement', '../placement', '/pla/osm_pla/placement',
-                            './', '/usr/lib/python3/dist-packages/osm_pla/placement']
+    template_search_path = [
+        "osm_pla/placement",
+        "../placement",
+        "/pla/osm_pla/placement",
+        "./",
+        "/usr/lib/python3/dist-packages/osm_pla/placement",
+    ]
 
     def __init__(self, log):
-        '''
+        """
         Constructor
-        '''
+        """
         self.log = log  # FIXME we do not log anything so far
 
     def create_model(self, ns_placement_data):
-        '''
+        """
         Creates a minizinc model according to the content of nspd
         nspd - NSPlacementData
         return MZNModel
-        '''
-        self.log.info('ns_desc: {}'.format(ns_placement_data['ns_desc']))
-        self.log.info('vld_desc: {}'.format(ns_placement_data['vld_desc']))
+        """
+        self.log.info("ns_desc: {}".format(ns_placement_data["ns_desc"]))
+        self.log.info("vld_desc: {}".format(ns_placement_data["vld_desc"]))
         mzn_model_template = self._load_jinja_template()
         mzn_model = mzn_model_template.render(ns_placement_data)
-        self.log.info('Minizinc model: {}'.format(mzn_model))
+        self.log.info("Minizinc model: {}".format(mzn_model))
         return mzn_model
 
     def _load_jinja_template(self, template_name=default_j2_template):
         """loads the jinja template used for model generation"""
         loader1 = FileSystemLoader(MznModelGenerator.template_search_path)
-        loader2 = PackageLoader('osm_pla', '.')
+        loader2 = PackageLoader("osm_pla", ".")
         env = Environment(loader=ChoiceLoader([loader1, loader2]))
         return env.get_template(template_name)
 
@@ -124,7 +141,15 @@ class NsPlacementDataFactory(object):
     information tailored for the minizinc model code generator
     """
 
-    def __init__(self, vim_accounts_info, vnf_prices, nsd, pil_info, pinning=None, order_constraints=None):
+    def __init__(
+        self,
+        vim_accounts_info,
+        vnf_prices,
+        nsd,
+        pil_info,
+        pinning=None,
+        order_constraints=None,
+    ):
         """
         :param vim_accounts_info: a dictionary with vim url as key and id as value, we add a unique index to it for use
         in the mzn array constructs and adjust the value of the id to minizinc acceptable identifier syntax
@@ -135,8 +160,10 @@ class NsPlacementDataFactory(object):
         :param order_constraints: any constraints provided at instantiation time
         """
         next_idx = itertools.count()
-        self._vim_accounts_info = {k: {'id': 'vim' + v.replace('-', '_'), 'idx': next(next_idx)} for k, v in
-                                   vim_accounts_info.items()}
+        self._vim_accounts_info = {
+            k: {"id": "vim" + v.replace("-", "_"), "idx": next(next_idx)}
+            for k, v in vim_accounts_info.items()
+        }
         self._vnf_prices = vnf_prices
         self._nsd = nsd
         self._pil_info = pil_info
@@ -148,18 +175,21 @@ class NsPlacementDataFactory(object):
         :param characteristics: one of  {pil_latency, pil_price, pil_jitter}
         :return: 2d array of requested trp_link characteristics data
         """
-        if characteristics not in {'pil_latency', 'pil_price', 'pil_jitter'}:
-            raise Exception('characteristic \'{}\' not supported'.format(characteristics))
+        if characteristics not in {"pil_latency", "pil_price", "pil_jitter"}:
+            raise Exception("characteristic '{}' not supported".format(characteristics))
         num_vims = len(self._vim_accounts_info)
-        trp_link_characteristics = [[0 if col == row else 0x7fff for col in range(num_vims)] for row in range(num_vims)]
-        for pil in self._pil_info['pil']:
+        trp_link_characteristics = [
+            [0 if col == row else 0x7FFF for col in range(num_vims)]
+            for row in range(num_vims)
+        ]
+        for pil in self._pil_info["pil"]:
             if characteristics in pil.keys():
-                ep1 = pil['pil_endpoints'][0]
-                ep2 = pil['pil_endpoints'][1]
+                ep1 = pil["pil_endpoints"][0]
+                ep2 = pil["pil_endpoints"][1]
                 # only consider links between applicable vims
                 if ep1 in self._vim_accounts_info and ep2 in self._vim_accounts_info:
-                    idx1 = self._vim_accounts_info[ep1]['idx']
-                    idx2 = self._vim_accounts_info[ep2]['idx']
+                    idx1 = self._vim_accounts_info[ep1]["idx"]
+                    idx2 = self._vim_accounts_info[ep2]["idx"]
                     trp_link_characteristics[idx1][idx2] = pil[characteristics]
                     trp_link_characteristics[idx2][idx1] = pil[characteristics]
 
@@ -175,61 +205,67 @@ class NsPlacementDataFactory(object):
 
         all_vld_member_vnf_index_refs = {}
         # TODO: Change for multiple DF support
-        ns_df = self._nsd.get('df', [{}])[0]
-        for vnf_profile in ns_df.get('vnf-profile', []):
-            for vlc in vnf_profile.get('virtual-link-connectivity', []):
-                vld_id = vlc.get('virtual-link-profile-id')
-                vld_member_vnf_index_ref = vnf_profile.get('id')
+        ns_df = self._nsd.get("df", [{}])[0]
+        for vnf_profile in ns_df.get("vnf-profile", []):
+            for vlc in vnf_profile.get("virtual-link-connectivity", []):
+                vld_id = vlc.get("virtual-link-profile-id")
+                vld_member_vnf_index_ref = vnf_profile.get("id")
                 if vld_id in all_vld_member_vnf_index_refs:
-                    all_vld_member_vnf_index_refs[vld_id].append(vld_member_vnf_index_ref)
+                    all_vld_member_vnf_index_refs[vld_id].append(
+                        vld_member_vnf_index_ref
+                    )
                 else:
                     all_vld_member_vnf_index_refs[vld_id] = [vld_member_vnf_index_ref]
 
         vld_desc = []
-        for vld in self._nsd.get('virtual-link-desc', ()):
-            if vld.get('mgmt-network', False) is True:
+        for vld in self._nsd.get("virtual-link-desc", ()):
+            if vld.get("mgmt-network", False) is True:
                 continue
             vld_desc_entry = {}
-            cp_refs = all_vld_member_vnf_index_refs[vld.get('id')]
+            cp_refs = all_vld_member_vnf_index_refs[vld.get("id")]
             if len(cp_refs) == 2:
-                vld_desc_entry['cp_refs'] = cp_refs
+                vld_desc_entry["cp_refs"] = cp_refs
                 # TODO: Change for multiple DF support
-                vld_df = vld.get('df', [{}])[0]
-                for constraint in vld_df.get('qos', {}):
-                    if constraint == 'latency':
-                        vld_desc_entry['latency'] = vld_df['qos'][constraint]
-                    elif constraint == 'packet-delay-variation':
-                        vld_desc_entry['jitter'] = vld_df['qos'][constraint]
+                vld_df = vld.get("df", [{}])[0]
+                for constraint in vld_df.get("qos", {}):
+                    if constraint == "latency":
+                        vld_desc_entry["latency"] = vld_df["qos"][constraint]
+                    elif constraint == "packet-delay-variation":
+                        vld_desc_entry["jitter"] = vld_df["qos"][constraint]
                 vld_desc.append(vld_desc_entry)
 
         # create candidates from instantiate params
         if self._order_constraints is not None:
             candidate_vld_desc = []
             # use id to find the endpoints in the nsd
-            for entry in self._order_constraints.get('vld-constraints'):
-                for vld in self._nsd.get('virtual-link-desc', ()):
-                    if entry['id'] == vld.get('id'):
+            for entry in self._order_constraints.get("vld-constraints"):
+                for vld in self._nsd.get("virtual-link-desc", ()):
+                    if entry["id"] == vld.get("id"):
                         vld_desc_instantiate_entry = {}
-                        cp_refs = all_vld_member_vnf_index_refs[vld.get('id')]
-                        vld_desc_instantiate_entry['cp_refs'] = cp_refs
+                        cp_refs = all_vld_member_vnf_index_refs[vld.get("id")]
+                        vld_desc_instantiate_entry["cp_refs"] = cp_refs
                         # add whatever constraints that are provided to the vld_desc_entry
                         # misspelled 'link-constraints' => empty dict
                         # lack (or misspelling) of one or both supported constraints => entry not appended
-                        for constraint, value in entry.get('link-constraints', {}).items():
-                            if constraint == 'latency':
-                                vld_desc_instantiate_entry['latency'] = value
-                            elif constraint == 'jitter':
-                                vld_desc_instantiate_entry['jitter'] = value
-                        if {'latency', 'jitter'}.intersection(vld_desc_instantiate_entry.keys()):
+                        for constraint, value in entry.get(
+                            "link-constraints", {}
+                        ).items():
+                            if constraint == "latency":
+                                vld_desc_instantiate_entry["latency"] = value
+                            elif constraint == "jitter":
+                                vld_desc_instantiate_entry["jitter"] = value
+                        if {"latency", "jitter"}.intersection(
+                            vld_desc_instantiate_entry.keys()
+                        ):
                             candidate_vld_desc.append(vld_desc_instantiate_entry)
             # merge with nsd originated, FIXME log any deviations?
             for vld_d in vld_desc:
                 for vld_d_i in candidate_vld_desc:
-                    if set(vld_d['cp_refs']) == set(vld_d_i['cp_refs']):
-                        if vld_d_i.get('jitter'):
-                            vld_d['jitter'] = vld_d_i['jitter']
-                        if vld_d_i.get('latency'):
-                            vld_d['latency'] = vld_d_i['latency']
+                    if set(vld_d["cp_refs"]) == set(vld_d_i["cp_refs"]):
+                        if vld_d_i.get("jitter"):
+                            vld_d["jitter"] = vld_d_i["jitter"]
+                        if vld_d_i.get("latency"):
+                            vld_d["latency"] = vld_d_i["latency"]
 
         return vld_desc
 
@@ -240,38 +276,50 @@ class NsPlacementDataFactory(object):
         """
         ns_desc = []
         # TODO: Change for multiple DF support
-        ns_df = self._nsd.get('df', [{}])[0]
-        for vnf_profile in ns_df.get('vnf-profile', []):
-            vnf_info = {'vnf_id': vnf_profile['id']}
+        ns_df = self._nsd.get("df", [{}])[0]
+        for vnf_profile in ns_df.get("vnf-profile", []):
+            vnf_info = {"vnf_id": vnf_profile["id"]}
             # prices
-            prices_for_vnfd = self._vnf_prices[vnf_profile['vnfd-id']]
+            prices_for_vnfd = self._vnf_prices[vnf_profile["vnfd-id"]]
             # the list of prices must be ordered according to the indexing of the vim_accounts
             price_list = [_ for _ in range(len(self._vim_accounts_info))]
             for k in prices_for_vnfd.keys():
                 if k in self._vim_accounts_info.keys():
-                    price_list[self._vim_accounts_info[k]['idx']] = prices_for_vnfd[k]
-            vnf_info['vnf_price_per_vim'] = price_list
+                    price_list[self._vim_accounts_info[k]["idx"]] = prices_for_vnfd[k]
+            vnf_info["vnf_price_per_vim"] = price_list
 
             # pinning to dc
             if self._pinning is not None:
                 for pinned_vnf in self._pinning:
-                    if vnf_profile['id'] == pinned_vnf['member-vnf-index']:
-                        vnf_info['vim_account'] = 'vim' + pinned_vnf['vimAccountId'].replace('-', '_')
+                    if vnf_profile["id"] == pinned_vnf["member-vnf-index"]:
+                        vnf_info["vim_account"] = "vim" + pinned_vnf[
+                            "vimAccountId"
+                        ].replace("-", "_")
 
             ns_desc.append(vnf_info)
         return ns_desc
 
     def create_ns_placement_data(self):
-        """populate NsPlacmentData object
-        """
-        ns_placement_data = {'vim_accounts': [vim_data['id'] for _, vim_data in sorted(self._vim_accounts_info.items(),
-                                                                                       key=lambda item: item[1][
-                                                                                           'idx'])],
-                             'trp_link_latency': self._produce_trp_link_characteristics_data('pil_latency'),
-                             'trp_link_jitter': self._produce_trp_link_characteristics_data('pil_jitter'),
-                             'trp_link_price_list': self._produce_trp_link_characteristics_data('pil_price'),
-                             'ns_desc': self._produce_ns_desc(),
-                             'vld_desc': self._produce_vld_desc(),
-                             'generator_data': {'file': __file__, 'time': datetime.datetime.now()}}
+        """populate NsPlacmentData object"""
+        ns_placement_data = {
+            "vim_accounts": [
+                vim_data["id"]
+                for _, vim_data in sorted(
+                    self._vim_accounts_info.items(), key=lambda item: item[1]["idx"]
+                )
+            ],
+            "trp_link_latency": self._produce_trp_link_characteristics_data(
+                "pil_latency"
+            ),
+            "trp_link_jitter": self._produce_trp_link_characteristics_data(
+                "pil_jitter"
+            ),
+            "trp_link_price_list": self._produce_trp_link_characteristics_data(
+                "pil_price"
+            ),
+            "ns_desc": self._produce_ns_desc(),
+            "vld_desc": self._produce_vld_desc(),
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
 
         return ns_placement_data
index 2258ed9..d2476ec 100644 (file)
@@ -30,8 +30,8 @@ from osm_pla.placement.mznplacement import NsPlacementDataFactory
 
 
 class Server:
-    pil_price_list_file = Path('/placement/pil_price_list.yaml')
-    vnf_price_list_file = Path('/placement/vnf_price_list.yaml')
+    pil_price_list_file = Path("/placement/pil_price_list.yaml")
+    vnf_price_list_file = Path("/placement/vnf_price_list.yaml")
 
     def __init__(self, config: Config, loop=None):
         self.log = logging.getLogger("pla.server")
@@ -41,25 +41,31 @@ class Server:
         self.loop = loop or asyncio.get_event_loop()
 
         try:
-            if config.get('database', 'driver') == "mongo":
+            if config.get("database", "driver") == "mongo":
                 self.db = dbmongo.DbMongo()
-                self.db.db_connect(config.get('database'))
-            elif config.get('database', 'driver') == "memory":
+                self.db.db_connect(config.get("database"))
+            elif config.get("database", "driver") == "memory":
                 self.db = dbmemory.DbMemory()
-                self.db.db_connect(config.get('database'))
+                self.db.db_connect(config.get("database"))
             else:
-                raise Exception("Invalid configuration param '{}' at '[database]':'driver'".format(
-                    config.get('database', 'driver')))
+                raise Exception(
+                    "Invalid configuration param '{}' at '[database]':'driver'".format(
+                        config.get("database", "driver")
+                    )
+                )
 
-            if config.get('message', 'driver') == "local":
+            if config.get("message", "driver") == "local":
                 self.msgBus = msglocal.MsgLocal()
-            elif config.get('message', 'driver') == "kafka":
+            elif config.get("message", "driver") == "kafka":
                 self.msgBus = msgkafka.MsgKafka()
             else:
-                raise Exception("Invalid message bus driver {}".format(
-                    config.get('message', 'driver')))
+                raise Exception(
+                    "Invalid message bus driver {}".format(
+                        config.get("message", "driver")
+                    )
+                )
             self.msgBus.loop = loop
-            self.msgBus.connect(config.get('message'))
+            self.msgBus.connect(config.get("message"))
 
         except Exception as e:
             self.log.exception("kafka setup error. Exception: {}".format(e))
@@ -78,7 +84,7 @@ class Server:
         :return: project name to project id mapping
         """
         projects = self.db.get_list("projects")
-        return {project['_id']: project['name'] for project in projects}
+        return {project["_id"]: project["name"] for project in projects}
 
     def _get_nsd(self, nsd_id):
         """
@@ -119,10 +125,10 @@ class Server:
         :return: True if project part of price list, else False
         """
         price_list_entry_keys = set(price_list[0].keys())
-        price_list_entry_keys.remove('vnfd')
+        price_list_entry_keys.remove("vnfd")
         pl_key = price_list_entry_keys.pop()
         entry_to_check = price_list[0][pl_key][0].keys()
-        return True if 'prices' in entry_to_check else False
+        return True if "prices" in entry_to_check else False
 
     def _get_vnf_price_list(self, price_list_file_path, project_name=None):
         """
@@ -136,12 +142,21 @@ class Server:
         if self._price_list_with_project(price_list_data):
             res = {}
             for i in price_list_data:
-                price_data = i[project_name] if type(i[project_name]) is dict else i[project_name][0]
-                res_component = {i['vim_name']: i['price'] for i in price_data['prices']}
-                res.update({i['vnfd']: res_component})
+                price_data = (
+                    i[project_name]
+                    if type(i[project_name]) is dict
+                    else i[project_name][0]
+                )
+                res_component = {
+                    i["vim_name"]: i["price"] for i in price_data["prices"]
+                }
+                res.update({i["vnfd"]: res_component})
             return res
         else:
-            return {i['vnfd']: {i1['vim_name']: i1['price'] for i1 in i['prices']} for i in price_list_data}
+            return {
+                i["vnfd"]: {i1["vim_name"]: i1["price"] for i1 in i["prices"]}
+                for i in price_list_data
+            }
 
     def _get_pil_info(self, pil_info_file_path):
         """
@@ -160,10 +175,11 @@ class Server:
          return tuples with mappings {<adjusted id>: <original id>} and {<original id>: <adjusted id>}
         """
         # TODO: Change for multiple DF support
-        ns_df = nsd.get('df', [{}])[0]
+        ns_df = nsd.get("df", [{}])[0]
         next_idx = itertools.count()
-        member_vnf_index2mzn = {e['id']: 'VNF' + str(next(next_idx)) for e in
-                                ns_df.get('vnf-profile', [])}
+        member_vnf_index2mzn = {
+            e["id"]: "VNF" + str(next(next_idx)) for e in ns_df.get("vnf-profile", [])
+        }
 
         # reverse the name map dictionary, used when the placement result is remapped
         mzn_name2member_vnf_index = {v: k for k, v in member_vnf_index2mzn.items()}
@@ -183,41 +199,47 @@ class Server:
         """
         try:
             nslcmop = self._get_nslcmop(nslcmop_id)
-            nsd = self._get_nsd(nslcmop['operationParams']['nsdId'])
+            nsd = self._get_nsd(nslcmop["operationParams"]["nsdId"])
             member_vnf_index2mzn, mzn2member_vnf_index = self._create_vnf_id_maps(nsd)
             # adjust vnf identifiers
             # TODO: Change for multiple DF support
-            ns_df = nsd.get('df', [{}])[0]
-            for vnf_profile in ns_df.get('vnf-profile', []):
-                vnf_profile['id'] = member_vnf_index2mzn[vnf_profile['id']]
-                for vlc in vnf_profile.get('virtual-link-connectivity', []):
-                    for ccpd in vlc.get('constituent-cpd-id', []):
-                        ccpd['constituent-base-element-id'] = member_vnf_index2mzn[ccpd['constituent-base-element-id']]
+            ns_df = nsd.get("df", [{}])[0]
+            for vnf_profile in ns_df.get("vnf-profile", []):
+                vnf_profile["id"] = member_vnf_index2mzn[vnf_profile["id"]]
+                for vlc in vnf_profile.get("virtual-link-connectivity", []):
+                    for ccpd in vlc.get("constituent-cpd-id", []):
+                        ccpd["constituent-base-element-id"] = member_vnf_index2mzn[
+                            ccpd["constituent-base-element-id"]
+                        ]
             self.log.info("adjusted nsd: {}".format(nsd))
             projects = self._get_projects()
             self.log.info("projects: {}".format(projects))
-            nslcmop_project = nslcmop['_admin']['projects_read'][0]
+            nslcmop_project = nslcmop["_admin"]["projects_read"][0]
             self.log.info("nslcmop_project: {}".format(nslcmop_project))
-            valid_vim_accounts = nslcmop['operationParams']['validVimAccounts']
+            valid_vim_accounts = nslcmop["operationParams"]["validVimAccounts"]
             vim_accounts_data = self._get_vim_accounts(valid_vim_accounts)
-            vims_information = {_['name']: _['_id'] for _ in vim_accounts_data}
-            price_list = self._get_vnf_price_list(Server.vnf_price_list_file, projects[nslcmop_project])
+            vims_information = {_["name"]: _["_id"] for _ in vim_accounts_data}
+            price_list = self._get_vnf_price_list(
+                Server.vnf_price_list_file, projects[nslcmop_project]
+            )
             pil_info = self._get_pil_info(Server.pil_price_list_file)
-            pinnings = nslcmop['operationParams'].get('vnf', [])
+            pinnings = nslcmop["operationParams"].get("vnf", [])
             # remap member-vnf-index values according to id map
             for pinning in pinnings:
-                pinning['member-vnf-index'] = member_vnf_index2mzn[pinning['member-vnf-index']]
+                pinning["member-vnf-index"] = member_vnf_index2mzn[
+                    pinning["member-vnf-index"]
+                ]
             self.log.info("pinnings: {}".format(pinnings))
-            order_constraints = nslcmop['operationParams'].get('placement-constraints')
+            order_constraints = nslcmop["operationParams"].get("placement-constraints")
             self.log.info("order constraints: {}".format(order_constraints))
 
-            nspd = NsPlacementDataFactory(vims_information,
-                                          price_list,
-                                          nsd,
-                                          pil_info,
-                                          pinnings, order_constraints).create_ns_placement_data()
+            nspd = NsPlacementDataFactory(
+                vims_information, price_list, nsd, pil_info, pinnings, order_constraints
+            ).create_ns_placement_data()
 
-            vnf_placement = MznPlacementConductor(self.log).do_placement_computation(nspd)
+            vnf_placement = MznPlacementConductor(self.log).do_placement_computation(
+                nspd
+            )
 
         except Exception as e:
             # Note: there is no cure for failure so we have a catch-all clause here
@@ -226,14 +248,17 @@ class Server:
         finally:
             # remap names in vnf_placement
             for e in vnf_placement:
-                e['member-vnf-index'] = mzn2member_vnf_index[e['member-vnf-index']]
-            await self.msgBus.aiowrite("pla", "placement",
-                                       {'placement': {'vnf': vnf_placement, 'nslcmopId': nslcmop_id}})
+                e["member-vnf-index"] = mzn2member_vnf_index[e["member-vnf-index"]]
+            await self.msgBus.aiowrite(
+                "pla",
+                "placement",
+                {"placement": {"vnf": vnf_placement, "nslcmopId": nslcmop_id}},
+            )
 
     def handle_kafka_command(self, topic, command, params):
         self.log.info("Kafka msg arrived: {} {} {}".format(topic, command, params))
         if topic == "pla" and command == "get_placement":
-            nslcmop_id = params.get('nslcmopId')
+            nslcmop_id = params.get("nslcmopId")
             self.loop.create_task(self.get_placement(nslcmop_id))
 
     async def kafka_read(self):
index ed571f4..4f0423d 100644 (file)
 # limitations under the License.
 import datetime
 import logging
+
 # import unittest
 from unittest import TestCase
+
 # import random
 # from operator import itemgetter
 import re
@@ -25,134 +27,286 @@ from jinja2 import Template
 from osm_pla.placement.mznplacement import MznModelGenerator
 
 test_ns_placement_data_str = {
-    'vim_accounts': ['vim' + vim_account.replace('-', '_') for vim_account in ['aaaaaaaa-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'cccccccc-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'dddddddd-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'eeeeeeee-38f5-438d-b8ee-3f93b3531f87']],
-    'trp_link_latency': [[0, 50, 100, 150, 200], [0, 0, 100, 150, 200], [0, 0, 0, 150, 200], [0, 0, 0, 0, 200],
-                         [0, 0, 0, 0, 0]],
-    'trp_link_jitter': [[0, 5, 10, 15, 20], [0, 0, 10, 15, 20], [0, 0, 0, 15, 20], [0, 0, 0, 0, 20],
-                        [0, 0, 0, 0, 0]],
-    'trp_link_price_list': [[0, 5, 6, 6, 7], [0, 0, 6, 6, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7], [0, 0, 0, 0, 0]],
-    'ns_desc': [
-        {'vnf_id': 'one', 'vnf_price_per_vim': [50, 51, 52, 53, 54]},
-        {'vnf_id': 'two', 'vnf_price_per_vim': [20, 21, 22, 23, 24]},
-        {'vnf_id': 'three', 'vnf_price_per_vim': [70, 71, 72, 73, 74]},
-        {'vnf_id': 'four', 'vnf_price_per_vim': [40, 41, 42, 43, 44]}],
-    'vld_desc': [{'cp_refs': ['one', 'two'], 'latency': 150, 'jitter': 30},
-                 {'cp_refs': ['two', 'three'], 'latency': 140, 'jitter': 30},
-                 {'cp_refs': ['three', 'four'], 'latency': 130, 'jitter': 30}],
-    'generator_data': {'file': __file__, 'time': datetime.datetime.now()}
+    "vim_accounts": [
+        "vim" + vim_account.replace("-", "_")
+        for vim_account in [
+            "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+            "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+            "cccccccc-ed84-4e49-b5df-a9d117bd731f",
+            "dddddddd-ed84-4e49-b5df-a9d117bd731f",
+            "eeeeeeee-38f5-438d-b8ee-3f93b3531f87",
+        ]
+    ],
+    "trp_link_latency": [
+        [0, 50, 100, 150, 200],
+        [0, 0, 100, 150, 200],
+        [0, 0, 0, 150, 200],
+        [0, 0, 0, 0, 200],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_jitter": [
+        [0, 5, 10, 15, 20],
+        [0, 0, 10, 15, 20],
+        [0, 0, 0, 15, 20],
+        [0, 0, 0, 0, 20],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_price_list": [
+        [0, 5, 6, 6, 7],
+        [0, 0, 6, 6, 7],
+        [0, 0, 0, 6, 7],
+        [0, 0, 0, 0, 7],
+        [0, 0, 0, 0, 0],
+    ],
+    "ns_desc": [
+        {"vnf_id": "one", "vnf_price_per_vim": [50, 51, 52, 53, 54]},
+        {"vnf_id": "two", "vnf_price_per_vim": [20, 21, 22, 23, 24]},
+        {"vnf_id": "three", "vnf_price_per_vim": [70, 71, 72, 73, 74]},
+        {"vnf_id": "four", "vnf_price_per_vim": [40, 41, 42, 43, 44]},
+    ],
+    "vld_desc": [
+        {"cp_refs": ["one", "two"], "latency": 150, "jitter": 30},
+        {"cp_refs": ["two", "three"], "latency": 140, "jitter": 30},
+        {"cp_refs": ["three", "four"], "latency": 130, "jitter": 30},
+    ],
+    "generator_data": {"file": __file__, "time": datetime.datetime.now()},
 }
 
 test_ns_placement_data_str_no_vld_constraints = {
-    'vim_accounts': ['vim' + vim_account.replace('-', '_') for vim_account in ['aaaaaaaa-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'cccccccc-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'dddddddd-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'eeeeeeee-38f5-438d-b8ee-3f93b3531f87']],
-    'trp_link_latency': [[0, 50, 100, 150, 200], [0, 0, 100, 150, 200], [0, 0, 0, 150, 200], [0, 0, 0, 0, 200],
-                         [0, 0, 0, 0, 0]],
-    'trp_link_jitter': [[0, 5, 10, 15, 20], [0, 0, 10, 15, 20], [0, 0, 0, 15, 20], [0, 0, 0, 0, 20],
-                        [0, 0, 0, 0, 0]],
-    'trp_link_price_list': [[0, 5, 6, 6, 7], [0, 0, 6, 6, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7], [0, 0, 0, 0, 0]],
-    'ns_desc': [
-        {'vnf_id': 'one', 'vnf_price_per_vim': [50, 51, 52, 53, 54]},
-        {'vnf_id': 'two', 'vnf_price_per_vim': [20, 21, 22, 23, 24]},
-        {'vnf_id': 'three', 'vnf_price_per_vim': [70, 71, 72, 73, 74]},
-        {'vnf_id': 'four', 'vnf_price_per_vim': [40, 41, 42, 43, 44]}],
-    'vld_desc': [{'cp_refs': ['one', 'two']},
-                 {'cp_refs': ['two', 'three']},
-                 {'cp_refs': ['three', 'four']}],
-    'generator_data': {'file': __file__, 'time': datetime.datetime.now()}
+    "vim_accounts": [
+        "vim" + vim_account.replace("-", "_")
+        for vim_account in [
+            "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+            "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+            "cccccccc-ed84-4e49-b5df-a9d117bd731f",
+            "dddddddd-ed84-4e49-b5df-a9d117bd731f",
+            "eeeeeeee-38f5-438d-b8ee-3f93b3531f87",
+        ]
+    ],
+    "trp_link_latency": [
+        [0, 50, 100, 150, 200],
+        [0, 0, 100, 150, 200],
+        [0, 0, 0, 150, 200],
+        [0, 0, 0, 0, 200],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_jitter": [
+        [0, 5, 10, 15, 20],
+        [0, 0, 10, 15, 20],
+        [0, 0, 0, 15, 20],
+        [0, 0, 0, 0, 20],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_price_list": [
+        [0, 5, 6, 6, 7],
+        [0, 0, 6, 6, 7],
+        [0, 0, 0, 6, 7],
+        [0, 0, 0, 0, 7],
+        [0, 0, 0, 0, 0],
+    ],
+    "ns_desc": [
+        {"vnf_id": "one", "vnf_price_per_vim": [50, 51, 52, 53, 54]},
+        {"vnf_id": "two", "vnf_price_per_vim": [20, 21, 22, 23, 24]},
+        {"vnf_id": "three", "vnf_price_per_vim": [70, 71, 72, 73, 74]},
+        {"vnf_id": "four", "vnf_price_per_vim": [40, 41, 42, 43, 44]},
+    ],
+    "vld_desc": [
+        {"cp_refs": ["one", "two"]},
+        {"cp_refs": ["two", "three"]},
+        {"cp_refs": ["three", "four"]},
+    ],
+    "generator_data": {"file": __file__, "time": datetime.datetime.now()},
 }
 
 test_ns_placement_data = {
-    'vim_accounts': ['vim' + vim_account.replace('-', '_') for vim_account in ['aaaaaaaa-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'cccccccc-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'dddddddd-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'eeeeeeee-38f5-438d-b8ee-3f93b3531f87']],
-    'trp_link_latency': [[0, 50, 100, 150, 200], [0, 0, 100, 150, 200], [0, 0, 0, 150, 200], [0, 0, 0, 0, 200],
-                         [0, 0, 0, 0, 0]],
-    'trp_link_jitter': [[0, 5, 10, 15, 20], [0, 0, 10, 15, 20], [0, 0, 0, 15, 20], [0, 0, 0, 0, 20],
-                        [0, 0, 0, 0, 0]],
-    'trp_link_price_list': [[0, 5, 6, 6, 7], [0, 0, 6, 6, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7], [0, 0, 0, 0, 0]],
-    'ns_desc': [
-        {'vnf_id': '1', 'vnf_price_per_vim': [50, 51, 52, 53, 54]},
-        {'vnf_id': '2', 'vnf_price_per_vim': [20, 21, 22, 23, 24]},
-        {'vnf_id': '3', 'vnf_price_per_vim': [70, 71, 72, 73, 74]},
-        {'vnf_id': '4', 'vnf_price_per_vim': [40, 41, 42, 43, 44]}],
-    'vld_desc': [{'cp_refs': ['1', '2'], 'latency': 150, 'jitter': 30},
-                 {'cp_refs': ['2', '3'], 'latency': 140, 'jitter': 30},
-                 {'cp_refs': ['3', '4'], 'latency': 130, 'jitter': 30}],
-    'generator_data': {'file': __file__, 'time': datetime.datetime.now()}
+    "vim_accounts": [
+        "vim" + vim_account.replace("-", "_")
+        for vim_account in [
+            "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+            "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+            "cccccccc-ed84-4e49-b5df-a9d117bd731f",
+            "dddddddd-ed84-4e49-b5df-a9d117bd731f",
+            "eeeeeeee-38f5-438d-b8ee-3f93b3531f87",
+        ]
+    ],
+    "trp_link_latency": [
+        [0, 50, 100, 150, 200],
+        [0, 0, 100, 150, 200],
+        [0, 0, 0, 150, 200],
+        [0, 0, 0, 0, 200],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_jitter": [
+        [0, 5, 10, 15, 20],
+        [0, 0, 10, 15, 20],
+        [0, 0, 0, 15, 20],
+        [0, 0, 0, 0, 20],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_price_list": [
+        [0, 5, 6, 6, 7],
+        [0, 0, 6, 6, 7],
+        [0, 0, 0, 6, 7],
+        [0, 0, 0, 0, 7],
+        [0, 0, 0, 0, 0],
+    ],
+    "ns_desc": [
+        {"vnf_id": "1", "vnf_price_per_vim": [50, 51, 52, 53, 54]},
+        {"vnf_id": "2", "vnf_price_per_vim": [20, 21, 22, 23, 24]},
+        {"vnf_id": "3", "vnf_price_per_vim": [70, 71, 72, 73, 74]},
+        {"vnf_id": "4", "vnf_price_per_vim": [40, 41, 42, 43, 44]},
+    ],
+    "vld_desc": [
+        {"cp_refs": ["1", "2"], "latency": 150, "jitter": 30},
+        {"cp_refs": ["2", "3"], "latency": 140, "jitter": 30},
+        {"cp_refs": ["3", "4"], "latency": 130, "jitter": 30},
+    ],
+    "generator_data": {"file": __file__, "time": datetime.datetime.now()},
 }
 
 test_ns_placement_data_w_pinning = {
-    'vim_accounts': ['vim' + vim_account.replace('-', '_') for vim_account in ['aaaaaaaa-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'cccccccc-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'dddddddd-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'eeeeeeee-38f5-438d-b8ee-3f93b3531f87']],
-    'trp_link_latency': [[0, 50, 100, 150, 200], [0, 0, 100, 150, 200], [0, 0, 0, 150, 200], [0, 0, 0, 0, 200],
-                         [0, 0, 0, 0, 0]],
-    'trp_link_jitter': [[0, 5, 10, 15, 20], [0, 0, 10, 15, 20], [0, 0, 0, 15, 20], [0, 0, 0, 0, 20],
-                        [0, 0, 0, 0, 0]],
-    'trp_link_price_list': [[0, 5, 6, 6, 7], [0, 0, 6, 6, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7], [0, 0, 0, 0, 0]],
-    'ns_desc': [
-        {'vnf_id': '1', 'vnf_price_per_vim': [50, 51, 52, 53, 54]},
-        {'vnf_id': '2', 'vnf_price_per_vim': [20, 21, 22, 23, 24],
-         'vim_account': 'vimeeeeeeee_38f5_438d_b8ee_3f93b3531f87'},
-        {'vnf_id': '3', 'vnf_price_per_vim': [70, 71, 72, 73, 74]},
-        {'vnf_id': '4', 'vnf_price_per_vim': [40, 41, 42, 43, 44],
-         'vim_account': 'vimcccccccc_ed84_4e49_b5df_a9d117bd731f'}],
-    'vld_desc': [{'cp_refs': ['1', '2'], 'latency': 150, 'jitter': 30},
-                 {'cp_refs': ['2', '3'], 'latency': 140, 'jitter': 30},
-                 {'cp_refs': ['3', '4'], 'latency': 130, 'jitter': 30}],
-    'generator_data': {'file': __file__, 'time': datetime.datetime.now()}
+    "vim_accounts": [
+        "vim" + vim_account.replace("-", "_")
+        for vim_account in [
+            "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+            "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+            "cccccccc-ed84-4e49-b5df-a9d117bd731f",
+            "dddddddd-ed84-4e49-b5df-a9d117bd731f",
+            "eeeeeeee-38f5-438d-b8ee-3f93b3531f87",
+        ]
+    ],
+    "trp_link_latency": [
+        [0, 50, 100, 150, 200],
+        [0, 0, 100, 150, 200],
+        [0, 0, 0, 150, 200],
+        [0, 0, 0, 0, 200],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_jitter": [
+        [0, 5, 10, 15, 20],
+        [0, 0, 10, 15, 20],
+        [0, 0, 0, 15, 20],
+        [0, 0, 0, 0, 20],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_price_list": [
+        [0, 5, 6, 6, 7],
+        [0, 0, 6, 6, 7],
+        [0, 0, 0, 6, 7],
+        [0, 0, 0, 0, 7],
+        [0, 0, 0, 0, 0],
+    ],
+    "ns_desc": [
+        {"vnf_id": "1", "vnf_price_per_vim": [50, 51, 52, 53, 54]},
+        {
+            "vnf_id": "2",
+            "vnf_price_per_vim": [20, 21, 22, 23, 24],
+            "vim_account": "vimeeeeeeee_38f5_438d_b8ee_3f93b3531f87",
+        },
+        {"vnf_id": "3", "vnf_price_per_vim": [70, 71, 72, 73, 74]},
+        {
+            "vnf_id": "4",
+            "vnf_price_per_vim": [40, 41, 42, 43, 44],
+            "vim_account": "vimcccccccc_ed84_4e49_b5df_a9d117bd731f",
+        },
+    ],
+    "vld_desc": [
+        {"cp_refs": ["1", "2"], "latency": 150, "jitter": 30},
+        {"cp_refs": ["2", "3"], "latency": 140, "jitter": 30},
+        {"cp_refs": ["3", "4"], "latency": 130, "jitter": 30},
+    ],
+    "generator_data": {"file": __file__, "time": datetime.datetime.now()},
 }
 
 test_ns_placement_data_w_pinning_str = {
-    'vim_accounts': ['vim' + vim_account.replace('-', '_') for vim_account in ['aaaaaaaa-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'cccccccc-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'dddddddd-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'eeeeeeee-38f5-438d-b8ee-3f93b3531f87']],
-    'trp_link_latency': [[0, 50, 100, 150, 200], [0, 0, 100, 150, 200], [0, 0, 0, 150, 200], [0, 0, 0, 0, 200],
-                         [0, 0, 0, 0, 0]],
-    'trp_link_jitter': [[0, 5, 10, 15, 20], [0, 0, 10, 15, 20], [0, 0, 0, 15, 20], [0, 0, 0, 0, 20],
-                        [0, 0, 0, 0, 0]],
-    'trp_link_price_list': [[0, 5, 6, 6, 7], [0, 0, 6, 6, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7], [0, 0, 0, 0, 0]],
-    'ns_desc': [
-        {'vnf_id': 'one', 'vnf_price_per_vim': [50, 51, 52, 53, 54]},
-        {'vnf_id': 'two', 'vnf_price_per_vim': [20, 21, 22, 23, 24],
-         'vim_account': 'vimeeeeeeee_38f5_438d_b8ee_3f93b3531f87'},
-        {'vnf_id': 'three', 'vnf_price_per_vim': [70, 71, 72, 73, 74]},
-        {'vnf_id': 'four', 'vnf_price_per_vim': [40, 41, 42, 43, 44],
-         'vim_account': 'vimcccccccc_ed84_4e49_b5df_a9d117bd731f'}],
-    'vld_desc': [{'cp_refs': ['one', 'two'], 'latency': 150, 'jitter': 30},
-                 {'cp_refs': ['two', 'three'], 'latency': 140, 'jitter': 30},
-                 {'cp_refs': ['three', 'four'], 'latency': 130, 'jitter': 30}],
-    'generator_data': {'file': __file__, 'time': datetime.datetime.now()}
+    "vim_accounts": [
+        "vim" + vim_account.replace("-", "_")
+        for vim_account in [
+            "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+            "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+            "cccccccc-ed84-4e49-b5df-a9d117bd731f",
+            "dddddddd-ed84-4e49-b5df-a9d117bd731f",
+            "eeeeeeee-38f5-438d-b8ee-3f93b3531f87",
+        ]
+    ],
+    "trp_link_latency": [
+        [0, 50, 100, 150, 200],
+        [0, 0, 100, 150, 200],
+        [0, 0, 0, 150, 200],
+        [0, 0, 0, 0, 200],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_jitter": [
+        [0, 5, 10, 15, 20],
+        [0, 0, 10, 15, 20],
+        [0, 0, 0, 15, 20],
+        [0, 0, 0, 0, 20],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_price_list": [
+        [0, 5, 6, 6, 7],
+        [0, 0, 6, 6, 7],
+        [0, 0, 0, 6, 7],
+        [0, 0, 0, 0, 7],
+        [0, 0, 0, 0, 0],
+    ],
+    "ns_desc": [
+        {"vnf_id": "one", "vnf_price_per_vim": [50, 51, 52, 53, 54]},
+        {
+            "vnf_id": "two",
+            "vnf_price_per_vim": [20, 21, 22, 23, 24],
+            "vim_account": "vimeeeeeeee_38f5_438d_b8ee_3f93b3531f87",
+        },
+        {"vnf_id": "three", "vnf_price_per_vim": [70, 71, 72, 73, 74]},
+        {
+            "vnf_id": "four",
+            "vnf_price_per_vim": [40, 41, 42, 43, 44],
+            "vim_account": "vimcccccccc_ed84_4e49_b5df_a9d117bd731f",
+        },
+    ],
+    "vld_desc": [
+        {"cp_refs": ["one", "two"], "latency": 150, "jitter": 30},
+        {"cp_refs": ["two", "three"], "latency": 140, "jitter": 30},
+        {"cp_refs": ["three", "four"], "latency": 130, "jitter": 30},
+    ],
+    "generator_data": {"file": __file__, "time": datetime.datetime.now()},
 }
 
 test_ns_placement_data_str_no_vld = {
-    'vim_accounts': ['vim' + vim_account.replace('-', '_') for vim_account in ['aaaaaaaa-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87',
-                                                                               'cccccccc-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'dddddddd-ed84-4e49-b5df-a9d117bd731f',
-                                                                               'eeeeeeee-38f5-438d-b8ee-3f93b3531f87']],
-    'trp_link_latency': [[0, 50, 100, 150, 200], [0, 0, 100, 150, 200], [0, 0, 0, 150, 200], [0, 0, 0, 0, 200],
-                         [0, 0, 0, 0, 0]],
-    'trp_link_jitter': [[0, 5, 10, 15, 20], [0, 0, 10, 15, 20], [0, 0, 0, 15, 20], [0, 0, 0, 0, 20],
-                        [0, 0, 0, 0, 0]],
-    'trp_link_price_list': [[0, 5, 6, 6, 7], [0, 0, 6, 6, 7], [0, 0, 0, 6, 7], [0, 0, 0, 0, 7], [0, 0, 0, 0, 0]],
-    'ns_desc': [
-        {'vnf_id': 'one', 'vnf_price_per_vim': [50, 51, 52, 53, 54]}],
-    'vld_desc': [],
-    'generator_data': {'file': __file__, 'time': datetime.datetime.now()}
+    "vim_accounts": [
+        "vim" + vim_account.replace("-", "_")
+        for vim_account in [
+            "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+            "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+            "cccccccc-ed84-4e49-b5df-a9d117bd731f",
+            "dddddddd-ed84-4e49-b5df-a9d117bd731f",
+            "eeeeeeee-38f5-438d-b8ee-3f93b3531f87",
+        ]
+    ],
+    "trp_link_latency": [
+        [0, 50, 100, 150, 200],
+        [0, 0, 100, 150, 200],
+        [0, 0, 0, 150, 200],
+        [0, 0, 0, 0, 200],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_jitter": [
+        [0, 5, 10, 15, 20],
+        [0, 0, 10, 15, 20],
+        [0, 0, 0, 15, 20],
+        [0, 0, 0, 0, 20],
+        [0, 0, 0, 0, 0],
+    ],
+    "trp_link_price_list": [
+        [0, 5, 6, 6, 7],
+        [0, 0, 6, 6, 7],
+        [0, 0, 0, 6, 7],
+        [0, 0, 0, 0, 7],
+        [0, 0, 0, 0, 0],
+    ],
+    "ns_desc": [{"vnf_id": "one", "vnf_price_per_vim": [50, 51, 52, 53, 54]}],
+    "vld_desc": [],
+    "generator_data": {"file": __file__, "time": datetime.datetime.now()},
 }
 
 expected_model_fragment = """
@@ -534,8 +688,11 @@ class TestMznModelGenerator(TestCase):
         mzn_model = mg.create_model(test_ns_placement_data_str)
 
         # so asserting exact content is difficult due to the datetime.now(), therefore we ignore the first lines
-        self.assertTrue(expected_model_fragment_str.replace('\n', '') in
-                        mzn_model.replace('\n', ''), "faulty model generated")
+        self.assertTrue(
+            expected_model_fragment_str.replace("\n", "")
+            in mzn_model.replace("\n", ""),
+            "faulty model generated",
+        )
 
     def test_create_model_no_vld_constraints(self):
         """
@@ -546,24 +703,33 @@ class TestMznModelGenerator(TestCase):
         mzn_model = mg.create_model(test_ns_placement_data_str_no_vld_constraints)
 
         # so asserting exact content is difficult due to the datetime.now(), therefore we ignore the first lines
-        self.assertTrue(expected_model_fragment_str_no_vld_constraints.replace('\n', '') in
-                        mzn_model.replace('\n', ''), "faulty model generated")
+        self.assertTrue(
+            expected_model_fragment_str_no_vld_constraints.replace("\n", "")
+            in mzn_model.replace("\n", ""),
+            "faulty model generated",
+        )
 
     def test_create_model_w_pinning(self):
         mg = MznModelGenerator(logging.getLogger(__name__))
         mzn_model = mg.create_model(test_ns_placement_data_w_pinning_str)
 
         # so asserting exact content is difficult due to the datetime.now(), therefore we ignore the first lines
-        self.assertTrue(expected_model_fragment_w_pinning_str.replace('\n', '') in
-                        mzn_model.replace('\n', ''), "faulty model generated")
+        self.assertTrue(
+            expected_model_fragment_w_pinning_str.replace("\n", "")
+            in mzn_model.replace("\n", ""),
+            "faulty model generated",
+        )
 
     def test_create_model_no_vld(self):
         mg = MznModelGenerator(logging.getLogger(__name__))
         mzn_model = mg.create_model(test_ns_placement_data_str_no_vld)
 
         # so asserting exact content is difficult due to the datetime.now(), therefore we ignore the first lines
-        self.assertTrue(expected_model_fragment_str_no_vld.replace('\n', '') in
-                        mzn_model.replace('\n', ''), "faulty model generated")
+        self.assertTrue(
+            expected_model_fragment_str_no_vld.replace("\n", "")
+            in mzn_model.replace("\n", ""),
+            "faulty model generated",
+        )
 
     def test__load_jinja_template(self):
         """
@@ -573,17 +739,21 @@ class TestMznModelGenerator(TestCase):
         """
         mg = MznModelGenerator(logging.getLogger(__name__))
         template = mg._load_jinja_template()  # Note we use the default template
-        self.assertTrue(isinstance(template, Template), "failed to load jinja2 template")
+        self.assertTrue(
+            isinstance(template, Template), "failed to load jinja2 template"
+        )
 
     def test_vim_account_replace(self):
         mg = MznModelGenerator(logging.getLogger(__name__))
         nspd = test_ns_placement_data_str
         mzn_model = mg.create_model(nspd)
 
-        expected = '%This is the NETWORK RESOURCE MODEL' + '\n' + 'enum  Vims = {' + '\n'
-        for val in test_ns_placement_data_str['vim_accounts']:
-            expected = expected + val.replace('-', '_') + ',\n'
-        expected = expected[:-2] + '}; % The vim-accounts'
+        expected = (
+            "%This is the NETWORK RESOURCE MODEL" + "\n" + "enum  Vims = {" + "\n"
+        )
+        for val in test_ns_placement_data_str["vim_accounts"]:
+            expected = expected + val.replace("-", "_") + ",\n"
+        expected = expected[:-2] + "}; % The vim-accounts"
         res = re.findall(expected, mzn_model)
         self.assertEqual(1, len(res), "vim accounts didnt replace from - to _")
 
@@ -591,10 +761,12 @@ class TestMznModelGenerator(TestCase):
         mg = MznModelGenerator(logging.getLogger(__name__))
         mzn_model = mg.create_model(test_ns_placement_data_str)
 
-        expected = 'array\\[Vims, Vims\\] of int: trp_link_price_list = \\['
-        for price_list in test_ns_placement_data_str['trp_link_price_list']:
-            expected = expected + '\\|' + (str(price_list)[1:-1]).replace(" ", "") + ',\n'
-        expected = expected + '\\|\\]; % Transport link price list'
+        expected = "array\\[Vims, Vims\\] of int: trp_link_price_list = \\["
+        for price_list in test_ns_placement_data_str["trp_link_price_list"]:
+            expected = (
+                expected + "\\|" + (str(price_list)[1:-1]).replace(" ", "") + ",\n"
+            )
+        expected = expected + "\\|\\]; % Transport link price list"
         res = re.findall(expected, mzn_model)
         self.assertEqual(1, len(res), "price list is not correct")
 
@@ -602,10 +774,12 @@ class TestMznModelGenerator(TestCase):
         mg = MznModelGenerator(logging.getLogger(__name__))
         mzn_model = mg.create_model(test_ns_placement_data_str)
 
-        expected = 'array\\[Vims, Vims\\] of int: trp_link_latency = \\['
-        for link_latency in test_ns_placement_data_str['trp_link_latency']:
-            expected = expected + '\\|' + (str(link_latency)[1:-1]).replace(" ", "") + ',\n'
-        expected = expected + '\\|\\]; % Transport link latency between data centers'
+        expected = "array\\[Vims, Vims\\] of int: trp_link_latency = \\["
+        for link_latency in test_ns_placement_data_str["trp_link_latency"]:
+            expected = (
+                expected + "\\|" + (str(link_latency)[1:-1]).replace(" ", "") + ",\n"
+            )
+        expected = expected + "\\|\\]; % Transport link latency between data centers"
         res = re.findall(expected, mzn_model)
         self.assertEqual(1, len(res), "trp_link_latency values is not correct")
 
@@ -613,10 +787,12 @@ class TestMznModelGenerator(TestCase):
         mg = MznModelGenerator(logging.getLogger(__name__))
         mzn_model = mg.create_model(test_ns_placement_data_str)
 
-        expected = 'array\\[Vims, Vims\\] of int: trp_link_jitter = \\['
-        for link_jitter in test_ns_placement_data_str['trp_link_jitter']:
-            expected = expected + '\\|' + (str(link_jitter)[1:-1]).replace(" ", "") + ',\n'
-        expected = expected + '\\|\\]; % Transport link jitter between data centers'
+        expected = "array\\[Vims, Vims\\] of int: trp_link_jitter = \\["
+        for link_jitter in test_ns_placement_data_str["trp_link_jitter"]:
+            expected = (
+                expected + "\\|" + (str(link_jitter)[1:-1]).replace(" ", "") + ",\n"
+            )
+        expected = expected + "\\|\\]; % Transport link jitter between data centers"
 
         res = re.findall(expected, mzn_model)
 
@@ -627,9 +803,13 @@ class TestMznModelGenerator(TestCase):
         mzn_model = mg.create_model(test_ns_placement_data_w_pinning_str)
 
         expected = ""
-        for price_list in test_ns_placement_data_w_pinning_str['ns_desc']:
-            expected += 'array\\[Vims\\] of int: vim_price_list_' + price_list.get('vnf_id') + " = "
-            temp = str(price_list.get('vnf_price_per_vim'))[1:-1].replace(" ", "")
+        for price_list in test_ns_placement_data_w_pinning_str["ns_desc"]:
+            expected += (
+                "array\\[Vims\\] of int: vim_price_list_"
+                + price_list.get("vnf_id")
+                + " = "
+            )
+            temp = str(price_list.get("vnf_price_per_vim"))[1:-1].replace(" ", "")
             expected += "\\[" + temp + "\\];\n"
 
         res = re.findall(expected, mzn_model)
@@ -640,11 +820,17 @@ class TestMznModelGenerator(TestCase):
         mzn_model = mg.create_model(test_ns_placement_data_str)
 
         expected = ""
-        for pin_list in test_ns_placement_data_str['ns_desc']:
-            if pin_list.get('vim_account'):
-                expected += 'Vims: VNF' + pin_list.get('vnf_id') + ' = ' + pin_list.get('vim_account') + ';\n'
+        for pin_list in test_ns_placement_data_str["ns_desc"]:
+            if pin_list.get("vim_account"):
+                expected += (
+                    "Vims: VNF"
+                    + pin_list.get("vnf_id")
+                    + " = "
+                    + pin_list.get("vim_account")
+                    + ";\n"
+                )
             else:
-                expected += 'var Vims: VNF' + pin_list.get('vnf_id') + ';\n'
+                expected += "var Vims: VNF" + pin_list.get("vnf_id") + ";\n"
 
         res = re.findall(expected, mzn_model)
         self.assertEqual(1, len(res), "mzn_model has no pinning")
@@ -654,11 +840,17 @@ class TestMznModelGenerator(TestCase):
         mzn_model = mg.create_model(test_ns_placement_data_w_pinning_str)
 
         expected = ""
-        for pin_list in test_ns_placement_data_w_pinning_str['ns_desc']:
-            if pin_list.get('vim_account'):
-                expected += 'Vims: VNF' + pin_list.get('vnf_id') + ' = ' + pin_list.get('vim_account') + ';\n'
+        for pin_list in test_ns_placement_data_w_pinning_str["ns_desc"]:
+            if pin_list.get("vim_account"):
+                expected += (
+                    "Vims: VNF"
+                    + pin_list.get("vnf_id")
+                    + " = "
+                    + pin_list.get("vim_account")
+                    + ";\n"
+                )
             else:
-                expected += 'var Vims: VNF' + pin_list.get('vnf_id') + ';\n'
+                expected += "var Vims: VNF" + pin_list.get("vnf_id") + ";\n"
 
         res = re.findall(expected, mzn_model)
         self.assertEqual(1, len(res), "mzn_model contains pinning")
@@ -670,15 +862,23 @@ class TestMznModelGenerator(TestCase):
         expected_latency = "constraint trp_link_latency"
         expected_jitter = "constraint trp_link_jitter"
         latency_or_jitter_was_found = 0
-        for l_o_j in test_ns_placement_data_str_no_vld_constraints['vld_desc']:
-            if l_o_j.get('latency') or l_o_j.get('jitter'):
+        for l_o_j in test_ns_placement_data_str_no_vld_constraints["vld_desc"]:
+            if l_o_j.get("latency") or l_o_j.get("jitter"):
                 latency_or_jitter_was_found = 1
 
         res_latency = re.findall(expected_latency, mzn_model)
         res_jitter = re.findall(expected_jitter, mzn_model)
-        self.assertEqual(0, latency_or_jitter_was_found, "Jitter or latency was found in the test input")
-        self.assertEqual(0, len(res_latency), "constraint trp_link_latency was found in mzn_model")
-        self.assertEqual(0, len(res_jitter), "constraint trp_link_latency was found in mzn_model")
+        self.assertEqual(
+            0,
+            latency_or_jitter_was_found,
+            "Jitter or latency was found in the test input",
+        )
+        self.assertEqual(
+            0, len(res_latency), "constraint trp_link_latency was found in mzn_model"
+        )
+        self.assertEqual(
+            0, len(res_jitter), "constraint trp_link_latency was found in mzn_model"
+        )
 
     def test__constraints_for_jitter_and_latency(self):
         mg = MznModelGenerator(logging.getLogger(__name__))
@@ -687,15 +887,35 @@ class TestMznModelGenerator(TestCase):
         expected_latency = ""
         expected_jitter = ""
         latency_or_jitter_was_found = 0
-        for l_o_j in test_ns_placement_data_str['vld_desc']:
-            if not (l_o_j.get('latency') or l_o_j.get('jitter')):
+        for l_o_j in test_ns_placement_data_str["vld_desc"]:
+            if not (l_o_j.get("latency") or l_o_j.get("jitter")):
                 latency_or_jitter_was_found = 1
-            expected_latency += "constraint trp_link_latency" + "\\[VNF" + l_o_j.get('cp_refs')[0] + ", VNF" + \
-                                l_o_j.get('cp_refs')[1] + "\\] \\<= " + str(l_o_j.get('latency')) + ";\n\n"
-
-            expected_jitter += "constraint trp_link_jitter" + "\\[VNF" + l_o_j.get('cp_refs')[0] + ", VNF" + \
-                               l_o_j.get('cp_refs')[1] + "\\] \\<= " + str(l_o_j.get('jitter')) + ";\n\n"
+            expected_latency += (
+                "constraint trp_link_latency"
+                + "\\[VNF"
+                + l_o_j.get("cp_refs")[0]
+                + ", VNF"
+                + l_o_j.get("cp_refs")[1]
+                + "\\] \\<= "
+                + str(l_o_j.get("latency"))
+                + ";\n\n"
+            )
+
+            expected_jitter += (
+                "constraint trp_link_jitter"
+                + "\\[VNF"
+                + l_o_j.get("cp_refs")[0]
+                + ", VNF"
+                + l_o_j.get("cp_refs")[1]
+                + "\\] \\<= "
+                + str(l_o_j.get("jitter"))
+                + ";\n\n"
+            )
 
         res = re.findall(expected_latency + expected_jitter, mzn_model)
-        self.assertEqual(0, latency_or_jitter_was_found, "Jitter or latency was not found in the test input")
+        self.assertEqual(
+            0,
+            latency_or_jitter_was_found,
+            "Jitter or latency was not found in the test input",
+        )
         self.assertEqual(1, len(res), "faulty model generated")
index 6bc42b6..9a181b1 100644 (file)
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 import logging
+
 # from collections import Counter
 from unittest import TestCase, mock
 
@@ -172,47 +173,89 @@ solve satisfy;
 
 class TestMznPlacementConductor(TestCase):
     def test__run_placement_model(self):
-        expected_result = [{'vimAccountId': 'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'},
-                           {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'},
-                           {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'},
-                           {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '4'}]
+        expected_result = [
+            {
+                "vimAccountId": "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "4",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
         placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc={})
         # sort the result to ease assert with expected result
-        sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+        sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
 
     def test__run_placement_model_w_pinning(self):
-        expected_result = [{'vimAccountId': 'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'},
-                           {'vimAccountId': 'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'},
-                           {'vimAccountId': 'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'},
-                           {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '4'}]
-
-        ns_desc = [{'vnf_price_per_vim': [10, 9, 7, 8], 'vnf_id': '2'},
-                   {'vim_account': 'vimbbbbbbbb_38f5_438d_b8ee_3f93b3531f87', 'vnf_price_per_vim': [10, 9, 7, 8],
-                    'vnf_id': '1'},
-                   {'vnf_price_per_vim': [10, 9, 7, 8], 'vnf_id': '4'},
-                   {'vim_account': 'vimbbbbbbbb_38f5_438d_b8ee_3f93b3531f87', 'vnf_price_per_vim': [10, 9, 7, 8],
-                    'vnf_id': '3'}
-                   ]
+        expected_result = [
+            {
+                "vimAccountId": "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "4",
+            },
+        ]
+
+        ns_desc = [
+            {"vnf_price_per_vim": [10, 9, 7, 8], "vnf_id": "2"},
+            {
+                "vim_account": "vimbbbbbbbb_38f5_438d_b8ee_3f93b3531f87",
+                "vnf_price_per_vim": [10, 9, 7, 8],
+                "vnf_id": "1",
+            },
+            {"vnf_price_per_vim": [10, 9, 7, 8], "vnf_id": "4"},
+            {
+                "vim_account": "vimbbbbbbbb_38f5_438d_b8ee_3f93b3531f87",
+                "vnf_price_per_vim": [10, 9, 7, 8],
+                "vnf_id": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model_w_pinning, ns_desc=ns_desc)
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model_w_pinning, ns_desc=ns_desc
+        )
         # sort the result to ease assert with expected result
-        sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+        sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
 
     def test__run_placement_model_unsatisfiable(self):
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        self.assertEqual([{}], mpc._run_placement_model(mzn_model=test_mzn_unsatisfiable_model, ns_desc={}),
-                         "Faulty syntax or content for unsatisfiable model")
-
-    @mock.patch.object(MznModelGenerator, 'create_model', side_effect=['%model'])
-    @mock.patch.object(MznPlacementConductor, '_run_placement_model')
+        self.assertEqual(
+            [{}],
+            mpc._run_placement_model(
+                mzn_model=test_mzn_unsatisfiable_model, ns_desc={}
+            ),
+            "Faulty syntax or content for unsatisfiable model",
+        )
+
+    @mock.patch.object(MznModelGenerator, "create_model", side_effect=["%model"])
+    @mock.patch.object(MznPlacementConductor, "_run_placement_model")
     def test_do_placement_computation(self, mock_run, mock_create):
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        dummy_nspd = {'ns_desc': {}}
+        dummy_nspd = {"ns_desc": {}}
         _ = mpc.do_placement_computation(dummy_nspd)
         mock_create.assert_called_with(dummy_nspd)
-        mock_run.assert_called_with('%model', {})
+        mock_run.assert_called_with("%model", {})
index b32ec94..e39dfc6 100644 (file)
@@ -1,4 +1,3 @@
-
 # Copyright 2019 ArctosLabs Scandinavia AB
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +14,7 @@
 # limitations under the License.
 
 # Note:
-# This unit test file is generated - 
+# This unit test file is generated -
 # from: c:\Users\LG\Desktop\plarepo\documents\Test\pla_algo_test (pr_update_4).xlsx
 # by code generator: mzntestcasegenerator.py
 # at: 2019-12-04 09:26:38.412430
@@ -31,165 +30,785 @@ from osm_pla.placement.mznplacement import MznPlacementConductor, MznModelGenera
 class TestMznModels(TestCase):
     def test_mznmodel_scenario1_subtestcase1(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario1_subtestcase2(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim33333333_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '33333333-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "33333333-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim33333333_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario1_subtestcase3(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim22222222_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '22222222-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "22222222-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim22222222_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario1_subtestcase4(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '44444444-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '22222222-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "44444444-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "22222222-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario1_subtestcase5(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim88888888_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '88888888-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "88888888-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim88888888_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario1_subtestcase6(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim99999999_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '99999999-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "99999999-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim99999999_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario1_subtestcase7(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim11111111_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim33333333_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
@@ -197,149 +816,697 @@ class TestMznModels(TestCase):
         expected_result = [{}]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim11111111_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim33333333_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario1_subtestcase8(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 120, 'jitter': 20}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 120, "jitter": 20},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario2_subtestcase1(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario2_subtestcase2(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '44444444-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '22222222-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '22222222-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "44444444-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "22222222-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "22222222-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario2_subtestcase3(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '55555555-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '66666666-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '66666666-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "55555555-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "66666666-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "66666666-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario2_subtestcase4(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '55555555-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '55555555-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '55555555-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "55555555-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "55555555-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "55555555-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario2_subtestcase5(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim33333333_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
@@ -347,24 +1514,107 @@ class TestMznModels(TestCase):
         expected_result = [{}]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim33333333_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario2_subtestcase6(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170'], 'vim_account': 'vim66666666_38f5_438d_b8ee_3f93b3531f87'}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                    "vim_account": "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
@@ -372,49 +1622,223 @@ class TestMznModels(TestCase):
         expected_result = [{}]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170'], 'vim_account': 'vim66666666_38f5_438d_b8ee_3f93b3531f87'}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                    "vim_account": "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario3_subtestcase1(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 3}, {'cp_refs': ['2', '3'], 'latency': 25, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 3},
+                {"cp_refs": ["2", "3"], "latency": 25, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario3_subtestcase2(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim22222222_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 3}, {'cp_refs': ['2', '3'], 'latency': 25, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 3},
+                {"cp_refs": ["2", "3"], "latency": 25, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
@@ -422,74 +1846,343 @@ class TestMznModels(TestCase):
         expected_result = [{}]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim22222222_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario3_subtestcase3(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 3}, {'cp_refs': ['2', '3'], 'latency': 25, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 3},
+                {"cp_refs": ["2", "3"], "latency": 25, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario3_subtestcase4(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim88888888_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 3}, {'cp_refs': ['2', '3'], 'latency': 25, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 3},
+                {"cp_refs": ["2", "3"], "latency": 25, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '88888888-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "88888888-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim88888888_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150']}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario3_subtestcase5(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim99999999_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170'], 'vim_account': 'vim88888888_38f5_438d_b8ee_3f93b3531f87'}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 3}, {'cp_refs': ['2', '3'], 'latency': 25, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                    "vim_account": "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 3},
+                {"cp_refs": ["2", "3"], "latency": 25, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
@@ -497,124 +2190,627 @@ class TestMznModels(TestCase):
         expected_result = [{}]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim99999999_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170'], 'vim_account': 'vim88888888_38f5_438d_b8ee_3f93b3531f87'}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                    "vim_account": "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario3_subtestcase6(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim99999999_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 3}, {'cp_refs': ['2', '3'], 'latency': 25, 'jitter': 6}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 3},
+                {"cp_refs": ["2", "3"], "latency": 25, "jitter": 6},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '99999999-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '77777777-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
+        expected_result = [
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "99999999-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "77777777-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim77777777_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['10,15,30,30,100,70,40,150,150,150'], 'vim_account': 'vim99999999_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '3', 'vnf_price_per_vim': ['30,30,60,40,100,90,40,150,200,170']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["10,15,30,30,100,70,40,150,150,150"],
+                    "vim_account": "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["30,30,60,40,100,90,40,150,200,170"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario4_subtestcase1(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '4'], 'latency': 50, 'jitter': 10}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 10}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "4"], "latency": 50, "jitter": 10},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 10},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}, {'vimAccountId': '00000000-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '4'}]
+        expected_result = [
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+            {
+                "vimAccountId": "00000000-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "4",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario4_subtestcase2(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim22222222_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '4'], 'latency': 50, 'jitter': 10}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 10}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "4"], "latency": 50, "jitter": 10},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 10},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '22222222-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '44444444-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '55555555-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}, {'vimAccountId': '66666666-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '4'}]
+        expected_result = [
+            {
+                "vimAccountId": "22222222-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "44444444-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "55555555-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+            {
+                "vimAccountId": "66666666-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "4",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim22222222_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario4_subtestcase3(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '4'], 'latency': 50, 'jitter': 10}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 10}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "4"], "latency": 50, "jitter": 10},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 10},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
         # run the model
-        expected_result = [{'vimAccountId': '55555555-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'}, {'vimAccountId': '66666666-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'}, {'vimAccountId': '66666666-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}, {'vimAccountId': '55555555-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '4'}]
+        expected_result = [
+            {
+                "vimAccountId": "55555555-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "66666666-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "66666666-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+            {
+                "vimAccountId": "55555555-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "4",
+            },
+        ]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim55555555_38f5_438d_b8ee_3f93b3531f87'}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
+
     def test_mznmodel_scenario4_subtestcase4(self):
         # generate the model
-        ns_placement_data = {'vim_accounts': ['vim00000000_38f5_438d_b8ee_3f93b3531f87', 'vim11111111_38f5_438d_b8ee_3f93b3531f87', 'vim22222222_38f5_438d_b8ee_3f93b3531f87', 'vim33333333_38f5_438d_b8ee_3f93b3531f87', 'vim44444444_38f5_438d_b8ee_3f93b3531f87', 'vim55555555_38f5_438d_b8ee_3f93b3531f87', 'vim66666666_38f5_438d_b8ee_3f93b3531f87', 'vim77777777_38f5_438d_b8ee_3f93b3531f87', 'vim88888888_38f5_438d_b8ee_3f93b3531f87', 'vim99999999_38f5_438d_b8ee_3f93b3531f87'],
-                             'trp_link_latency' : [[0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767], [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767], [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767], [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0]],
-                             'trp_link_jitter' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0]],
-                             'trp_link_price_list' : [[0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767], [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767], [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767], [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15], [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0]],
-                             'ns_desc' : [{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim00000000_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}],
-                             'vld_desc' : [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20}, {'cp_refs': ['2', '4'], 'latency': 50, 'jitter': 10}, {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 10}],
-                             'generator_data': {'file': __file__ ,'time': datetime.datetime.now()}
-                            }
-        
+        ns_placement_data = {
+            "vim_accounts": [
+                "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                "vim11111111_38f5_438d_b8ee_3f93b3531f87",
+                "vim22222222_38f5_438d_b8ee_3f93b3531f87",
+                "vim33333333_38f5_438d_b8ee_3f93b3531f87",
+                "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                "vim55555555_38f5_438d_b8ee_3f93b3531f87",
+                "vim66666666_38f5_438d_b8ee_3f93b3531f87",
+                "vim77777777_38f5_438d_b8ee_3f93b3531f87",
+                "vim88888888_38f5_438d_b8ee_3f93b3531f87",
+                "vim99999999_38f5_438d_b8ee_3f93b3531f87",
+            ],
+            "trp_link_latency": [
+                [0, 30, 70, 80, 32767, 32767, 32767, 32767, 32767, 32767],
+                [30, 0, 75, 60, 32767, 32767, 32767, 32767, 32767, 32767],
+                [70, 75, 0, 40, 100, 32767, 32767, 32767, 32767, 32767],
+                [80, 60, 40, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 100, 32767, 0, 5, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 0, 5, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 5, 5, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 30, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 30, 0, 20],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 20, 20, 0],
+            ],
+            "trp_link_jitter": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 5, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 5, 32767, 0, 4, 4, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 0, 10, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 4, 10, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 1, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 0, 1],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 1, 1, 0],
+            ],
+            "trp_link_price_list": [
+                [0, 5, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 0, 5, 10, 32767, 32767, 32767, 32767, 32767, 32767],
+                [5, 5, 0, 10, 10, 32767, 32767, 32767, 32767, 32767],
+                [10, 10, 10, 0, 32767, 32767, 32767, 32767, 32767, 32767],
+                [32767, 32767, 10, 32767, 0, 20, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 0, 20, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 20, 20, 0, 32767, 32767, 32767],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, 15, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 0, 15],
+                [32767, 32767, 32767, 32767, 32767, 32767, 32767, 15, 15, 0],
+            ],
+            "ns_desc": [
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+            ],
+            "vld_desc": [
+                {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+                {"cp_refs": ["2", "4"], "latency": 50, "jitter": 10},
+                {"cp_refs": ["2", "3"], "latency": 20, "jitter": 10},
+            ],
+            "generator_data": {"file": __file__, "time": datetime.datetime.now()},
+        }
+
         mg = MznModelGenerator(logging.getLogger(__name__))
         test_mzn_model = mg.create_model(ns_placement_data)
 
@@ -622,10 +2818,32 @@ class TestMznModels(TestCase):
         expected_result = [{}]
 
         mpc = MznPlacementConductor(logging.getLogger(__name__))
-        placement = mpc._run_placement_model(mzn_model=test_mzn_model, ns_desc=[{'vnf_id': '1', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim00000000_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '2', 'vnf_price_per_vim': ['15,20,40,40,110,80,50,110,160,210']}, {'vnf_id': '3', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200'], 'vim_account': 'vim44444444_38f5_438d_b8ee_3f93b3531f87'}, {'vnf_id': '4', 'vnf_price_per_vim': ['5,10,30,30,100,70,40,100,150,200']}])
+        placement = mpc._run_placement_model(
+            mzn_model=test_mzn_model,
+            ns_desc=[
+                {
+                    "vnf_id": "1",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim00000000_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "2",
+                    "vnf_price_per_vim": ["15,20,40,40,110,80,50,110,160,210"],
+                },
+                {
+                    "vnf_id": "3",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                    "vim_account": "vim44444444_38f5_438d_b8ee_3f93b3531f87",
+                },
+                {
+                    "vnf_id": "4",
+                    "vnf_price_per_vim": ["5,10,30,30,100,70,40,100,150,200"],
+                },
+            ],
+        )
         # sort the result to ease assert with expected result
         if not placement[0]:
             sorted_placement = placement
         else:
-            sorted_placement = sorted(placement, key=lambda k: k['member-vnf-index'])
-        self.assertEqual(expected_result, sorted_placement, 'Faulty syntax or content')
\ No newline at end of file
+            sorted_placement = sorted(placement, key=lambda k: k["member-vnf-index"])
+        self.assertEqual(expected_result, sorted_placement, "Faulty syntax or content")
index fe3c8da..dbb8572 100644 (file)
@@ -25,159 +25,309 @@ from osm_pla.placement.mznplacement import NsPlacementDataFactory
 
 
 class TestNsPlacementDataFactory(TestCase):
-    vim_accounts = [{"vim_password": "FxtnynxBCnouzAT4Hkerhg==", "config": {},
-                     "_admin": {"modified": 1564579854.0480285, "created": 1564579854.0480285,
-                                "operationalState": "ENABLED",
-                                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                "deployed": {"RO-account": "6beb4e2e-b397-11e9-a7a3-02420aff0008",
-                                             "RO": "6bcfc3fc-b397-11e9-a7a3-02420aff0008"},
-                                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"], "detailed-status": "Done"},
-                     "name": "OpenStack1", "vim_type": "openstack", "_id": "92b056a7-38f5-438d-b8ee-3f93b3531f87",
-                     "schema_version": "1.1", "vim_user": "admin", "vim_url": "http://10.234.12.47:5000/v3",
-                     "vim_tenant_name": "admin"},
-                    {"config": {}, "vim_tenant_name": "osm_demo", "schema_version": "1.1", "name": "OpenStack2",
-                     "vim_password": "gK5v4Gh2Pl41o6Skwp6RCw==", "vim_type": "openstack",
-                     "_admin": {"modified": 1567148372.2490237, "created": 1567148372.2490237,
-                                "operationalState": "ENABLED",
-                                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                "deployed": {"RO-account": "b7fb0034-caf3-11e9-9388-02420aff000a",
-                                             "RO": "b7f129ce-caf3-11e9-9388-02420aff000a"},
-                                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"], "detailed-status": "Done"},
-                     "vim_user": "admin", "vim_url": "http://10.234.12.44:5000/v3",
-                     "_id": "6618d412-d7fc-4eb0-a6f8-d2c258e0e900"},
-                    {"config": {}, "schema_version": "1.1", "name": "OpenStack3",
-                     "vim_password": "1R2FoMQnaL6rNSosoRP2hw==", "vim_type": "openstack", "vim_tenant_name": "osm_demo",
-                     "_admin": {"modified": 1567599746.689582, "created": 1567599746.689582,
-                                "operationalState": "ENABLED",
-                                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                "deployed": {"RO-account": "a8161f54-cf0e-11e9-9388-02420aff000a",
-                                             "RO": "a80b6280-cf0e-11e9-9388-02420aff000a"},
-                                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"], "detailed-status": "Done"},
-                     "vim_user": "admin", "vim_url": "http://10.234.12.46:5000/v3",
-                     "_id": "331ffdec-44a8-4707-94a1-af7a292d9735"},
-                    {"config": {}, "schema_version": "1.1", "name": "OpenStack4",
-                     "vim_password": "6LScyPeMq3QFh3GRb/xwZw==", "vim_type": "openstack", "vim_tenant_name": "osm_demo",
-                     "_admin": {"modified": 1567599911.5108898, "created": 1567599911.5108898,
-                                "operationalState": "ENABLED",
-                                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                "deployed": {"RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
-                                             "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a"},
-                                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"], "detailed-status": "Done"},
-                     "vim_user": "admin", "vim_url": "http://10.234.12.43:5000/v3",
-                     "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31"}]
-
-    vim_accounts_fewer_vims = [{"vim_password": "FxtnynxBCnouzAT4Hkerhg==", "config": {},
-                                "_admin": {"modified": 1564579854.0480285, "created": 1564579854.0480285,
-                                           "operationalState": "ENABLED",
-                                           "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                           "deployed": {"RO-account": "6beb4e2e-b397-11e9-a7a3-02420aff0008",
-                                                        "RO": "6bcfc3fc-b397-11e9-a7a3-02420aff0008"},
-                                           "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                           "detailed-status": "Done"},
-                                "name": "OpenStack1", "vim_type": "openstack",
-                                "_id": "92b056a7-38f5-438d-b8ee-3f93b3531f87",
-                                "schema_version": "1.1", "vim_user": "admin", "vim_url": "http://10.234.12.47:5000/v3",
-                                "vim_tenant_name": "admin"},
-                               {"config": {}, "vim_tenant_name": "osm_demo", "schema_version": "1.1",
-                                "name": "OpenStack2",
-                                "vim_password": "gK5v4Gh2Pl41o6Skwp6RCw==", "vim_type": "openstack",
-                                "_admin": {"modified": 1567148372.2490237, "created": 1567148372.2490237,
-                                           "operationalState": "ENABLED",
-                                           "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                           "deployed": {"RO-account": "b7fb0034-caf3-11e9-9388-02420aff000a",
-                                                        "RO": "b7f129ce-caf3-11e9-9388-02420aff000a"},
-                                           "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                           "detailed-status": "Done"},
-                                "vim_user": "admin", "vim_url": "http://10.234.12.44:5000/v3",
-                                "_id": "6618d412-d7fc-4eb0-a6f8-d2c258e0e900"},
-                               {"config": {}, "schema_version": "1.1", "name": "OpenStack4",
-                                "vim_password": "6LScyPeMq3QFh3GRb/xwZw==", "vim_type": "openstack",
-                                "vim_tenant_name": "osm_demo",
-                                "_admin": {"modified": 1567599911.5108898, "created": 1567599911.5108898,
-                                           "operationalState": "ENABLED",
-                                           "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                           "deployed": {"RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
-                                                        "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a"},
-                                           "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                           "detailed-status": "Done"},
-                                "vim_user": "admin", "vim_url": "http://10.234.12.43:5000/v3",
-                                "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31"}]
-
-    vim_accounts_more_vims = [{"vim_password": "FxtnynxBCnouzAT4Hkerhg==", "config": {},
-                               "_admin": {"modified": 1564579854.0480285, "created": 1564579854.0480285,
-                                          "operationalState": "ENABLED",
-                                          "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "deployed": {"RO-account": "6beb4e2e-b397-11e9-a7a3-02420aff0008",
-                                                       "RO": "6bcfc3fc-b397-11e9-a7a3-02420aff0008"},
-                                          "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "detailed-status": "Done"},
-                               "name": "OpenStack1", "vim_type": "openstack",
-                               "_id": "92b056a7-38f5-438d-b8ee-3f93b3531f87",
-                               "schema_version": "1.1", "vim_user": "admin", "vim_url": "http://10.234.12.47:5000/v3",
-                               "vim_tenant_name": "admin"},
-                              {"config": {}, "vim_tenant_name": "osm_demo", "schema_version": "1.1",
-                               "name": "OpenStack2",
-                               "vim_password": "gK5v4Gh2Pl41o6Skwp6RCw==", "vim_type": "openstack",
-                               "_admin": {"modified": 1567148372.2490237, "created": 1567148372.2490237,
-                                          "operationalState": "ENABLED",
-                                          "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "deployed": {"RO-account": "b7fb0034-caf3-11e9-9388-02420aff000a",
-                                                       "RO": "b7f129ce-caf3-11e9-9388-02420aff000a"},
-                                          "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "detailed-status": "Done"},
-                               "vim_user": "admin", "vim_url": "http://10.234.12.44:5000/v3",
-                               "_id": "6618d412-d7fc-4eb0-a6f8-d2c258e0e900"},
-                              {"config": {}, "schema_version": "1.1", "name": "OpenStack4",
-                               "vim_password": "6LScyPeMq3QFh3GRb/xwZw==", "vim_type": "openstack",
-                               "vim_tenant_name": "osm_demo",
-                               "_admin": {"modified": 1567599911.5108898, "created": 1567599911.5108898,
-                                          "operationalState": "ENABLED",
-                                          "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "deployed": {"RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
-                                                       "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a"},
-                                          "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "detailed-status": "Done"},
-                               "vim_user": "admin", "vim_url": "http://10.234.12.43:5000/v3",
-                               "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31"},
-                              {"config": {}, "schema_version": "1.1", "name": "OpenStack3",
-                               "vim_password": "6LScyPeMq3QFh3GRb/xwZw==", "vim_type": "openstack",
-                               "vim_tenant_name": "osm_demo",
-                               "_admin": {"modified": 1567599911.5108898, "created": 1567599911.5108898,
-                                          "operationalState": "ENABLED",
-                                          "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "deployed": {"RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
-                                                       "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a"},
-                                          "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "detailed-status": "Done"},
-                               "vim_user": "admin", "vim_url": "http://10.234.12.46:5000/v3",
-                               "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31"},
-                              {"config": {}, "schema_version": "1.1", "name": "OpenStack5",
-                               "vim_password": "6LScyPeMq3QFh3GRb/xwZw==", "vim_type": "openstack",
-                               "vim_tenant_name": "osm_demo",
-                               "_admin": {"modified": 1567599911.5108898, "created": 1567599911.5108898,
-                                          "operationalState": "ENABLED",
-                                          "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "deployed": {"RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
-                                                       "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a"},
-                                          "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
-                                          "detailed-status": "Done"},
-                               "vim_user": "admin", "vim_url": "http://1.1.1.1:5000/v3",
-                               "_id": "ffffffff-29b9-4007-9709-c1833dbfbe31"}]
+    vim_accounts = [
+        {
+            "vim_password": "FxtnynxBCnouzAT4Hkerhg==",
+            "config": {},
+            "_admin": {
+                "modified": 1564579854.0480285,
+                "created": 1564579854.0480285,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "6beb4e2e-b397-11e9-a7a3-02420aff0008",
+                    "RO": "6bcfc3fc-b397-11e9-a7a3-02420aff0008",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "name": "OpenStack1",
+            "vim_type": "openstack",
+            "_id": "92b056a7-38f5-438d-b8ee-3f93b3531f87",
+            "schema_version": "1.1",
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.47:5000/v3",
+            "vim_tenant_name": "admin",
+        },
+        {
+            "config": {},
+            "vim_tenant_name": "osm_demo",
+            "schema_version": "1.1",
+            "name": "OpenStack2",
+            "vim_password": "gK5v4Gh2Pl41o6Skwp6RCw==",
+            "vim_type": "openstack",
+            "_admin": {
+                "modified": 1567148372.2490237,
+                "created": 1567148372.2490237,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "b7fb0034-caf3-11e9-9388-02420aff000a",
+                    "RO": "b7f129ce-caf3-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.44:5000/v3",
+            "_id": "6618d412-d7fc-4eb0-a6f8-d2c258e0e900",
+        },
+        {
+            "config": {},
+            "schema_version": "1.1",
+            "name": "OpenStack3",
+            "vim_password": "1R2FoMQnaL6rNSosoRP2hw==",
+            "vim_type": "openstack",
+            "vim_tenant_name": "osm_demo",
+            "_admin": {
+                "modified": 1567599746.689582,
+                "created": 1567599746.689582,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "a8161f54-cf0e-11e9-9388-02420aff000a",
+                    "RO": "a80b6280-cf0e-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.46:5000/v3",
+            "_id": "331ffdec-44a8-4707-94a1-af7a292d9735",
+        },
+        {
+            "config": {},
+            "schema_version": "1.1",
+            "name": "OpenStack4",
+            "vim_password": "6LScyPeMq3QFh3GRb/xwZw==",
+            "vim_type": "openstack",
+            "vim_tenant_name": "osm_demo",
+            "_admin": {
+                "modified": 1567599911.5108898,
+                "created": 1567599911.5108898,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
+                    "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.43:5000/v3",
+            "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31",
+        },
+    ]
+
+    vim_accounts_fewer_vims = [
+        {
+            "vim_password": "FxtnynxBCnouzAT4Hkerhg==",
+            "config": {},
+            "_admin": {
+                "modified": 1564579854.0480285,
+                "created": 1564579854.0480285,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "6beb4e2e-b397-11e9-a7a3-02420aff0008",
+                    "RO": "6bcfc3fc-b397-11e9-a7a3-02420aff0008",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "name": "OpenStack1",
+            "vim_type": "openstack",
+            "_id": "92b056a7-38f5-438d-b8ee-3f93b3531f87",
+            "schema_version": "1.1",
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.47:5000/v3",
+            "vim_tenant_name": "admin",
+        },
+        {
+            "config": {},
+            "vim_tenant_name": "osm_demo",
+            "schema_version": "1.1",
+            "name": "OpenStack2",
+            "vim_password": "gK5v4Gh2Pl41o6Skwp6RCw==",
+            "vim_type": "openstack",
+            "_admin": {
+                "modified": 1567148372.2490237,
+                "created": 1567148372.2490237,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "b7fb0034-caf3-11e9-9388-02420aff000a",
+                    "RO": "b7f129ce-caf3-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.44:5000/v3",
+            "_id": "6618d412-d7fc-4eb0-a6f8-d2c258e0e900",
+        },
+        {
+            "config": {},
+            "schema_version": "1.1",
+            "name": "OpenStack4",
+            "vim_password": "6LScyPeMq3QFh3GRb/xwZw==",
+            "vim_type": "openstack",
+            "vim_tenant_name": "osm_demo",
+            "_admin": {
+                "modified": 1567599911.5108898,
+                "created": 1567599911.5108898,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
+                    "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.43:5000/v3",
+            "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31",
+        },
+    ]
+
+    vim_accounts_more_vims = [
+        {
+            "vim_password": "FxtnynxBCnouzAT4Hkerhg==",
+            "config": {},
+            "_admin": {
+                "modified": 1564579854.0480285,
+                "created": 1564579854.0480285,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "6beb4e2e-b397-11e9-a7a3-02420aff0008",
+                    "RO": "6bcfc3fc-b397-11e9-a7a3-02420aff0008",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "name": "OpenStack1",
+            "vim_type": "openstack",
+            "_id": "92b056a7-38f5-438d-b8ee-3f93b3531f87",
+            "schema_version": "1.1",
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.47:5000/v3",
+            "vim_tenant_name": "admin",
+        },
+        {
+            "config": {},
+            "vim_tenant_name": "osm_demo",
+            "schema_version": "1.1",
+            "name": "OpenStack2",
+            "vim_password": "gK5v4Gh2Pl41o6Skwp6RCw==",
+            "vim_type": "openstack",
+            "_admin": {
+                "modified": 1567148372.2490237,
+                "created": 1567148372.2490237,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "b7fb0034-caf3-11e9-9388-02420aff000a",
+                    "RO": "b7f129ce-caf3-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.44:5000/v3",
+            "_id": "6618d412-d7fc-4eb0-a6f8-d2c258e0e900",
+        },
+        {
+            "config": {},
+            "schema_version": "1.1",
+            "name": "OpenStack4",
+            "vim_password": "6LScyPeMq3QFh3GRb/xwZw==",
+            "vim_type": "openstack",
+            "vim_tenant_name": "osm_demo",
+            "_admin": {
+                "modified": 1567599911.5108898,
+                "created": 1567599911.5108898,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
+                    "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.43:5000/v3",
+            "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31",
+        },
+        {
+            "config": {},
+            "schema_version": "1.1",
+            "name": "OpenStack3",
+            "vim_password": "6LScyPeMq3QFh3GRb/xwZw==",
+            "vim_type": "openstack",
+            "vim_tenant_name": "osm_demo",
+            "_admin": {
+                "modified": 1567599911.5108898,
+                "created": 1567599911.5108898,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
+                    "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://10.234.12.46:5000/v3",
+            "_id": "eda92f47-29b9-4007-9709-c1833dbfbe31",
+        },
+        {
+            "config": {},
+            "schema_version": "1.1",
+            "name": "OpenStack5",
+            "vim_password": "6LScyPeMq3QFh3GRb/xwZw==",
+            "vim_type": "openstack",
+            "vim_tenant_name": "osm_demo",
+            "_admin": {
+                "modified": 1567599911.5108898,
+                "created": 1567599911.5108898,
+                "operationalState": "ENABLED",
+                "projects_read": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "deployed": {
+                    "RO-account": "0a651200-cf0f-11e9-9388-02420aff000a",
+                    "RO": "0a4defc6-cf0f-11e9-9388-02420aff000a",
+                },
+                "projects_write": ["69915588-e5e2-46d3-96b0-a29bedef6f73"],
+                "detailed-status": "Done",
+            },
+            "vim_user": "admin",
+            "vim_url": "http://1.1.1.1:5000/v3",
+            "_id": "ffffffff-29b9-4007-9709-c1833dbfbe31",
+        },
+    ]
 
     def _produce_ut_vim_accounts_info(self, vim_accounts):
         """
         FIXME temporary, we will need more control over vim_urls and _id for test purpose - make a generator
         :return: vim_url and _id as dict, i.e. extract these from vim_accounts data
         """
-        return {_['name']: _['_id'] for _ in vim_accounts}
+        return {_["name"]: _["_id"] for _ in vim_accounts}
 
     def _adjust_path(self, file):
         """In case we are not running from test directory,
         then assume we are in top level directory (e.g. running from tox) and adjust file path accordingly"""
-        path_component = '/osm_pla/test/'
+        path_component = "/osm_pla/test/"
         real_path = os.path.realpath(file)
         if path_component not in real_path:
-            return os.path.dirname(real_path) + path_component + os.path.basename(real_path)
+            return (
+                os.path.dirname(real_path)
+                + path_component
+                + os.path.basename(real_path)
+            )
         else:
             return real_path
 
@@ -211,29 +361,67 @@ class TestNsPlacementDataFactory(TestCase):
         price_list_file = "vnf_price_list.yaml"
         with open(str(Path(self._adjust_path(price_list_file)))) as pl_fd:
             price_list_data = yaml.safe_load_all(pl_fd)
-            return {i['vnfd']: {i1['vim_name']: i1['price'] for i1 in i['prices']} for i in next(price_list_data)}
+            return {
+                i["vnfd"]: {i1["vim_name"]: i1["price"] for i1 in i["prices"]}
+                for i in next(price_list_data)
+            }
 
     def _produce_ut_vnf_test_price_list(self, price_list):
         price_list_file = price_list
         with open(str(Path(self._adjust_path(price_list_file)))) as pl_fd:
             price_list_data = yaml.safe_load_all(pl_fd)
-            return {i['vnfd']: {i1['vim_name']: i1['price'] for i1 in i['prices']} for i in next(price_list_data)}
+            return {
+                i["vnfd"]: {i1["vim_name"]: i1["price"] for i1 in i["prices"]}
+                for i in next(price_list_data)
+            }
 
     def test__produce_trp_link_characteristics_link_latency_with_more_vims(self):
         """
-         -test with more(other) vims compared to pil
-         """
-        content_expected = [0, 0, 0, 0, 0, 120, 120, 130, 130, 140, 140, 230, 230, 240, 240,
-                            340, 340, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767]
+        -test with more(other) vims compared to pil
+        """
+        content_expected = [
+            0,
+            0,
+            0,
+            0,
+            0,
+            120,
+            120,
+            130,
+            130,
+            140,
+            140,
+            230,
+            230,
+            240,
+            240,
+            340,
+            340,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+        ]
         nspdf = NsPlacementDataFactory(
-            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts_more_vims),
+            self._produce_ut_vim_accounts_info(
+                TestNsPlacementDataFactory.vim_accounts_more_vims
+            ),
             self._produce_ut_vnf_price_list(),
             nsd=None,
-            pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'),
-            pinning=None)
-        pil_latencies = nspdf._produce_trp_link_characteristics_data('pil_latency')
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_latencies = nspdf._produce_trp_link_characteristics_data("pil_latency")
         content_produced = [i for row in pil_latencies for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'trp_link_latency incorrect')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "trp_link_latency incorrect",
+        )
 
     def test__produce_trp_link_characteristics_link_latency_with_fewer_vims(self):
         """
@@ -242,27 +430,41 @@ class TestNsPlacementDataFactory(TestCase):
         """
         content_expected = [0, 0, 0, 120, 120, 140, 140, 240, 240]
         nspdf = NsPlacementDataFactory(
-            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts_fewer_vims),
+            self._produce_ut_vim_accounts_info(
+                TestNsPlacementDataFactory.vim_accounts_fewer_vims
+            ),
             self._produce_ut_vnf_price_list(),
             nsd=None,
-            pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'),
-            pinning=None)
-        pil_latencies = nspdf._produce_trp_link_characteristics_data('pil_latency')
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_latencies = nspdf._produce_trp_link_characteristics_data("pil_latency")
         content_produced = [i for row in pil_latencies for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'trp_link_latency incorrect')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "trp_link_latency incorrect",
+        )
 
     def test__produce_trp_link_characteristic_not_supported(self):
         """
         - test with non-supported characteristic
         """
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest1.yaml'), pinning=None)
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest1.yaml"),
+            pinning=None,
+        )
 
         with self.assertRaises(Exception) as e:
-            nspdf._produce_trp_link_characteristics_data('test_no_support')
-        self.assertRegex(str(e.exception), r'characteristic.*not supported', "invalid exception content")
+            nspdf._produce_trp_link_characteristics_data("test_no_support")
+        self.assertRegex(
+            str(e.exception),
+            r"characteristic.*not supported",
+            "invalid exception content",
+        )
 
     def test__produce_trp_link_characteristics_link_latency(self):
         """
@@ -274,343 +476,570 @@ class TestNsPlacementDataFactory(TestCase):
 
         :return:
         """
-        content_expected = [0, 0, 0, 0, 120, 120, 130, 130, 140, 140, 230, 230, 240, 240, 340, 340]
+        content_expected = [
+            0,
+            0,
+            0,
+            0,
+            120,
+            120,
+            130,
+            130,
+            140,
+            140,
+            230,
+            230,
+            240,
+            240,
+            340,
+            340,
+        ]
 
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'), pinning=None)
-        pil_latencies = nspdf._produce_trp_link_characteristics_data('pil_latency')
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_latencies = nspdf._produce_trp_link_characteristics_data("pil_latency")
         content_produced = [i for row in pil_latencies for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'trp_link_latency incorrect')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "trp_link_latency incorrect",
+        )
 
     def test__produce_trp_link_characteristics_link_jitter(self):
         """
         -test with full set of vims as in pil
         """
-        content_expected = [0, 0, 0, 0, 1200, 1200, 1300, 1300, 1400, 1400, 2300, 2300, 2400, 2400, 3400, 3400]
+        content_expected = [
+            0,
+            0,
+            0,
+            0,
+            1200,
+            1200,
+            1300,
+            1300,
+            1400,
+            1400,
+            2300,
+            2300,
+            2400,
+            2400,
+            3400,
+            3400,
+        ]
 
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'), pinning=None)
-        pil_jitter = nspdf._produce_trp_link_characteristics_data('pil_jitter')
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_jitter = nspdf._produce_trp_link_characteristics_data("pil_jitter")
         content_produced = [i for row in pil_jitter for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'trp_link_jitter incorrect')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "trp_link_jitter incorrect",
+        )
 
     def test__produce_trp_link_characteristics_link_jitter_with_fewer_vims(self):
         """
         -test with fewer vims compared to pil, link jitter
         """
         content_expected = [0, 0, 0, 1200, 1200, 1400, 1400, 2400, 2400]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(self.vim_accounts_fewer_vims),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'), pinning=None)
-        pil_latencies = nspdf._produce_trp_link_characteristics_data('pil_jitter')
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(self.vim_accounts_fewer_vims),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_latencies = nspdf._produce_trp_link_characteristics_data("pil_jitter")
         content_produced = [i for row in pil_latencies for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'trp_link_jitter incorrect')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "trp_link_jitter incorrect",
+        )
 
     def test__produce_trp_link_characteristics_link_jitter_with_more_vims(self):
         """
         -test with more vims compared to pil, link jitter
         """
-        content_expected = [0, 0, 0, 0, 0, 1200, 1200, 1300, 1300, 1400, 1400, 2300,
-                            2300, 2400, 2400, 3400, 3400, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(self.vim_accounts_more_vims),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'), pinning=None)
-        pil_latencies = nspdf._produce_trp_link_characteristics_data('pil_jitter')
+        content_expected = [
+            0,
+            0,
+            0,
+            0,
+            0,
+            1200,
+            1200,
+            1300,
+            1300,
+            1400,
+            1400,
+            2300,
+            2300,
+            2400,
+            2400,
+            3400,
+            3400,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+            32767,
+        ]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(self.vim_accounts_more_vims),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_latencies = nspdf._produce_trp_link_characteristics_data("pil_jitter")
         content_produced = [i for row in pil_latencies for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'trp_link_jitter incorrect')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "trp_link_jitter incorrect",
+        )
 
     def test__produce_trp_link_characteristics_link_price(self):
         """
         -test with full set of vims as in pil
         """
         content_expected = [0, 0, 0, 0, 12, 12, 13, 13, 14, 14, 23, 23, 24, 24, 34, 34]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'), pinning=None)
-        pil_prices = nspdf._produce_trp_link_characteristics_data('pil_price')
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_prices = nspdf._produce_trp_link_characteristics_data("pil_price")
         content_produced = [i for row in pil_prices for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'invalid trp link prices')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "invalid trp link prices",
+        )
 
     def test__produce_trp_link_characteristics_link_price_with_fewer_vims(self):
         """
         -test with fewer vims compared to pil
         """
         content_expected = [0, 0, 0, 12, 12, 14, 14, 24, 24]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(self.vim_accounts_fewer_vims),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest1_keys.yaml'), pinning=None)
-        pil_prices = nspdf._produce_trp_link_characteristics_data('pil_price')
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(self.vim_accounts_fewer_vims),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest1_keys.yaml"),
+            pinning=None,
+        )
+        pil_prices = nspdf._produce_trp_link_characteristics_data("pil_price")
         content_produced = [i for row in pil_prices for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced), 'invalid trp link prices')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "invalid trp link prices",
+        )
 
     def test__produce_trp_link_characteristics_partly_constrained(self):
-        content_expected = [0, 0, 0, 0, 32767, 32767, 32767, 32767, 1200, 1200, 1400, 1400, 2400, 2400, 3400, 3400]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('pil_unittest2_keys.yaml'), pinning=None)
-        pil_jitter = nspdf._produce_trp_link_characteristics_data('pil_jitter')
+        content_expected = [
+            0,
+            0,
+            0,
+            0,
+            32767,
+            32767,
+            32767,
+            32767,
+            1200,
+            1200,
+            1400,
+            1400,
+            2400,
+            2400,
+            3400,
+            3400,
+        ]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info("pil_unittest2_keys.yaml"),
+            pinning=None,
+        )
+        pil_jitter = nspdf._produce_trp_link_characteristics_data("pil_jitter")
         content_produced = [i for row in pil_jitter for i in row]
-        self.assertEqual(Counter(content_expected), Counter(content_produced),
-                         'invalid trp link jitter, partly constrained')
+        self.assertEqual(
+            Counter(content_expected),
+            Counter(content_produced),
+            "invalid trp link jitter, partly constrained",
+        )
 
     def test__produce_vld_desc_partly_constrained(self):
-        vld_desc_expected = [{'cp_refs': ['one', 'two'], 'jitter': 30},
-                             {'cp_refs': ['two', 'three'], 'latency': 120}]
-
-        nsd = self._get_ut_nsd_from_file('nsd_unittest2.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None)
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(),
-                         "vld_desc incorrect")
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"], "jitter": 30},
+            {"cp_refs": ["two", "three"], "latency": 120},
+        ]
+
+        nsd = self._get_ut_nsd_from_file("nsd_unittest2.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+        )
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_trp_link_characteristics_link_latency_not_yaml_conformant(self):
         """
         -test with invalid/corrupt pil configuration file (not yaml conformant)
         """
         with self.assertRaises(Exception) as e:
-            _ = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('not_yaml_conformant.yaml'),
-                                       pinning=None)
-        self.assertRegex(str(e.exception), r'mapping values are not allowed here.*', "invalid exception content")
+            _ = NsPlacementDataFactory(
+                self._produce_ut_vim_accounts_info(
+                    TestNsPlacementDataFactory.vim_accounts
+                ),
+                self._produce_ut_vnf_price_list(),
+                nsd=None,
+                pil_info=self._populate_pil_info("not_yaml_conformant.yaml"),
+                pinning=None,
+            )
+        self.assertRegex(
+            str(e.exception),
+            r"mapping values are not allowed here.*",
+            "invalid exception content",
+        )
 
     def test__produce_trp_link_characteristics_with_invalid_pil_config(self):
         """
         -test with invalid/corrupt pil configuration file (missing endpoint)
         """
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=None,
-                                       pil_info=self._populate_pil_info('corrupt_pil_endpoints_config_unittest1.yaml'),
-                                       pinning=None)
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=None,
+            pil_info=self._populate_pil_info(
+                "corrupt_pil_endpoints_config_unittest1.yaml"
+            ),
+            pinning=None,
+        )
         with self.assertRaises(Exception) as e:
-            _ = nspdf._produce_trp_link_characteristics_data('pil_latency')
-        self.assertEqual('list index out of range', str(e.exception), "unexpected exception")
+            _ = nspdf._produce_trp_link_characteristics_data("pil_latency")
+        self.assertEqual(
+            "list index out of range", str(e.exception), "unexpected exception"
+        )
 
     def test__produce_vld_desc_w_instantiate_override(self):
 
-        vld_desc_expected = [{'cp_refs': ['one', 'two'], 'latency': 150, 'jitter': 30},
-                             {'cp_refs': ['two', 'three'], 'latency': 90, 'jitter': 30}]
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"], "latency": 150, "jitter": 30},
+            {"cp_refs": ["two", "three"], "latency": 90, "jitter": 30},
+        ]
 
-        nsd = self._get_ut_nsd_from_file('nsd_unittest_no_vld_constraints.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest_no_vld_constraints.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints=None,
+        )
 
-        self.assertNotEqual(nspdf._produce_vld_desc(),
-                            vld_desc_expected, "vld_desc incorrect")
+        self.assertNotEqual(
+            nspdf._produce_vld_desc(), vld_desc_expected, "vld_desc incorrect"
+        )
 
     def test__produce_vld_desc_nsd_w_instantiate_wo(self):
         """
         nsd w/ constraints, instantiate w/o constraints
         :return:
         """
-        vld_desc_expected = [{'cp_refs': ['one', 'two'], 'latency': 150, 'jitter': 30},
-                             {'cp_refs': ['two', 'three'], 'latency': 90, 'jitter': 30}]
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"], "latency": 150, "jitter": 30},
+            {"cp_refs": ["two", "three"], "latency": 90, "jitter": 30},
+        ]
 
-        nsd = self._get_ut_nsd_from_file('nsd_unittest3.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest3.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints=None,
+        )
 
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(),
-                         "vld_desc incorrect")
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_vld_desc_nsd_w_instantiate_w(self):
         """
         nsd w/ constraints, instantiate w/ constraints => override
         :return:
         """
-        vld_desc_expected = [{'cp_refs': ['one', 'two'], 'latency': 120, 'jitter': 21},
-                             {'cp_refs': ['two', 'three'], 'latency': 121, 'jitter': 22}]
-
-        nsd = self._get_ut_nsd_from_file('nsd_unittest3.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints={
-                                           'vld-constraints': [{'id': 'three_vnf_constrained_nsd_vld1',
-                                                                'link-constraints': {'latency': 120,
-                                                                                     'jitter': 21}},
-                                                               {'id': 'three_vnf_constrained_nsd_vld2',
-                                                                'link-constraints': {'latency': 121,
-                                                                                     'jitter': 22}}]})
-
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(),
-                         "vld_desc incorrect")
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"], "latency": 120, "jitter": 21},
+            {"cp_refs": ["two", "three"], "latency": 121, "jitter": 22},
+        ]
+
+        nsd = self._get_ut_nsd_from_file("nsd_unittest3.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints={
+                "vld-constraints": [
+                    {
+                        "id": "three_vnf_constrained_nsd_vld1",
+                        "link-constraints": {"latency": 120, "jitter": 21},
+                    },
+                    {
+                        "id": "three_vnf_constrained_nsd_vld2",
+                        "link-constraints": {"latency": 121, "jitter": 22},
+                    },
+                ]
+            },
+        )
+
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_vld_desc_nsd_wo_instantiate_wo(self):
         """
         nsd w/o constraints, instantiate w/o constraints = no constraints in model
         :return:
         """
-        vld_desc_expected = [{'cp_refs': ['one', 'two']},
-                             {'cp_refs': ['two', 'three']}]
+        vld_desc_expected = [{"cp_refs": ["one", "two"]}, {"cp_refs": ["two", "three"]}]
 
-        nsd = self._get_ut_nsd_from_file('nsd_unittest_no_vld_constraints.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest_no_vld_constraints.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints=None,
+        )
 
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(),
-                         "vld_desc incorrect")
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_vld_desc_nsd_wo_instantiate_w(self):
         """
         nsd w/o constraints, instantiate w/ constraints => add constraints
         :return:
         """
-        vld_desc_expected = [{'cp_refs': ['one', 'two'], 'latency': 140, 'jitter': 41},
-                             {'cp_refs': ['two', 'three'], 'latency': 141, 'jitter': 42}]
-
-        nsd = self._get_ut_nsd_from_file('nsd_unittest_no_vld_constraints.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints={
-                                           'vld-constraints': [{'id': 'three_vnf_constrained_nsd_vld1',
-                                                                'link-constraints': {'latency': 140,
-                                                                                     'jitter': 41}},
-                                                               {'id': 'three_vnf_constrained_nsd_vld2',
-                                                                'link-constraints': {'latency': 141,
-                                                                                     'jitter': 42}}]})
-
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(),
-                         "vld_desc incorrect")
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"], "latency": 140, "jitter": 41},
+            {"cp_refs": ["two", "three"], "latency": 141, "jitter": 42},
+        ]
+
+        nsd = self._get_ut_nsd_from_file("nsd_unittest_no_vld_constraints.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints={
+                "vld-constraints": [
+                    {
+                        "id": "three_vnf_constrained_nsd_vld1",
+                        "link-constraints": {"latency": 140, "jitter": 41},
+                    },
+                    {
+                        "id": "three_vnf_constrained_nsd_vld2",
+                        "link-constraints": {"latency": 141, "jitter": 42},
+                    },
+                ]
+            },
+        )
+
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_vld_desc_nsd_wo_instantiate_w_faulty_input(self):
         """
         nsd w/o constraints, instantiate w/ constraints => add constraints that can be parsed
         :return:
         """
-        vld_desc_expected = [{'cp_refs': ['one', 'two']},
-                             {'cp_refs': ['two', 'three'], 'latency': 151}]
-
-        nsd = self._get_ut_nsd_from_file('nsd_unittest_no_vld_constraints.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints={'vld-constraints': [{'id': 'not_included_vld',
-                                                                               'misspelled-constraints':
-                                                                                   {'latency': 120,
-                                                                                    'jitter': 20}},
-                                                                              {'id': 'three_vnf_constrained_nsd_vld2',
-                                                                               'link-constraints': {
-                                                                                   'latency': 151}}]})
-
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(),
-                         "vld_desc incorrect")
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"]},
+            {"cp_refs": ["two", "three"], "latency": 151},
+        ]
+
+        nsd = self._get_ut_nsd_from_file("nsd_unittest_no_vld_constraints.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints={
+                "vld-constraints": [
+                    {
+                        "id": "not_included_vld",
+                        "misspelled-constraints": {"latency": 120, "jitter": 20},
+                    },
+                    {
+                        "id": "three_vnf_constrained_nsd_vld2",
+                        "link-constraints": {"latency": 151},
+                    },
+                ]
+            },
+        )
+
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_vld_desc_nsd_wo_instantiate_w_faulty_input_again(self):
         """
         nsd w/o constraints, instantiate w/ faulty constraints => add constraints that can be parsed
         :return:
         """
-        vld_desc_expected = [{'cp_refs': ['one', 'two'], 'jitter': 21},
-                             {'cp_refs': ['two', 'three']}]
-
-        nsd = self._get_ut_nsd_from_file('nsd_unittest_no_vld_constraints.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints={
-                                           'vld-constraints': [{'id': 'three_vnf_constrained_nsd_vld1',
-                                                                'link-constraints': {'delay': 120,
-                                                                                     'jitter': 21}},
-                                                               {'id': 'three_vnf_constrained_nsd_vld2',
-                                                                'misspelled-constraints': {'latency': 121,
-                                                                                           'jitter': 22}}]})
-
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(),
-                         "vld_desc incorrect")
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"], "jitter": 21},
+            {"cp_refs": ["two", "three"]},
+        ]
 
-    def test__produce_vld_desc_mgmt_network(self):
-        vld_desc_expected = [{'cp_refs': ['1', '2'], 'latency': 120, 'jitter': 20},
-                             {'cp_refs': ['2', '4'], 'latency': 50, 'jitter': 10},
-                             {'cp_refs': ['2', '3'], 'latency': 20, 'jitter': 10}, ]
+        nsd = self._get_ut_nsd_from_file("nsd_unittest_no_vld_constraints.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints={
+                "vld-constraints": [
+                    {
+                        "id": "three_vnf_constrained_nsd_vld1",
+                        "link-constraints": {"delay": 120, "jitter": 21},
+                    },
+                    {
+                        "id": "three_vnf_constrained_nsd_vld2",
+                        "misspelled-constraints": {"latency": 121, "jitter": 22},
+                    },
+                ]
+            },
+        )
+
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
-        nsd = self._get_ut_nsd_from_file('test_five_nsd.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints=None)
+    def test__produce_vld_desc_mgmt_network(self):
+        vld_desc_expected = [
+            {"cp_refs": ["1", "2"], "latency": 120, "jitter": 20},
+            {"cp_refs": ["2", "4"], "latency": 50, "jitter": 10},
+            {"cp_refs": ["2", "3"], "latency": 20, "jitter": 10},
+        ]
+
+        nsd = self._get_ut_nsd_from_file("test_five_nsd.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints=None,
+        )
 
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect")
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_vld_desc_single_vnf_nsd(self):
         vld_desc_expected = []
 
-        nsd = self._get_ut_nsd_from_file('nsd_unittest4.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest4.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints=None,
+        )
 
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc_incorrect")
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc_incorrect"
+        )
 
     def test__produce_vld_desc_slice_nsd(self):
         vld_desc_expected = []
-        nsd = self._get_ut_nsd_from_file('slice_hackfest_middle_nsd.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints=None)
+        nsd = self._get_ut_nsd_from_file("slice_hackfest_middle_nsd.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints=None,
+        )
 
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc_incorrect")
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc_incorrect"
+        )
 
     def test__produce_vld_desc(self):
         """
 
         :return:
         """
-        vld_desc_expected = [{'cp_refs': ['one', 'two'], 'latency': 150, 'jitter': 30},
-                             {'cp_refs': ['two', 'three'], 'latency': 90, 'jitter': 30}]
+        vld_desc_expected = [
+            {"cp_refs": ["one", "two"], "latency": 150, "jitter": 30},
+            {"cp_refs": ["two", "three"], "latency": 90, "jitter": 30},
+        ]
 
-        nsd = self._get_ut_nsd_from_file('nsd_unittest3.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None, pinning=None,
-                                       order_constraints=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest3.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+            order_constraints=None,
+        )
 
-        self.assertEqual(vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect")
+        self.assertEqual(
+            vld_desc_expected, nspdf._produce_vld_desc(), "vld_desc incorrect"
+        )
 
     def test__produce_ns_desc(self):
         """
@@ -620,170 +1049,257 @@ class TestNsPlacementDataFactory(TestCase):
         - nsd with different vndfd-id-refs
         - fault case scenarios with non-existing vims, non-existing vnfds
         """
-        nsd = self._get_ut_nsd_from_file('nsd_unittest3.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None,
-                                       pinning=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest3.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+        )
 
         ns_desc = nspdf._produce_ns_desc()
         # check that all expected member-vnf-index are present
-        vnfs = [e['vnf_id'] for e in ns_desc]
-        self.assertEqual(Counter(['one', 'two', 'three']), Counter(vnfs), 'vnf_id invalid')
+        vnfs = [e["vnf_id"] for e in ns_desc]
+        self.assertEqual(
+            Counter(["one", "two", "three"]), Counter(vnfs), "vnf_id invalid"
+        )
 
-        expected_keys = ['vnf_id', 'vnf_price_per_vim']
+        expected_keys = ["vnf_id", "vnf_price_per_vim"]
         for e in ns_desc:
             # check that vnf_price_per_vim has proper values
-            self.assertEqual(Counter([5, 10, 30, 30]), Counter(e['vnf_price_per_vim']), 'vnf_price_per_vim invalid')
+            self.assertEqual(
+                Counter([5, 10, 30, 30]),
+                Counter(e["vnf_price_per_vim"]),
+                "vnf_price_per_vim invalid",
+            )
             # check that no pinning directives included
-            self.assertEqual(Counter(expected_keys), Counter(e.keys()), 'pinning directive misplaced')
+            self.assertEqual(
+                Counter(expected_keys), Counter(e.keys()), "pinning directive misplaced"
+            )
 
     def test__produce_ns_desc_with_more_vims(self):
-        nsd = self._get_ut_nsd_from_file('nsd_unittest1.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(self.vim_accounts_more_vims),
-                                       self._produce_ut_vnf_test_price_list('vnf_price_list_more_vims.yaml'),
-                                       nsd=nsd,
-                                       pil_info=None,
-                                       pinning=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest1.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(self.vim_accounts_more_vims),
+            self._produce_ut_vnf_test_price_list("vnf_price_list_more_vims.yaml"),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+        )
 
         ns_desc = nspdf._produce_ns_desc()
         # check that all expected member-vnf-index are present
-        vnfs = [e['vnf_id'] for e in ns_desc]
-        self.assertEqual(Counter({'1': 1, '2': 1, '3': 1}), Counter(vnfs), 'vnf_id invalid')
+        vnfs = [e["vnf_id"] for e in ns_desc]
+        self.assertEqual(
+            Counter({"1": 1, "2": 1, "3": 1}), Counter(vnfs), "vnf_id invalid"
+        )
 
-        expected_keys = ['vnf_id', 'vnf_price_per_vim']
+        expected_keys = ["vnf_id", "vnf_price_per_vim"]
         for e in ns_desc:
             # check that vnf_price_per_vim has proper values
-            self.assertEqual(Counter([5, 10, 30, 30, 3]), Counter(e['vnf_price_per_vim']), 'vnf_price_per_vim invalid')
+            self.assertEqual(
+                Counter([5, 10, 30, 30, 3]),
+                Counter(e["vnf_price_per_vim"]),
+                "vnf_price_per_vim invalid",
+            )
             # check that no pinning directives included
-            self.assertEqual(Counter(expected_keys), Counter(e.keys()), 'pinning directive misplaced')
+            self.assertEqual(
+                Counter(expected_keys), Counter(e.keys()), "pinning directive misplaced"
+            )
 
     def test__produce_ns_desc_with_fewer_vims(self):
-        nsd = self._get_ut_nsd_from_file('nsd_unittest1.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(self.vim_accounts_fewer_vims),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None,
-                                       pinning=None)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest1.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(self.vim_accounts_fewer_vims),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=None,
+        )
 
         ns_desc = nspdf._produce_ns_desc()
         # check that all expected member-vnf-index are present
-        vnfs = [e['vnf_id'] for e in ns_desc]
-        self.assertEqual(Counter({'1': 1, '2': 1, '3': 1}), Counter(vnfs), 'vnf_id invalid')
+        vnfs = [e["vnf_id"] for e in ns_desc]
+        self.assertEqual(
+            Counter({"1": 1, "2": 1, "3": 1}), Counter(vnfs), "vnf_id invalid"
+        )
 
-        expected_keys = ['vnf_id', 'vnf_price_per_vim']
+        expected_keys = ["vnf_id", "vnf_price_per_vim"]
         for e in ns_desc:
             # check that vnf_price_per_vim has proper values
-            self.assertEqual(Counter([5, 10, 30]), Counter(e['vnf_price_per_vim']), 'vnf_price_per_vim invalid')
+            self.assertEqual(
+                Counter([5, 10, 30]),
+                Counter(e["vnf_price_per_vim"]),
+                "vnf_price_per_vim invalid",
+            )
             # check that no pinning directives included
-            self.assertEqual(Counter(expected_keys), Counter(e.keys()), 'pinning directive misplaced')
+            self.assertEqual(
+                Counter(expected_keys), Counter(e.keys()), "pinning directive misplaced"
+            )
 
     def test__produce_ns_desc_w_pinning(self):
-        nsd = self._get_ut_nsd_from_file('nsd_unittest3.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        pinning = [{'member-vnf-index': 'two', 'vimAccountId': '331ffdec-44a8-4707-94a1-af7a292d9735'}]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=None,
-                                       pinning=pinning)
+        nsd = self._get_ut_nsd_from_file("nsd_unittest3.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        pinning = [
+            {
+                "member-vnf-index": "two",
+                "vimAccountId": "331ffdec-44a8-4707-94a1-af7a292d9735",
+            }
+        ]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=None,
+            pinning=pinning,
+        )
         ns_desc = nspdf._produce_ns_desc()
         # check that all expected member-vnf-index are present
-        vnfs = [e['vnf_id'] for e in ns_desc]
-        self.assertEqual(Counter(['one', 'three', 'two']), Counter(vnfs), 'vnf_id invalid')
+        vnfs = [e["vnf_id"] for e in ns_desc]
+        self.assertEqual(
+            Counter(["one", "three", "two"]), Counter(vnfs), "vnf_id invalid"
+        )
 
         for e in ns_desc:
             # check that vnf_price_per_vim has proper values
-            self.assertEqual(Counter([5, 10, 30, 30]), Counter(e['vnf_price_per_vim']), 'vnf_price_per_vim invalid')
+            self.assertEqual(
+                Counter([5, 10, 30, 30]),
+                Counter(e["vnf_price_per_vim"]),
+                "vnf_price_per_vim invalid",
+            )
             # check that member-vnf-index 2 is pinned correctly
-            if e['vnf_id'] == 'two':
-                self.assertTrue('vim_account' in e.keys(), 'missing pinning directive')
-                self.assertTrue(pinning[0]['vimAccountId'] == e['vim_account'][3:].replace('_', '-'),
-                                'invalid pinning vim-account')
+            if e["vnf_id"] == "two":
+                self.assertTrue("vim_account" in e.keys(), "missing pinning directive")
+                self.assertTrue(
+                    pinning[0]["vimAccountId"]
+                    == e["vim_account"][3:].replace("_", "-"),
+                    "invalid pinning vim-account",
+                )
             else:
-                self.assertTrue('vim-account' not in e.keys(), 'pinning directive misplaced')
-
-    @mock.patch.object(NsPlacementDataFactory, '_produce_trp_link_characteristics_data')
-    @mock.patch.object(NsPlacementDataFactory, '_produce_vld_desc')
-    @mock.patch.object(NsPlacementDataFactory, '_produce_ns_desc')
-    def test_create_ns_placement_data_wo_order(self, mock_prd_ns_desc, mock_prd_vld_desc, mock_prd_trp_link_char):
+                self.assertTrue(
+                    "vim-account" not in e.keys(), "pinning directive misplaced"
+                )
+
+    @mock.patch.object(NsPlacementDataFactory, "_produce_trp_link_characteristics_data")
+    @mock.patch.object(NsPlacementDataFactory, "_produce_vld_desc")
+    @mock.patch.object(NsPlacementDataFactory, "_produce_ns_desc")
+    def test_create_ns_placement_data_wo_order(
+        self, mock_prd_ns_desc, mock_prd_vld_desc, mock_prd_trp_link_char
+    ):
         """
         :return:
         """
-        vim_accounts_expected = [v.replace('-', '_') for v in ['vim92b056a7-38f5-438d-b8ee-3f93b3531f87',
-                                                               'vim6618d412-d7fc-4eb0-a6f8-d2c258e0e900',
-                                                               'vim331ffdec-44a8-4707-94a1-af7a292d9735',
-                                                               'vimeda92f47-29b9-4007-9709-c1833dbfbe31']]
-
-        nsd = self._get_ut_nsd_from_file('nsd_unittest3.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=self._populate_pil_info('pil_unittest1.yaml'),
-                                       pinning=None,
-                                       order_constraints=None)
+        vim_accounts_expected = [
+            v.replace("-", "_")
+            for v in [
+                "vim92b056a7-38f5-438d-b8ee-3f93b3531f87",
+                "vim6618d412-d7fc-4eb0-a6f8-d2c258e0e900",
+                "vim331ffdec-44a8-4707-94a1-af7a292d9735",
+                "vimeda92f47-29b9-4007-9709-c1833dbfbe31",
+            ]
+        ]
+
+        nsd = self._get_ut_nsd_from_file("nsd_unittest3.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=self._populate_pil_info("pil_unittest1.yaml"),
+            pinning=None,
+            order_constraints=None,
+        )
         nspd = nspdf.create_ns_placement_data()
-        self.assertEqual(Counter(vim_accounts_expected), Counter(nspd['vim_accounts']),
-                         "vim_accounts incorrect")
+        self.assertEqual(
+            Counter(vim_accounts_expected),
+            Counter(nspd["vim_accounts"]),
+            "vim_accounts incorrect",
+        )
         # mock1.assert_called_once() Note for python > 3.5
-        self.assertTrue(mock_prd_ns_desc.called, '_produce_ns_desc not called')
+        self.assertTrue(mock_prd_ns_desc.called, "_produce_ns_desc not called")
         # mock2.assert_called_once() Note for python > 3.5
-        self.assertTrue(mock_prd_vld_desc.called, ' _produce_vld_desc not called')
-        mock_prd_trp_link_char.assert_has_calls([call('pil_latency'), call('pil_jitter'), call('pil_price')])
-
-        regexps = [r"\{.*\}", r".*'file':.*mznplacement.py", r".*'time':.*datetime.datetime\(.*\)"]
-        generator_data = str(nspd['generator_data'])
+        self.assertTrue(mock_prd_vld_desc.called, " _produce_vld_desc not called")
+        mock_prd_trp_link_char.assert_has_calls(
+            [call("pil_latency"), call("pil_jitter"), call("pil_price")]
+        )
+
+        regexps = [
+            r"\{.*\}",
+            r".*'file':.*mznplacement.py",
+            r".*'time':.*datetime.datetime\(.*\)",
+        ]
+        generator_data = str(nspd["generator_data"])
         for regex in regexps:
             self.assertRegex(generator_data, regex, "generator data invalid")
 
-    @mock.patch.object(NsPlacementDataFactory, '_produce_trp_link_characteristics_data')
-    @mock.patch.object(NsPlacementDataFactory, '_produce_vld_desc')
-    @mock.patch.object(NsPlacementDataFactory, '_produce_ns_desc')
-    def test_create_ns_placement_data_w_order(self, mock_prd_ns_desc, mock_prd_vld_desc,
-                                              mock_prd_trp_link_char):
+    @mock.patch.object(NsPlacementDataFactory, "_produce_trp_link_characteristics_data")
+    @mock.patch.object(NsPlacementDataFactory, "_produce_vld_desc")
+    @mock.patch.object(NsPlacementDataFactory, "_produce_ns_desc")
+    def test_create_ns_placement_data_w_order(
+        self, mock_prd_ns_desc, mock_prd_vld_desc, mock_prd_trp_link_char
+    ):
         """
         :return:
         """
-        vim_accounts_expected = [v.replace('-', '_') for v in ['vim92b056a7-38f5-438d-b8ee-3f93b3531f87',
-                                                               'vim6618d412-d7fc-4eb0-a6f8-d2c258e0e900',
-                                                               'vim331ffdec-44a8-4707-94a1-af7a292d9735',
-                                                               'vimeda92f47-29b9-4007-9709-c1833dbfbe31']]
-
-        nsd = self._get_ut_nsd_from_file('nsd_unittest3.yaml')
-        nsd = nsd['nsd']['nsd'][0]
-        nspdf = NsPlacementDataFactory(self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
-                                       self._produce_ut_vnf_price_list(),
-                                       nsd=nsd,
-                                       pil_info=self._populate_pil_info('pil_unittest1.yaml'),
-                                       pinning=None,
-                                       order_constraints={
-                                           'vld-constraints': [{'id': 'three_vnf_constrained_nsd_vld1',
-                                                                'link-constraints': {'latency': 120,
-                                                                                     'jitter': 21}},
-                                                               {'id': 'three_vnf_constrained_nsd_vld2',
-                                                                'link-constraints': {'latency': 121,
-                                                                                     'jitter': 22}}]}
-                                       )
+        vim_accounts_expected = [
+            v.replace("-", "_")
+            for v in [
+                "vim92b056a7-38f5-438d-b8ee-3f93b3531f87",
+                "vim6618d412-d7fc-4eb0-a6f8-d2c258e0e900",
+                "vim331ffdec-44a8-4707-94a1-af7a292d9735",
+                "vimeda92f47-29b9-4007-9709-c1833dbfbe31",
+            ]
+        ]
+
+        nsd = self._get_ut_nsd_from_file("nsd_unittest3.yaml")
+        nsd = nsd["nsd"]["nsd"][0]
+        nspdf = NsPlacementDataFactory(
+            self._produce_ut_vim_accounts_info(TestNsPlacementDataFactory.vim_accounts),
+            self._produce_ut_vnf_price_list(),
+            nsd=nsd,
+            pil_info=self._populate_pil_info("pil_unittest1.yaml"),
+            pinning=None,
+            order_constraints={
+                "vld-constraints": [
+                    {
+                        "id": "three_vnf_constrained_nsd_vld1",
+                        "link-constraints": {"latency": 120, "jitter": 21},
+                    },
+                    {
+                        "id": "three_vnf_constrained_nsd_vld2",
+                        "link-constraints": {"latency": 121, "jitter": 22},
+                    },
+                ]
+            },
+        )
         nspd = nspdf.create_ns_placement_data()
-        self.assertEqual(Counter(vim_accounts_expected), Counter(nspd['vim_accounts']),
-                         "vim_accounts incorrect")
+        self.assertEqual(
+            Counter(vim_accounts_expected),
+            Counter(nspd["vim_accounts"]),
+            "vim_accounts incorrect",
+        )
         # mock1.assert_called_once() Note for python > 3.5
-        self.assertTrue(mock_prd_ns_desc.called, '_produce_ns_desc not called')
+        self.assertTrue(mock_prd_ns_desc.called, "_produce_ns_desc not called")
         # mock2.assert_called_once() Note for python > 3.5
-        self.assertTrue(mock_prd_vld_desc.called, ' _produce_vld_desc not called')
-        mock_prd_trp_link_char.assert_has_calls([call('pil_latency'), call('pil_jitter'), call('pil_price')])
-
-        regexps = [r"\{.*\}", r".*'file':.*mznplacement.py", r".*'time':.*datetime.datetime\(.*\)"]
-        generator_data = str(nspd['generator_data'])
+        self.assertTrue(mock_prd_vld_desc.called, " _produce_vld_desc not called")
+        mock_prd_trp_link_char.assert_has_calls(
+            [call("pil_latency"), call("pil_jitter"), call("pil_price")]
+        )
+
+        regexps = [
+            r"\{.*\}",
+            r".*'file':.*mznplacement.py",
+            r".*'time':.*datetime.datetime\(.*\)",
+        ]
+        generator_data = str(nspd["generator_data"])
         for regex in regexps:
             self.assertRegex(generator_data, regex, "generator data invalid")
 
 
 if __name__ == "__main__":
-    if __name__ == '__main__':
+    if __name__ == "__main__":
         unittest.main()
index fdde3eb..3ba2979 100644 (file)
@@ -28,241 +28,401 @@ from osm_pla.placement.mznplacement import NsPlacementDataFactory, MznPlacementC
 from pathlib import Path
 
 # need to Mock the imports from osm_common made in Server and Config beforehand
-sys.modules['osm_common'] = Mock()
+sys.modules["osm_common"] = Mock()
 from osm_pla.server.server import Server  # noqa: E402
 from osm_pla.config.config import Config  # noqa: E402
 
-nslcmop_record_wo_pinning = {'statusEnteredTime': 1574625718.8280587, 'startTime': 1574625718.8280587,
-                             '_admin': {'created': 1574625718.8286533,
-                                        'projects_write': ['61e4bbab-9659-4abc-a01d-ba3a307becf9'],
-                                        'worker': 'e5121e773e8b', 'modified': 1574625718.8286533,
-                                        'projects_read': ['61e4bbab-9659-4abc-a01d-ba3a307becf9']},
-                             'operationState': 'PROCESSING', 'nsInstanceId': '45f588bd-5bf4-4181-b13b-f16a55a23be4',
-                             'lcmOperationType': 'instantiate', 'isCancelPending': False,
-                             'id': 'a571b1de-19e5-48bd-b252-ba0ad7d540c9',
-                             '_id': 'a571b1de-19e5-48bd-b252-ba0ad7d540c9',
-                             'isAutomaticInvocation': False,
-                             'links': {'nsInstance': '/osm/nslcm/v1/ns_instances/45f588bd-5bf4-4181-b13b-f16a55a23be4',
-                                       'self': '/osm/nslcm/v1/ns_lcm_op_occs/a571b1de-19e5-48bd-b252-ba0ad7d540c9'},
-                             'operationParams': {'vimAccountId': 'eb553051-5b6c-4ad6-939b-2ad23bd82e57',
-                                                 'lcmOperationType': 'instantiate', 'nsDescription': 'just a test',
-                                                 'nsdId': '0f4e658f-62a6-4f73-8623-270e8f0a18bc',
-                                                 'nsName': 'ThreeNsd plain placement', 'ssh_keys': [],
-                                                 'validVimAccounts': ['eb553051-5b6c-4ad6-939b-2ad23bd82e57',
-                                                                      '576bbe0a-b95d-4ced-a63e-f387f8e6e2ce',
-                                                                      '3d1ffc5d-b36d-4f69-8356-7f59c740ca2f',
-                                                                      'db54dcd4-9fc4-441c-8820-17bce0aef2c3'],
-                                                 'nsr_id': '45f588bd-5bf4-4181-b13b-f16a55a23be4',
-                                                 'placement-engine': 'PLA',
-                                                 'nsInstanceId': '45f588bd-5bf4-4181-b13b-f16a55a23be4'}}
-
-nslcmop_record_w_pinning = {'statusEnteredTime': 1574627411.420499, 'startTime': 1574627411.420499,
-                            '_admin': {'created': 1574627411.4209971,
-                                       'projects_write': ['61e4bbab-9659-4abc-a01d-ba3a307becf9'],
-                                       'worker': 'e5121e773e8b', 'modified': 1574627411.4209971,
-                                       'projects_read': ['61e4bbab-9659-4abc-a01d-ba3a307becf9']},
-                            'operationState': 'PROCESSING',
-                            'nsInstanceId': '61587478-ea25-44eb-9f13-7005046ddb08', 'lcmOperationType': 'instantiate',
-                            'isCancelPending': False, 'id': '80f95a17-6fa7-408d-930f-40aa4589d074',
-                            '_id': '80f95a17-6fa7-408d-930f-40aa4589d074',
-                            'isAutomaticInvocation': False,
-                            'links': {
-                                'nsInstance': '/osm/nslcm/v1/ns_instances/61587478-ea25-44eb-9f13-7005046ddb08',
-                                'self': '/osm/nslcm/v1/ns_lcm_op_occs/80f95a17-6fa7-408d-930f-40aa4589d074'},
-                            'operationParams': {
-                                'vimAccountId': '576bbe0a-b95d-4ced-a63e-f387f8e6e2ce',
-                                'nsr_id': '61587478-ea25-44eb-9f13-7005046ddb08',
-                                'nsDescription': 'default description', 'nsdId': '0f4e658f-62a6-4f73-8623-270e8f0a18bc',
-                                'validVimAccounts': [
-                                    'eb553051-5b6c-4ad6-939b-2ad23bd82e57', '576bbe0a-b95d-4ced-a63e-f387f8e6e2ce',
-                                    '3d1ffc5d-b36d-4f69-8356-7f59c740ca2f',
-                                    'db54dcd4-9fc4-441c-8820-17bce0aef2c3'], 'nsName': 'ThreeVnfTest2',
-                                'wimAccountId': False, 'vnf': [
-                                    {'vimAccountId': '3d1ffc5d-b36d-4f69-8356-7f59c740ca2f', 'member-vnf-index': '1'}],
-                                'placementEngine': 'PLA',
-                                'nsInstanceId': '61587478-ea25-44eb-9f13-7005046ddb08',
-                                'lcmOperationType': 'instantiate'}}
+nslcmop_record_wo_pinning = {
+    "statusEnteredTime": 1574625718.8280587,
+    "startTime": 1574625718.8280587,
+    "_admin": {
+        "created": 1574625718.8286533,
+        "projects_write": ["61e4bbab-9659-4abc-a01d-ba3a307becf9"],
+        "worker": "e5121e773e8b",
+        "modified": 1574625718.8286533,
+        "projects_read": ["61e4bbab-9659-4abc-a01d-ba3a307becf9"],
+    },
+    "operationState": "PROCESSING",
+    "nsInstanceId": "45f588bd-5bf4-4181-b13b-f16a55a23be4",
+    "lcmOperationType": "instantiate",
+    "isCancelPending": False,
+    "id": "a571b1de-19e5-48bd-b252-ba0ad7d540c9",
+    "_id": "a571b1de-19e5-48bd-b252-ba0ad7d540c9",
+    "isAutomaticInvocation": False,
+    "links": {
+        "nsInstance": "/osm/nslcm/v1/ns_instances/45f588bd-5bf4-4181-b13b-f16a55a23be4",
+        "self": "/osm/nslcm/v1/ns_lcm_op_occs/a571b1de-19e5-48bd-b252-ba0ad7d540c9",
+    },
+    "operationParams": {
+        "vimAccountId": "eb553051-5b6c-4ad6-939b-2ad23bd82e57",
+        "lcmOperationType": "instantiate",
+        "nsDescription": "just a test",
+        "nsdId": "0f4e658f-62a6-4f73-8623-270e8f0a18bc",
+        "nsName": "ThreeNsd plain placement",
+        "ssh_keys": [],
+        "validVimAccounts": [
+            "eb553051-5b6c-4ad6-939b-2ad23bd82e57",
+            "576bbe0a-b95d-4ced-a63e-f387f8e6e2ce",
+            "3d1ffc5d-b36d-4f69-8356-7f59c740ca2f",
+            "db54dcd4-9fc4-441c-8820-17bce0aef2c3",
+        ],
+        "nsr_id": "45f588bd-5bf4-4181-b13b-f16a55a23be4",
+        "placement-engine": "PLA",
+        "nsInstanceId": "45f588bd-5bf4-4181-b13b-f16a55a23be4",
+    },
+}
+
+nslcmop_record_w_pinning = {
+    "statusEnteredTime": 1574627411.420499,
+    "startTime": 1574627411.420499,
+    "_admin": {
+        "created": 1574627411.4209971,
+        "projects_write": ["61e4bbab-9659-4abc-a01d-ba3a307becf9"],
+        "worker": "e5121e773e8b",
+        "modified": 1574627411.4209971,
+        "projects_read": ["61e4bbab-9659-4abc-a01d-ba3a307becf9"],
+    },
+    "operationState": "PROCESSING",
+    "nsInstanceId": "61587478-ea25-44eb-9f13-7005046ddb08",
+    "lcmOperationType": "instantiate",
+    "isCancelPending": False,
+    "id": "80f95a17-6fa7-408d-930f-40aa4589d074",
+    "_id": "80f95a17-6fa7-408d-930f-40aa4589d074",
+    "isAutomaticInvocation": False,
+    "links": {
+        "nsInstance": "/osm/nslcm/v1/ns_instances/61587478-ea25-44eb-9f13-7005046ddb08",
+        "self": "/osm/nslcm/v1/ns_lcm_op_occs/80f95a17-6fa7-408d-930f-40aa4589d074",
+    },
+    "operationParams": {
+        "vimAccountId": "576bbe0a-b95d-4ced-a63e-f387f8e6e2ce",
+        "nsr_id": "61587478-ea25-44eb-9f13-7005046ddb08",
+        "nsDescription": "default description",
+        "nsdId": "0f4e658f-62a6-4f73-8623-270e8f0a18bc",
+        "validVimAccounts": [
+            "eb553051-5b6c-4ad6-939b-2ad23bd82e57",
+            "576bbe0a-b95d-4ced-a63e-f387f8e6e2ce",
+            "3d1ffc5d-b36d-4f69-8356-7f59c740ca2f",
+            "db54dcd4-9fc4-441c-8820-17bce0aef2c3",
+        ],
+        "nsName": "ThreeVnfTest2",
+        "wimAccountId": False,
+        "vnf": [
+            {
+                "vimAccountId": "3d1ffc5d-b36d-4f69-8356-7f59c740ca2f",
+                "member-vnf-index": "1",
+            }
+        ],
+        "placementEngine": "PLA",
+        "nsInstanceId": "61587478-ea25-44eb-9f13-7005046ddb08",
+        "lcmOperationType": "instantiate",
+    },
+}
 
 nslcmop_record_w_pinning_and_order_constraints = {
-    'links': {'nsInstance': '/osm/nslcm/v1/ns_instances/7c4c3d94-ebb2-44e8-b236-d876b118434e',
-              'self': '/osm/nslcm/v1/ns_lcm_op_occs/fd7c9e15-38aa-4fc5-913c-417b26859fb0'},
-    'id': 'fd7c9e15-38aa-4fc5-913c-417b26859fb0', 'operationState': 'PROCESSING', 'isAutomaticInvocation': False,
-    'nsInstanceId': '7c4c3d94-ebb2-44e8-b236-d876b118434e', '_id': 'fd7c9e15-38aa-4fc5-913c-417b26859fb0',
-    'isCancelPending': False, 'startTime': 1574772631.6932728, 'statusEnteredTime': 1574772631.6932728,
-    'lcmOperationType': 'instantiate',
-    'operationParams': {'placementEngine': 'PLA',
-                        'placement-constraints': {
-                            'vld-constraints': [{
-                                'id': 'three_vnf_constrained_vld_1',
-                                'link-constraints': {
-                                    'latency': 120,
-                                    'jitter': 20}},
-                                {
-                                    'link_constraints': {
-                                        'latency': 120,
-                                        'jitter': 20},
-                                    'id': 'three_vnf_constrained_nsd_vld_2'}]},
-                        'nsName': 'ThreeVnfTest2',
-                        'nsDescription': 'default description',
-                        'nsr_id': '7c4c3d94-ebb2-44e8-b236-d876b118434e',
-                        'nsdId': '0f4e658f-62a6-4f73-8623-270e8f0a18bc',
-                        'validVimAccounts': ['eb553051-5b6c-4ad6-939b-2ad23bd82e57',
-                                             '576bbe0a-b95d-4ced-a63e-f387f8e6e2ce',
-                                             '3d1ffc5d-b36d-4f69-8356-7f59c740ca2f',
-                                             'db54dcd4-9fc4-441c-8820-17bce0aef2c3'],
-                        'wimAccountId': False,
-                        'vnf': [{'member-vnf-index': '3', 'vimAccountId': '3d1ffc5d-b36d-4f69-8356-7f59c740ca2f'}],
-                        'nsInstanceId': '7c4c3d94-ebb2-44e8-b236-d876b118434e',
-                        'lcmOperationType': 'instantiate',
-                        'vimAccountId': '576bbe0a-b95d-4ced-a63e-f387f8e6e2ce'},
-    '_admin': {'projects_read': ['61e4bbab-9659-4abc-a01d-ba3a307becf9'], 'modified': 1574772631.693885,
-               'projects_write': ['61e4bbab-9659-4abc-a01d-ba3a307becf9'], 'created': 1574772631.693885,
-               'worker': 'e5121e773e8b'}}
-
-list_of_vims = [{"_id": "73cd1a1b-333e-4e29-8db2-00d23bd9b644", "vim_user": "admin", "name": "OpenStack1",
-                 "vim_url": "http://10.234.12.47:5000/v3", "vim_type": "openstack", "vim_tenant_name": "osm_demo",
-                 "vim_password": "O/mHomfXPmCrTvUbYXVoyg==", "schema_version": "1.1",
-                 "_admin": {"modified": 1565597984.3155663,
-                            "deployed": {"RO": "f0c1b516-bcd9-11e9-bb73-02420aff0030",
-                                         "RO-account": "f0d45496-bcd9-11e9-bb73-02420aff0030"},
-                            "projects_write": ["admin"], "operationalState": "ENABLED", "detailed-status": "Done",
-                            "created": 1565597984.3155663, "projects_read": ["admin"]},
-                 "config": {}},
-                {"_id": "684165ea-2cf9-4fbd-ac22-8464ca07d1d8", "vim_user": "admin",
-                 "name": "OpenStack2", "vim_url": "http://10.234.12.44:5000/v3",
-                 "vim_tenant_name": "osm_demo", "vim_password": "Rw7gln9liP4ClMyHd5OFsw==",
-                 "description": "Openstack on NUC", "vim_type": "openstack",
-                 "admin": {"modified": 1566474766.7288046,
-                           "deployed": {"RO": "5bc59656-c4d3-11e9-b1e5-02420aff0006",
-                                        "RO-account": "5bd772e0-c4d3-11e9-b1e5-02420aff0006"},
-                           "projects_write": ["admin"], "operationalState": "ENABLED",
-                           "detailed-status": "Done", "created": 1566474766.7288046,
-                           "projects_read": ["admin"]},
-                 "config": {}, "schema_version": "1.1"},
-                {"_id": "8460b670-31cf-4fae-9f3e-d0dd6c57b61e", "vim_user": "admin", "name": "OpenStack1",
-                 "vim_url": "http://10.234.12.47:5000/v3", "vim_type": "openstack",
-                 "vim_tenant_name": "osm_demo", "vim_password": "NsgJJDlCdKreX30FQFNz7A==",
-                 "description": "Openstack on Dell",
-                 "_admin": {"modified": 1566992449.5942867,
-                            "deployed": {"RO": "aed94f86-c988-11e9-bb38-02420aff0088",
-                                         "RO-account": "aee72fac-c988-11e9-bb38-02420aff0088"},
-                            "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
-                            "operationalState": "ENABLED", "detailed-status": "Done", "created": 1566992449.5942867,
-                            "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"]}, "config": {},
-                 "schema_version": "1.1"},
-                {"_id": "9b8b5268-acb7-4893-b494-a77656b418f2",
-                 "vim_user": "admin", "name": "OpenStack2",
-                 "vim_url": "http://10.234.12.44:5000/v3",
-                 "vim_type": "openstack", "vim_tenant_name": "osm_demo",
-                 "vim_password": "AnAV3xtoiwwdnAfv0KahSw==",
-                 "description": "Openstack on NUC",
-                 "_admin": {"modified": 1566992484.9190753,
-                            "deployed": {"RO": "c3d61158-c988-11e9-bb38-02420aff0088",
-                                         "RO-account": "c3ec973e-c988-11e9-bb38-02420aff0088"},
-                            "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
-                            "operationalState": "ENABLED", "detailed-status": "Done",
-                            "created": 1566992484.9190753,
-                            "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"]},
-                 "config": {}, "schema_version": "1.1"},
-                {"_id": "3645f215-f32d-4355-b5ab-df0a2e2233c3", "vim_user": "admin", "name": "OpenStack3",
-                 "vim_url": "http://10.234.12.46:5000/v3", "vim_tenant_name": "osm_demo",
-                 "vim_password": "XkG2w8e8/DiuohCFNp0+lQ==", "description": "Openstack on NUC",
-                 "vim_type": "openstack",
-                 "_admin": {"modified": 1567421247.7016313,
-                            "deployed": {"RO": "0e80f6a2-cd6f-11e9-bb50-02420aff00b6",
-                                         "RO-account": "0e974524-cd6f-11e9-bb50-02420aff00b6"},
-                            "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
-                            "operationalState": "ENABLED", "detailed-status": "Done",
-                            "created": 1567421247.7016313,
-                            "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"]},
-                 "schema_version": "1.1", "config": {}},
-                {"_id": "53f8f2bb-88b5-4bf9-babf-556698b5261f",
-                 "vim_user": "admin", "name": "OpenStack4",
-                 "vim_url": "http://10.234.12.43:5000/v3",
-                 "vim_tenant_name": "osm_demo",
-                 "vim_password": "GLrgVn8fMVneXMZq1r4yVA==",
-                 "description": "Openstack on NUC",
-                 "vim_type": "openstack",
-                 "_admin": {"modified": 1567421296.1576457,
-                            "deployed": {
-                                "RO": "2b43c756-cd6f-11e9-bb50-02420aff00b6",
-                                "RO-account": "2b535aea-cd6f-11e9-bb50-02420aff00b6"},
-                            "projects_write": [
-                                "0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
-                            "operationalState": "ENABLED",
-                            "detailed-status": "Done",
-                            "created": 1567421296.1576457,
-                            "projects_read": [
-                                "0a5d0c5b-7e08-48a1-a686-642a038bbd70"]},
-                 "schema_version": "1.1", "config": {}}]
+    "links": {
+        "nsInstance": "/osm/nslcm/v1/ns_instances/7c4c3d94-ebb2-44e8-b236-d876b118434e",
+        "self": "/osm/nslcm/v1/ns_lcm_op_occs/fd7c9e15-38aa-4fc5-913c-417b26859fb0",
+    },
+    "id": "fd7c9e15-38aa-4fc5-913c-417b26859fb0",
+    "operationState": "PROCESSING",
+    "isAutomaticInvocation": False,
+    "nsInstanceId": "7c4c3d94-ebb2-44e8-b236-d876b118434e",
+    "_id": "fd7c9e15-38aa-4fc5-913c-417b26859fb0",
+    "isCancelPending": False,
+    "startTime": 1574772631.6932728,
+    "statusEnteredTime": 1574772631.6932728,
+    "lcmOperationType": "instantiate",
+    "operationParams": {
+        "placementEngine": "PLA",
+        "placement-constraints": {
+            "vld-constraints": [
+                {
+                    "id": "three_vnf_constrained_vld_1",
+                    "link-constraints": {"latency": 120, "jitter": 20},
+                },
+                {
+                    "link_constraints": {"latency": 120, "jitter": 20},
+                    "id": "three_vnf_constrained_nsd_vld_2",
+                },
+            ]
+        },
+        "nsName": "ThreeVnfTest2",
+        "nsDescription": "default description",
+        "nsr_id": "7c4c3d94-ebb2-44e8-b236-d876b118434e",
+        "nsdId": "0f4e658f-62a6-4f73-8623-270e8f0a18bc",
+        "validVimAccounts": [
+            "eb553051-5b6c-4ad6-939b-2ad23bd82e57",
+            "576bbe0a-b95d-4ced-a63e-f387f8e6e2ce",
+            "3d1ffc5d-b36d-4f69-8356-7f59c740ca2f",
+            "db54dcd4-9fc4-441c-8820-17bce0aef2c3",
+        ],
+        "wimAccountId": False,
+        "vnf": [
+            {
+                "member-vnf-index": "3",
+                "vimAccountId": "3d1ffc5d-b36d-4f69-8356-7f59c740ca2f",
+            }
+        ],
+        "nsInstanceId": "7c4c3d94-ebb2-44e8-b236-d876b118434e",
+        "lcmOperationType": "instantiate",
+        "vimAccountId": "576bbe0a-b95d-4ced-a63e-f387f8e6e2ce",
+    },
+    "_admin": {
+        "projects_read": ["61e4bbab-9659-4abc-a01d-ba3a307becf9"],
+        "modified": 1574772631.693885,
+        "projects_write": ["61e4bbab-9659-4abc-a01d-ba3a307becf9"],
+        "created": 1574772631.693885,
+        "worker": "e5121e773e8b",
+    },
+}
+
+list_of_vims = [
+    {
+        "_id": "73cd1a1b-333e-4e29-8db2-00d23bd9b644",
+        "vim_user": "admin",
+        "name": "OpenStack1",
+        "vim_url": "http://10.234.12.47:5000/v3",
+        "vim_type": "openstack",
+        "vim_tenant_name": "osm_demo",
+        "vim_password": "O/mHomfXPmCrTvUbYXVoyg==",
+        "schema_version": "1.1",
+        "_admin": {
+            "modified": 1565597984.3155663,
+            "deployed": {
+                "RO": "f0c1b516-bcd9-11e9-bb73-02420aff0030",
+                "RO-account": "f0d45496-bcd9-11e9-bb73-02420aff0030",
+            },
+            "projects_write": ["admin"],
+            "operationalState": "ENABLED",
+            "detailed-status": "Done",
+            "created": 1565597984.3155663,
+            "projects_read": ["admin"],
+        },
+        "config": {},
+    },
+    {
+        "_id": "684165ea-2cf9-4fbd-ac22-8464ca07d1d8",
+        "vim_user": "admin",
+        "name": "OpenStack2",
+        "vim_url": "http://10.234.12.44:5000/v3",
+        "vim_tenant_name": "osm_demo",
+        "vim_password": "Rw7gln9liP4ClMyHd5OFsw==",
+        "description": "Openstack on NUC",
+        "vim_type": "openstack",
+        "admin": {
+            "modified": 1566474766.7288046,
+            "deployed": {
+                "RO": "5bc59656-c4d3-11e9-b1e5-02420aff0006",
+                "RO-account": "5bd772e0-c4d3-11e9-b1e5-02420aff0006",
+            },
+            "projects_write": ["admin"],
+            "operationalState": "ENABLED",
+            "detailed-status": "Done",
+            "created": 1566474766.7288046,
+            "projects_read": ["admin"],
+        },
+        "config": {},
+        "schema_version": "1.1",
+    },
+    {
+        "_id": "8460b670-31cf-4fae-9f3e-d0dd6c57b61e",
+        "vim_user": "admin",
+        "name": "OpenStack1",
+        "vim_url": "http://10.234.12.47:5000/v3",
+        "vim_type": "openstack",
+        "vim_tenant_name": "osm_demo",
+        "vim_password": "NsgJJDlCdKreX30FQFNz7A==",
+        "description": "Openstack on Dell",
+        "_admin": {
+            "modified": 1566992449.5942867,
+            "deployed": {
+                "RO": "aed94f86-c988-11e9-bb38-02420aff0088",
+                "RO-account": "aee72fac-c988-11e9-bb38-02420aff0088",
+            },
+            "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+            "operationalState": "ENABLED",
+            "detailed-status": "Done",
+            "created": 1566992449.5942867,
+            "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+        },
+        "config": {},
+        "schema_version": "1.1",
+    },
+    {
+        "_id": "9b8b5268-acb7-4893-b494-a77656b418f2",
+        "vim_user": "admin",
+        "name": "OpenStack2",
+        "vim_url": "http://10.234.12.44:5000/v3",
+        "vim_type": "openstack",
+        "vim_tenant_name": "osm_demo",
+        "vim_password": "AnAV3xtoiwwdnAfv0KahSw==",
+        "description": "Openstack on NUC",
+        "_admin": {
+            "modified": 1566992484.9190753,
+            "deployed": {
+                "RO": "c3d61158-c988-11e9-bb38-02420aff0088",
+                "RO-account": "c3ec973e-c988-11e9-bb38-02420aff0088",
+            },
+            "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+            "operationalState": "ENABLED",
+            "detailed-status": "Done",
+            "created": 1566992484.9190753,
+            "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+        },
+        "config": {},
+        "schema_version": "1.1",
+    },
+    {
+        "_id": "3645f215-f32d-4355-b5ab-df0a2e2233c3",
+        "vim_user": "admin",
+        "name": "OpenStack3",
+        "vim_url": "http://10.234.12.46:5000/v3",
+        "vim_tenant_name": "osm_demo",
+        "vim_password": "XkG2w8e8/DiuohCFNp0+lQ==",
+        "description": "Openstack on NUC",
+        "vim_type": "openstack",
+        "_admin": {
+            "modified": 1567421247.7016313,
+            "deployed": {
+                "RO": "0e80f6a2-cd6f-11e9-bb50-02420aff00b6",
+                "RO-account": "0e974524-cd6f-11e9-bb50-02420aff00b6",
+            },
+            "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+            "operationalState": "ENABLED",
+            "detailed-status": "Done",
+            "created": 1567421247.7016313,
+            "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+        },
+        "schema_version": "1.1",
+        "config": {},
+    },
+    {
+        "_id": "53f8f2bb-88b5-4bf9-babf-556698b5261f",
+        "vim_user": "admin",
+        "name": "OpenStack4",
+        "vim_url": "http://10.234.12.43:5000/v3",
+        "vim_tenant_name": "osm_demo",
+        "vim_password": "GLrgVn8fMVneXMZq1r4yVA==",
+        "description": "Openstack on NUC",
+        "vim_type": "openstack",
+        "_admin": {
+            "modified": 1567421296.1576457,
+            "deployed": {
+                "RO": "2b43c756-cd6f-11e9-bb50-02420aff00b6",
+                "RO-account": "2b535aea-cd6f-11e9-bb50-02420aff00b6",
+            },
+            "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+            "operationalState": "ENABLED",
+            "detailed-status": "Done",
+            "created": 1567421296.1576457,
+            "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+        },
+        "schema_version": "1.1",
+        "config": {},
+    },
+]
 
 # FIXME this is not correct re mgmt-network setting.
-nsd_from_db = {"_id": "15fc1941-f095-4cd8-af2d-1000bd6d9eaa",
-               "_admin": {"modified": 1567672251.7531693,
-                          "storage": {"pkg-dir": "ns_constrained_nsd", "fs": "local",
-                                      "descriptor": "ns_constrained_nsd/ns_constrained_nsd.yaml",
-                                      "zipfile": "package.tar.gz",
-                                      "folder": "15fc1941-f095-4cd8-af2d-1000bd6d9eaa", "path": "/app/storage/"},
-                          "onboardingState": "ONBOARDED", "usageState": "NOT_IN_USE",
-                          "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"], "operationalState": "ENABLED",
-                          "userDefinedData": {}, "created": 1567672251.7531693,
-                          "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"]},
-               'id': 'three_vnf_constrained_nsd_low',
-               'name': 'three_vnf_constrained_nsd_low',
-               'description': 'Placement constraints NSD',
-               'designer': 'ArctosLabs',
-               'version': '1.0',
-               'vnfd-id': ['cirros_vnfd_v2'],
-               'df': [{
-                   'id': 'default-df',
-                   'vnf-profile': [{
-                       'id': 'one',
-                       'vnfd-id': 'cirros_vnfd_v2',
-                       'virtual-link-connectivity': [{
-                           'virtual-link-profile-id': 'three_vnf_constrained_nsd_low_vld1',
-                           'constituent-cpd-id': [{
-                               'constituent-base-element-id': 'one',
-                               'constituent-cpd-id': 'vnf-cp0-ext'
-                           }]
-                       }]
-                   }, {
-                       'id': 'two',
-                       'vnfd-id': 'cirros_vnfd_v2',
-                       'virtual-link-connectivity': [{
-                           'virtual-link-profile-id': 'three_vnf_constrained_nsd_low_vld1',
-                           'constituent-cpd-id': [{
-                               'constituent-base-element-id': 'two',
-                               'constituent-cpd-id': 'vnf-cp0-ext'
-                           }]
-                       }, {
-                           'virtual-link-profile-id': 'three_vnf_constrained_nsd_low_vld2',
-                           'constituent-cpd-id': [{
-                               'constituent-base-element-id': 'two',
-                               'constituent-cpd-id': 'vnf-cp0-ext'
-                           }]
-                       }]
-                   }, {
-                       'id': 'three',
-                       'vnfd-id': 'cirros_vnfd_v2',
-                       'virtual-link-connectivity': [{
-                           'virtual-link-profile-id': 'three_vnf_constrained_nsd_low_vld2',
-                           'constituent-cpd-id': [{
-                               'constituent-base-element-id': 'three',
-                               'constituent-cpd-id': 'vnf-cp0-ext'
-                           }]
-                       }]
-                   }]
-               }],
-               'virtual-link-desc': [{
-                   'id': 'three_vnf_constrained_nsd_low_vld1',
-                   'mgmt-network': True,
-                   'vim-network-name': 'external'
-               }, {
-                   'id': 'three_vnf_constrained_nsd_low_vld2',
-                   'mgmt-network': True,
-                   'vim-network-name': 'lanretxe'
-               }],
-               }
+nsd_from_db = {
+    "_id": "15fc1941-f095-4cd8-af2d-1000bd6d9eaa",
+    "_admin": {
+        "modified": 1567672251.7531693,
+        "storage": {
+            "pkg-dir": "ns_constrained_nsd",
+            "fs": "local",
+            "descriptor": "ns_constrained_nsd/ns_constrained_nsd.yaml",
+            "zipfile": "package.tar.gz",
+            "folder": "15fc1941-f095-4cd8-af2d-1000bd6d9eaa",
+            "path": "/app/storage/",
+        },
+        "onboardingState": "ONBOARDED",
+        "usageState": "NOT_IN_USE",
+        "projects_write": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+        "operationalState": "ENABLED",
+        "userDefinedData": {},
+        "created": 1567672251.7531693,
+        "projects_read": ["0a5d0c5b-7e08-48a1-a686-642a038bbd70"],
+    },
+    "id": "three_vnf_constrained_nsd_low",
+    "name": "three_vnf_constrained_nsd_low",
+    "description": "Placement constraints NSD",
+    "designer": "ArctosLabs",
+    "version": "1.0",
+    "vnfd-id": ["cirros_vnfd_v2"],
+    "df": [
+        {
+            "id": "default-df",
+            "vnf-profile": [
+                {
+                    "id": "one",
+                    "vnfd-id": "cirros_vnfd_v2",
+                    "virtual-link-connectivity": [
+                        {
+                            "virtual-link-profile-id": "three_vnf_constrained_nsd_low_vld1",
+                            "constituent-cpd-id": [
+                                {
+                                    "constituent-base-element-id": "one",
+                                    "constituent-cpd-id": "vnf-cp0-ext",
+                                }
+                            ],
+                        }
+                    ],
+                },
+                {
+                    "id": "two",
+                    "vnfd-id": "cirros_vnfd_v2",
+                    "virtual-link-connectivity": [
+                        {
+                            "virtual-link-profile-id": "three_vnf_constrained_nsd_low_vld1",
+                            "constituent-cpd-id": [
+                                {
+                                    "constituent-base-element-id": "two",
+                                    "constituent-cpd-id": "vnf-cp0-ext",
+                                }
+                            ],
+                        },
+                        {
+                            "virtual-link-profile-id": "three_vnf_constrained_nsd_low_vld2",
+                            "constituent-cpd-id": [
+                                {
+                                    "constituent-base-element-id": "two",
+                                    "constituent-cpd-id": "vnf-cp0-ext",
+                                }
+                            ],
+                        },
+                    ],
+                },
+                {
+                    "id": "three",
+                    "vnfd-id": "cirros_vnfd_v2",
+                    "virtual-link-connectivity": [
+                        {
+                            "virtual-link-profile-id": "three_vnf_constrained_nsd_low_vld2",
+                            "constituent-cpd-id": [
+                                {
+                                    "constituent-base-element-id": "three",
+                                    "constituent-cpd-id": "vnf-cp0-ext",
+                                }
+                            ],
+                        }
+                    ],
+                },
+            ],
+        }
+    ],
+    "virtual-link-desc": [
+        {
+            "id": "three_vnf_constrained_nsd_low_vld1",
+            "mgmt-network": True,
+            "vim-network-name": "external",
+        },
+        {
+            "id": "three_vnf_constrained_nsd_low_vld2",
+            "mgmt-network": True,
+            "vim-network-name": "lanretxe",
+        },
+    ],
+}
 
 
 ######################################################
@@ -284,20 +444,23 @@ def _async_mock(*args, **kwargs):
 
 ######################################################
 
-class TestServer(TestCase):
 
+class TestServer(TestCase):
     def _produce_ut_vim_accounts_info(self, list_of_vims):
         """
         FIXME temporary, we will need more control over vim_urls and _id for test purpose - make a generator
         :return: vim_url and _id as dict, i.e. extract these from vim_accounts data
         """
-        return {_['name']: _['_id'] for _ in list_of_vims}
+        return {_["name"]: _["_id"] for _ in list_of_vims}
 
     def _produce_ut_vnf_price_list(self):
         price_list_file = "vnf_price_list.yaml"
         with open(str(Path(price_list_file))) as pl_fd:
             price_list_data = yaml.safe_load_all(pl_fd)
-            return {i['vnfd']: {i1['vim_name']: i1['price'] for i1 in i['prices']} for i in next(price_list_data)}
+            return {
+                i["vnfd"]: {i1["vim_name"]: i1["price"] for i1 in i["prices"]}
+                for i in next(price_list_data)
+            }
 
     def _populate_pil_info(self, file):
         """
@@ -308,8 +471,12 @@ class TestServer(TestCase):
             test_data = yaml.safe_load_all(pp_fd)
             return next(test_data)
 
-    @mock.patch.object(Config, '_read_config_file')
-    @mock.patch.object(Config, 'get', side_effect=['doesnotmatter', 'memory', 'memory', 'local', 'doesnotmatter'])
+    @mock.patch.object(Config, "_read_config_file")
+    @mock.patch.object(
+        Config,
+        "get",
+        side_effect=["doesnotmatter", "memory", "memory", "local", "doesnotmatter"],
+    )
     def serverSetup(self, mock_get, mock__read_config_file):
         """
         Helper that returns a Server object
@@ -321,10 +488,14 @@ class TestServer(TestCase):
     def _adjust_path(self, file):
         """In case we are not running from test directory,
         then assume we are in top level directory (e.g. running from tox) and adjust file path accordingly"""
-        path_component = '/osm_pla/test/'
+        path_component = "/osm_pla/test/"
         real_path = os.path.realpath(file)
         if path_component not in real_path:
-            return os.path.dirname(real_path) + path_component + os.path.basename(real_path)
+            return (
+                os.path.dirname(real_path)
+                + path_component
+                + os.path.basename(real_path)
+            )
         else:
             return real_path
 
@@ -332,41 +503,57 @@ class TestServer(TestCase):
         server = self.serverSetup()
         server.db = Mock()
         _ = server._get_nslcmop(nslcmop_record_wo_pinning["id"])
-        server.db.get_one.assert_called_with("nslcmops", {'_id': nslcmop_record_wo_pinning["id"]})
+        server.db.get_one.assert_called_with(
+            "nslcmops", {"_id": nslcmop_record_wo_pinning["id"]}
+        )
 
     def test__get_nsd(self):  # OK
         server = self.serverSetup()
         server.db = Mock()
-        _ = server._get_nsd(nslcmop_record_wo_pinning['operationParams']['nsdId'])
-        server.db.get_one.assert_called_with("nsds", {'_id': nslcmop_record_wo_pinning['operationParams']['nsdId']})
+        _ = server._get_nsd(nslcmop_record_wo_pinning["operationParams"]["nsdId"])
+        server.db.get_one.assert_called_with(
+            "nsds", {"_id": nslcmop_record_wo_pinning["operationParams"]["nsdId"]}
+        )
 
     def test__create_vnf_id_maps(self):
         server = self.serverSetup()
         server.db = Mock()
-        expected_mvi2mzn = {'one': 'VNF0', 'two': 'VNF1', 'three': 'VNF2'}
-        expected_mzn2mvi = {'VNF0': 'one', 'VNF1': 'two', 'VNF2': 'three'}
+        expected_mvi2mzn = {"one": "VNF0", "two": "VNF1", "three": "VNF2"}
+        expected_mzn2mvi = {"VNF0": "one", "VNF1": "two", "VNF2": "three"}
 
         nsd_for_test = copy.deepcopy(nsd_from_db)
         mvi2mzn, mzn2mvi = server._create_vnf_id_maps(nsd_for_test)
 
-        self.assertDictEqual(expected_mvi2mzn, mvi2mzn, 'Faulty mzn2member-vnf-index mapping')
-        self.assertDictEqual(expected_mzn2mvi, mzn2mvi, 'Faulty mzn2member-vnf-index mapping')
+        self.assertDictEqual(
+            expected_mvi2mzn, mvi2mzn, "Faulty mzn2member-vnf-index mapping"
+        )
+        self.assertDictEqual(
+            expected_mzn2mvi, mzn2mvi, "Faulty mzn2member-vnf-index mapping"
+        )
 
     def test__get_vim_accounts(self):  # OK
         server = self.serverSetup()
         server.db = Mock()
-        _ = server._get_vim_accounts(nslcmop_record_wo_pinning['operationParams']['validVimAccounts'])
-        server.db.get_list.assert_called_with('vim_accounts',
-                                              {'_id': nslcmop_record_wo_pinning['operationParams']['validVimAccounts']})
+        _ = server._get_vim_accounts(
+            nslcmop_record_wo_pinning["operationParams"]["validVimAccounts"]
+        )
+        server.db.get_list.assert_called_with(
+            "vim_accounts",
+            {"_id": nslcmop_record_wo_pinning["operationParams"]["validVimAccounts"]},
+        )
 
     def test__get_vnf_price_list(self):
         server = self.serverSetup()
-        pl1 = server._get_vnf_price_list(Path(self._adjust_path('./vnf_price_list.yaml')))
+        pl1 = server._get_vnf_price_list(
+            Path(self._adjust_path("./vnf_price_list.yaml"))
+        )
         self.assertIs(type(pl1), dict, "price list not a dictionary")
         for k, v in pl1.items():
             self.assertIs(type(v), dict, "price list values not a dict")
 
-        pl2 = server._get_vnf_price_list(Path(self._adjust_path('./vnf_price_list_keys.yaml')), 'hackfest_project_a')
+        pl2 = server._get_vnf_price_list(
+            Path(self._adjust_path("./vnf_price_list_keys.yaml")), "hackfest_project_a"
+        )
         self.assertIs(type(pl2), dict, "price list not a dictionary")
         for k, v in pl2.items():
             self.assertIs(type(v), dict, "price list values not a dict")
@@ -374,46 +561,73 @@ class TestServer(TestCase):
 
     def test__get_pil_info(self):
         server = self.serverSetup()
-        ppi = server._get_pil_info(Path(self._adjust_path('./pil_price_list.yaml')))
+        ppi = server._get_pil_info(Path(self._adjust_path("./pil_price_list.yaml")))
         self.assertIs(type(ppi), dict, "pil is not a dict")
-        self.assertIn('pil', ppi.keys(), "pil has no pil key")
-        self.assertIs(type(ppi['pil']), list, "pil does not contain a list")
+        self.assertIn("pil", ppi.keys(), "pil has no pil key")
+        self.assertIs(type(ppi["pil"]), list, "pil does not contain a list")
         # check for expected keys
-        expected_keys = {'pil_description', 'pil_price', 'pil_latency', 'pil_jitter', 'pil_endpoints'}
-        self.assertEqual(expected_keys, ppi['pil'][0].keys(), 'expected keys not found')
+        expected_keys = {
+            "pil_description",
+            "pil_price",
+            "pil_latency",
+            "pil_jitter",
+            "pil_endpoints",
+        }
+        self.assertEqual(expected_keys, ppi["pil"][0].keys(), "expected keys not found")
 
     def test_handle_kafka_command(self):  # OK
         server = self.serverSetup()
         server.loop.create_task = Mock()
-        server.handle_kafka_command('pli', 'get_placement', {})
+        server.handle_kafka_command("pli", "get_placement", {})
         server.loop.create_task.assert_not_called()
         server.loop.create_task.reset_mock()
-        server.handle_kafka_command('pla', 'get_placement', {'nslcmopId': nslcmop_record_wo_pinning["id"]})
-        self.assertTrue(server.loop.create_task.called, 'create_task not called')
+        server.handle_kafka_command(
+            "pla", "get_placement", {"nslcmopId": nslcmop_record_wo_pinning["id"]}
+        )
+        self.assertTrue(server.loop.create_task.called, "create_task not called")
         args, kwargs = server.loop.create_task.call_args
-        self.assertIn('Server.get_placement', str(args[0]), 'get_placement not called')
-
-    @mock.patch.object(NsPlacementDataFactory, '__init__', lambda x0, x1, x2, x3, x4, x5, x6: None)
-    @mock.patch.object(MznPlacementConductor, 'do_placement_computation')
-    @mock.patch.object(NsPlacementDataFactory, 'create_ns_placement_data')
-    @mock.patch.object(Server, '_get_vim_accounts')
-    @mock.patch.object(Server, '_get_nsd')
-    @mock.patch.object(Server, '_get_nslcmop')
-    @mock.patch.object(Server, '_get_vnf_price_list')
-    @mock.patch.object(Server, '_get_pil_info')
-    @mock.patch.object(Server, '_get_projects')
-    def test_get_placement(self, mock_get_projects, mock_get_pil_info, mock_get_vnf_price_list, mock__get_nslcmop,
-                           mock__get_nsd,
-                           mock__get_vim_accounts,
-                           mock_create_ns_placement_data,
-                           mock_do_placement_computation):
+        self.assertIn("Server.get_placement", str(args[0]), "get_placement not called")
+
+    @mock.patch.object(
+        NsPlacementDataFactory, "__init__", lambda x0, x1, x2, x3, x4, x5, x6: None
+    )
+    @mock.patch.object(MznPlacementConductor, "do_placement_computation")
+    @mock.patch.object(NsPlacementDataFactory, "create_ns_placement_data")
+    @mock.patch.object(Server, "_get_vim_accounts")
+    @mock.patch.object(Server, "_get_nsd")
+    @mock.patch.object(Server, "_get_nslcmop")
+    @mock.patch.object(Server, "_get_vnf_price_list")
+    @mock.patch.object(Server, "_get_pil_info")
+    @mock.patch.object(Server, "_get_projects")
+    def test_get_placement(
+        self,
+        mock_get_projects,
+        mock_get_pil_info,
+        mock_get_vnf_price_list,
+        mock__get_nslcmop,
+        mock__get_nsd,
+        mock__get_vim_accounts,
+        mock_create_ns_placement_data,
+        mock_do_placement_computation,
+    ):
         """
         run _get_placement and check that things get called as expected
         :return:
         """
-        placement_ret_val = [{'vimAccountId': 'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': 'VNF0'},
-                             {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': 'VNF1'},
-                             {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': 'VNF2'}]
+        placement_ret_val = [
+            {
+                "vimAccountId": "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "VNF0",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "VNF1",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "VNF2",
+            },
+        ]
         server = self.serverSetup()
 
         server.msgBus.aiowrite = _async_mock()
@@ -423,67 +637,119 @@ class TestServer(TestCase):
 
         # FIXME need update to match nslcmop, not for test but for consistency
         mock_do_placement_computation.return_value = placement_ret_val
-        _run(server.get_placement(nslcmop_record_wo_pinning['id']))
-
-        self.assertTrue(mock_get_projects.called, '_get_projects not called as expected')
-        self.assertTrue(mock_get_vnf_price_list.called, '_get_vnf_price_list not called as expected')
-        self.assertTrue(mock_get_pil_info.called, '_get_pil_info not called as expected')
-        self.assertTrue(mock__get_nslcmop.called, '_get_nslcmop not called as expected')
+        _run(server.get_placement(nslcmop_record_wo_pinning["id"]))
+
+        self.assertTrue(
+            mock_get_projects.called, "_get_projects not called as expected"
+        )
+        self.assertTrue(
+            mock_get_vnf_price_list.called, "_get_vnf_price_list not called as expected"
+        )
+        self.assertTrue(
+            mock_get_pil_info.called, "_get_pil_info not called as expected"
+        )
+        self.assertTrue(mock__get_nslcmop.called, "_get_nslcmop not called as expected")
         # mock_get_nsd.assert_called_once() assert_called_once() for python > 3.5
-        self.assertTrue(mock__get_nsd.called, 'get_nsd not called as expected')
+        self.assertTrue(mock__get_nsd.called, "get_nsd not called as expected")
         # mock_get_enabled_vims.assert_called_once() assert_called_once() for python > 3.5
-        self.assertTrue(mock__get_vim_accounts.called, 'get_vim_accounts not called as expected')
+        self.assertTrue(
+            mock__get_vim_accounts.called, "get_vim_accounts not called as expected"
+        )
         # mock_create_ns_placement_data.assert_called_once() assert_called_once() for python > 3.5
-        self.assertTrue(mock_create_ns_placement_data.called, 'create_ns_placement_data not called as expected')
+        self.assertTrue(
+            mock_create_ns_placement_data.called,
+            "create_ns_placement_data not called as expected",
+        )
         # mock_do_placement_computation.assert_called_once()  assert_called_once() for python > 3.5
-        self.assertTrue(mock_do_placement_computation.called, 'do_placement_computation not called as expected')
+        self.assertTrue(
+            mock_do_placement_computation.called,
+            "do_placement_computation not called as expected",
+        )
         self.assertTrue(server.msgBus.aiowrite.mock.called)
 
         args, kwargs = server.msgBus.aiowrite.mock.call_args
-        self.assertTrue(len(args) == 3, 'invalid format')
-        self.assertEqual('pla', args[0], 'topic invalid')
-        self.assertEqual('placement', args[1], 'message invalid')
+        self.assertTrue(len(args) == 3, "invalid format")
+        self.assertEqual("pla", args[0], "topic invalid")
+        self.assertEqual("placement", args[1], "message invalid")
         # extract placement result and check content
         rsp_payload = args[2]
 
-        expected_rsp_keys = {'placement'}
-        self.assertEqual(expected_rsp_keys, set(rsp_payload.keys()), "placement response missing keys")
-        self.assertIs(type(rsp_payload['placement']), dict, 'placement not a dict')
-
-        expected_placement_keys = {'vnf', 'nslcmopId'}
-        self.assertEqual(expected_placement_keys, set(rsp_payload['placement']), "placement keys invalid")
-
-        vim_account_candidates = [e['vimAccountId'] for e in placement_ret_val]
-
-        self.assertEqual(nslcmop_record_wo_pinning['id'], rsp_payload['placement']['nslcmopId'], "nslcmopId invalid")
-
-        self.assertIs(type(rsp_payload['placement']['vnf']), list, 'vnf not a list')
-        expected_vnf_keys = {'vimAccountId', 'member-vnf-index'}
-        self.assertEqual(expected_vnf_keys, set(rsp_payload['placement']['vnf'][0]), "placement['vnf'] missing keys")
-        self.assertIn(rsp_payload['placement']['vnf'][0]['vimAccountId'], vim_account_candidates,
-                      "vimAccountId invalid")
-
-    @mock.patch.object(NsPlacementDataFactory, '__init__', lambda x0, x1, x2, x3, x4, x5, x6: None)
-    @mock.patch.object(MznPlacementConductor, 'do_placement_computation')
-    @mock.patch.object(NsPlacementDataFactory, 'create_ns_placement_data')
-    @mock.patch.object(Server, '_get_vim_accounts')
-    @mock.patch.object(Server, '_get_nsd')
-    @mock.patch.object(Server, '_get_nslcmop')
-    @mock.patch.object(Server, '_get_vnf_price_list')
-    @mock.patch.object(Server, '_get_pil_info')
-    @mock.patch.object(Server, '_get_projects')
-    def test_get_placement_with_pinning(self, mock_get_projects, mock_get_pil_info, mock_get_vnf_price_list,
-                                        mock__get_nslcmop,
-                                        mock__get_nsd, mock__get_vim_accounts,
-                                        mock_create_ns_placement_data,
-                                        mock_do_placement_computation):
+        expected_rsp_keys = {"placement"}
+        self.assertEqual(
+            expected_rsp_keys,
+            set(rsp_payload.keys()),
+            "placement response missing keys",
+        )
+        self.assertIs(type(rsp_payload["placement"]), dict, "placement not a dict")
+
+        expected_placement_keys = {"vnf", "nslcmopId"}
+        self.assertEqual(
+            expected_placement_keys,
+            set(rsp_payload["placement"]),
+            "placement keys invalid",
+        )
+
+        vim_account_candidates = [e["vimAccountId"] for e in placement_ret_val]
+
+        self.assertEqual(
+            nslcmop_record_wo_pinning["id"],
+            rsp_payload["placement"]["nslcmopId"],
+            "nslcmopId invalid",
+        )
+
+        self.assertIs(type(rsp_payload["placement"]["vnf"]), list, "vnf not a list")
+        expected_vnf_keys = {"vimAccountId", "member-vnf-index"}
+        self.assertEqual(
+            expected_vnf_keys,
+            set(rsp_payload["placement"]["vnf"][0]),
+            "placement['vnf'] missing keys",
+        )
+        self.assertIn(
+            rsp_payload["placement"]["vnf"][0]["vimAccountId"],
+            vim_account_candidates,
+            "vimAccountId invalid",
+        )
+
+    @mock.patch.object(
+        NsPlacementDataFactory, "__init__", lambda x0, x1, x2, x3, x4, x5, x6: None
+    )
+    @mock.patch.object(MznPlacementConductor, "do_placement_computation")
+    @mock.patch.object(NsPlacementDataFactory, "create_ns_placement_data")
+    @mock.patch.object(Server, "_get_vim_accounts")
+    @mock.patch.object(Server, "_get_nsd")
+    @mock.patch.object(Server, "_get_nslcmop")
+    @mock.patch.object(Server, "_get_vnf_price_list")
+    @mock.patch.object(Server, "_get_pil_info")
+    @mock.patch.object(Server, "_get_projects")
+    def test_get_placement_with_pinning(
+        self,
+        mock_get_projects,
+        mock_get_pil_info,
+        mock_get_vnf_price_list,
+        mock__get_nslcmop,
+        mock__get_nsd,
+        mock__get_vim_accounts,
+        mock_create_ns_placement_data,
+        mock_do_placement_computation,
+    ):
         """
         run _get_placement and check that things get called as expected
         :return:
         """
-        placement_ret_val = [{'vimAccountId': 'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': 'VNF0'},
-                             {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': 'VNF1'},
-                             {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': 'VNF2'}]
+        placement_ret_val = [
+            {
+                "vimAccountId": "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "VNF0",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "VNF1",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "VNF2",
+            },
+        ]
         server = self.serverSetup()
 
         server.msgBus.aiowrite = _async_mock()
@@ -493,58 +759,96 @@ class TestServer(TestCase):
 
         # FIXME need update to match nslcmop, not for test but for consistency
         mock_do_placement_computation.return_value = placement_ret_val
-        _run(server.get_placement(nslcmop_record_w_pinning['id']))
-
-        self.assertTrue((mock_get_projects.called, '_get_projects not called as expected'))
-        self.assertTrue(mock_get_vnf_price_list.called, '_get_vnf_price_list not called as expected')
-        self.assertTrue(mock_get_pil_info.called, '_get_pil_info not called as expected')
-        self.assertTrue(mock__get_nslcmop.called, '_get_nslcmop not called as expected')
+        _run(server.get_placement(nslcmop_record_w_pinning["id"]))
+
+        self.assertTrue(
+            (mock_get_projects.called, "_get_projects not called as expected")
+        )
+        self.assertTrue(
+            mock_get_vnf_price_list.called, "_get_vnf_price_list not called as expected"
+        )
+        self.assertTrue(
+            mock_get_pil_info.called, "_get_pil_info not called as expected"
+        )
+        self.assertTrue(mock__get_nslcmop.called, "_get_nslcmop not called as expected")
         # mock_get_nsd.assert_called_once() assert_called_once() for python > 3.5
-        self.assertTrue(mock__get_nsd.called, 'get_nsd not called as expected')
+        self.assertTrue(mock__get_nsd.called, "get_nsd not called as expected")
         # mock_get_enabled_vims.assert_called_once() assert_called_once() for python > 3.5
-        self.assertTrue(mock__get_vim_accounts.called, 'get_vim_accounts not called as expected')
+        self.assertTrue(
+            mock__get_vim_accounts.called, "get_vim_accounts not called as expected"
+        )
         # mock_create_ns_placement_data.assert_called_once() assert_called_once() for python > 3.5
-        self.assertTrue(mock_create_ns_placement_data.called, 'create_ns_placement_data not called as expected')
+        self.assertTrue(
+            mock_create_ns_placement_data.called,
+            "create_ns_placement_data not called as expected",
+        )
         # mock_do_placement_computation.assert_called_once()  assert_called_once() for python > 3.5
-        self.assertTrue(mock_do_placement_computation.called, 'do_placement_computation not called as expected')
+        self.assertTrue(
+            mock_do_placement_computation.called,
+            "do_placement_computation not called as expected",
+        )
         self.assertTrue(server.msgBus.aiowrite.mock.called)
 
         args, kwargs = server.msgBus.aiowrite.mock.call_args
-        self.assertTrue(len(args) == 3, 'invalid format')
-        self.assertEqual('pla', args[0], 'topic invalid')
-        self.assertEqual('placement', args[1], 'message invalid')
+        self.assertTrue(len(args) == 3, "invalid format")
+        self.assertEqual("pla", args[0], "topic invalid")
+        self.assertEqual("placement", args[1], "message invalid")
         # extract placement result and check content
         rsp_payload = args[2]
 
-        expected_rsp_keys = {'placement'}
-        self.assertEqual(expected_rsp_keys, set(rsp_payload.keys()), "placement response missing keys")
-        self.assertIs(type(rsp_payload['placement']), dict, 'placement not a dict')
-
-        expected_placement_keys = {'vnf', 'nslcmopId'}
-        self.assertEqual(expected_placement_keys, set(rsp_payload['placement']), "placement keys invalid")
-
-        vim_account_candidates = [e['vimAccountId'] for e in placement_ret_val]
-
-        self.assertEqual(nslcmop_record_w_pinning['id'], rsp_payload['placement']['nslcmopId'], "nslcmopId invalid")
-
-        self.assertIs(type(rsp_payload['placement']['vnf']), list, 'vnf not a list')
-        expected_vnf_keys = {'vimAccountId', 'member-vnf-index'}
-        self.assertEqual(expected_vnf_keys, set(rsp_payload['placement']['vnf'][0]), "placement['vnf'] missing keys")
-        self.assertIn(rsp_payload['placement']['vnf'][0]['vimAccountId'], vim_account_candidates,
-                      "vimAccountId invalid")
+        expected_rsp_keys = {"placement"}
+        self.assertEqual(
+            expected_rsp_keys,
+            set(rsp_payload.keys()),
+            "placement response missing keys",
+        )
+        self.assertIs(type(rsp_payload["placement"]), dict, "placement not a dict")
+
+        expected_placement_keys = {"vnf", "nslcmopId"}
+        self.assertEqual(
+            expected_placement_keys,
+            set(rsp_payload["placement"]),
+            "placement keys invalid",
+        )
+
+        vim_account_candidates = [e["vimAccountId"] for e in placement_ret_val]
+
+        self.assertEqual(
+            nslcmop_record_w_pinning["id"],
+            rsp_payload["placement"]["nslcmopId"],
+            "nslcmopId invalid",
+        )
+
+        self.assertIs(type(rsp_payload["placement"]["vnf"]), list, "vnf not a list")
+        expected_vnf_keys = {"vimAccountId", "member-vnf-index"}
+        self.assertEqual(
+            expected_vnf_keys,
+            set(rsp_payload["placement"]["vnf"][0]),
+            "placement['vnf'] missing keys",
+        )
+        self.assertIn(
+            rsp_payload["placement"]["vnf"][0]["vimAccountId"],
+            vim_account_candidates,
+            "vimAccountId invalid",
+        )
 
     # Note: does not mock reading of price list and pil_info
-    @mock.patch.object(NsPlacementDataFactory, '__init__', lambda x0, x1, x2, x3, x4, x5: None)
-    @mock.patch.object(MznPlacementConductor, 'do_placement_computation')
-    @mock.patch.object(NsPlacementDataFactory, 'create_ns_placement_data')
-    @mock.patch.object(Server, '_get_vim_accounts')
-    @mock.patch.object(Server, '_get_nsd')
-    @mock.patch.object(Server, '_get_nslcmop')
-    def test_get_placement_w_exception(self, mock__get_nslcmop,
-                                       mock__get_nsd,
-                                       mock__get_vim_accounts,
-                                       mock_create_ns_placement_data,
-                                       mock_do_placement_computation):
+    @mock.patch.object(
+        NsPlacementDataFactory, "__init__", lambda x0, x1, x2, x3, x4, x5: None
+    )
+    @mock.patch.object(MznPlacementConductor, "do_placement_computation")
+    @mock.patch.object(NsPlacementDataFactory, "create_ns_placement_data")
+    @mock.patch.object(Server, "_get_vim_accounts")
+    @mock.patch.object(Server, "_get_nsd")
+    @mock.patch.object(Server, "_get_nslcmop")
+    def test_get_placement_w_exception(
+        self,
+        mock__get_nslcmop,
+        mock__get_nsd,
+        mock__get_vim_accounts,
+        mock_create_ns_placement_data,
+        mock_do_placement_computation,
+    ):
         """
         check that raised exceptions are handled and response provided accordingly
         """
@@ -553,19 +857,35 @@ class TestServer(TestCase):
         server.msgBus.aiowrite = _async_mock()
         nsd_for_test = copy.deepcopy(nsd_from_db)
         mock__get_nsd.return_value = nsd_for_test
-        mock__get_nsd.side_effect = RuntimeError('kaboom!')
+        mock__get_nsd.side_effect = RuntimeError("kaboom!")
         mock__get_vim_accounts.return_value = list_of_vims
-        mock_do_placement_computation.return_value = \
-            [{'vimAccountId': 'bbbbbbbb-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '1'},
-             {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '2'},
-             {'vimAccountId': 'aaaaaaaa-38f5-438d-b8ee-3f93b3531f87', 'member-vnf-index': '3'}]
-
-        _run(server.get_placement(nslcmop_record_w_pinning['id']))
+        mock_do_placement_computation.return_value = [
+            {
+                "vimAccountId": "bbbbbbbb-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "1",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "2",
+            },
+            {
+                "vimAccountId": "aaaaaaaa-38f5-438d-b8ee-3f93b3531f87",
+                "member-vnf-index": "3",
+            },
+        ]
+
+        _run(server.get_placement(nslcmop_record_w_pinning["id"]))
         self.assertTrue(server.msgBus.aiowrite.mock.called)
         args, kwargs = server.msgBus.aiowrite.mock.call_args
         rsp_payload = args[2]
-        expected_keys = {'placement'}
-        self.assertEqual(expected_keys, set(rsp_payload.keys()), "placement response missing keys")
-        self.assertIs(type(rsp_payload['placement']['vnf']), list, 'vnf not a list')
-        self.assertEqual([], rsp_payload['placement']['vnf'], 'vnf list not empty')
-        self.assertEqual(nslcmop_record_w_pinning['id'], rsp_payload['placement']['nslcmopId'], "nslcmopId invalid")
+        expected_keys = {"placement"}
+        self.assertEqual(
+            expected_keys, set(rsp_payload.keys()), "placement response missing keys"
+        )
+        self.assertIs(type(rsp_payload["placement"]["vnf"]), list, "vnf not a list")
+        self.assertEqual([], rsp_payload["placement"]["vnf"], "vnf list not empty")
+        self.assertEqual(
+            nslcmop_record_w_pinning["id"],
+            rsp_payload["placement"]["nslcmopId"],
+            "nslcmopId invalid",
+        )
diff --git a/tox.ini b/tox.ini
index 4069746..9f416bc 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -27,13 +27,14 @@ basepython = python3.8
 setenv = VIRTUAL_ENV={envdir}
          PYTHONDONTWRITEBYTECODE = 1
 deps =  -r{toxinidir}/requirements.txt
+parallel_show_output = true
 
 #######################################################################################
 [testenv:black]
 deps = black
 skip_install = true
 commands =
-        black --check --diff osm_pla/
+        black --check --diff osm_pla/
 
 
 #######################################################################################