3 from http.server import BaseHTTPRequestHandler
6 posted_event_from_prh = b'Empty'
7 received_event_to_get_method = b'Empty'
10 class DmaapSetup(BaseHTTPRequestHandler):
13 if re.search('/set_get_event', self.path):
14 global received_event_to_get_method
15 content_length = int(self.headers['Content-Length'])
16 received_event_to_get_method = self.rfile.read(content_length)
17 httpServerLib.header_200_and_json(self)
22 if re.search('/events/pnfReady', self.path):
23 httpServerLib.header_200_and_json(self)
24 self.wfile.write(posted_event_from_prh)
29 if re.search('/reset', self.path):
30 global posted_event_from_prh
31 global received_event_to_get_method
32 posted_event_from_prh = b'Empty'
33 received_event_to_get_method = b'Empty'
34 httpServerLib.header_200_and_json(self)
39 class DMaaPHandler(BaseHTTPRequestHandler):
42 if re.search('/events/unauthenticated.PNF_READY', self.path):
43 global posted_event_from_prh
44 content_length = int(self.headers['Content-Length'])
45 posted_event_from_prh = self.rfile.read(content_length)
46 httpServerLib.header_200_and_json(self)
51 if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12', self.path):
52 httpServerLib.header_200_and_json(self)
53 self.wfile.write(received_event_to_get_method)
58 def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"):
59 handler_class.protocol_version = protocol
60 httpServerLib.start_http_endpoint(2222, DMaaPHandler)
61 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")
62 httpServerLib.start_http_endpoint(2224, DmaapSetup)
67 if __name__ == '__main__':