diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/onaptests/configuration/basic_clamp_settings.py | 3 | ||||
-rw-r--r-- | src/onaptests/steps/loop/clamp.py | 5 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/service.py | 30 | ||||
-rw-r--r-- | src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py | 2 |
4 files changed, 29 insertions, 11 deletions
diff --git a/src/onaptests/configuration/basic_clamp_settings.py b/src/onaptests/configuration/basic_clamp_settings.py index 1781c54..d2f38a0 100644 --- a/src/onaptests/configuration/basic_clamp_settings.py +++ b/src/onaptests/configuration/basic_clamp_settings.py @@ -1,8 +1,6 @@ import sys from yaml import load -from pathlib import Path - from .settings import * # pylint: disable=W0614 """ Specific Basic clamp settings.""" @@ -32,7 +30,6 @@ OPERATIONAL_POLICIES = [ } ] -CERT = (Path.cwd() / 'cert.pem', Path.cwd() / 'cert.key') # SERVICE_NAME = "ubuntu18agent" # if a yaml file is define, retrieve info from this yaml files diff --git a/src/onaptests/steps/loop/clamp.py b/src/onaptests/steps/loop/clamp.py index 9ae5a5f..e781bd2 100644 --- a/src/onaptests/steps/loop/clamp.py +++ b/src/onaptests/steps/loop/clamp.py @@ -29,7 +29,7 @@ class ClampStep(YamlTemplateBaseStep): super().__init__(cleanup=cleanup) self._yaml_template: dict = None self.add_step(OnboardClampStep(cleanup=cleanup)) - Clamp(cert=settings.CERT) + Clamp() self.loop_instance = None @property @@ -95,8 +95,7 @@ class ClampStep(YamlTemplateBaseStep): """Instantite a closed loopin CLAMP.""" loop = InstantiateLoop(template=loop_template, loop_name=loop_name, - operational_policies=operational_policies, - cert=settings.CERT) + operational_policies=operational_policies) return loop.instantiate_loop() def loop_counter(self, action: str) -> None: diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py index bc99169..b591f8d 100644 --- a/src/onaptests/steps/onboard/service.py +++ b/src/onaptests/steps/onboard/service.py @@ -1,7 +1,9 @@ +import time from typing import Any, Dict from yaml import load from onapsdk.configuration import settings +from onapsdk.exceptions import APIError, ResourceNotFound from onapsdk.sdc.component import Component from onapsdk.sdc.pnf import Pnf from onapsdk.sdc.properties import ComponentProperty @@ -63,8 +65,18 @@ class ServiceOnboardStep(BaseStep): if settings.PNF_NAME != "": pnf: Pnf = Pnf(name=settings.PNF_NAME) service.add_resource(pnf) - service.checkin() - service.onboard() + # If the service is already distributed, do not try to checkin/onboard (replay of tests) + # checkin is done if needed + # If service is replayed, no need to try to re-onboard the model + if not service.distributed: + try: + service.checkin() + except (APIError, ResourceNotFound): + # Retry as checkin may be a bit long + # Temp workaround to avoid internal race in SDC + time.sleep(5) + service.checkin() + service.onboard() class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): @@ -137,8 +149,18 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): service.create() self.declare_resources(service) self.assign_properties(service) - service.checkin() - service.onboard() + # If the service is already distributed, do not try to checkin/onboard (replay of tests) + # checkin is done if needed + # If service is replayed, no need to try to re-onboard the model + if not service.distributed: + try: + service.checkin() + except (APIError, ResourceNotFound): + # Retry as checkin may be a bit long + # Temp workaround to avoid internal race in SDC + time.sleep(5) + service.checkin() + service.onboard() def declare_resources(self, service: Service) -> None: """Declare resources. diff --git a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py index 7a0fbf2..a73f668 100644 --- a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py +++ b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py @@ -83,7 +83,7 @@ class PnfSimulatorCnfRegisterStep(BaseStep): super().execute() if not self.is_pnf_pod_running(): EnvironmentPreparationException("PNF simulator is not running") - time.sleep(5.0) # Let's still wait for PNF simulator to make sure it's initialized + time.sleep(30.0) # Let's still wait for PNF simulator to make sure it's initialized ves_ip, ves_port = self.get_ves_ip_and_port() response = requests.post( "http://portal.api.simpledemo.onap.org:30999/simulator/event", |