3 from http.server import BaseHTTPRequestHandler
9 class AAISetup(BaseHTTPRequestHandler):
12 if re.search('/set_pnfs', self.path):
14 content_length = int(self.headers['Content-Length'])
15 pnfs = self.rfile.read(content_length)
16 httpServerLib.header_200_and_json(self)
21 if re.search('/reset', self.path):
24 httpServerLib.header_200_and_json(self)
29 class AAIHandler(BaseHTTPRequestHandler):
32 pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode()
33 if re.search('wrong_aai_record', self.path):
34 self.send_response(400)
36 elif re.search(pnfs_name, self.path):
37 self.send_response(200)
43 def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"):
44 handler_class.protocol_version = protocol
45 httpServerLib.start_http_endpoint(3333, AAIHandler)
46 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")
47 httpServerLib.start_http_endpoint(3335, AAISetup)
52 if __name__ == '__main__':