From 40c1ddcef93d169922cdb2b95a817e2ff50a25ce Mon Sep 17 00:00:00 2001 From: Stavros Kanarakis Date: Wed, 27 Mar 2019 19:11:43 +0200 Subject: CSIT tests for bbs-event-processor Change-Id: Iaf4d5f47754489b111a0af90bf3cdf819d4e62f7 Issue-ID: DCAEGEN2-1355 Signed-off-by: Stavros Kanarakis --- .../dcaegen2/bbs-testcases/resources/BbsLibrary.py | 173 +++++++++++++++++++++ .../bbs-testcases/resources/bbs_library.robot | 108 +++++++++++++ .../bbs-testcases/resources/docker-compose.yml | 64 ++++++++ .../bbs-testcases/resources/simulator/AAI.py | 108 +++++++++++++ .../resources/simulator/AAI_simulator | 6 + .../bbs-testcases/resources/simulator/DMaaP.py | 92 +++++++++++ .../resources/simulator/DMaaP_simulator | 6 + .../resources/simulator/certs/aai_aai.onap.org.cer | 55 +++++++ .../resources/simulator/certs/ca_local_0.cer | 31 ++++ .../certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer | 51 ++++++ .../resources/simulator/certs/keystore.password | 1 + .../resources/simulator/certs/org.onap.aai.key | 29 ++++ .../resources/simulator/certs/org.onap.dcae.jks | Bin 0 -> 4512 bytes .../simulator/certs/org.onap.dcae.trust.jks | Bin 0 -> 1413 bytes .../simulator/certs/org.onap.dmaap-bc.key | 29 ++++ .../resources/simulator/certs/truststore.password | 1 + .../resources/simulator/httpServerLib.py | 37 +++++ 17 files changed, 791 insertions(+) create mode 100644 tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py create mode 100644 tests/dcaegen2/bbs-testcases/resources/bbs_library.robot create mode 100644 tests/dcaegen2/bbs-testcases/resources/docker-compose.yml create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password create mode 100644 tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py (limited to 'tests/dcaegen2/bbs-testcases/resources') diff --git a/tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py b/tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py new file mode 100644 index 00000000..8dbdc5a3 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py @@ -0,0 +1,173 @@ +import json + +import docker +import time +from docker.utils.json_stream import json_stream +from collections import OrderedDict + + +class BbsLibrary(object): + + def __init__(self): + pass + + @staticmethod + def check_for_log(search_for): + client = docker.from_env() + container = client.containers.get('bbs') + + alog = container.logs(stream=False, tail=1000) + try: + alog = alog.decode() + except AttributeError: + pass + + found = alog.find(search_for) + if found != -1: + return True + else: + return False + + @staticmethod + def create_pnf_name_from_auth(json_file): + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + return correlation_id + + @staticmethod + def get_invalid_auth_elements(json_file): + """ + Get the correlationId, oldState, newState, stateInterface, macAddress, swVersion elements + from the invalid message and place the elements into a JSON object (string) as fields for comparision + """ + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + oldState = json_to_python.get("event").get("stateChangeFields").get("oldState") + newState = json_to_python.get("event").get("stateChangeFields").get("newState") + stateInterface = json_to_python.get("event").get("stateChangeFields").get("stateInterface") + macAddress = json_to_python.get("event").get("stateChangeFields").get("additionalFields").get("macAddress") + swVersion = json_to_python.get("event").get("stateChangeFields").get("additionalFields").get("swVersion") + if swVersion is None: + swVersion = "" + + inv_fields = OrderedDict() + + #inv_fields = dict() + inv_fields['correlationId'] = correlation_id + inv_fields['oldState'] = oldState + inv_fields['newState'] = newState + inv_fields['stateInterface'] = stateInterface + inv_fields['macAddress'] = macAddress + inv_fields['swVersion'] = swVersion + + # Transform the dictionary to JSON string + json_str = json.dumps(inv_fields) + + # Need to remove spaces between elements + json_str = json_str.replace(', ', ',') + return json_str + + @staticmethod + def get_invalid_update_elements(json_file): + """ + Get the correlationId, attachment-point, remote-id, cvlan, svlan, elements + from the invalid message and place the elements into a JSON object (string) as fields for comparision + """ + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("correlationId") + attachmentPoint = json_to_python.get("additionalFields").get("attachment-point") + remoteId = json_to_python.get("additionalFields").get("remote-id") + cvlan = json_to_python.get("additionalFields").get("cvlan") + svlan = json_to_python.get("additionalFields").get("svlan") + + inv_fields = OrderedDict() + #inv_fields = dict() + inv_fields['correlationId'] = correlation_id + inv_fields['attachment-point'] = attachmentPoint + inv_fields['remote-id'] = remoteId + inv_fields['cvlan'] = cvlan + inv_fields['svlan'] = svlan + + # Transform the dictionary to JSON string + json_str = json.dumps(inv_fields) + + # Need to remove spaces between elements + json_str = json_str.replace(', ', ',') + return json_str + + @staticmethod + def compare_policy(dmaap_policy, json_policy): + resp = False + try: + python_policy = json.loads(json_policy).pop() + except: + python_policy = "" + + try: + python_dmaap_policy = json.loads(dmaap_policy) + except: + python_dmaap_policy = "" + + try: + d_policy = python_dmaap_policy.get("policyName") + except: + d_policy = "" + + try: + j_policy = python_policy.get("policyName") + except: + return "False" + + resp = "False" + if (d_policy == j_policy): + resp = "True" + return resp + + @staticmethod + def create_pnf_name_from_update(json_file): + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("correlationId") + return correlation_id + + @staticmethod + def ensure_container_is_running(name): + + client = docker.from_env() + + if not BbsLibrary.is_in_status(client, name, "running"): + print ("starting container", name) + container = client.containers.get(name) + container.start() + BbsLibrary.wait_for_status(client, name, "running") + + BbsLibrary.print_status(client) + + @staticmethod + def ensure_container_is_exited(name): + + client = docker.from_env() + + if not BbsLibrary.is_in_status(client, name, "exited"): + print ("stopping container", name) + container = client.containers.get(name) + container.stop() + BbsLibrary.wait_for_status(client, name, "exited") + + BbsLibrary.print_status(client) + + @staticmethod + def print_status(client): + print("containers status") + for c in client.containers.list(all=True): + print(c.name, " ", c.status) + + @staticmethod + def wait_for_status(client, name, status): + while not BbsLibrary.is_in_status(client, name, status): + print ("waiting for container: ", name, "to be in status: ", status) + time.sleep(3) + + @staticmethod + def is_in_status(client, name, status): + return len(client.containers.list(all=True, filters={"name": "^/"+name+"$", "status": status})) == 1 + diff --git a/tests/dcaegen2/bbs-testcases/resources/bbs_library.robot b/tests/dcaegen2/bbs-testcases/resources/bbs_library.robot new file mode 100644 index 00000000..34c94caa --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/bbs_library.robot @@ -0,0 +1,108 @@ +*** Settings *** +Library RequestsLibrary +Library Collections +Library BbsLibrary.py +Resource ../../../common.robot + +*** Keywords *** +Create header + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + Set Suite Variable ${suite_headers} ${headers} + +Create sessions + Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} + Set Suite Variable ${dmaap_setup_session} dmaap_setup_session + Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} + Set Suite Variable ${aai_setup_session} aai_setup_session + +Reset Simulators + Reset AAI simulator + Reset DMaaP simulator + +Set AAI Records + [Timeout] 30s + ${data}= Get Data From File ${AAI_PNFS} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_pnfs headers=${headers} data=${data} + Should Be Equal As Strings ${resp.status_code} 200 + ${data}= Get Data From File ${AAI_SERVICES} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_services headers=${headers} data=${data} + Should Be Equal As Strings ${resp.status_code} 200 + ${data}= Get Data From File ${AAI_PNF_NOT_FOUND} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_pnf_not_found headers=${headers} data=${data} + Should Be Equal As Strings ${resp.status_code} 200 + +Invalid rgmac auth event processing + [Arguments] ${input_invalid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${err_msg}= Catenate SEPARATOR= \\n RGW MAC address taken from event (Optional[]) does not match with A&AI metadata corresponding value + Wait Until Keyword Succeeds 20x 2000ms Check BBS log ${err_msg} + +Invalid auth event processing + [Arguments] ${input_invalid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${json_obj}= Get invalid auth elements ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log Incorrect CPE Authentication JSON event: + Wait Until Keyword Succeeds 20x 2000ms Check BBS log ${json_obj} +Valid auth event processing + [Arguments] ${input_valid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_valid_event_in_dmaap} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check policy ${AUTH_POLICY} + +Check policy + [Arguments] ${json_policy_file} + ${resp}= Get Request ${dmaap_setup_session} /events/dcaeClOutput headers=${suite_headers} + ${data}= Get Data From File ${json_policy_file} + ${result}= Compare policy ${resp.text} ${data} + Should Be Equal As Strings ${result} True + +Invalid update event processing + [Arguments] ${input_invalid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${json_obj}= Get invalid update elements ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log Incorrect Re-Registration + Wait Until Keyword Succeeds 20x 2000ms Check BBS log JSON event: + Wait Until Keyword Succeeds 20x 2000ms Check BBS log ${json_obj} + + +Valid update event processing + [Arguments] ${input_valid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_valid_event_in_dmaap} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check policy ${UPDATE_POLICY} + + +Check BBS log + [Arguments] ${searched_log} + ${status}= Check for log ${searched_log} + Should Be Equal As Strings ${status} True + +Set PNF name in AAI + [Arguments] ${pnfs_name} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_pnfs headers=${headers} data=${pnfs_name} + Should Be Equal As Strings ${resp.status_code} 200 + +Set event in DMaaP + [Arguments] ${event_in_dmaap} + ${resp} = Put Request ${dmaap_setup_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap} + Should Be Equal As Strings ${resp.status_code} 200 + +Reset AAI simulator + ${resp} = Post Request ${aai_setup_session} /reset + Should Be Equal As Strings ${resp.status_code} 200 + +Reset DMaaP simulator + ${resp}= Post Request ${dmaap_setup_session} /reset + Should Be Equal As Strings ${resp.status_code} 200 \ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/resources/docker-compose.yml b/tests/dcaegen2/bbs-testcases/resources/docker-compose.yml new file mode 100644 index 00000000..e42c0d29 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/docker-compose.yml @@ -0,0 +1,64 @@ +version: '3' +services: + bbs: + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.components.bbs-event-processor:1.0.0-SNAPSHOT + command: > + --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap_simulator + --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222 + --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap_simulator + --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222 + --aai.aaiClientConfiguration.aaiHostPortNumber=3333 + --aai.aaiClientConfiguration.aaiHost=aai_simulator + --aai.aaiClientConfiguration.aaiProtocol=http + ports: + - "32100:8100" + environment: + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_DMAAPHOSTNAME: dmaap_simulator + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_DMAAPPORTNUMBER: 2222 + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_DMAAPTOPICNAME: /events/unauthenticated_PNF_UPDATE + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_CONSUMERGROUP: + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_CONSUMERID: + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_DMAAPHOSTNAME: dmaap_simulator + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_DMAAPPORTNUMBER: 2222 + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_DMAAPTOPICNAME: /events/unauthenticated_CPE_AUTHENTICATION + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_CONSUMERGROUP: + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_CONSUMERID: + CONFIGS_DMAAP_PRODUCER_DMAAPHOSTNAME: dmaap-bc + CONFIGS_DMAAP_PRODUCER_DMAAPPORTNUMBER: 2222 + CONFIGS_DMAAP_PRODUCER_DMAAPTOPICNAME: /events/unauthenticated_DCAE_CL_OUTPUT + CONFIGS_AAI_CLIENT_AAIHOST: aai_simulator + CONFIGS_AAI_CLIENT_AAIPORT: 3333 + CONFIGS_AAI_CLIENT_AAIPROTOCOL: http + CONFIGS_APPLICATION_PIPELINESPOLLINGINTERVALSEC: 15 + CONFIGS_APPLICATION_PIPELINESTIMEOUTSEC: 10 + CONFIGS_APPLICATION_RE-REGISTRATION_POLICYSCOPE: "re-reg_policy_scope" + CONFIGS_APPLICATION_RE-REGISTRATION_CLCONTROLNAME: "re-reg_cl" + CONFIGS_APPLICATION_CPE-AUTHENTICATION_POLICYSCOPE: "cpe-auth_policy_scope" + CONFIGS_APPLICATION_CPE-AUTHENTICATION_CLCONTROLNAME: "cpe-auth_cl" + LOGGING_LEVEL_ORG_ONAP_BBS: TRACE + container_name: bbs + depends_on: + - dmaap-bc + - aai + + dmaap-bc: + image: dmaap-bc:latest + build: + context: simulator + dockerfile: DMaaP_simulator + ports: + - "2222:2222" + - "2223:2223" + - "2224:2224" + container_name: dmaap_simulator + + aai: + image: aai:latest + build: + context: simulator + dockerfile: AAI_simulator + ports: + - "3333:3333" + - "3334:3334" + - "3335:3335" + container_name: aai_simulator diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py new file mode 100644 index 00000000..ba32582d --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py @@ -0,0 +1,108 @@ +import re +import time +from http.server import BaseHTTPRequestHandler +import httpServerLib + +import json + +pnfs = [] +services = [] +pnf_not_found = '[{}]' + +class AAISetup(BaseHTTPRequestHandler): + + def do_PUT(self): + global pnfs + global services + global pnf_not_found + if re.search('/set_pnfs', self.path): + content_length = int(self.headers['Content-Length']) + pnfs = self.rfile.read(content_length) + pnfs = pnfs.decode() + httpServerLib.header_200_and_json(self) + elif re.search('/set_services', self.path): + content_length = int(self.headers['Content-Length']) + services = self.rfile.read(content_length) + services = services.decode() + httpServerLib.header_200_and_json(self) + elif re.search('/set_pnf_not_found', self.path): + content_length = int(self.headers['Content-Length']) + pnf_not_found = self.rfile.read(content_length) + pnf_not_found = pnf_not_found.decode() + httpServerLib.header_200_and_json(self) + + return + + def do_POST(self): + if re.search('/reset', self.path): + httpServerLib.header_200_and_json(self) + + return + + +class AAIHandler(BaseHTTPRequestHandler): + + def do_GET(self): + global pnfs + global services + global pnf_not_found + pnf_path = '/aai/v14/network/pnfs/pnf/' + service_path = '/aai/v14/nodes/service-instances/service-instance/' + found_resource = None + if re.search(pnf_path, self.path): + try: + python_pnfs = json.loads(pnfs) + except AttributeError: + python_pnfs = [] + for pnf_instance in python_pnfs: + try: + pnf_name = pnf_path + pnf_instance.get("pnf-name") + except AttributeError: + pnf_name = "PNF not found" + if re.search(pnf_name, self.path): + found_resource = pnf_instance + break + elif re.search(service_path, self.path): + try: + python_services = json.loads(services) + except AttributeError: + python_services = [] + for service_instance in python_services: + try: + service_name = service_path + service_instance.get("service-instance-id") + except AttributeError: + pnf_name = "Service not found" + if re.search(service_name, self.path): + found_resource = service_instance + break + + if found_resource is not None: + # Prepare the response for DMaaP (byte encoded JSON Object) + found_resource = json.dumps(found_resource) + found_resource = found_resource.encode() + httpServerLib.header_200_and_json(self) + self.wfile.write(found_resource) + else: + # Send a 404 message for not found + pnf_resp = pnf_not_found + # We have to replace the request line data + err_pnf_template = "nodes/pnfs/pnf/Wrong-PNF-Name" + pnf_resp = pnf_resp.replace(err_pnf_template, self.path) + pnf_resp = pnf_resp.encode() + httpServerLib.header_404_and_json(self) + self.wfile.write(pnf_resp) + + + return + +def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"): + handler_class.protocol_version = protocol + httpServerLib.start_http_endpoint(3333, AAIHandler) + httpServerLib.start_https_endpoint(3334, AAIHandler, keyfile="certs/org.onap.aai.key", certfile="certs/aai_aai.onap.org.cer", ca_certs="certs/ca_local_0.cer") + httpServerLib.start_http_endpoint(3335, AAISetup) + while 1: + time.sleep(10) + + +if __name__ == '__main__': + _main_() diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator new file mode 100644 index 00000000..a906bc58 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator @@ -0,0 +1,6 @@ +FROM python:3-alpine + +ADD AAI.py httpServerLib.py / +COPY certs/* /certs/ + +CMD [ "python", "./AAI.py" ] diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py new file mode 100644 index 00000000..edeec8cf --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py @@ -0,0 +1,92 @@ +import re +import time +from http.server import BaseHTTPRequestHandler +import httpServerLib + + +posted_event_from_bbs = b'[]' +received_event_to_get_method = b'[]' + + +class DmaapSetup(BaseHTTPRequestHandler): + + """ + This Handler is used by the test harness to prepare the buffers: + test harness places VES events using PUT from the harness into the + "received_event buffer" + test harness will write policy topics from the BBS us to the posted event buffer + """ + def do_PUT(self): + # Read the event from the test harness place it in the received event buffer + if re.search('/set_get_event', self.path): + content_length = int(self.headers['Content-Length']) + global received_event_to_get_method + received_event_to_get_method = self.rfile.read(content_length) + httpServerLib.header_200_and_json(self) + + return + + def do_GET(self): + # The test harness receives the policy triggers from the posted event + # by issuing a get and receiving the response. + if re.search('/events/dcaeClOutput', self.path): + global posted_event_from_bbs + httpServerLib.header_200_and_json(self) + self.wfile.write(posted_event_from_bbs) + + return + + def do_POST(self): + if re.search('/reset', self.path): + global posted_event_from_bbs + global received_event_to_get_method + posted_event_from_bbs = b'[]' + received_event_to_get_method = b'[]' + httpServerLib.header_200_and_json(self) + + return + + +class DMaaPHandler(BaseHTTPRequestHandler): + """ + This Handler is what the BBS uS connects to - The test library has posted the + the VES events in the setup Handler which are then received by the BBS uS via + this handler's do_GET function. + Likewise the policy trigger posted by the BBS uS is received and placed in the + in the posted event buffer which the test harness retrieves using the setup handler. + """ + + def do_POST(self): + # Post of the policy triggers from the BBS uS + if re.search('/events/unauthenticated.DCAE_CL_OUTPUT', self.path): + global posted_event_from_bbs + content_length = int(self.headers['Content-Length']) + posted_event_from_bbs = self.rfile.read(content_length) + httpServerLib.header_200_and_json(self) + + return + + def do_GET(self): + # BBS uS issues a Get to receive VES and PNF UPdate event from DMAAP + global received_event_to_get_method + if re.search('/events/unauthenticated.PNF_UPDATE', self.path): + httpServerLib.header_200_and_json(self) + self.wfile.write(received_event_to_get_method) + elif re.search('/events/unauthenticated_CPE_AUTHENTICATION/OpenDcae-c12/c12', self.path): + httpServerLib.header_200_and_json(self) + self.wfile.write(received_event_to_get_method) + + return + + +def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"): + handler_class.protocol_version = protocol + httpServerLib.start_http_endpoint(2222, DMaaPHandler) + httpServerLib.start_https_endpoint(2223, DMaaPHandler, keyfile="certs/org.onap.dmaap-bc.key", certfile="certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer", ca_certs="certs/ca_local_0.cer") + httpServerLib.start_http_endpoint(2224, DmaapSetup) + while 1: + time.sleep(10) + + +if __name__ == '__main__': + _main_() diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator new file mode 100644 index 00000000..8139fc33 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator @@ -0,0 +1,6 @@ +FROM python:3-alpine + +ADD DMaaP.py httpServerLib.py / +COPY certs/* /certs/ + +CMD [ "python", "./DMaaP.py" ] diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer new file mode 100644 index 00000000..327f57b6 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer @@ -0,0 +1,55 @@ +-----BEGIN CERTIFICATE----- +MIIE5TCCA82gAwIBAgIJAI5fEseaW2LVMA0GCSqGSIb3DQEBCwUAMEcxCzAJBgNV +BAYTAlVTMQ0wCwYDVQQKDARPTkFQMQ4wDAYDVQQLDAVPU0FBRjEZMBcGA1UEAwwQ +aW50ZXJtZWRpYXRlQ0FfMjAeFw0xODEwMTgxMDM3MzJaFw0xOTA0MTgxMDM3MzJa +MGYxDDAKBgNVBAMMA2FhaTEPMA0GCSqGSIb3DQEJARYAMRkwFwYDVQQLDBBhYWlA +YWFpLm9uYXA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UdDgQWBBQEBI0AJDjGnHjXgFdBZ0kGgOZyRzAfBgNVHSMEGDAWgBTtc8Wb +I4DL8Bm6CVi8//GsTyq8NTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAt4VCLb2UHiZpDfSQbe62vlFzsGlODYKF +k7BhW9Q5jfIXpPhhtBLFwJFEKAWFLVWubz+YIa7I5wtniS6zEPC/5t3JOiEXMJQY +PfaPDSsovZ+eShu0QtrjjldFwL2MiqNsd2IWLSIRQUP63RZGBRTTxSsxB0VAfRyT +cu/8znpmZsHna3DspGZQputm7qsxgUhAcPCdo9RQtG6Ox6L1wTXUJmTPHdKQtZjr +qqSQ7kn8u3i5KQYYapmc3UO+CBbzoLPD5Rrlq+ROBbiNd9R/j5vVgRO7vsU9SHnm +AaKFEjDPTSjDtMOxu1BsTNmftaE2jcYa9/ZW67H8URCuo92NE0cZRxBqHkPUjH3/ +/S43/TBAfjfarF5WW7iMAEZfEGhrQu26JWXBMcZshStuHUEPl2b+RC5LZcBMYKgi +SqSOXzpiJeRNASpXKCQQZG8n03c/jBf1U20HaK/4Z2ikOql5B21suxhUbixG1EQN +DOrFGOFUqG4Eyw+xjUR5rTfDnpKgQfJo0/aohZs9p5x+UwitkrQkJQ1ZmEzeVDjm +7xsmOcAJS2T9DLle6fDWvyh76InymAPxzk1/2AWOp8uw8iwNfFxE+p+M7h0psZxp +SnvlgASASdWlZLcMQtNiiKzMK75FW9SMctQfA/RfohNEwivpp6tNpgJozoKmhoPK +zs5HS/mx8GI= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer new file mode 100644 index 00000000..ff37eaf7 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIF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gNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAN +BgkqhkiG9w0BAQsFAAOCAgEAW4IYy1PUrV/wHblIGFTBo5z7EB33rpHfAJzbDkop +2n5wOlmh78pkeRNb1TOKcSHJPw0MdkwVBPI1wm/SOpHUPmKTW1muO6RUnFjZ68y9 +DiVa6zCW/RBFeG3f8kywxgqPLml1TbikRuMBU0ucOa/bXZ98P2hMLkjWTgeARGSj +QCb7QyqeFzG0mPmAuX6zMj5xwpdyPB0zCoRGXa/BIWEvYjgkaRM+E+9oRWt/6BHQ +4uw11R7gAV4/TSu7qYNfTMllBaLJ0o/1q0QF16e4mV1E4erDfWKlrvUlgCaHCx8Q +3PL7ovM4jjrTNAjnX0q5xtWbF0mlJhJk/NbPDb7hArBv4vp9XoITyRW1vcbe94jv +GzqLKlvBQUxGue4kLYDmUFdog7gaCkEH3N4mH3ad4HZUsOMeanvVgbVZr10VOlNq +TEWqDPATayJdo+VhJCGc6hVa+IJsDTAa/z2MLybqcoOfNT/rxYIdvlX4OjSqAqOj +bSivsCe9c4km56pP2ufA/woPzh+Z46Ukt+krGyFQwKdQQLh5Pp7Yuhvdld/5kd8M +S2fqcBFpzzBSj+huVayw6jFi5qLlISouhCVsc0rBqvnfuQTQwmfFIlfaHBTSjniv +5DdibZEtMqYYXl1VB4XUHTt5dOGHLEX2w/d5887DQVLUbaUKm1mfScb/vPjGgk6/ +re4= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer new file mode 100644 index 00000000..756dd3a0 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer @@ -0,0 +1,51 @@ +-----BEGIN CERTIFICATE----- +MIIELDCCAxSgAwIBAgIJAI5fEseaW2L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BI0AJDjGnHjXgFdBZ0kGgOZyRzAfBgNVHSMEGDAWgBTtc8Wb +I4DL8Bm6CVi8//GsTyq8NTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAt4VCLb2UHiZpDfSQbe62vlFzsGlODYKF +k7BhW9Q5jfIXpPhhtBLFwJFEKAWFLVWubz+YIa7I5wtniS6zEPC/5t3JOiEXMJQY +PfaPDSsovZ+eShu0QtrjjldFwL2MiqNsd2IWLSIRQUP63RZGBRTTxSsxB0VAfRyT +cu/8znpmZsHna3DspGZQputm7qsxgUhAcPCdo9RQtG6Ox6L1wTXUJmTPHdKQtZjr +qqSQ7kn8u3i5KQYYapmc3UO+CBbzoLPD5Rrlq+ROBbiNd9R/j5vVgRO7vsU9SHnm +AaKFEjDPTSjDtMOxu1BsTNmftaE2jcYa9/ZW67H8URCuo92NE0cZRxBqHkPUjH3/ +/S43/TBAfjfarF5WW7iMAEZfEGhrQu26JWXBMcZshStuHUEPl2b+RC5LZcBMYKgi +SqSOXzpiJeRNASpXKCQQZG8n03c/jBf1U20HaK/4Z2ikOql5B21suxhUbixG1EQN +DOrFGOFUqG4Eyw+xjUR5rTfDnpKgQfJo0/aohZs9p5x+UwitkrQkJQ1ZmEzeVDjm +7xsmOcAJS2T9DLle6fDWvyh76InymAPxzk1/2AWOp8uw8iwNfFxE+p+M7h0psZxp +SnvlgASASdWlZLcMQtNiiKzMK75FW9SMctQfA/RfohNEwivpp6tNpgJozoKmhoPK +zs5HS/mx8GI= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password new file mode 100644 index 00000000..39823872 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password @@ -0,0 +1 @@ +mYHC98!qX}7h?W}jRv}MIXTJ \ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key new file mode 100644 index 00000000..b9a22cf3 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key @@ -0,0 +1,29 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCCnz1BBkcDy1M7 +3ANgkbfwYANSJPdnU/meXpgHKYvXa8xbEI3Lsi5EnB7o9nthZFdU5dPZRFV5uJEO +l0pjt3ogmPo0XZGYO++GfRNLq+c2YVmYjTLgFvEz6GzUtLueYjrl2JItGRugx0wN +PXQmaAX3/8wD7nOTAZjlmuSWCeeJu5GBaX4aaiwVOONDGhmZZ7jISTE0xvvU936E +CnUhSZtt/qRvnA1EJB/Hhs5Se4VPx6lTXYf8PXquI0IgDV49hlLhbPMKadQ8lo2y +itiaSMJHsLZ1Wt6ob9oNFlBcceq3tfXPMVVylssuAI1pc3HsbmV7kMIwg0P1fyVo +IALHlXgDAgMBAAECggEATFkLEpC6vWsAsYI9rxo9KxDToBXfTdP1mS2tKrKL/FQT +1D5uwtrY1F10a7J2F0zxBrx3AQ1B8K2Ci8a+Ql6h0Z/YzvbJ/PM7Y56Dwr0tncl0 +9wfA7t46CZ8WzZT9/OtphaL6fcWpMmaK+0oqM7ClnHk1JC8h+pD6b2oDpfcQEJ5r +hxFxdOotKgMzANMqTydteecfefy9l0hzgFiymxLZAo7ktW3HFpXO5HOgh1vkm5Pu +FedGRwiI/RBqad2T59J/XcRH0f5Ky7sgpyCShwqIp23xpdum10N0/MTzY5iu/gvR +pXGaPeYUrSPoLwuoMGAUm9wFbDqskI/mQzw6/rnfsQKBgQDU2O7ogZ/BjDVtjpfL +NntXhLOq02U+dB16ZXSalMbsG//FILVLL/Ths2wutKk/9IIiC1qI4NhDc0smDkgJ +l+oTZTnhVxZhWvOYovz7T3L3mp9VBIA0lW62dTDLK9gT6IRoQGN1fzzXF7ZfgOME +irDQqBSfMqt5YCeQOKNe29eo5QKBgQCdGrLaGHBeWBdhvG8XcybJDk2Q9XnojO69 +2UtfJ64+hzTc2MFvyBlWymZt3/Qq3llP/K9WUYW/ohL9l8rTXHEfBGpQVPzU2roQ +iicbx/zc2qfO79YaE10D/paekX2vrpoJlhtp0yMU/HMEYxrucbYQJEdKx9frcTXo +fQ9l5V+WxwKBgQDKEkYGsQGFk+IpZ+XOhKPmu9KDDH0jJMPTrrxcAYE1KYPSl7Hm +dtoK6Pd9BAFm+XAOeC70olpO9wdSUt6rVPFihojD2ZUiymFX+O0qfgwM7Fv2L/az +dWcNjAbN7IsQo4AJJZAHPcv5/MYkt01Pw4gIIHqrhURsUBBfiJX5ecetzQKBgC9I +NcPFzyvVv1O+7oBUO7wO/fE+r+35XHDu0OxWeO6Aqrw80BrgUh/40lMHL+km+iJE +nlCQQHyoPqbr5DMwgysenRCIQ3+cRJttuM93pPajKBXzwLAgW8I0AQjAKN+S4PE5 +qA51aP2L7OHJIfXZaz34bSxocOd/LwZFfTjhi59JAoGAVc3HAzQOkrCs1GPXvuOx +YwJUyuwLtCzcb05q+ys/5b/02RxTl4QPfOPqj47y8SDUUC7Cbr6ktqAkfsBOyPPj +tSniVhPKa4XdP0Brsil934sd3shvwrpEb9Xs6ialTid+PKaU/rFn1DYWZUP8lNMK +tq0nYLX/Z6N7LHiz32G9Kjs= +-----END PRIVATE KEY----- + diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks new file mode 100644 index 00000000..e74ce64f Binary files /dev/null and b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks differ diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks new file mode 100644 index 00000000..10103cfb Binary files /dev/null and b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks differ diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key new file mode 100644 index 00000000..880a33bf --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key @@ -0,0 +1,29 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCzaZBJ5KyErhms +DBzz9A0dmJRUguVDBjKi+I98vbvyZXU5dJihNb4/MVTVO/ofAoQUver2L3/LWbQO +OE/h+sek1VVOjkoh4K/p8iwBien+nnQ/cQ6HcAl6G1mbgC3E3oN4yVoG/XUZhRSb +oTrRDfpjpaCSWry7UoOeBgnLX9AGXxoCIluPa+kvrhZIjdzI3P+p4jj8/EeyoEdQ +Uj3oZwu0s8sNKUhBahahmGSJBMetThLHn+dV1aKF9zRHT6Mbkgf6YNvxZQ2bIedo +eKeu3kSvWzKlT83EP42VE8U7UrgPHjSzF8CW7YsUKWUOBJL9dx+x7SfL9OsvZFYQ +ugg7P02NAgMBAAECggEAfPetwlqe9DgUt6skS6SVsiTCRO9746iggrXhtECwdlHH +SkL1wWye3INvFKwXN5xYBd6Xl+1T9X/BFBqTQdOdViompnYkGt7XiXvevR+kNm+G +h14ngZ0/bKc6Tj8FIljfeLW/mJjZBPKWfSTbxBwZaWlHpEnBpjT+aobIMbnGO3i8 +iuPEIlSTmI/MmIvwyXkJ8r41phIZpdhtyKACx5LSvSArwPTYzVLyaGBJ63T4Qcat +GY/Oa1nAJkbFT46sP06O+sm1UIVUGbjewzPaDnfdFyJWmae0nGn1xU8VZUPI7rfu +YCf7le2grgtKy16jQo0o69RGYc4ebP27DKGd8YJHHQKBgQDts/7x6sG3fqPvbv9D +M5LDraslrj+noHGVcvCfigcgngvnMGcB/R8IT6YPmNRfATHV/UTLuW++PuqXsR21 +/WwJVbxudZ3alX7sz6CTGvcCQvnvPQm2e/iVW/JFrQu/poPxL1k3talDdKFWTRql +ZvQE05YjdTutlN2hGvqjSTZ1AwKBgQDBOO7GmG4FRQ4jXvUULXKMRUw+UzUy9NAV +io1b3CiwWynsdW2OPp6Jy6GB6+e7Di2M0i35hkpQd5NoeDnVqkm9ERYLnHr9FAs0 +5cKT7DDRC9ddJesJrqdhqGfhZCHMoqEiDRf3kNMBfFMV1TCefdQ0kIFYUuhHgboJ +aK+GqmtGLwKBgEEqmpdaA7e5mVn39TVIO1E4GHahGcRr4RfWxg8G+UNA8QR1qZfK +/Cn8JAucm4RcQHxpDeZINVFT0F676OhOzMKWZa1mw1r8pypnFZ+ewd81221yL2p+ +/Dx+U6I0eccV8JA7qdrzC695lw2g39A+tGFqXHvmFPFWoZgcXGBNnwdfAoGBAJ8y +9mEAhF2pKN3xxgGq9F8oVYpgakuis7Ob5Z5TBd9QLXmawvpZE6y670YphVN0egk1 +vxWBFMe5zeVccWJfHMQ/SKemdRsBob4itC/Gge4rUHV54W6nzVdENtrY8pQ1RofU +u/OJCqGFursZXSaoy+fHTBrmrGUGOK655y0QSrSXAoGBANbSu8DfjJwDHcWTstcn +XJ/bHB6aZmKe4ibOSFBMsOuy0AP1vRxQTgvQhgeRWm5ngv7YhPes2UHqRktadfGz +VUzx9/ILpL5skhIFEzgEP32cO1tQNE1vxODs3zg+U/Wy9gxJt0dLCB/sPQJcGLri +mkzev7AyLLr137K+ssxhczqg +-----END PRIVATE KEY----- + diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password new file mode 100644 index 00000000..168e64bd --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password @@ -0,0 +1 @@ +*TQH?Lnszprs4LmlAj38yds( \ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py b/tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py new file mode 100644 index 00000000..d963169d --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py @@ -0,0 +1,37 @@ +import _thread +import ssl +from http.server import HTTPServer + + +def header_200_and_json(self): + self.send_response(200) + self.send_header('Content-Type', 'application/json') + self.end_headers() + +def header_404_and_json(self): + self.send_response(404) + self.send_header('Content-Type', 'application/json') + self.end_headers() + +def start_http_endpoint(port, handler_class): + _thread.start_new_thread(init_http_endpoints, (port, handler_class)) + + +def start_https_endpoint(port, handler_class, keyfile, certfile, ca_certs): + _thread.start_new_thread(init_https_endpoints, (port, handler_class, keyfile, certfile, ca_certs)) + + +def init_http_endpoints(port, handler_class, server_class=HTTPServer): + server = server_class(('', port), handler_class) + sa = server.socket.getsockname() + print("Serving HTTP on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() + + +def init_https_endpoints(port, handler_class, keyfile, certfile, ca_certs, server_class=HTTPServer): + server = server_class(('', port), handler_class) + server.socket = ssl.wrap_socket(server.socket, keyfile=keyfile, certfile=certfile, + ca_certs=ca_certs, server_side=True) + sa = server.socket.getsockname() + print("Serving HTTPS on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() -- cgit 1.2.3-korg