diff options
Diffstat (limited to 'tests/dcaegen2/prh-testcases/resources')
5 files changed, 21 insertions, 10 deletions
diff --git a/tests/dcaegen2/prh-testcases/resources/.env b/tests/dcaegen2/prh-testcases/resources/.env index a558a2e8..b1de55a9 100644 --- a/tests/dcaegen2/prh-testcases/resources/.env +++ b/tests/dcaegen2/prh-testcases/resources/.env @@ -1,5 +1,4 @@ -LOG_LEVEL=INFO -PRH_LOG_LEVEL=TRACE HOSTNAME=dcae-prh CONSUL_HOST=consul CONFIG_BINDING_SERVICE=cbs +CONFIG_BINDING_SERVICE_SERVICE_PORT=10000
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py index b9942611..b3f5f8d9 100644 --- a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py +++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py @@ -46,8 +46,7 @@ class PrhLibrary(object): @staticmethod def create_invalid_notification(json_file): output = {} - input = json.loads(json_file)[0] - + input = json.loads(json_file) output["correlationId"] = PrhLibrary.__extract_correlation_id_value(input) output["oamV4IpAddress"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "oamV4IpAddress") output["oamV6IpAddress"] = PrhLibrary.__extract_value_from_pnfRegistrationFields(input, "oamV6IpAddress") diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml index aba658b0..f8472a5d 100644 --- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml +++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml @@ -8,11 +8,10 @@ services: volumes: - ./simulator/certs:/tmp/certs environment: - - LOG_LEVEL - - PRH_LOG_LEVEL - - HOSTNAME - - CONSUL_HOST + - HOSTNAME=dcae-prh + - CONSUL_HOST # not in use, but still required by SDK - should be removed later on - CONFIG_BINDING_SERVICE + - CONFIG_BINDING_SERVICE_SERVICE_PORT container_name: prh depends_on: cbs: @@ -55,6 +54,8 @@ services: image: consul:1.0.6 restart: on-failure command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-prh", '{ + "logging.level.org.onap.dcaegen2.services.prh": "debug", + "logging.level.org.onap.dcaegen2.services.sdk": "debug", "dmaap.dmaapConsumerConfiguration.dmaapUserName":"admin", "dmaap.dmaapConsumerConfiguration.dmaapUserPassword":"admin", "dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json", diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index bd426db3..7bf12645 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -25,6 +25,7 @@ Verify event with missing required field is logged [Arguments] ${test_case_directory} ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json Set VES event in DMaaP ${invalid_ves_event} + Log Invalid ves event: ${invalid_ves_event} ${notification}= Create invalid notification ${invalid_ves_event} ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created: Wait Until Keyword Succeeds 10x 3000ms Check PRH json log ${error_msg} ${notification} @@ -34,7 +35,7 @@ Verify incorrect JSON event is logged [Arguments] ${test_case_directory} ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json Set VES event in DMaaP ${invalid_ves_event} - Check PRH log |com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray + Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created: Verify missing AAI record is logged [Timeout] 100s diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py index 43d0bca0..5ec601f6 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py @@ -2,6 +2,7 @@ import logging import re import sys import time +import json from http.server import BaseHTTPRequestHandler import httpServerLib @@ -99,7 +100,7 @@ class DMaaPHandler(BaseHTTPRequestHandler): try: if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDCAE-c12/c12', self.path): global event_ves - httpServerLib.set_response_200_ok(self, payload = event_ves) + httpServerLib.set_response_200_ok(self, payload=self.pack_event_json_as_quoted_string_into_array(event_ves)) logger.debug( 'DMaaPHandler GET /events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12 -> 200, content: ' + event_ves.decode("utf-8")) @@ -112,6 +113,16 @@ class DMaaPHandler(BaseHTTPRequestHandler): logger.error(e) httpServerLib.set_response_500_server_error(self) + def pack_event_json_as_quoted_string_into_array(self, event): + if event == DMAAP_EMPTY: + return DMAAP_EMPTY + else: + decoded = event_ves.decode("utf-8") + packed = '[' + json.dumps(decoded) + ']' + logger.info("prepared response: " + packed) + return packed.encode() + + def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"): handler_class.protocol_version = protocol httpServerLib.start_https_endpoint(2223, DMaaPHandler, keyfile="certs/dmaap-mr.key", certfile="certs/dmaap-mr.crt", ca_certs="certs/root.crt") |