diff --git a/edge_cloud_management_api/controllers/network_functions_controller.py b/edge_cloud_management_api/controllers/network_functions_controller.py index 1cdffca8885dd37af88434506d126f582233db4f..32697b76b1276946584dcebcfb422d7f81cc4101 100644 --- a/edge_cloud_management_api/controllers/network_functions_controller.py +++ b/edge_cloud_management_api/controllers/network_functions_controller.py @@ -15,8 +15,7 @@ def create_qod_session(body: dict): pi_edge_factory = PiEdgeAPIClientFactory() api_client = pi_edge_factory.create_pi_edge_api_client() response = api_client.create_qod_session(body) - - return response + return response.json() except ValidationError as e: return jsonify({"error": "Invalid input", "details": e.errors()}), 400 @@ -40,7 +39,7 @@ def delete_qod_session(sessionId: str): api_client = pi_edge_factory.create_pi_edge_api_client() response = api_client.delete_qod_session(sessionId=sessionId) - return response.json() + return response.text except ValidationError as e: return jsonify({"error": "Invalid input", "details": e.errors()}), 400 @@ -85,7 +84,7 @@ def create_traffic_influence_resource(body: dict): pi_edge_factory = PiEdgeAPIClientFactory() api_client = pi_edge_factory.create_pi_edge_api_client() response = api_client.create_traffic_influence_resource(body) - return response + return response.json() except ValidationError as e: return jsonify({"error": "Invalid input", "details": e.errors()}), 400 @@ -100,7 +99,7 @@ def get_traffic_influence_resource(id: str): pi_edge_factory = PiEdgeAPIClientFactory() api_client = pi_edge_factory.create_pi_edge_api_client() response = api_client.get_traffic_influence_resource(id) - return response + return response.json() except ValidationError as e: return jsonify({"error": "Invalid input", "details": e.errors()}), 400 @@ -116,7 +115,7 @@ def delete_traffic_influence_resource(id: str): pi_edge_factory = PiEdgeAPIClientFactory() api_client = pi_edge_factory.create_pi_edge_api_client() response = api_client.delete_traffic_influence_resource(id) - return response + return response.text except ValidationError as e: return jsonify({"error": "Invalid input", "details": e.errors()}), 400 diff --git a/edge_cloud_management_api/services/pi_edge_services.py b/edge_cloud_management_api/services/pi_edge_services.py index 0832a2ef99be9a96e0a683bfd4580bc8bc524d08..cfdf3cb05e19d05216ff52a5d6b847f2f4c39373 100644 --- a/edge_cloud_management_api/services/pi_edge_services.py +++ b/edge_cloud_management_api/services/pi_edge_services.py @@ -298,12 +298,12 @@ class PiEdgeAPIClient: return e.args def create_traffic_influence_resource(self, body_dict): - url = f"{self.base_url}/traffic-influences/" + 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() + return response except Exception as e: logger.info(e.args) return e.args @@ -325,7 +325,7 @@ class PiEdgeAPIClient: try: response = requests.get(url, headers=request_headers,verify=False) response.raise_for_status() - return response.json() + return response except Exception as e: logger.info(e.args) return e.args @@ -336,7 +336,7 @@ class PiEdgeAPIClient: try: response = requests.get(url, headers=request_headers,verify=False) response.raise_for_status() - return response.json() + return response except Exception as e: logger.info(e.args) return e.args diff --git a/edge_cloud_management_api/specification/openapi.yaml b/edge_cloud_management_api/specification/openapi.yaml index cd4145c1de8183db1865955bb1f97e30ccd21f92..67f026d04b4a855a4dc39c75301b6e3ff7c359e2 100644 --- a/edge_cloud_management_api/specification/openapi.yaml +++ b/edge_cloud_management_api/specification/openapi.yaml @@ -712,7 +712,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/' + $ref: '#/components/schemas/QoDSchema' responses: "200": description: Session created. @@ -770,7 +770,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/' + $ref: '#/components/schemas/TrafficInfluenceSchema' responses: "200": description: Resource created. @@ -1308,6 +1308,122 @@ components: schemas: + QoDSchema: + type: object + properties: + device: + type: object + properties: + phoneNumber: + type: string + networkAccessIdentifier: + type: string + ipv4Address: + type: object + properties: + publicAddress: + type: string + publicPort: + type: integer + ipv6Address: + type: string + + applicationServer: + type: object + properties: + ipv4Address: + type: string + ipv6Address: + type: string + devicePorts: + type: object + properties: + ranges: + type: array + items: + type: object + required: + - from + - to + properties: + from: + type: integer + to: + type: integer + ports: + type: array + items: + type: integer + applicationServerPorts: + type: object + properties: + ranges: + type: array + items: + type: object + required: + - from + - to + properties: + from: + type: integer + to: + type: integer + ports: + type: array + items: + type: integer + qosProfile: + type: string + sink: + type: string + duration: + type: integer + TrafficInfluenceSchema: + type: object + properties: + apiConsumerId: + type: string + appId: + type: string + appInstanceId: + type: string + edgeCloudRegion: + type: string + edgeCloudZoneId: + type: string + sourceTrafficFilters: + type: object + properties: + sourcePort: + type: integer + destinationTrafficFilters: + type: object + properties: + destinationPort: + type: integer + destinationProtocol: + type: string + notificationUri: + type: string + notificationAuthToken: + type: string + notificationSink: + type: object + properties: + sink: + type: string + sinkCredentials: + type: object + properties: + credentialtype: + type: string + accessToken: + type: string + accessTokenExpireUtc: + type: string + accessTokenType: + type: string AccessEndpoint: type: object description: | @@ -1596,16 +1712,16 @@ components: AppProvider: type: string - pattern: ^[A-Za-z][A-Za-z0-9_]{7,63}$ + # pattern: ^[A-Za-z][A-Za-z0-9_]{7,63}$ description: Human readable name of the Application Provider. AppIdentifier: - pattern: "^[A-Za-z][A-Za-z0-9_]{7,63}$" + # pattern: "^[A-Za-z][A-Za-z0-9_]{7,63}$" type: string description: Identifier used to refer to an application. AppProviderId: - pattern: "^[A-Za-z][A-Za-z0-9_]{7,63}$" + # pattern: "^[A-Za-z][A-Za-z0-9_]{7,63}$" type: string description: UserId of the app provider. Identifier is relevant only in context of this federation. @@ -1654,7 +1770,7 @@ components: description: "Latitude,Longitude as decimal fraction up to 4 digit precision" InstanceIdentifier: - pattern: "^[A-Za-z0-9][A-Za-z0-9_]{6,62}[A-Za-z0-9]$" + # pattern: "^[A-Za-z0-9][A-Za-z0-9_]{6,62}[A-Za-z0-9]$" type: string description: Unique identifier generated by the partner OP to identify an instance of the application on a specific zone. @@ -2745,14 +2861,3 @@ components: status: 503 code: UNAVAILABLE message: "Service unavailable" - - - - - - - - - - -