Fix Bug 2229 Set fixed IP address for VDU through VNFD and the instantiation params
[osm/NBI.git] / osm_nbi / tests / run_test.py
index 079b129..b7768ba 100755 (executable)
@@ -371,7 +371,7 @@ class TestRest:
 
             location = r.headers.get("Location")
             if location:
-                _id = location[location.rfind("/") + 1:]
+                _id = location[location.rfind("/") + 1 :]
                 if _id:
                     self.last_id = str(_id)
             if not pooling:
@@ -481,7 +481,8 @@ class TestRest:
                 )
             vim_data = (
                 "{{schema_version: '1.0', name: '{}', vim_type: {}, vim_url: '{}',"
-                "vim_tenant_name: '{}', " "vim_user: {}, vim_password: {}"
+                "vim_tenant_name: '{}', "
+                "vim_user: {}, vim_password: {}"
             ).format(
                 vim_name,
                 os.environ.get("OSMNBITEST_VIM_TYPE", "openstack"),
@@ -2002,7 +2003,6 @@ class TestFakeVim:
         ]
 
     def run(self, engine, test_osm, manual_check, test_params=None):
-
         vim_bad = self.vim.copy()
         vim_bad.pop("name")
 
@@ -2621,7 +2621,6 @@ class TestDeploy:
         keys=None,
         timeout=0,
     ):
-
         r = engine.test(
             "GET VNFR IDs",
             "GET",
@@ -2782,7 +2781,7 @@ class TestDeploy:
             ns_data.update(self.ns_params)
         if test_params and test_params.get("ns-config"):
             if isinstance(test_params["ns-config"], str):
-                ns_data.update(yaml.load(test_params["ns-config"]), Loader=yaml.Loader)
+                ns_data.update(yaml.safe_load(test_params["ns-config"]))
             else:
                 ns_data.update(test_params["ns-config"])
         self.instantiate(engine, ns_data)
@@ -3024,9 +3023,7 @@ class TestDeployIpMac(TestDeploy):
             "vnfd_2vdu_set_ip_mac.yaml",
         )
         self.nsd_filename = "scenario_2vdu_set_ip_mac.yaml"
-        self.descriptor_url = (
-            "https://osm.etsi.org/gitweb/?p=osm/RO.git;a=blob_plain;f=test/RO_tests/v3_2vdu_set_ip_mac/"
-        )
+        self.descriptor_url = "https://osm.etsi.org/gitweb/?p=osm/RO.git;a=blob_plain;f=test/RO_tests/v3_2vdu_set_ip_mac/"
         self.commands = {
             "1": [
                 "ls -lrt",
@@ -3350,7 +3347,7 @@ class TestDeployHackfest3Charmed3(TestDeployHackfest3Charmed):
             "2": ["ls -lrt /home/ubuntu/first-touch-2"],
         }
         self.descriptor_edit = {
-            "vnfd0": yaml.load(
+            "vnfd0": yaml.safe_load(
                 """
                 scaling-group-descriptor:
                     -   name: "scale_dataVM"
@@ -3400,7 +3397,6 @@ class TestDeployHackfest3Charmed3(TestDeployHackfest3Charmed):
                                 "$[0]":
                                     default-value: "<touch_filename2>"
                 """,
-                Loader=yaml.Loader,
             )
         }
         self.ns_params = {
@@ -3813,7 +3809,7 @@ class TestDeployHnfd(TestDeployHackfest3Charmed):
         }
         if test_params and test_params.get("ns-config"):
             if isinstance(test_params["ns-config"], str):
-                ns_data.update(yaml.load(test_params["ns-config"]), Loader=yaml.Loader)
+                ns_data.update(yaml.safe_load(test_params["ns-config"]))
             else:
                 ns_data.update(test_params["ns-config"])
 
@@ -5046,7 +5042,6 @@ class TestNbiQuotas:
         test_user_id = engine.last_id if res else None
 
         if test_project_id and test_user_id:
-
             # Get user access
             engine.token = None
             engine.user = test_username
@@ -5114,7 +5109,6 @@ class TestNbiQuotas:
             test_vim_ids += [engine.last_id if res else None]
 
             if test_vim_ids[0]:
-
                 # Download descriptor files (if required)
                 test_dir = "/tmp/" + test_username + "/"
                 test_url = "https://osm-download.etsi.org/ftp/osm-6.0-six/7th-hackfest/packages/"
@@ -5141,7 +5135,6 @@ class TestNbiQuotas:
                                 file.write(res.content)
 
                 if all([os.path.exists(test_dir + p) for p in desc_filenames]):
-
                     # Test VNFD Quotas
                     res = engine.test(
                         "Create test VNFD #1",
@@ -5207,7 +5200,6 @@ class TestNbiQuotas:
                                 test_vnfd_ids[i] = None
 
                     if test_vnfd_ids[0] and test_vnfd_ids[1]:
-
                         # Test NSD Quotas
                         res = engine.test(
                             "Create test NSD #1",
@@ -5273,7 +5265,6 @@ class TestNbiQuotas:
                                     test_nsd_ids[i] = None
 
                         if test_nsd_ids[0] and test_nsd_ids[1]:
-
                             # Test NSR Quotas
                             res = engine.test(
                                 "Create test NSR #1",