From f5245d1e297c39edf67bad0c443219393bc478ab Mon Sep 17 00:00:00 2001 From: gpapathan87 Date: Thu, 10 Jul 2025 10:36:58 +0300 Subject: [PATCH] resolve conflicts --- .coverage | Bin 53248 -> 53248 bytes coverage.xml | 490 ++++++++++++------ .../controllers/app_controllers.py | 73 --- .../controllers/edge_cloud_controller.py | 10 +- .../network_functions_controller.py | 4 +- .../services/pi_edge_services.py | 79 --- 6 files changed, 333 insertions(+), 323 deletions(-) diff --git a/.coverage b/.coverage index 1862db14a5396d8631739e7cbc31d7fd5032d8f6..a971904287219021b0dd2eecebe4d6e7dde83190 100644 GIT binary patch delta 437 zcmZozz}&Eac>{|Bvj}_VWOfI2Cic$Ff&!83Y&9Y*42`vu?R_E@^HNL7^NX_M(@OJ_ zOEUBGisO^>^Gb^Hb8=FP^a?6-g(o-o25ye>Sj8?T!rsNeHHrHnuO!b#{^|T`JXYLE z>|L8B0t(n!Ygrm=89@dr5HL_=a(!&j=BS7@>Qagf{6G0`@?YdX!GD0ilfRL_oIim- zjNh4GakHQRBmZRme)jr5I}{ig7#TPi8W3SkGJt@CAU6vmrwaGB56(XX z>{|F48yFfmxL6oDg}Bb`XA$LOVdT`|wEOq0pMgPuk%Pg`b!pJGW@{E~{86?2WD96OY$Z5wUC(OXW=)l16f|=o(+S_Oc1&0c57KIOg mnKu9I=Qdy#;h!^^{eU_X|D4T&0y+Gw%p%MTyptE6j|TwsYiN!D delta 310 zcmZozz}&Eac>{|BvoHtyWOfJj&4L0q*_m>MCpY*8ZjSO;#V#Vu!NI^aiTfe1B+o|v z>HKOuR@_OOr2-1rCoX81Tpt^>IVxg}x|BWx|4;tg{FnJp@gL%!%HPZ1%%8`f!XL=5 zzgbX#pTAy#hlP>TiKos-fT4kbfrY_=fq{uZfq{XMAwh`&1QZ0hSr|E0xYhm$*tPIK zbY@UsP~hNVVdNCzI=7!in3IK(Q-jm)-?M%O1_2fYh93eqnK?K>(j0pAOl<5djGTPz zjM{80jGPf{^O7An7#IW?m>57-F)%VXh%kU`Y+wLc$-%(DVBo~SATaqrzoeWD6AL4! z6_cDW0|TQ21H%huhV1FzbQKg7_OLQtVBh?+pWA?0n1A79_5+}>DdwNN@O(S~^%z1m diff --git a/coverage.xml b/coverage.xml index c75f163..2ce6dda 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -61,13 +61,13 @@ - + - + @@ -114,64 +114,63 @@ - - - + + - + - - - - + + + - + - + - - + + - - + + + - - - + + - + - - - - + + + + - - - - - - - - + + + + + + + + + - + @@ -203,74 +202,139 @@ - - + - - - - - - - - - + + + + + + + + + - - - - - + + + + + + + + + + + - + + - - + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -279,8 +343,9 @@ - - + + + @@ -288,8 +353,28 @@ - + + + + + + + + + + + + + + + + + + + + + @@ -498,28 +583,27 @@ - + - + - - + - - - - - + + + + + @@ -536,8 +620,8 @@ - - + + @@ -554,8 +638,8 @@ - - + + @@ -573,8 +657,8 @@ - - + + @@ -591,8 +675,8 @@ - - + + @@ -609,8 +693,8 @@ - - + + @@ -627,8 +711,8 @@ - - + + @@ -645,44 +729,45 @@ - + - - - - - - + + + + + + - + - + - + - + - + - + - + - - - + + + - + + - + @@ -706,16 +791,17 @@ + - - - - + + + + @@ -724,18 +810,18 @@ - + - + - + - + - + - - + + @@ -743,12 +829,12 @@ - + - + - - + + @@ -756,90 +842,168 @@ - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - - + + - + - + - - - + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/edge_cloud_management_api/controllers/app_controllers.py b/edge_cloud_management_api/controllers/app_controllers.py index 3ce787f..2a00106 100644 --- a/edge_cloud_management_api/controllers/app_controllers.py +++ b/edge_cloud_management_api/controllers/app_controllers.py @@ -85,79 +85,6 @@ def delete_app(appId, x_correlator=None): ) -#def create_app_instance(): - # logger.info("Received request to create app instance") - - # try: - # Step 1: Get request body - # body = request.get_json() - # logger.debug(f"Request body: {body}") - - # Step 2: Validate body format - # app_id = body.get('appId') - # app_zones = body.get('appZones') - - # if not app_id or not app_zones: - # return jsonify({"error": "Missing required fields: appId or appZones"}), 400 - - # Step 3: Connect to Mongo and check if app exists - # with MongoManager() as mongo_manager: - # app_data = mongo_manager.find_document("apps", {"_id": app_id}) - # pi_edge_client_factory = PiEdgeAPIClientFactory() - # pi_edge_client = pi_edge_client_factory.create_pi_edge_api_client() - # app_data = pi_edge_client.get_app(app_id) - - # if len(app_data)<1: - # logger.warning(f"No application found with ID {app_id}") - # return jsonify({"error": "App not found", "details": f"No application found with ID {app_id}"}), 404 - - # logger.info(f"Application {app_id} found in database") - - # Step 4: Deploy app instance using Pi-Edge client - - - #logger.info(f"Preparing to send deployment request to SRM for appId={app_id}") - - # deployment_payload = { - # "appId": app_id, - # "appZones": app_zones - #} - - #Print everything before sending - # print("\n=== Preparing Deployment Request ===") - # print(f"Endpoint: {pi_edge_client.base_url}/deployedServiceFunction") - # print(f"Headers: {pi_edge_client._get_headers()}") - # print(f"Payload: {deployment_payload}") - # print("=== End of Deployment Request ===\n") - - #Try sending to Pi-Edge, catch connection errors separately - # try: - # response = pi_edge_client.deploy_service_function(data=deployment_payload) - - # if isinstance(response, dict) and "error" in response: - # logger.warning(f"Failed to deploy service function: {response}") - # return jsonify({ - # "warning": "Deployment not completed (SRM service unreachable)", - # "details": response - # }), 202 # Still accept the request but warn - - # logger.info(f"Deployment response from SRM: {response}") - - # except Exception as inner_error: - # logger.error(f"Exception while trying to deploy to SRM: {inner_error}") - # return jsonify({ - # "warning": "SRM backend unavailable. Deployment request was built correctly.", - # "details": str(inner_error) - # }), 202 # Still accept it (because your backend worked) - - # return jsonify({"message": f"Application {app_id} instantiation accepted"}), 202 - - # except ValidationError as e: - # logger.error(f"Validation error: {str(e)}") - # return jsonify({"error": "Validation error", "details": str(e)}), 400 - #except Exception as e: - # logger.error(f"Unexpected error in create_app_instance: {str(e)}") - # return jsonify({"error": "An unexpected error occurred", "details": str(e)}), 500 def create_app_instance(): logger.info("Received request to create app instance") diff --git a/edge_cloud_management_api/controllers/edge_cloud_controller.py b/edge_cloud_management_api/controllers/edge_cloud_controller.py index ce31309..1773dee 100644 --- a/edge_cloud_management_api/controllers/edge_cloud_controller.py +++ b/edge_cloud_management_api/controllers/edge_cloud_controller.py @@ -110,15 +110,13 @@ def get_edge_cloud_zones(x_correlator: str | None = None, region=None, status=No "message": f"An error occurred: {str(e)}", } return jsonify(error_info), 500 - -<<<<<<< HEAD def edge_cloud_zone_details(zoneId: str) -> dict: pi_edge_factory = PiEdgeAPIClientFactory() api_client = pi_edge_factory.create_pi_edge_api_client() result = api_client.edge_cloud_zone_details(zone_id=zoneId) return result -======= - def get_zone_details(zoneId:str): - pass ->>>>>>> 1c306f8dd595452cbe7804c3473f2f4b77a0b270 + +def get_zone_details(zoneId:str): + pass + diff --git a/edge_cloud_management_api/controllers/network_functions_controller.py b/edge_cloud_management_api/controllers/network_functions_controller.py index 32697b7..c10fc80 100644 --- a/edge_cloud_management_api/controllers/network_functions_controller.py +++ b/edge_cloud_management_api/controllers/network_functions_controller.py @@ -1,5 +1,5 @@ from flask import jsonify -from pydantic import Field, ValidationError +from pydantic import ValidationError #Field from edge_cloud_management_api.managers.log_manager import logger from edge_cloud_management_api.services.pi_edge_services import PiEdgeAPIClientFactory @@ -138,4 +138,4 @@ def get_all_traffic_influence_resources(): return ( jsonify({"error": "An unexpected error occurred", "details": str(e)}), 500, - ) \ No newline at end of file + ) diff --git a/edge_cloud_management_api/services/pi_edge_services.py b/edge_cloud_management_api/services/pi_edge_services.py index 24d7a11..503d7da 100644 --- a/edge_cloud_management_api/services/pi_edge_services.py +++ b/edge_cloud_management_api/services/pi_edge_services.py @@ -340,86 +340,7 @@ class PiEdgeAPIClient: logger.info(e.args) return e.args - def create_qod_session(self, body:dict): - - url = f"{self.base_url}/sessions" - request_headers = self._get_headers() - try: - response = requests.post(url, json=body, headers=request_headers,verify=False) - response.raise_for_status() - return response.json() - except Exception as e: - logger.info(e.args) - return e.args - - def get_qod_session(self, sessionId: str): - - url = f"{self.base_url}/sessions/"+sessionId - request_headers = self._get_headers() - try: - response = requests.get(url, headers=request_headers,verify=False) - response.raise_for_status() - return response - except Exception as e: - logger.info(e.args) - return e.args - - def delete_qod_session(self, sessionId: str): - - url = f"{self.base_url}/sessions/"+sessionId - request_headers = self._get_headers() - try: - response = requests.delete(url, headers=request_headers,verify=False) - response.raise_for_status() - return response - except Exception as e: - logger.info(e.args) - return e.args - def create_traffic_influence_resource(self, body_dict): - url = f"{self.base_url}/traffic-influences/" - request_headers = self._get_headers() - try: - response = requests.post(url, json=body_dict, headers=request_headers,verify=False) - response.raise_for_status() - return response.json() - except Exception as e: - logger.info(e.args) - return e.args - - def delete_traffic_influence_resource(self, id: str): - url = f"{self.base_url}/traffic-influences/"+id - request_headers = self._get_headers() - try: - response = requests.delete(url, headers=request_headers,verify=False) - response.raise_for_status() - return response - except Exception as e: - logger.info(e.args) - return e.args - - def get_traffic_influence_resource(self, id: str): - url = f"{self.base_url}/traffic-influences/"+id - request_headers = self._get_headers() - try: - response = requests.get(url, headers=request_headers,verify=False) - response.raise_for_status() - return response.json() - except Exception as e: - logger.info(e.args) - return e.args - - def get_all_traffic_influence_resources(self): - url = f"{self.base_url}/traffic-influences/" - request_headers = self._get_headers() - try: - response = requests.get(url, headers=request_headers,verify=False) - response.raise_for_status() - return response.json() - except Exception as e: - logger.info(e.args) - return e.args - class PiEdgeAPIClientFactory: -- GitLab