aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormorganrol <morgan.richomme@orange.com>2021-04-27 17:08:34 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2021-04-28 09:02:23 +0000
commit44c4437d52355a4ba371f80ce68a12a7967b2cb4 (patch)
tree911909a4d16e0ee9c9c5a82320faf88e7d8c23e7 /src
parentea75b7596605a2bb7e5f51aa39ca6e5a962c59db (diff)
[CLAMP] Update clamp to allow re-play of the test
Today a docker restart is failing because we try to enrich a certified artifacts Like for other basic_* tests, if the service is already distributed we may just consider creating the loop (bypass the model onboarding part) so we can run the test as a replay and use it for parallel tests Issue-ID: TEST-334 Signed-off-by: morganrol <morgan.richomme@orange.com> Change-Id: I5f353488e64b420fa94303695311a473682a5fa1 (cherry picked from commit 227f55ed67caec8e67a037bc3e901caf54617c4c)
Diffstat (limited to 'src')
-rw-r--r--src/onaptests/steps/loop/clamp.py7
-rw-r--r--src/onaptests/steps/onboard/clamp.py31
2 files changed, 22 insertions, 16 deletions
diff --git a/src/onaptests/steps/loop/clamp.py b/src/onaptests/steps/loop/clamp.py
index e781bd2..86bcbb0 100644
--- a/src/onaptests/steps/loop/clamp.py
+++ b/src/onaptests/steps/loop/clamp.py
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
"""Clamp Scenario class."""
from yaml import load
+import random
+import string
import time
from onapsdk.clamp.clamp_element import Clamp
@@ -93,8 +95,11 @@ class ClampStep(YamlTemplateBaseStep):
def instantiate_clamp(self, loop_template: str, loop_name: str, operational_policies: list):
"""Instantite a closed loopin CLAMP."""
+ letters = string.ascii_letters
+ loop_name_random = loop_name.join(
+ random.choice(letters) for i in range(6))
loop = InstantiateLoop(template=loop_template,
- loop_name=loop_name,
+ loop_name=loop_name_random,
operational_policies=operational_policies)
return loop.instantiate_loop()
diff --git a/src/onaptests/steps/onboard/clamp.py b/src/onaptests/steps/onboard/clamp.py
index 1fc8ae0..afbd7cb 100644
--- a/src/onaptests/steps/onboard/clamp.py
+++ b/src/onaptests/steps/onboard/clamp.py
@@ -84,18 +84,19 @@ class OnboardClampStep(YamlTemplateBaseStep):
service.create()
self._logger.info(" Service %s created", service)
- service.add_resource(vf)
-
- # we add the artifact to the first VNF
- self._logger.info("Try to add blueprint to %s", vf.name)
- payload_file = open(settings.CONFIGURATION_PATH + 'tca-microservice.yaml', 'rb')
- data = payload_file.read()
- self._logger.info("DCAE INVENTORY BLUEPRINT file retrieved")
- service.add_artifact_to_vf(vnf_name=vf.name,
- artifact_type="DCAE_INVENTORY_BLUEPRINT",
- artifact_name="tca-microservice.yaml",
- artifact=data)
- payload_file.close()
- service.checkin()
- service.onboard()
- self._logger.info("DCAE INVENTORY BLUEPRINT ADDED")
+ if not service.distributed:
+ service.add_resource(vf)
+
+ # we add the artifact to the first VNF
+ self._logger.info("Try to add blueprint to %s", vf.name)
+ payload_file = open(settings.CONFIGURATION_PATH + 'tca-microservice.yaml', 'rb')
+ data = payload_file.read()
+ self._logger.info("DCAE INVENTORY BLUEPRINT file retrieved")
+ service.add_artifact_to_vf(vnf_name=vf.name,
+ artifact_type="DCAE_INVENTORY_BLUEPRINT",
+ artifact_name="tca-microservice.yaml",
+ artifact=data)
+ payload_file.close()
+ service.checkin()
+ service.onboard()
+ self._logger.info("DCAE INVENTORY BLUEPRINT ADDED")