diff options
Diffstat (limited to 'src/onaptests/steps/loop')
-rw-r--r-- | src/onaptests/steps/loop/clamp.py | 22 | ||||
-rw-r--r-- | src/onaptests/steps/loop/instantiate_loop.py | 5 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/onaptests/steps/loop/clamp.py b/src/onaptests/steps/loop/clamp.py index dc00eb1..68a2dde 100644 --- a/src/onaptests/steps/loop/clamp.py +++ b/src/onaptests/steps/loop/clamp.py @@ -6,20 +6,19 @@ # # http://www.apache.org/licenses/LICENSE-2.0 """Clamp Scenario class.""" -from yaml import load, SafeLoader import random import string import time -from onapsdk.clamp.clamp_element import Clamp -from onapsdk.sdc.service import Service +from yaml import SafeLoader, load import onaptests.utils.exceptions as onap_test_exceptions +from onapsdk.clamp.clamp_element import Clamp from onapsdk.configuration import settings -from onaptests.steps.onboard.clamp import OnboardClampStep +from onapsdk.sdc.service import Service +from onaptests.steps.base import YamlTemplateBaseStep from onaptests.steps.loop.instantiate_loop import InstantiateLoop - -from ..base import YamlTemplateBaseStep +from onaptests.steps.onboard.clamp import OnboardClampStep class ClampStep(YamlTemplateBaseStep): @@ -56,7 +55,7 @@ class ClampStep(YamlTemplateBaseStep): """ if self.is_root: if not self._yaml_template: - with open(settings.SERVICE_YAML_TEMPLATE, "r") as yaml_template: + with open(settings.SERVICE_YAML_TEMPLATE, "r", encoding="utf-8") as yaml_template: self._yaml_template: dict = load(yaml_template, SafeLoader) return self._yaml_template return self.parent.yaml_template @@ -73,13 +72,14 @@ class ClampStep(YamlTemplateBaseStep): req_policies=30) # 30 required policy self._logger.info("Operational policy found.") if not exist: - raise ValueError("Couldn't load the policy %s", policy) + raise ValueError("Couldn't load the policy %s" % policy) # retrieve the service..based on service name service: Service = Service(self.service_name) if is_template: loop_template = Clamp.check_loop_template(service=service) self._logger.info("Loop template checked.") return loop_template + return None def instantiate_clamp(self, loop_template: str, loop_name: str, operational_policies: list): """Instantite a closed loopin CLAMP.""" @@ -116,9 +116,9 @@ class ClampStep(YamlTemplateBaseStep): service.name) break self._logger.info( - "Service Distribution for %s ongoing, Wait for 60 s", - service.name) - time.sleep(60) + "Service Distribution for %s ongoing, Wait for %d s", + service.name, settings.SERVICE_DISTRIBUTION_SLEEP_TIME) + time.sleep(settings.SERVICE_DISTRIBUTION_SLEEP_TIME) nb_try += 1 if distribution_completed is False: diff --git a/src/onaptests/steps/loop/instantiate_loop.py b/src/onaptests/steps/loop/instantiate_loop.py index fab70ad..3d34731 100644 --- a/src/onaptests/steps/loop/instantiate_loop.py +++ b/src/onaptests/steps/loop/instantiate_loop.py @@ -9,6 +9,7 @@ from onapsdk.configuration import settings import onaptests.utils.exceptions as onap_test_exceptions +# pylint: disable=protected-access class InstantiateLoop(): """class instantiating a closed loop in clamp.""" @@ -71,8 +72,8 @@ class InstantiateLoop(): loop = LoopInstance(template=self.template, name=self.loop_name, details={}) - details = loop.create() - if details: + loop.create() + if loop.details: self._logger.info("Loop instance %s successfully created !!", self.loop_name) else: self._logger.error("An error occured while creating the loop instance") |