diff options
Diffstat (limited to 'src/onaptests/steps/simulator')
-rw-r--r-- | src/onaptests/steps/simulator/cds_mockserver.py | 62 | ||||
-rw-r--r-- | src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py | 4 |
2 files changed, 2 insertions, 64 deletions
diff --git a/src/onaptests/steps/simulator/cds_mockserver.py b/src/onaptests/steps/simulator/cds_mockserver.py deleted file mode 100644 index 6933fa0..0000000 --- a/src/onaptests/steps/simulator/cds_mockserver.py +++ /dev/null @@ -1,62 +0,0 @@ -# http://www.apache.org/licenses/LICENSE-2.0 -"""CDS mockserver registration module.""" - -import time - -import requests -from onapsdk.configuration import settings - -from onaptests.steps.base import BaseStep -from onaptests.steps.instantiate.msb_k8s import CreateInstanceStep -from onaptests.utils.exceptions import OnapTestException - - -class CdsMockserverCnfConfigureStep(BaseStep): - """Configure cds mockserver expectations.""" - - def __init__(self, cleanup: bool = False) -> None: - """Initialize step. - - Substeps: - - CreateInstanceStep. - """ - super().__init__(cleanup=cleanup) - self.add_step(CreateInstanceStep(cleanup=cleanup)) - - @property - def description(self) -> str: - """Step description.""" - return "Configure cds-mockserver." - - @property - def component(self) -> str: - """Component name.""" - return "Environment" - - @BaseStep.store_state - def execute(self) -> None: - """Create mockserver expectations. - - Use settings values: - - CDS_MOCKSERVER_EXPECTATIONS. - """ - super().execute() - time.sleep(60) # Wait for mockserver - for expectation in settings.CDS_MOCKSERVER_EXPECTATIONS: - try: - response = requests.put( - "http://portal.api.simpledemo.onap.org:30726/mockserver/expectation", - json={ - "httpRequest" : { - "method": expectation["method"], - "path": expectation["path"] - }, - "httpResponse" : { - "body": expectation["response"] - } - } - ) - response.raise_for_status() - except (requests.ConnectionError, requests.HTTPError) as http_error: - self._logger.debug(f"Can't register cds-mockserver expectation: {str(http_error)}") - raise OnapTestException("CDS mockserver not configured") 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 1960659..caeb20b 100644 --- a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py +++ b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py @@ -51,7 +51,7 @@ class PnfSimulatorCnfRegisterStep(BaseStep): k8s_watch: "Watch" = watch.Watch() try: for event in k8s_watch.stream(k8s_client.list_namespaced_pod, - namespace=settings.K8S_ADDITIONAL_RESOURCES_NAMESPACE, + namespace=settings.K8S_NAMESPACE, timeout_seconds=timeout_seconds): if event["object"].metadata.name == "pnf-macro-test-simulator": if not event["object"].status.phase in ["Pending", "Running"]: @@ -76,7 +76,7 @@ class PnfSimulatorCnfRegisterStep(BaseStep): config.load_kube_config(settings.K8S_CONFIG) k8s_client: "CoreV1API" = client.CoreV1Api() try: - for service in k8s_client.list_namespaced_service(namespace=settings.K8S_ONAP_NAMESPACE).items: + for service in k8s_client.list_namespaced_service(namespace=settings.K8S_NAMESPACE).items: if service.metadata.name == settings.DCAE_VES_COLLECTOR_POD_NAME: return service.spec.cluster_ip, service.spec.ports[0].port raise EnvironmentPreparationException("Couldn't get VES ip and port") |