aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormorganrol <morgan.richomme@orange.com>2021-03-31 19:07:11 +0200
committermorganrol <morgan.richomme@orange.com>2021-03-31 19:23:15 +0200
commitc5f7f5e4d905171c1f0663bcb64ee050985a2d0b (patch)
treed48441654387a204abfce38da9fa094e70f58631 /src
parenteffb276cbd7d61c6e5ee2d93eb2a7d6baa1d5baa (diff)
[CLAMP] Integrate basic_clamp
Some regressions occured and old files were used This patch update the different components with the right versions It also renames the vnf-service in basic_clamp-services.yaml It creates the entry point and the scenario to integrate the test in xtesting Issue-ID: INT-1819 Signed-off-by: morganrol <morgan.richomme@orange.com> Change-Id: I7a9e49d8ddc2c5bd0625a4a5ed940c10aed74f81
Diffstat (limited to 'src')
-rw-r--r--src/onaptests/configuration/basic_clamp_settings.py11
-rw-r--r--src/onaptests/configuration/tca-microservice.yaml2
-rw-r--r--src/onaptests/scenario/basic_clamp.py47
-rw-r--r--src/onaptests/steps/loop/instantiate_loop.py6
-rw-r--r--src/onaptests/templates/vnf-services/basic_clamp-service.yaml (renamed from src/onaptests/templates/vnf-services/ubuntu18agent-service.yaml)0
5 files changed, 58 insertions, 8 deletions
diff --git a/src/onaptests/configuration/basic_clamp_settings.py b/src/onaptests/configuration/basic_clamp_settings.py
index d2f38a0..1c6ad61 100644
--- a/src/onaptests/configuration/basic_clamp_settings.py
+++ b/src/onaptests/configuration/basic_clamp_settings.py
@@ -6,6 +6,13 @@ from .settings import * # pylint: disable=W0614
""" Specific Basic clamp settings."""
CLEANUP_FLAG = False
CLAMP_DISTRIBUTION_TIMER = 10
+
+# pylint: disable=bad-whitespace
+# The ONAP part
+SERVICE_DETAILS=("Onboarding, enriching a model with TCA." +
+ "Design a loop with Clamp and deploy it in Policy and DCAE")
+SERVICE_COMPONENTS="SDC, CLAMP, POLICY, DCAE, DMAAP"
+
VENDOR_NAME = "basiclamp_vendor"
VSP_NAME = "basiclamp_vsp"
@@ -30,12 +37,10 @@ OPERATIONAL_POLICIES = [
}
]
-# SERVICE_NAME = "ubuntu18agent"
-
# if a yaml file is define, retrieve info from this yaml files
# if not declare the parameters in the settings
SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
- "ubuntu18agent-service.yaml")
+ "basic_clamp-service.yaml")
CONFIGURATION_PATH = sys.path[-1] + "/onaptests/configuration/"
try:
diff --git a/src/onaptests/configuration/tca-microservice.yaml b/src/onaptests/configuration/tca-microservice.yaml
index e7d967a..0f13c53 100644
--- a/src/onaptests/configuration/tca-microservice.yaml
+++ b/src/onaptests/configuration/tca-microservice.yaml
@@ -19,7 +19,7 @@
tosca_definitions_version: cloudify_dsl_1_3
imports:
- https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
- - plugin:k8splugin?version=3.4.2
+ - plugin:k8splugin?version=>=3.4.3,<4.0.0
- plugin:clamppolicyplugin?version=1.1.0
inputs:
service_name:
diff --git a/src/onaptests/scenario/basic_clamp.py b/src/onaptests/scenario/basic_clamp.py
new file mode 100644
index 0000000..d3a9ba1
--- /dev/null
+++ b/src/onaptests/scenario/basic_clamp.py
@@ -0,0 +1,47 @@
+"""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 onaptests.steps.loop.clamp import ClampStep
+from onaptests.utils.exceptions import OnapTestException
+class BasicClamp(testcase.TestCase):
+ """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")
+ 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()
+ self.__logger.debug("start time")
+ try:
+ self.test.execute()
+ self.__logger.info("VNF basic_clamp successfully created")
+ # The cleanup is part of the test, not only a teardown action
+ if settings.CLEANUP_FLAG:
+ self.__logger.info("VNF basic_clamp cleanup called")
+ time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
+ self.test.cleanup()
+ self.result = 100
+ else:
+ self.__logger.info("No cleanup requested. Test completed.")
+ self.result = 100
+ except (OnapTestException, SDKException, APIError) as exc:
+ self.result = 0
+ self.__logger.error(exc.error_message)
+ finally:
+ self.stop_time = time.time()
+ def clean(self):
+ """Clean Additional resources if needed."""
+ self.__logger.info("Generate Test report")
+ self.test.reports_collection.generate_report()
diff --git a/src/onaptests/steps/loop/instantiate_loop.py b/src/onaptests/steps/loop/instantiate_loop.py
index bd34a04..b6f4ffa 100644
--- a/src/onaptests/steps/loop/instantiate_loop.py
+++ b/src/onaptests/steps/loop/instantiate_loop.py
@@ -11,11 +11,10 @@ from onapsdk.configuration import settings
class InstantiateLoop():
"""class instantiating a closed loop in clamp."""
- def __init__(self, template: str, loop_name: str, operational_policies: list, cert: tuple):
+ def __init__(self, template: str, loop_name: str, operational_policies: list):
self.template=template
self.loop_name=loop_name
self.operational_policies=operational_policies
- self.cert=cert
self._logger: logging.Logger = logging.getLogger("")
logging.config.dictConfig(settings.LOG_CONFIG)
@@ -71,8 +70,7 @@ class InstantiateLoop():
"""Instantiate the control loop."""
loop = LoopInstance(template=self.template,
name=self.loop_name,
- details={},
- cert=self.cert)
+ details={})
details = loop.create()
if details:
self._logger.info("Loop instance %s successfully created !!", self.loop_name)
diff --git a/src/onaptests/templates/vnf-services/ubuntu18agent-service.yaml b/src/onaptests/templates/vnf-services/basic_clamp-service.yaml
index f5fe653..f5fe653 100644
--- a/src/onaptests/templates/vnf-services/ubuntu18agent-service.yaml
+++ b/src/onaptests/templates/vnf-services/basic_clamp-service.yaml