Commit 63e66ed6 authored by Dimitrios Laskaratos's avatar Dimitrios Laskaratos
Browse files

Merge branch 'dev' into 'main'

Dev

See merge request !4
parents 7eae88a0 2d716fc8
Loading
Loading
Loading
Loading
+71 −14
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ from sunrise6g_opensdk.common.sdk import Sdk as sdkclient

logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
network_adapter = None

if environ.get('NETWORK_ADAPTER_NAME') is not None:
    network_adapter_name = environ.get('NETWORK_ADAPTER_NAME')
@@ -24,8 +25,20 @@ def create_qod_session():
     
    if connexion.request.is_json:
        try:
            if network_adapter is not None:
                response = network_adapter.create_qod_session(connexion.request.get_json())
                return response
            else:
                return {
                        "applicationServer": {
                        "ipv4Address": "198.51.100.0/24"
                        },
                        "qosProfile": "QOS_L",
                        "sink": "https://application-server.com/notifications",
                        "sessionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
                        "duration": 3600,
                        "qosStatus": "REQUESTED"
                        }
        except Exception as ce_:
            logger.error(ce_)
            return ce_
@@ -35,8 +48,11 @@ def create_qod_session():
def get_qod_session(session_id: str):
    
    try:
        if network_adapter is not None:
            response = network_adapter.get_qod_session(id)
        return {'status': 200, 'session': response.json()}
            return {'status': 200, 'session': response}
        else:
            return "Requested QoD session with ID: "+session_id
    except Exception as ce_:
        logger.error(ce_)
        return ce_
@@ -44,23 +60,64 @@ def get_qod_session(session_id: str):
def delete_qod_session(session_id: str):
   
    try:
        if network_adapter is not None:
                response = network_adapter.delete_qod_session(id)
                return response
        else:
            return "Deleting QoD session with ID: "+ session_id
    except Exception as ce_:
        logger.error(ce_)
        return ce_

def create_traffic_influence_resource(body):
     #TODO
     pass
     try:
        if network_adapter is not None:
            response = network_adapter.create_traffic_influence_resource(traffic_influence_info=body)
            return response
        else:
            return {
                    "trafficInfluenceID": "string",
                    "apiConsumerId": "string",
                    "appId": "6B29FC40-CA47-1067-B31D-00DD010662DA",
                    "appInstanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
                    "edgeCloudRegion": "string",
                    "edgeCloudZoneId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
                    "state": "ordered",
                    "sourceTrafficFilters": {
                    "sourcePort": 65535
                     },
                    "destinationTrafficFilters": {
                    "destinationPort": 65535,
                    "destinationProtocol": "TCP"
                    },
                    "notificationUri": "string",
                    "notificationAuthToken": "string"
                    }
     except Exception as ce_:
        logger.error(ce_)
        return ce_

def delete_traffic_influence_resource(id: str):
     #TODO
     pass
def delete_traffic_influence_resource(traffic_influence_id: str):
     try:
        if network_adapter is not None:
                response = network_adapter.delete_traffic_influence_resource(resource_id=traffic_influence_id)
                return response
        else:
            return "Deleting Traffic Influence resource with ID: "+ traffic_influence_id
     except Exception as ce_:
        logger.error(ce_)
        return ce_

def get_traffic_influence_resource(id: str):
     #TODO
     pass
def get_traffic_influence_resource(traffic_influence_id: str):
     try:
        if network_adapter is not None:
            response = network_adapter.get_individual_traffic_influence_resource(resource_id=traffic_influence_id)
            return {'status': 200, 'session': response}
        else:
            return "Requested Traffice Influence resource with ID: "+traffic_influence_id
     except Exception as ce_:
        logger.error(ce_)
        return ce_

def get_all_traffic_influence_resources():
     #TODO
+3 −3
Original line number Diff line number Diff line
@@ -386,14 +386,14 @@ paths:
        "200":
          description: Resources retrieved.
      x-openapi-router-controller: src.controllers.network_functions_controller  
  /traffic-influences/{id}:
  /traffic-influences/{trafficInfluenceId}:
    get:
      tags:
      - Traffic Influence Functions
      summary: Retrieve details of a TrafficInfluence resource
      operationId: get_traffic_influence_resource
      parameters:
      - name: id
      - name: trafficInfluenceId
        in: path
        description: Represents a TrafficInfluence resource.
        required: true
@@ -415,7 +415,7 @@ paths:
      summary: Remove TrafficInfluence resource
      operationId: delete_traffic_influence_resource
      parameters:
      - name: id
      - name: trafficInfluenceId
        in: path
        description: Represents a TrafficInfluence resource
        required: true