aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2021-04-02 07:44:15 +0000
committerGerrit Code Review <gerrit@onap.org>2021-04-02 07:44:15 +0000
commit70d027470fc650115e69bfaca911e613de19de62 (patch)
tree11e06024c668ee769871ada50600f7f3df0fb7a2
parentb8037f19c416b3c66e735863cbb1143b75571236 (diff)
parentc5f7f5e4d905171c1f0663bcb64ee050985a2d0b (diff)
Merge "[CLAMP] Integrate basic_clamp"
-rw-r--r--setup.cfg1
-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
6 files changed, 59 insertions, 8 deletions
diff --git a/setup.cfg b/setup.cfg
index 8882ddc..a2a0d45 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -52,3 +52,4 @@ xtesting.testcase =
clearwater_ims = onaptests.scenario.clearwater_ims:ClearwaterIms
basic_onboard = onaptests.scenario.basic_onboard:BasicOnboard
pnf_macro = onaptests.scenario.pnf_macro:PnfMacro
+ basic_clamp = onaptests.scenario.basic_clamp:BasicClamp
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