From ca80137a39ccbd1cb5e3b83bdc55b2adf1d20c65 Mon Sep 17 00:00:00 2001
From: Laskaratos Dimitris <dlaskaratos@intracomtel.com>
Date: Wed, 9 Jul 2025 15:36:27 +0300
Subject: [PATCH] Added network functions support and fixed edge cloud bugs
---
.../network_functions_controller.py | 11 +-
.../services/pi_edge_services.py | 8 +-
.../specification/openapi.yaml | 139 +++++++++++++++---
3 files changed, 131 insertions(+), 27 deletions(-)
diff --git a/edge_cloud_management_api/controllers/network_functions_controller.py b/edge_cloud_management_api/controllers/network_functions_controller.py
index 1cdffca..32697b7 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 0832a2e..cfdf3cb 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 cd4145c..67f026d 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"
-
-
-
-
-
-
-
-
-
-
-
--
GitLab