aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2021-05-28 14:16:05 +0000
committerMorgan Richomme <morgan.richomme@orange.com>2021-05-28 15:24:30 +0000
commitd04b13030287261bd6fc7d2c82096fc1b75f3067 (patch)
tree54d749524cdbe48e00bb33b1bad0abcd107828ef /src
parentb27c9a646f6cc1ad6386a41f45f3a0a0c9606ab2 (diff)
[TEST] Use nf-simulator/vesclient
Pnf-simulator created "mongo" service and deployment what causes errors. With the nf-simulator/vesclinet we could create mogno service with custom name Issue-ID: TEST-341 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: Iafde4be988d44291a56c649a1902319bbeeb050c (cherry picked from commit fc0c7c85fc3d45055a274dd24fb134a476725678)
Diffstat (limited to 'src')
-rw-r--r--src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py55
-rw-r--r--[-rwxr-xr-x]src/onaptests/templates/artifacts/pnf-simulator.tar.gzbin1233 -> 1225 bytes
2 files changed, 24 insertions, 31 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 f3e4583..4b09328 100644
--- a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py
+++ b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py
@@ -11,7 +11,7 @@ import urllib3
from onaptests.steps.base import BaseStep
from onaptests.steps.instantiate.msb_k8s import CreateInstanceStep
-from onaptests.utils.exceptions import EnvironmentPreparationException
+from onaptests.utils.exceptions import EnvironmentPreparationException, OnapTestException
class PnfSimulatorCnfRegisterStep(BaseStep):
@@ -90,32 +90,19 @@ class PnfSimulatorCnfRegisterStep(BaseStep):
super().execute()
if not self.is_pnf_pod_running():
EnvironmentPreparationException("PNF simulator is not running")
- 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",
- json={
- "vesServerUrl": f"https://{ves_ip}:{ves_port}/eventListener/v7",
- "event": {
- "event": {
- "commonEventHeader": {
- "domain": "pnfRegistration",
- "eventId": "ORAN_SIM_400600927_2020-04-02T17:20:22.2Z",
- "eventName": "pnfRegistration",
- "eventType": "EventType5G",
- "sequence": 0,
- "priority": "Low",
- "reportingEntityId": "",
- "reportingEntityName": "ORAN_SIM_400600927",
- "sourceId": "",
- "sourceName": settings.SERVICE_INSTANCE_NAME,
- "startEpochMicrosec": 94262132085746,
- "lastEpochMicrosec": 94262132085746,
- "nfNamingCode": "sdn controller",
- "nfVendorName": "sdn",
- "timeZoneOffset": "+00:00",
- "version": "4.0.1",
- "vesEventListenerVersion": "7.0.1"
+ 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
+ registration_number: int = 0
+ registered_successfully: bool = False
+ while registration_number < settings.PNF_REGISTRATION_NUMBER_OF_TRIES and not registered_successfully:
+ try:
+ response = requests.post(
+ "http://portal.api.simpledemo.onap.org:30999/simulator/start",
+ json={
+ "simulatorParams": {
+ "repeatCount": 9999,
+ "repeatInterval": 30,
+ "vesServerUrl": f"https://sample1:sample1@{ves_ip}:8443/eventListener/v7"
},
"templateName": "registration.json",
"patch": {
@@ -130,7 +117,13 @@ class PnfSimulatorCnfRegisterStep(BaseStep):
}
}
}
- }
- }
- )
- response.raise_for_status()
+ )
+ response.raise_for_status()
+ registered_successfully = True
+ self._logger.info(f"PNF registered with {settings.SERVICE_INSTANCE_NAME} source name")
+ except (requests.ConnectionError, requests.HTTPError) as http_error:
+ self._logger.debug(f"Can't connect with PNF simulator: {str(http_error)}")
+ registration_number = registration_number + 1
+ time.sleep(settings.PNF_WAIT_TIME)
+ if not registered_successfully:
+ raise OnapTestException("PNF not registered successfully")
diff --git a/src/onaptests/templates/artifacts/pnf-simulator.tar.gz b/src/onaptests/templates/artifacts/pnf-simulator.tar.gz
index 58cde89..a7e6311 100755..100644
--- a/src/onaptests/templates/artifacts/pnf-simulator.tar.gz
+++ b/src/onaptests/templates/artifacts/pnf-simulator.tar.gz
Binary files differ