Loading services/docker-compose-capif.yml +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ services: - ${CAPIF_INTERCONNECTION_HOSTNAME:-capifcore-b}:host-gateway environment: - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CAPIF_HTTPS_PORT=${CAPIF_HTTPS_PORT} - CONTAINER_NAME=${HELPER_CONTAINER_NAME} - VAULT_HOSTNAME=${CAPIF_VAULT} - VAULT_ACCESS_TOKEN=${CAPIF_VAULT_TOKEN} Loading services/helper/helper_service/services/interconnection/core/capifdomaindetails.py +36 −2 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ class CapifDomainOperations(Resource): payload = json.dumps({ "caRoot": server_ca.decode("utf-8"), "ccfId": config['ccf_id'], "dstProvDom": os.getenv("CAPIF_HOSTNAME"), "dstProvDom": "{}:{}".format(os.getenv("CAPIF_HOSTNAME"), os.getenv("CAPIF_HTTPS_PORT")), "publicKey": server_pub.decode("utf-8") }) headers = { Loading Loading @@ -108,4 +108,38 @@ class CapifDomainOperations(Resource): def delete_capifdomain(self, ccf_id): """Remove an interconnection request for a CCF.""" pass current_app.logger.debug("Interconnection: Delete domain") current_app.logger.debug(ccf_id) interconnected_col = self.db.get_col_by_name(self.db.interconnected) interconnected_ccf = interconnected_col.find_one({"ccf_id": ccf_id}) if interconnected_ccf: current_app.logger.debug("CAPIF domain with ccf_id {} interconnected".format(ccf_id)) # Retrieve the destination provider domain from the interconnected collection dst_prov_dom = interconnected_ccf.get("dst_prov_dom") # Retrieve the CAPIF configuration from the database to get the CCF ID of the originator CCF config_col = self.db.get_col_by_name(self.db.capif_configuration) config = config_col.find_one({}, {"_id": 0}) url = "https://{}/helper/interconnection/establish/{}".format(dst_prov_dom, config['ccf_id']) headers = { 'accept': 'application/problem+json' } try: response = requests.request("DELETE", url, headers=headers, cert=('certs/server.crt', 'certs/server.key'), verify='certs/ca.crt') if response.status_code in (204, 404): interconnected_col.delete_one({"ccf_id": ccf_id}) return make_response("CAPIF domain with ccf_id {} deleted".format(ccf_id), 204) else: return Response(response.text, status=response.status_code, mimetype="application/json") except requests.exceptions.RequestException as exc: return not_found_error( detail="CAPIF domain with ccf_id {} not found".format(ccf_id), cause="NOT_FOUND", ) return not_found_error("CAPIF domain with ccf_id {} not found".format(ccf_id)) services/helper/helper_service/services/interconnection/core/ccfinstancedetails.py +13 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ class CcfInstanceOperations(Resource): ccfinstancedetails_dict['ca_root'] = server_ca.decode("utf-8") ccfinstancedetails_dict['public_key'] = server_pub.decode("utf-8") ccfinstancedetails_dict['ccf_id'] = config['ccf_id'] ccfinstancedetails_dict['dst_prov_dom'] = os.getenv("CAPIF_HOSTNAME") ccfinstancedetails_dict['dst_prov_dom'] = "{}:{}".format(os.getenv("CAPIF_HOSTNAME"), os.getenv("CAPIF_HTTPS_PORT")) current_app.logger.debug(ccfinstancedetails_dict) ccfinstancedetails_new = CcfInstanceDetails().from_dict(dict_to_camel_case(ccfinstancedetails_dict)) Loading @@ -77,4 +77,15 @@ class CcfInstanceOperations(Resource): def delete_ccfinstance(self, ccf_id): """Remove an established interconnection with a peer CCF.""" pass No newline at end of file current_app.logger.debug("Interconnection: Remove instance") current_app.logger.debug(ccf_id) interconnected_col = self.db.get_col_by_name(self.db.interconnected) interconnected_ccf = interconnected_col.find_one({"ccf_id": ccf_id}) if interconnected_ccf: interconnected_col.delete_one({"ccf_id": ccf_id}) res = make_response(object = "CCF instance with ccf_id {} deleted".format(ccf_id), status=204) else: res = not_found_error("CCF instance with ccf_id {} not found".format(ccf_id)) return res Loading
services/docker-compose-capif.yml +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ services: - ${CAPIF_INTERCONNECTION_HOSTNAME:-capifcore-b}:host-gateway environment: - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} - CAPIF_HTTPS_PORT=${CAPIF_HTTPS_PORT} - CONTAINER_NAME=${HELPER_CONTAINER_NAME} - VAULT_HOSTNAME=${CAPIF_VAULT} - VAULT_ACCESS_TOKEN=${CAPIF_VAULT_TOKEN} Loading
services/helper/helper_service/services/interconnection/core/capifdomaindetails.py +36 −2 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ class CapifDomainOperations(Resource): payload = json.dumps({ "caRoot": server_ca.decode("utf-8"), "ccfId": config['ccf_id'], "dstProvDom": os.getenv("CAPIF_HOSTNAME"), "dstProvDom": "{}:{}".format(os.getenv("CAPIF_HOSTNAME"), os.getenv("CAPIF_HTTPS_PORT")), "publicKey": server_pub.decode("utf-8") }) headers = { Loading Loading @@ -108,4 +108,38 @@ class CapifDomainOperations(Resource): def delete_capifdomain(self, ccf_id): """Remove an interconnection request for a CCF.""" pass current_app.logger.debug("Interconnection: Delete domain") current_app.logger.debug(ccf_id) interconnected_col = self.db.get_col_by_name(self.db.interconnected) interconnected_ccf = interconnected_col.find_one({"ccf_id": ccf_id}) if interconnected_ccf: current_app.logger.debug("CAPIF domain with ccf_id {} interconnected".format(ccf_id)) # Retrieve the destination provider domain from the interconnected collection dst_prov_dom = interconnected_ccf.get("dst_prov_dom") # Retrieve the CAPIF configuration from the database to get the CCF ID of the originator CCF config_col = self.db.get_col_by_name(self.db.capif_configuration) config = config_col.find_one({}, {"_id": 0}) url = "https://{}/helper/interconnection/establish/{}".format(dst_prov_dom, config['ccf_id']) headers = { 'accept': 'application/problem+json' } try: response = requests.request("DELETE", url, headers=headers, cert=('certs/server.crt', 'certs/server.key'), verify='certs/ca.crt') if response.status_code in (204, 404): interconnected_col.delete_one({"ccf_id": ccf_id}) return make_response("CAPIF domain with ccf_id {} deleted".format(ccf_id), 204) else: return Response(response.text, status=response.status_code, mimetype="application/json") except requests.exceptions.RequestException as exc: return not_found_error( detail="CAPIF domain with ccf_id {} not found".format(ccf_id), cause="NOT_FOUND", ) return not_found_error("CAPIF domain with ccf_id {} not found".format(ccf_id))
services/helper/helper_service/services/interconnection/core/ccfinstancedetails.py +13 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ class CcfInstanceOperations(Resource): ccfinstancedetails_dict['ca_root'] = server_ca.decode("utf-8") ccfinstancedetails_dict['public_key'] = server_pub.decode("utf-8") ccfinstancedetails_dict['ccf_id'] = config['ccf_id'] ccfinstancedetails_dict['dst_prov_dom'] = os.getenv("CAPIF_HOSTNAME") ccfinstancedetails_dict['dst_prov_dom'] = "{}:{}".format(os.getenv("CAPIF_HOSTNAME"), os.getenv("CAPIF_HTTPS_PORT")) current_app.logger.debug(ccfinstancedetails_dict) ccfinstancedetails_new = CcfInstanceDetails().from_dict(dict_to_camel_case(ccfinstancedetails_dict)) Loading @@ -77,4 +77,15 @@ class CcfInstanceOperations(Resource): def delete_ccfinstance(self, ccf_id): """Remove an established interconnection with a peer CCF.""" pass No newline at end of file current_app.logger.debug("Interconnection: Remove instance") current_app.logger.debug(ccf_id) interconnected_col = self.db.get_col_by_name(self.db.interconnected) interconnected_ccf = interconnected_col.find_one({"ccf_id": ccf_id}) if interconnected_ccf: interconnected_col.delete_one({"ccf_id": ccf_id}) res = make_response(object = "CCF instance with ccf_id {} deleted".format(ccf_id), status=204) else: res = not_found_error("CCF instance with ccf_id {} not found".format(ccf_id)) return res