aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2023-06-16 15:56:52 +0000
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2023-06-20 10:31:35 +0000
commitc10f9f4706aeb848cc55ad7a552081dbf3e7b6a7 (patch)
treeaffe65029df890a676185a777a2c21459d3c381f /src/onaptests
parent27ddbbeebee8dd18b266ade15d075d88b5c50c7e (diff)
BaseScenario class added
It prints out settings and will unify logic of scenarios later on. Issue-ID: TEST-395 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> Change-Id: Ie5929e0cc136183d4374b95bfc1600445126c4b6
Diffstat (limited to 'src/onaptests')
-rw-r--r--src/onaptests/scenario/basic_clamp.py16
-rw-r--r--src/onaptests/scenario/basic_cnf.py14
-rw-r--r--src/onaptests/scenario/basic_cnf_macro.py15
-rw-r--r--src/onaptests/scenario/basic_cps.py11
-rw-r--r--src/onaptests/scenario/basic_network.py14
-rw-r--r--src/onaptests/scenario/basic_onboard.py11
-rw-r--r--src/onaptests/scenario/basic_sdnc.py10
-rw-r--r--src/onaptests/scenario/basic_vm.py14
-rw-r--r--src/onaptests/scenario/basic_vm_macro.py15
-rw-r--r--src/onaptests/scenario/basic_vm_macro_stability.py13
-rw-r--r--src/onaptests/scenario/cds_blueprint_enrichment.py10
-rw-r--r--src/onaptests/scenario/cds_resource_resolution.py13
-rw-r--r--src/onaptests/scenario/clearwater_ims.py14
-rw-r--r--src/onaptests/scenario/multi_vnf_macro.py16
-rw-r--r--src/onaptests/scenario/pnf_macro.py18
-rw-r--r--src/onaptests/scenario/scenario_base.py20
-rw-r--r--src/onaptests/scenario/status.py11
17 files changed, 109 insertions, 126 deletions
diff --git a/src/onaptests/scenario/basic_clamp.py b/src/onaptests/scenario/basic_clamp.py
index fcaa265..c539c11 100644
--- a/src/onaptests/scenario/basic_clamp.py
+++ b/src/onaptests/scenario/basic_clamp.py
@@ -1,25 +1,26 @@
"""Basic Clamp test case."""
import logging
import time
-from xtesting.core import testcase
+
from onapsdk.configuration import settings
-from onapsdk.exceptions import SDKException, APIError
+from onapsdk.exceptions import APIError, SDKException
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.loop.clamp import ClampStep
from onaptests.utils.exceptions import OnapTestException
-class BasicClamp(testcase.TestCase):
+
+
+class BasicClamp(ScenarioBase):
"""Onboard, update a model with a loop, design the loop and deploy it."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init Basic Clamp, onboard a VM, design and deploy a loop with CLAMP."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_clamp'
- super(BasicClamp, self).__init__(**kwargs)
- self.__logger.debug("Basic CLAMP init started")
+ super().__init__('basic_clamp', **kwargs)
self.test = ClampStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
self.stop_time = None
self.result = 0
+
def run(self):
"""Run Basic CLAMP onap test."""
self.start_time = time.time()
@@ -44,6 +45,7 @@ class BasicClamp(testcase.TestCase):
self.__logger.exception("SDK exception")
finally:
self.stop_time = time.time()
+
def clean(self):
"""Clean Additional resources if needed."""
self.__logger.info("Generate Test report")
diff --git a/src/onaptests/scenario/basic_cnf.py b/src/onaptests/scenario/basic_cnf.py
index fb9a879..06f6f15 100644
--- a/src/onaptests/scenario/basic_cnf.py
+++ b/src/onaptests/scenario/basic_cnf.py
@@ -3,24 +3,22 @@
import logging
import time
-from xtesting.core import testcase
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-
-from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
+from onaptests.scenario.scenario_base import ScenarioBase
+from onaptests.steps.instantiate.vf_module_ala_carte import \
+ YamlTemplateVfModuleAlaCarteInstantiateStep
from onaptests.utils.exceptions import OnapTestException
-class BasicCnf(testcase.TestCase):
+
+class BasicCnf(ScenarioBase):
"""Onboard then instantiate a simple CNF with ONAP."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init BasicCnf."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_cnf'
- super(BasicCnf, self).__init__(**kwargs)
- self.__logger.debug("BasicCnf init started")
+ super().__init__('basic_cnf', **kwargs)
self.test = YamlTemplateVfModuleAlaCarteInstantiateStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
diff --git a/src/onaptests/scenario/basic_cnf_macro.py b/src/onaptests/scenario/basic_cnf_macro.py
index ddc8802..18435ca 100644
--- a/src/onaptests/scenario/basic_cnf_macro.py
+++ b/src/onaptests/scenario/basic_cnf_macro.py
@@ -1,16 +1,16 @@
"""Instantiate basic cnf using SO macro flow."""
import logging
import time
-from yaml import load, SafeLoader
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-from xtesting.core import testcase
-
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.base import YamlTemplateBaseStep
+from onaptests.steps.instantiate.service_macro import \
+ YamlTemplateServiceMacroInstantiateStep
from onaptests.steps.onboard.cds import CbaPublishStep
from onaptests.utils.exceptions import OnapTestException
-from onaptests.steps.instantiate.service_macro import YamlTemplateServiceMacroInstantiateStep
+from yaml import SafeLoader, load
class BasicCnfMacroStep(YamlTemplateBaseStep):
@@ -98,17 +98,14 @@ class BasicCnfMacroStep(YamlTemplateBaseStep):
return settings.SERVICE_INSTANCE_NAME
-class BasicCnfMacro(testcase.TestCase):
+class BasicCnfMacro(ScenarioBase):
"""Instantiate a basic cnf macro."""
__logger = logging.getLogger()
def __init__(self, **kwargs):
"""Init Basic Cnf Macro use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_cnf_macro'
- super().__init__(**kwargs)
- self.__logger.debug("Basic Cnf macro init started")
+ super().__init__('basic_cnf_macro', **kwargs)
self.test = BasicCnfMacroStep(cleanup=settings.CLEANUP_FLAG)
def run(self):
diff --git a/src/onaptests/scenario/basic_cps.py b/src/onaptests/scenario/basic_cps.py
index f7bf7a3..a1c7316 100644
--- a/src/onaptests/scenario/basic_cps.py
+++ b/src/onaptests/scenario/basic_cps.py
@@ -2,13 +2,15 @@
"""Basic CPS test case."""
import logging
import time
-from xtesting.core import testcase
+
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.onboard.cps import CreateCpsAnchorNodeStep
from onaptests.utils.exceptions import OnapTestException
-class BasicCps(testcase.TestCase):
+
+class BasicCps(ScenarioBase):
"""Create CPS resources:
- dataspace
- schemaset
@@ -23,10 +25,7 @@ class BasicCps(testcase.TestCase):
def __init__(self, **kwargs):
"""Init Basic CPS."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_cps'
- super().__init__(**kwargs)
- self.__logger.debug("BasicCps init started")
+ super().__init__('basic_cps', **kwargs)
self.test = CreateCpsAnchorNodeStep(cleanup=settings.CLEANUP_FLAG)
self.start_time = None
self.stop_time = None
diff --git a/src/onaptests/scenario/basic_network.py b/src/onaptests/scenario/basic_network.py
index a40dc06..3970700 100644
--- a/src/onaptests/scenario/basic_network.py
+++ b/src/onaptests/scenario/basic_network.py
@@ -3,14 +3,15 @@
import logging
import time
-from xtesting.core import testcase
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-
-from onaptests.steps.instantiate.vl_ala_carte import YamlTemplateVlAlaCarteInstantiateStep
+from onaptests.scenario.scenario_base import ScenarioBase
+from onaptests.steps.instantiate.vl_ala_carte import \
+ YamlTemplateVlAlaCarteInstantiateStep
from onaptests.utils.exceptions import OnapTestException
-class BasicNetwork(testcase.TestCase):
+
+class BasicNetwork(ScenarioBase):
"""Onboard then instantiate a simple Network with ONAP."""
__logger = logging.getLogger(__name__)
@@ -18,10 +19,7 @@ class BasicNetwork(testcase.TestCase):
def __init__(self, **kwargs):
"""Init Basic Network use case."""
# import basic_network_nomulticloud_settings needed
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_network'
- super(BasicNetwork, self).__init__(**kwargs)
- self.__logger.debug("BasicNetwork init started")
+ super().__init__('basic_network', **kwargs)
self.test = YamlTemplateVlAlaCarteInstantiateStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
diff --git a/src/onaptests/scenario/basic_onboard.py b/src/onaptests/scenario/basic_onboard.py
index 37947f0..cb1d0fe 100644
--- a/src/onaptests/scenario/basic_onboard.py
+++ b/src/onaptests/scenario/basic_onboard.py
@@ -2,13 +2,15 @@
"""Basic Onboard test case."""
import logging
import time
-from xtesting.core import testcase
+
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.onboard.service import YamlTemplateServiceOnboardStep
from onaptests.utils.exceptions import OnapTestException
-class BasicOnboard(testcase.TestCase):
+
+class BasicOnboard(ScenarioBase):
"""Onboard a simple VM with ONAP."""
__logger = logging.getLogger(__name__)
@@ -16,10 +18,7 @@ class BasicOnboard(testcase.TestCase):
def __init__(self, **kwargs):
"""Init BasicOnboard."""
# import basic_onboard_settings needed
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_onboard'
- super(BasicOnboard, self).__init__(**kwargs)
- self.__logger.debug("BasicOnboard init started")
+ super().__init__('basic_onboard', **kwargs)
self.test = YamlTemplateServiceOnboardStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
diff --git a/src/onaptests/scenario/basic_sdnc.py b/src/onaptests/scenario/basic_sdnc.py
index 328a175..9255d29 100644
--- a/src/onaptests/scenario/basic_sdnc.py
+++ b/src/onaptests/scenario/basic_sdnc.py
@@ -1,15 +1,14 @@
import logging
import time
-from xtesting.core import testcase
-
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.instantiate.sdnc_service import TestSdncStep
from onaptests.utils.exceptions import OnapTestException
-class BasicSdnc(testcase.TestCase):
+class BasicSdnc(ScenarioBase):
"""Create SDNC service.
Check and delete the service.
"""
@@ -18,10 +17,7 @@ class BasicSdnc(testcase.TestCase):
def __init__(self, **kwargs):
"""Init Basic SDNC use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_SDNC'
- super().__init__(**kwargs)
- self.__logger.debug("Basic SDNC init started")
+ super().__init__('basic_sdnc', **kwargs)
self.test = TestSdncStep(cleanup=settings.CLEANUP_FLAG)
def run(self):
diff --git a/src/onaptests/scenario/basic_vm.py b/src/onaptests/scenario/basic_vm.py
index 897e9d4..81c2d09 100644
--- a/src/onaptests/scenario/basic_vm.py
+++ b/src/onaptests/scenario/basic_vm.py
@@ -3,24 +3,22 @@
import logging
import time
-from xtesting.core import testcase
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-
-from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
+from onaptests.scenario.scenario_base import ScenarioBase
+from onaptests.steps.instantiate.vf_module_ala_carte import \
+ YamlTemplateVfModuleAlaCarteInstantiateStep
from onaptests.utils.exceptions import OnapTestException
-class BasicVm(testcase.TestCase):
+
+class BasicVm(ScenarioBase):
"""Onboard then instantiate a simple VM with ONAP."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init BasicVM."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_vm'
- super(BasicVm, self).__init__(**kwargs)
- self.__logger.debug("BasicVm init started")
+ super().__init__('basic_vm', **kwargs)
self.test = YamlTemplateVfModuleAlaCarteInstantiateStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
diff --git a/src/onaptests/scenario/basic_vm_macro.py b/src/onaptests/scenario/basic_vm_macro.py
index 3b10983..7159686 100644
--- a/src/onaptests/scenario/basic_vm_macro.py
+++ b/src/onaptests/scenario/basic_vm_macro.py
@@ -1,16 +1,16 @@
"""Instantiate basic vm using SO macro flow."""
import logging
import time
-from yaml import load, SafeLoader
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-from xtesting.core import testcase
-
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.base import YamlTemplateBaseStep
+from onaptests.steps.instantiate.service_macro import \
+ YamlTemplateServiceMacroInstantiateStep
from onaptests.steps.onboard.cds import CbaPublishStep
from onaptests.utils.exceptions import OnapTestException
-from onaptests.steps.instantiate.service_macro import YamlTemplateServiceMacroInstantiateStep
+from yaml import SafeLoader, load
class BasicVmMacroStep(YamlTemplateBaseStep):
@@ -98,17 +98,14 @@ class BasicVmMacroStep(YamlTemplateBaseStep):
return settings.SERVICE_INSTANCE_NAME
-class BasicVmMacro(testcase.TestCase):
+class BasicVmMacro(ScenarioBase):
"""Instantiate a basic vm macro."""
__logger = logging.getLogger()
def __init__(self, **kwargs):
"""Init Basic Macro use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_vm_macro'
- super().__init__(**kwargs)
- self.__logger.debug("Basic VM macro init started")
+ super().__init__('basic_vm_macro', **kwargs)
self.test = BasicVmMacroStep(cleanup=settings.CLEANUP_FLAG)
def run(self):
diff --git a/src/onaptests/scenario/basic_vm_macro_stability.py b/src/onaptests/scenario/basic_vm_macro_stability.py
index 06c17ca..98464a4 100644
--- a/src/onaptests/scenario/basic_vm_macro_stability.py
+++ b/src/onaptests/scenario/basic_vm_macro_stability.py
@@ -4,23 +4,20 @@ import time
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-from xtesting.core import testcase
-
+from onaptests.scenario.scenario_base import ScenarioBase
+from onaptests.steps.instantiate.service_macro import \
+ YamlTemplateServiceMacroInstantiateStep
from onaptests.utils.exceptions import OnapTestException
-from onaptests.steps.instantiate.service_macro import YamlTemplateServiceMacroInstantiateStep
-class BasicVmMacroStability(testcase.TestCase):
+class BasicVmMacroStability(ScenarioBase):
"""Instantiate a basic vm macro."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init Basic Macro use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_vm_macro_stability'
- super().__init__(**kwargs)
- self.__logger.debug("Basic VM macro stability init started")
+ super().__init__('basic_vm_macro_stability', **kwargs)
self.test = YamlTemplateServiceMacroInstantiateStep(cleanup=settings.CLEANUP_FLAG)
def run(self):
diff --git a/src/onaptests/scenario/cds_blueprint_enrichment.py b/src/onaptests/scenario/cds_blueprint_enrichment.py
index c442780..5a63695 100644
--- a/src/onaptests/scenario/cds_blueprint_enrichment.py
+++ b/src/onaptests/scenario/cds_blueprint_enrichment.py
@@ -6,23 +6,19 @@ import time
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-from xtesting.core import testcase
-
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.onboard.cds import CbaEnrichStep
from onaptests.utils.exceptions import OnapTestException
-class CDSBlueprintEnrichment(testcase.TestCase):
+class CDSBlueprintEnrichment(ScenarioBase):
"""Enrich simple blueprint using CDS blueprintprocessor."""
__logger = logging.getLogger()
def __init__(self, **kwargs):
"""Init CDS blueprint enrichment use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_cds'
- super(CDSBlueprintEnrichment, self).__init__(**kwargs)
- self.__logger.debug("CDS blueprint enrichment initialization")
+ super().__init__('basic_cds', **kwargs)
self.test = CbaEnrichStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
diff --git a/src/onaptests/scenario/cds_resource_resolution.py b/src/onaptests/scenario/cds_resource_resolution.py
index cff04d8..7bf2f94 100644
--- a/src/onaptests/scenario/cds_resource_resolution.py
+++ b/src/onaptests/scenario/cds_resource_resolution.py
@@ -6,11 +6,11 @@ import time
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-from xtesting.core import testcase
-
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.base import BaseStep
from onaptests.steps.onboard.cds import CbaProcessStep
-from onaptests.steps.simulator.cds_mockserver import CdsMockserverCnfConfigureStep
+from onaptests.steps.simulator.cds_mockserver import \
+ CdsMockserverCnfConfigureStep
from onaptests.utils.exceptions import OnapTestException
@@ -58,17 +58,14 @@ class CDSResourceResolutionStep(BaseStep):
return "PythonSDK-tests"
-class CDSResourceResolution(testcase.TestCase):
+class CDSResourceResolution(ScenarioBase):
"""Enrich simple blueprint using CDS blueprintprocessor."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init CDS resource resolution use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'basic_cds'
- super().__init__(**kwargs)
- self.__logger.debug("CDS resource resolution initialization")
+ super().__init__('basic_cds', **kwargs)
self.test = CDSResourceResolutionStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
diff --git a/src/onaptests/scenario/clearwater_ims.py b/src/onaptests/scenario/clearwater_ims.py
index c79e6f7..db0a01f 100644
--- a/src/onaptests/scenario/clearwater_ims.py
+++ b/src/onaptests/scenario/clearwater_ims.py
@@ -3,14 +3,15 @@
import logging
import time
-from xtesting.core import testcase
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-
-from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
+from onaptests.scenario.scenario_base import ScenarioBase
+from onaptests.steps.instantiate.vf_module_ala_carte import \
+ YamlTemplateVfModuleAlaCarteInstantiateStep
from onaptests.utils.exceptions import OnapTestException
-class ClearwaterIms(testcase.TestCase):
+
+class ClearwaterIms(ScenarioBase):
"""Onboard then instantiate a clearwater vIMS with ONAP."""
__logger = logging.getLogger(__name__)
@@ -18,10 +19,7 @@ class ClearwaterIms(testcase.TestCase):
def __init__(self, **kwargs):
"""Init Clearwater IMS."""
# import clearwater_ims_nomulticloud_settings needed
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'clearwater_ims'
- super(ClearwaterIms, self).__init__(**kwargs)
- self.__logger.debug("vIMS init started")
+ super().__init__('clearwater_ims', **kwargs)
self.test = YamlTemplateVfModuleAlaCarteInstantiateStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None
diff --git a/src/onaptests/scenario/multi_vnf_macro.py b/src/onaptests/scenario/multi_vnf_macro.py
index 41833e6..4a8c6cc 100644
--- a/src/onaptests/scenario/multi_vnf_macro.py
+++ b/src/onaptests/scenario/multi_vnf_macro.py
@@ -2,16 +2,15 @@
import logging
import time
-from yaml import load, SafeLoader
-
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-from xtesting.core import testcase
-
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.base import YamlTemplateBaseStep
+from onaptests.steps.instantiate.service_macro import \
+ YamlTemplateServiceMacroInstantiateStep
from onaptests.steps.onboard.cds import CbaPublishStep
from onaptests.utils.exceptions import OnapTestException
-from onaptests.steps.instantiate.service_macro import YamlTemplateServiceMacroInstantiateStep
+from yaml import SafeLoader, load
class MultiVnfUbuntuMacroStep(YamlTemplateBaseStep):
@@ -103,17 +102,14 @@ class MultiVnfUbuntuMacroStep(YamlTemplateBaseStep):
return settings.SERVICE_INSTANCE_NAME
-class MultiVnfUbuntuMacro(testcase.TestCase):
+class MultiVnfUbuntuMacro(ScenarioBase):
"""Instantiate a basic vm macro."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init Basic Macro use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'nso_ubuntu_macro'
- super().__init__(**kwargs)
- self.__logger.debug("NSO Ubuntu macro init started")
+ super().__init__('nso_ubuntu_macro', **kwargs)
self.test = MultiVnfUbuntuMacroStep(cleanup=settings.CLEANUP_FLAG)
def run(self):
diff --git a/src/onaptests/scenario/pnf_macro.py b/src/onaptests/scenario/pnf_macro.py
index 24f9a1e..7ecf3c2 100644
--- a/src/onaptests/scenario/pnf_macro.py
+++ b/src/onaptests/scenario/pnf_macro.py
@@ -1,17 +1,18 @@
"""Instantiate service with PNF using SO macro flow."""
import logging
import time
-from yaml import load, SafeLoader
-from xtesting.core import testcase
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.base import YamlTemplateBaseStep
+from onaptests.steps.instantiate.service_macro import \
+ YamlTemplateServiceMacroInstantiateStep
from onaptests.steps.onboard.cds import CbaEnrichStep
-from onaptests.steps.simulator.pnf_simulator_cnf.pnf_register import PnfSimulatorCnfRegisterStep
-from onaptests.steps.instantiate.service_macro import YamlTemplateServiceMacroInstantiateStep
+from onaptests.steps.simulator.pnf_simulator_cnf.pnf_register import \
+ PnfSimulatorCnfRegisterStep
from onaptests.utils.exceptions import OnapTestException
+from yaml import SafeLoader, load
class PnfMacroScenarioStep(YamlTemplateBaseStep):
@@ -102,17 +103,14 @@ class PnfMacroScenarioStep(YamlTemplateBaseStep):
return settings.SERVICE_INSTANCE_NAME
-class PnfMacro(testcase.TestCase):
+class PnfMacro(ScenarioBase):
"""Run PNF simulator and onboard then instantiate a service with PNF."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init Basic Network use case."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'pnf_macro'
- super().__init__(**kwargs)
- self.__logger.debug("PnfMacro init started")
+ super().__init__('pnf_macro', **kwargs)
self.test = PnfMacroScenarioStep(cleanup=settings.CLEANUP_FLAG)
def run(self):
diff --git a/src/onaptests/scenario/scenario_base.py b/src/onaptests/scenario/scenario_base.py
new file mode 100644
index 0000000..6fea811
--- /dev/null
+++ b/src/onaptests/scenario/scenario_base.py
@@ -0,0 +1,20 @@
+import logging
+
+from onapsdk.configuration import settings
+from xtesting.core import testcase
+
+
+class ScenarioBase(testcase.TestCase):
+ """Scenario base class."""
+
+ __logger = logging.getLogger()
+
+ def __init__(self, case_name_override, **kwargs):
+ """Init base scenario."""
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = case_name_override
+ self.__logger.info("Global Configuration:")
+ for val in settings._settings:
+ self.__logger.info("%s: %s", val, settings._settings[val])
+ super().__init__(**kwargs)
+ self.__logger.debug("%s init started", kwargs["case_name"])
diff --git a/src/onaptests/scenario/status.py b/src/onaptests/scenario/status.py
index 79ce0c6..ed27975 100644
--- a/src/onaptests/scenario/status.py
+++ b/src/onaptests/scenario/status.py
@@ -1,24 +1,21 @@
import logging
import time
-from xtesting.core import testcase
+
from onapsdk.configuration import settings
from onapsdk.exceptions import SDKException
-
+from onaptests.scenario.scenario_base import ScenarioBase
from onaptests.steps.cloud.check_status import CheckNamespaceStatusStep
from onaptests.utils.exceptions import OnapTestException
-class Status(testcase.TestCase):
+class Status(ScenarioBase):
"""Retrieve status of Kubernetes resources in the nemaspace."""
__logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
"""Init the testcase."""
- if "case_name" not in kwargs:
- kwargs["case_name"] = 'status'
- super().__init__(**kwargs)
- self.__logger.debug("Status check init started")
+ super().__init__('status', **kwargs)
self.test = CheckNamespaceStatusStep(
cleanup=settings.CLEANUP_FLAG)
self.start_time = None