Revert "[TEST] Do not try to recreate already created SDC resources" 08/121308/1
authorMorgan Richomme <morgan.richomme@orange.com>
Thu, 13 May 2021 07:42:35 +0000 (07:42 +0000)
committerMorgan Richomme <morgan.richomme@orange.com>
Thu, 13 May 2021 07:42:35 +0000 (07:42 +0000)
This reverts commit ed9b039e5f4b54aa6ebbef7aa95fafdce7d5ce75.

Reason for revert: regression observed in all chains and gating

Change-Id: I2b310ac172bec7880687dae591f62f5d02814b07
Signed-off-by: morganrol <morgan.richomme@orange.com>
Issue-ID: TEST-333

src/onaptests/configuration/basic_vm_macro_settings.py
src/onaptests/steps/onboard/pnf.py
src/onaptests/steps/onboard/service.py
src/onaptests/steps/onboard/vf.py

index b29cd1d..bdeeb85 100644 (file)
@@ -1,7 +1,6 @@
 import os
 import openstack
 from pathlib import Path
-from uuid import uuid4
 
 from yaml import load
 
@@ -58,4 +57,4 @@ try:
 except (FileNotFoundError, ValueError):
     raise onap_test_exceptions.TestConfigurationException
 
-SERVICE_INSTANCE_NAME = f"basic_macro_{str(uuid4())}"
+SERVICE_INSTANCE_NAME = "basic_vm_macro_service_instance"
index c5958dc..6250d7e 100644 (file)
@@ -50,15 +50,14 @@ class PnfOnboardStep(BaseStep):
         super().execute()
         vendor: Vendor = Vendor(name=settings.VENDOR_NAME)
         pnf: Pnf = Pnf(name=settings.PNF_NAME, vendor=vendor)
-        if not pnf.created:
-            pnf.create()
-            pnf.add_deployment_artifact(
-                artifact_type=settings.PNF_ARTIFACT_TYPE,
-                artifact_name=settings.PNF_ARTIFACT_NAME,
-                artifact_label=settings.PNF_ARTIFACT_LABEL,
-                artifact=settings.PNF_ARTIFACT_FILE_PATH
-            )
-            pnf.onboard()
+        pnf.create()
+        pnf.add_deployment_artifact(
+            artifact_type=settings.PNF_ARTIFACT_TYPE,
+            artifact_name=settings.PNF_ARTIFACT_NAME,
+            artifact_label=settings.PNF_ARTIFACT_LABEL,
+            artifact=settings.PNF_ARTIFACT_FILE_PATH
+        )
+        pnf.onboard()
 
 
 class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep):
@@ -111,12 +110,11 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep):
                 else:
                     vsp = None
                 pnf_obj: Pnf = Pnf(name=pnf["pnf_name"], vendor=vendor, vsp=vsp)
-                if not pnf_obj.created:
-                    pnf_obj.create()
-                    pnf_obj.add_deployment_artifact(
-                        artifact_type=pnf["pnf_artifact_type"],
-                        artifact_name=pnf["pnf_artifact_name"],
-                        artifact_label=pnf["pnf_artifact_label"],
-                        artifact=pnf["pnf_artifact_file_path"]
-                    )
-                    pnf_obj.onboard()
+                pnf_obj.create()
+                pnf_obj.add_deployment_artifact(
+                    artifact_type=pnf["pnf_artifact_type"],
+                    artifact_name=pnf["pnf_artifact_name"],
+                    artifact_label=pnf["pnf_artifact_label"],
+                    artifact=pnf["pnf_artifact_file_path"]
+                )
+                pnf_obj.onboard()
index a8f5e31..6300a43 100644 (file)
@@ -55,17 +55,16 @@ class ServiceOnboardStep(BaseStep):
         """
         super().execute()
         service: Service = Service(name=settings.SERVICE_NAME, instantiation_type=settings.SERVICE_INSTANTIATION_TYPE)
-        if not service.created:
-            service.create()
-            if settings.VL_NAME != "":
-                vl: Vl = Vl(name=settings.VL_NAME)
-                service.add_resource(vl)
-            if settings.VF_NAME != "":
-                vf: Vf = Vf(name=settings.VF_NAME)
-                service.add_resource(vf)
-            if settings.PNF_NAME != "":
-                pnf: Pnf = Pnf(name=settings.PNF_NAME)
-                service.add_resource(pnf)
+        service.create()
+        if settings.VL_NAME != "":
+            vl: Vl = Vl(name=settings.VL_NAME)
+            service.add_resource(vl)
+        if settings.VF_NAME != "":
+            vf: Vf = Vf(name=settings.VF_NAME)
+            service.add_resource(vf)
+        if settings.PNF_NAME != "":
+            pnf: Pnf = Pnf(name=settings.PNF_NAME)
+            service.add_resource(pnf)
         # If the service is already distributed, do not try to checkin/onboard (replay of tests)
         # checkin is done if needed
         # If service is replayed, no need to try to re-onboard the model
@@ -142,13 +141,12 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep):
         else:
             instantiation_type: ServiceInstantiationType = ServiceInstantiationType.A_LA_CARTE
         service: Service = Service(name=self.service_name, instantiation_type=instantiation_type)
-        if not service.created:
-            service.create()
-            self.declare_resources(service)
-            self.assign_properties(service)
-            # If the service is already distributed, do not try to checkin/onboard (replay of tests)
-            # checkin is done if needed
-            # If service is replayed, no need to try to re-onboard the model
+        service.create()
+        self.declare_resources(service)
+        self.assign_properties(service)
+        # If the service is already distributed, do not try to checkin/onboard (replay of tests)
+        # checkin is done if needed
+        # If service is replayed, no need to try to re-onboard the model
         if not service.distributed:
             try:
                 service.checkin()
index d26e123..5f5fc4d 100644 (file)
@@ -40,8 +40,7 @@ class VfOnboardStep(BaseStep):
         super().execute()
         vsp: Vsp = Vsp(name=settings.VSP_NAME)
         vf: Vf = Vf(name=settings.VF_NAME, vsp=vsp)
-        if not vf.created:
-            vf.onboard()
+        vf.onboard()
 
 
 class YamlTemplateVfOnboardStep(YamlTemplateBaseStep):
@@ -86,16 +85,15 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep):
             for vnf in self.yaml_template["vnfs"]:
                 vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP")
                 vf: Vf = Vf(name=vnf['vnf_name'], vsp=vsp)
-                if not vf.created:
-                    if all([x in vnf for x in ["vnf_artifact_type",
-                                               "vnf_artifact_name",
-                                               "vnf_artifact_label",
-                                               "vnf_artifact_file_path"]]):
-                        vf.create()
-                        vf.add_deployment_artifact(
-                            artifact_type=vnf["vnf_artifact_type"],
-                            artifact_name=vnf["vnf_artifact_name"],
-                            artifact_label=vnf["vnf_artifact_label"],
-                            artifact=vnf["vnf_artifact_file_path"]
-                        )
-                    vf.onboard()
+                if all([x in vnf for x in ["vnf_artifact_type",
+                                           "vnf_artifact_name",
+                                           "vnf_artifact_label",
+                                           "vnf_artifact_file_path"]]):
+                    vf.create()
+                    vf.add_deployment_artifact(
+                        artifact_type=vnf["vnf_artifact_type"],
+                        artifact_name=vnf["vnf_artifact_name"],
+                        artifact_label=vnf["vnf_artifact_label"],
+                        artifact=vnf["vnf_artifact_file_path"]
+                    )
+                vf.onboard()