diff options
author | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2023-01-31 15:14:41 +0100 |
---|---|---|
committer | Micha? Jagie??o <michal.jagiello@t-mobile.pl> | 2023-02-02 15:42:20 +0000 |
commit | 54b66f2da9ee9d9aafc07c3f78bd7d6b755e1d17 (patch) | |
tree | 3d133a790671ae1ff1fec84ccf2281d592197b66 | |
parent | b723ad3518ee635cdb2c5e1b9b5bc507bad1703c (diff) |
[TEST] Way of creating VES url changed
Issue-ID: TEST-389
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: I5bd418697bb21ddd3d841a8f1a3c4c97e7c66078
-rw-r--r-- | src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py | 21 |
1 files changed, 12 insertions, 9 deletions
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..3180733 100644 --- a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py +++ b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py @@ -63,14 +63,14 @@ class PnfSimulatorCnfRegisterStep(BaseStep): self._logger.error("Can't connect with k8s") raise OnapTestException - def get_ves_ip_and_port(self) -> Tuple[str, str]: - """Static method to get VES ip address and port. + def get_ves_protocol_ip_and_port(self) -> Tuple[str, str, str]: + """Static method to get VES protocol, ip address and port. Raises: EnvironmentPreparationException: VES pod is not running Returns: - Tuple[str, str]: VES IP and port + Tuple[str, str, str]: VES protocol, IP and port """ config.load_kube_config(settings.K8S_CONFIG) @@ -78,10 +78,13 @@ class PnfSimulatorCnfRegisterStep(BaseStep): try: for service in k8s_client.list_namespaced_service(namespace=settings.K8S_ONAP_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") - except urllib3.exceptions.HTTPError: - self._logger.error("Can't connect with k8s") + proto = "http" + if "443" in str(service.spec.ports[0].port): + proto = "https" + return proto, service.spec.cluster_ip, service.spec.ports[0].port + raise EnvironmentPreparationException("Couldn't get VES protocol, ip and port") + except Exception: + self._logger.exception("Can't connect with k8s") raise OnapTestException @BaseStep.store_state @@ -91,7 +94,7 @@ class PnfSimulatorCnfRegisterStep(BaseStep): if not self.is_pnf_pod_running(): EnvironmentPreparationException("PNF simulator is not running") time.sleep(settings.PNF_WAIT_TIME) # Let's still wait for PNF simulator to make sure it's initialized - ves_ip, _ = self.get_ves_ip_and_port() # Use only 8443 + ves_proto, ves_ip, ves_port = self.get_ves_protocol_ip_and_port() registration_number: int = 0 registered_successfully: bool = False while registration_number < settings.PNF_REGISTRATION_NUMBER_OF_TRIES and not registered_successfully: @@ -102,7 +105,7 @@ class PnfSimulatorCnfRegisterStep(BaseStep): "simulatorParams": { "repeatCount": 9999, "repeatInterval": 30, - "vesServerUrl": f"https://sample1:sample1@{ves_ip}:8443/eventListener/v7" + "vesServerUrl": f"{ves_proto}://sample1:sample1@{ves_ip}:{ves_port}/eventListener/v7" }, "templateName": "registration.json", "patch": { |