5G-MAG / rt-5gms-application-function

5G Media Streaming - Application Function
https://www.5g-mag.com/streaming
Other
11 stars 6 forks source link

M5: Network Assistance Session API: Lifecycle #64

Closed davidjwbbc closed 7 months ago

davidjwbbc commented 1 year ago

Description

When an AF offers Network Assistance (see 5G-MAG/rt-5gms-application-function#63) the UE may then choose to establish a NetworkAssistanceSession with the AF and use this session to request available bandwidth estimates or ask for a temporary download bit rate boost.

If the request to establish a NetworkAssistanceSession with the AF fails then the UE is denied access to these features.

If the request succeeds then the UE is provided with a naSessionId (Network Assistance Session Identifier), which it can then use to:

Relevant Specifications

Design

All these API operations are performed on the interface at reference point M5 using the URL path prefix of: {apiRoot}/3gpp-m5/v2/network-assistance/

createNetworkAssistanceSession

This is a POST request with no further sub-resource path elements. The UE will provide a NetworkAssistanceSession resource in the body of the request with:

A connection to the PCF should be established using the UE details from the serviceDataFlowInformation or an existing connection for the UE may be re-used.

A call to pcf_session_create_app_session() (see 5G-MAG/rt-5gc-service-consumers#3) is then made to establish an AppSessionContext for the UE with the PCF. The ue_address parameter will be derived from the serviceDataFlowInformation in the request. The events parameter will be the following event types ORed together:

When the change_callback is called then:

retrieveNetworkAssistanceSession

Lookup the naSessionId in the application context and generate the NetworkAssistanceSession response body from the associated data. Return this with a 200 response code. If the naSessionId was not found then return a 404 response code.

updateNetworkAssistanceSession

TODO

destroyNetworkAssistanceSession

Lookup the naSessionId in the application context and if found use pcf_app_session_free() on the pcf_app_session_t associated with the naSessionId. When the change_callback is called with NULL, return a 204 response.

If the lookup failed then return a 404 response.

rjb1000 commented 1 year ago

I suggest splitting out requestBitRateRecommendation and requestDeliveryBoost into their own separate issues so that this issue can focus on the smaller, more focussed scope of managing the life-cycle of the Network Assistance session.

devbbc commented 1 year ago

In preparation for the implementation of the Network Assistance Session API, integrated the PCF Service consumer library with the 5GMS AF. The AF initialises the library, which listens to the events.

Generated the OpenAPI code files and currently implementing the M5_NetworkAssistance_createNetworkAssistanceSession operation.

devbbc commented 1 year ago

Implemented the internal data structures in the 5G MSAF to hold the serviceDataFlowInformation and policyTemplate.

Modified the MSAF M5 State machine to receive and process the createNetworkAssistanceSession request sent by the 5GMS client.

The next step is to test the createNetworkAssistanceSession and implement (or call already implemented) functions to establish connection with the PCF.

devbbc commented 1 year ago

The PCF service consumer library requires the connection details of the UE, media component and _changecallback to communicate with the PCF.

The AF can now extract the connection details of the UE from serviceDataFlowInformation and populate a basic media component parameter from the policy template.

Another parameter for the pcf_session_create_app_session() is the _changecallback, which will be implemented next.

devbbc commented 1 year ago

When a new Network Assistance Session is created by the Media Session Handler invoking createNetworkAssistanceSession, the 5GMS AF receives a NetworkAssistanceSession resource. NetworkAssistanceSession.requestedQoS provides QoS requirements, namely the maximum, minimum and desired bit rates, potentially in both the uplink and downlink directions.

The QoS parameters from the M5 Network Assistance Session are passed to the PCF through the MediaComponent data type in the N5 Application Session Context.

As mentioned in the createNetworkAssistanceSession design section, the media_component data structure is expected to be populated by the 5GMS AF from a combination of the requestedQoS parameters provided by the Media Session Handler and the QoS parameters provisioned in a Policy Template in the optionally cited policyTemplateId. The media_component data structure is then passed to the PCF service consumer library as a parameter to the function pcf_session_create_app_session().

The table below shows the OpenAPI model data structures for M5 requestedQos and the mediaComponent type.

M5 Network Assistance Session Media Component
``` typedef struct OpenAPI_m5_qo_s_specification_s { bool is_des_latency; int des_latency; bool is_des_loss; int des_loss; char *mar_bw_dl_bit_rate; char *mar_bw_ul_bit_rate; char *min_des_bw_dl_bit_rate; char *min_des_bw_ul_bit_rate; char *mir_bw_dl_bit_rate; char *mir_bw_ul_bit_rate; } OpenAPI_m5_qo_s_specification_t; ``` ``` typedef struct OpenAPI_media_component_s { char *af_app_id; struct OpenAPI_af_routing_requirement_s *af_rout_req; char *qos_reference; bool is_dis_ue_notif; int dis_ue_notif; OpenAPI_list_t *alt_ser_reqs; OpenAPI_list_t *alt_ser_reqs_data; bool is_cont_ver; int cont_ver; OpenAPI_list_t *codecs; bool is_des_max_latency; float des_max_latency; bool is_des_max_loss; float des_max_loss; char *flus_id; OpenAPI_flow_status_e f_status; char *mar_bw_dl; char *mar_bw_ul; bool is_max_packet_loss_rate_dl; int max_packet_loss_rate_dl; bool is_max_packet_loss_rate_ul; int max_packet_loss_rate_ul; char *max_supp_bw_dl; char *max_supp_bw_ul; int med_comp_n; OpenAPI_list_t* med_sub_comps; OpenAPI_media_type_e med_type; char *min_des_bw_dl; char *min_des_bw_ul; char *mir_bw_dl; char *mir_bw_ul; OpenAPI_preemption_capability_e preempt_cap; OpenAPI_preemption_vulnerability_e preempt_vuln; OpenAPI_priority_sharing_indicator_e prio_sharing_ind; OpenAPI_reserv_priority_e res_prio; char *rr_bw; char *rs_bw; bool is_sharing_key_dl; int sharing_key_dl; bool is_sharing_key_ul; int sharing_key_ul; struct OpenAPI_tsn_qos_container_s *tsn_qos; struct OpenAPI_tscai_input_container_s *tscai_input_dl; struct OpenAPI_tscai_input_container_s *tscai_input_ul; bool is_tscai_time_dom; int tscai_time_dom; } ```

At this stage, however, the 5GMS AF does not handle policy template. (This will be implemented as part of the Dynamic Policies feature.) So, the initial implementation simply maps the QoS parameters obtained from the requestedQoS to the corresponding elements of the media component.

The mapping of the relevant fields is shown below:

M5 Network Assistance Session Media Component
mar_bw_dl_bit_rate mar_bw_dl
mar_bw_ul_bit_rate mar_bw_ul
min_des_bw_dl_bit_rate min_des_bw_dl
min_des_bw_ul_bit_rate min_des_bw_ul
mir_bw_dl_bit_rate mir_bw_dl
mir_bw_ul_bit_rate mir_bw_ul
rjb1000 commented 1 year ago

In the absence of clear specification in TS 26.512, the above simple mapping is our best guess of the intended 5GMS AF behaviour when the Media Session Handler omits the policyTemplateId parameter, either out of choice, or because no Policy Templates are provisioned in the relevant Provisioning Session.

Raised issue 5G-MAG/Standards#80 to seek clarity on this.

devbbc commented 1 year ago

During testing, we discovered that @acetcom's current implementation of the Open5GS PCF requires a media type to be specified in the media component, despite MediaComponent.medType being specified as optional in table 5.6.2.7-1 of TS 29.514. Specifically, Open5GS PCF recognises only the AUDIO, VIDEO and CONTROL media types and not OTHER, for example. Any other value (or no media type at all) results in an error being returned from the PCF, which is not very helpful!

https://github.com/open5gs/open5gs/blob/99f7da154e0fc4a494b35d1e74c26d89b934d5bc/src/pcf/npcf-handler.c#L642-L665

So, for the time being I will hard code the media type as VIDEO when populating the media component.

devbbc commented 1 year ago

createNetworkAssistanceSession implemented and tested.

Here is an example network interaction at reference point N5 between a test client (curl) standing in for the Media Session Handler and the 5GMS AF (As the PCF has no UE registered to it during the test, the 5GMS AF returns an error, as required.)

$ curl -H 'User-Agent: AF' -H 'Content-Type: application/json' --data @/home/ubuntu/m5-nas.json --http2-prior-knowledge -v http://127.0.0.24:7777/3gpp-m5/v2/network-assistance
> POST /3gpp-m5/v2/network-assistance HTTP/2
> Host: 127.0.0.24:7777
> accept: */*
> user-agent: AF
> content-type: application/json
> content-length: 518
> 
< HTTP/2 401 
< server: Open5GS v2.6.4-30-g26141ee+
< date: Fri, 21 Jul 2023 16:23:57 GMT
< content-length: 188
< server: 5GMSAF-localhost/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< content-type: application/problem+json
< 
{
    "type": "/3gpp-m5/v2",
    "title":    "Creation of the Network Assistance Session failed.",
    "status":   401,
    "detail":   "PCF App Session creation failed",
    "instance": "/network-assistance"
}

Error message sent to stderr by the PCF Service consumer:

07/21 16:23:57.186: [pcf-service-consumer] ERROR: UE address not known by the PCF (../lib/pcf-service-consumer/npcf-process.c:219)

Next steps

  1. Some of the data structures need proper de allocation of resources during finalisation.
  2. Currently, the PCF address is static. This needs to be modified so that the AF uses the PCF provided by the BSF.
devbbc commented 1 year ago

The code of the AF is modified so that it uses the PCF provided by the BSF.

The allocated resources are released during finalisation.

Now implementing the retrieveNetworkAssistanceSession operation.

devbbc commented 1 year ago

Implemented theretrieveNetworkAssistanceSession operation.

Currently during the test, there is no UE registered with the network. This means there is no PCF bindings for the UE.

So, both creation and retrieval return an unsuccessful responses:

$ curl -H 'User-Agent: AF' -H 'Content-Type: application/json' --data @m5-nas.json --http2-prior-knowledge -v http://127.0.0.24:7777/3gpp-m5/v2/network-assistance
> POST /3gpp-m5/v2/network-assistance HTTP/2
> Host: 127.0.0.24:7777
> accept: */*
> user-agent: AF
> content-type: application/json
> content-length: 508
> 
< HTTP/2 404 
< server: Open5GS v2.6.4-30-g26141ee+
< date: Thu, 27 Jul 2023 09:53:23 GMT
< content-length: 178
< server: 5GMSAF-localhost/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< content-type: application/problem+json
< 
{
    "type": "/3gpp-m5/v2",
    "title":    "Creation of the Network Assistance Session failed.",
    "status":   404,
    "detail":   "PCF binding not found",
    "instance": "/network-assistance"
}
$ curl -H 'User-Agent: AF' --http2-prior-knowledge -v http://127.0.0.24:7777/3gpp-m5/v2/network-assistance/1
> GET /3gpp-m5/v2/network-assistance/1 HTTP/2
> Host: 127.0.0.24:7777
> accept: */*
> user-agent: AF
> 
< HTTP/2 404 
< server: Open5GS v2.6.4-30-g26141ee+
< date: Thu, 27 Jul 2023 09:56:00 GMT
< content-length: 205
< server: 5GMSAF-localhost/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< content-type: application/problem+json
< 
{
    "type": "/3gpp-m5/v2",
    "title":    "Unable to retrieve the Network Assistance Session",
    "status":   404,
    "detail":   "The AF does not have this Network Assistance Session",
    "instance": "/network-assistance/1"
}

Moving on to the destroyNetworkAssistanceSession operation.

devbbc commented 1 year ago

Implemented the destroyNetworkAssistanceSession operation.

When the AF finds the session to be deleted, it:

  1. Moves the pcf_app_session to a delete list.
  2. Remove the msaf_network_assistance_session_t from the AF's internal data structure.
  3. Sends a 204 No Content response to the client.

Items on the delete list are processed lazily by the AF on a separate "garbage collection" thread:

  1. Invokes the pcf_app_session_free() function of the PCF service consumer library for each pcf_app_session_t on the delete list to remove the corresponding Application Session Context from the PCF.
  2. The PCF Service Consumer library invokes the callback function on the 5GMS AF to confirm success of the previous step at which point the pcf_app_session_t is removed from the AF's delete list.
devbbc commented 1 year ago

Currently working on testing these operations with a virtualised UE/gNB.

devbbc commented 1 year ago

Did some additional testing of the createNetworkAssistanceSession operation with a virtualised UE:

curl -H 'User-Agent: AF' -H 'Content-Type: application/json' --data @/home/ubuntu/msaf-pcf/m5-nas.json --http2-prior-knowledge -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance
> POST /3gpp-m5/v2/network-assistance HTTP/2
> Host: 192.168.10.223:7773
> accept: */*
> user-agent: AF
> content-type: application/json
> content-length: 446
> 
< HTTP/2 200 
< server: Open5GS v2.6.4-30-g26141ee+
< date: Mon, 31 Jul 2023 19:03:24 GMT
< content-length: 498
< server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< content-type: application/json
< cache-control: max-age=60
< 
{
    "naSessionId":  "ec782162-2fd4-41ee-ac3e-dba34e90aa08",
    "serviceDataFlowDescription":   [{
            "domainName":   "internet",
            "flowDescription":  {
                "direction":    "downlink",
                "dstIp":    "10.45.0.4",
                "srcIp":    "10.55.1.20"
            }
        }],
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "96000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }
}

The above output shows that a Network Assistance session is created for the UE with 10.45.0.4 and is assigned the Network Assistance session identifier ec782162-2fd4-41ee-ac3e-dba34e90aa08 by the AF .

Some code tidy up and testing of other operations will be done next.

rjb1000 commented 1 year ago

We noticed this morning that all of the above testing at reference point M5 has been done using HTTP/2 with prior knowledge, whereas the target for reference point M5 is HTTP/1.1 (for compatibility with the Media Session Handler reference implementation).

We have a medium term ambition to develop a way of autodetecting HTTP/1.1 versus HTTP/2 with prior knowledge on the same listening socket, as well as supporting protocol upgrade from HTTP/1.1 to HTTP/2 (see #12). To make progress on this issue now, we just need to flip all listening sockets on the AF back to HTTP/1.1 (per the solution described in #10) by linking it against libmicrohttpd instead of libnghttp2 at build time.

(Note that this won't stop the AF using an HTTP/2 client to invoke service operations on the NRF, BSF and PCF. However, it will temporarily prevent the AF from receiving asynchronous notifications from these Network Functions using HTTP/2. This isn't a problem at the moment, though, since the Open5GS PCF doesn't yet implement any asynchronous notifications anyway...)

devbbc commented 1 year ago

The AF now handles HTTP/1.1 for reference point M5. Tested the createNetworkAssistanceSession and retrieveNetworkAssistanceSession operation with virtual UE. Below is the sample output.

Will test the destroy operation next.

createNetworkAssistanceSession

$ curl -H 'User-Agent: AF' -H 'Content-Type: application/json' --data @/home/ubuntu/msaf-pcf/m5-nas.json -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance
> POST /3gpp-m5/v2/network-assistance HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> Content-Type: application/json
> Content-Length: 507
> 
< HTTP/1.1 200 OK
< Date: Wed, 02 Aug 2023 13:26:48 GMT
< Cache-Control: max-age=60
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< Content-Type: application/json
< Content-Length: 562
< 
{
    "naSessionId":  "3bdbad0a-3138-41ee-a62d-153625ff0a5f",
    "serviceDataFlowDescription":   [{
            "domainName":   "internet",
            "flowDescription":  {
                "direction":    "downlink",
                "dstIp":    "10.45.0.4",
                "dstPort":  12345,
                "protocol": 5,
                "srcIp":    "10.55.1.20",
                "srcPort":  123456
            }
        }],
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "96000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }
}

retrieveNetworkAssistanceSession

$ curl -H 'User-Agent: AF' -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/3bdbad0a-3138-41ee-a62d-153625ff0a5f
> GET /3gpp-m5/v2/network-assistance/3bdbad0a-3138-41ee-a62d-153625ff0a5f HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> 
< HTTP/1.1 200 OK
< Date: Wed, 02 Aug 2023 13:35:41 GMT
< Connection: close
< ETag: 1a2fc5ab371256b9a36cd42b0dc1f6bd25d4b328676a5e42e471a2655b004a8d
< Last-Modified: Wed, 02 Aug 2023 13:26:48 GMT
< Cache-Control: max-age=60
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< Location: /3gpp-m5/v2/network-assistance/3bdbad0a-3138-41ee-a62d-153625ff0a5f
< Content-Type: application/json
< Content-Length: 562
< 
{
    "naSessionId":  "3bdbad0a-3138-41ee-a62d-153625ff0a5f",
    "serviceDataFlowDescription":   [{
            "domainName":   "internet",
            "flowDescription":  {
                "direction":    "downlink",
                "dstIp":    "10.45.0.4",
                "dstPort":  12345,
                "protocol": 5,
                "srcIp":    "10.55.1.20",
                "srcPort":  123456
            }
        }],
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "96000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }

}
devbbc commented 1 year ago

Implemented and tested the create, retrieve and destroy operations.

Sample output below:

createNetworkAssistanceSession

$ curl -H 'User-Agent: AF' -H 'Content-Type: application/json' --data @/home/ubuntu/msaf-pcf/m5-nas.json -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance
> POST /3gpp-m5/v2/network-assistance HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> Content-Type: application/json
> Content-Length: 507
> 
< HTTP/1.1 200 OK
< Date: Wed, 09 Aug 2023 17:23:32 GMT
< Cache-Control: max-age=60
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< Content-Type: application/json
< Content-Length: 562
< 
{
    "naSessionId":  "7726e19e-36d9-41ee-aca7-89b1030e4a61",
    "serviceDataFlowDescription":   [{
            "domainName":   "internet",
            "flowDescription":  {
                "direction":    "downlink",
                "dstIp":    "10.45.0.4",
                "dstPort":  12345,
                "protocol": 5,
                "srcIp":    "10.55.1.20",
                "srcPort":  123456
            }
        }],
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "96000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }
}

retrieveNetworkAssistanceSession

$ curl -H 'User-Agent: AF' -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/7726e19e-36d9-41ee-aca7-89b1030e4a61
> GET /3gpp-m5/v2/network-assistance/7726e19e-36d9-41ee-aca7-89b1030e4a61 HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> 
< HTTP/1.1 200 OK
< Date: Wed, 09 Aug 2023 17:24:44 GMT
< Connection: close
< ETag: 77108ee202453ebcd15fc28bdf9829249b8c95b57d7dad64b0208b715d8cc130
< Last-Modified: Wed, 09 Aug 2023 17:23:32 GMT
< Cache-Control: max-age=60
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< Location: /3gpp-m5/v2/network-assistance/7726e19e-36d9-41ee-aca7-89b1030e4a61
< Content-Type: application/json
< Content-Length: 562
< 
{
    "naSessionId":  "7726e19e-36d9-41ee-aca7-89b1030e4a61",
    "serviceDataFlowDescription":   [{
            "domainName":   "internet",
            "flowDescription":  {
                "direction":    "downlink",
                "dstIp":    "10.45.0.4",
                "dstPort":  12345,
                "protocol": 5,
                "srcIp":    "10.55.1.20",
                "srcPort":  123456
            }
        }],
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "96000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }
}

destroyNetworkAssistanceSession

$ curl -H 'User-Agent: AF' -X DELETE -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/7726e19e-36d9-41ee-aca7-89b1030e4a61
> DELETE /3gpp-m5/v2/network-assistance/7726e19e-36d9-41ee-aca7-89b1030e4a61 HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> 
< HTTP/1.1 204 No Content
< Date: Wed, 09 Aug 2023 17:26:46 GMT
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.0.1) rt-5gms-application-function/1.3.0
< 
rjb1000 commented 1 year ago

A call to pcf_session_create_app_session() (see https://github.com/5G-MAG/rt-5gc-service-consumers/issues/3) is then made to establish an AppSessionContext for the UE with the PCF. The ue_address parameter will be derived from the serviceDataFlowInformation in the request. The events parameter will be the following event types ORed together:

  • PCF_APP_SESSION_EVENT_TYPE_QOS_NOTIF
  • PCF_APP_SESSION_EVENT_TYPE_QOS_MONITORING
  • PCF_APP_SESSION_EVENT_TYPE_SUCCESSFUL_QOS_UPDATE
  • PCF_APP_SESSION_EVENT_TYPE_FAILED_QOS_UPDATE

@davidjwbbc: Does the above list of events correspond to the first bullet specified in TS 26.512 clause 16.1 (reproduced below)? Does your specification need to be expanded to include events corresponding to the second and third bullets below?

When serving a media streaming session that belongs to the AF application session context, the AF shall subscribe to the following PCF notifications with the PCF:

  • Service Data Flow QoS notification control;
  • Service Data Flow Deactivation;
  • Resources allocation outcome.
davidjwbbc commented 1 year ago

I think the first 2 equate to the "Service Data Flow QoS notification control" and the last two equate to the "Resources allocation outcome". The "Service Data Flow Deactivation" comes through a change notification channel rather than the event notification channel.

devbbc commented 9 months ago

Started implementing the updateNetworkAssistanceSession operation.

The workflow is described below:

This operation uses a PUT method with the naSessionId as a sub-component on the path and the body contains application/json data for a NetworkAssistanceSession. The UE will provide a NetworkAssistanceSession resource to be requested in the request body.

Look up the naSessionId in the application context network assistance session list. If not found return a 404 error response. If found then set the naSessionId of the received NetworkAssistanceSession to the naSessionId used in the path.

Use pcf_session_update_app_session() function to update the stored AppSessionContext with a new MediaComponent derived from the serviceDataFlowInformation and the requestedQoS parameters.

Replace the NetworkAssistanceSession in the network assistance session list, regenerate the SHA256 hash and store the current timestamp in the list too.

Return the NetworkAssistanceSession as JSON in the body of a 200 response with the ETag and Last-Modified headers set to the SHA256 and timestamp.

devbbc commented 9 months ago

Implemented the updateNetworkAssistanceSession operation. Some memory leaks and testing needs to be done.

devbbc commented 9 months ago

Sample outputs from the Network Assistance Session API:

createNetworkAssistanceSession

curl -H 'User-Agent: AF' -H 'Content-Type: application/json' --data @m5-nas.json -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance

> POST /3gpp-m5/v2/network-assistance HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> Content-Type: application/json
> Content-Length: 571
> 

< HTTP/1.1 200 OK
< Date: Tue, 28 Nov 2023 17:30:16 GMT
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.1.0) rt-5gms-application-function/1.3.0
< Content-Type: application/json
< Cache-Control: max-age=60
< Content-Length: 622
< 
{
    "naSessionId":  "cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05",
    "provisioningSessionId":    "ba977c40-8e13-41ee-b9cb-bb3be1d3aa05",
    "serviceDataFlowDescriptions":  [{
            "flowDescription":  {
                "direction":    "DOWNLINK",
                "dstIp":    "10.45.0.3",
                "dstPort":  12345,
                "protocol": 6,
                "srcIp":    "10.45.0.3",
                "srcPort":  123456
            }
        }],
    "mediaType":    "VIDEO",
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "96000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }
}

retrieveNetworkAssistanceSession

$ curl -H 'User-Agent: AF' -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05

> GET /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05 HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> 

< HTTP/1.1 200 OK
< Date: Tue, 28 Nov 2023 17:30:31 GMT
< Connection: close
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.1.0) rt-5gms-application-function/1.3.0
< Location: /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05
< Content-Type: application/json
< ETag: d763fd5c94945c447288a8b2dd83b0e0445302260e3e89f89d749950d479b8c5
< Last-Modified: Tue, 28 Nov 2023 17:30:16 GMT
< Cache-Control: max-age=60
< Content-Length: 622
< 
{
    "naSessionId":  "cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05",
    "provisioningSessionId":    "ba977c40-8e13-41ee-b9cb-bb3be1d3aa05",
    "serviceDataFlowDescriptions":  [{
            "flowDescription":  {
                "direction":    "DOWNLINK",
                "dstIp":    "10.45.0.3",
                "dstPort":  12345,
                "protocol": 6,
                "srcIp":    "10.45.0.3",
                "srcPort":  123456
            }
        }],
    "mediaType":    "VIDEO",
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "96000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }
}

updateNetworkAssistanceSession

$ curl -H 'User-Agent: AF' -X PUT -H 'Content-Type: application/json' --data @m5-nas.json -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05

> PUT /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05 HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> Content-Type: application/json
> Content-Length: 571
> 

< HTTP/1.1 200 OK
< Date: Tue, 28 Nov 2023 17:31:17 GMT
< ETag: d7beabb6603b928d124697ba12c36ad9c287c302db92020246fc04107f7f87e8
< Last-Modified: Tue, 28 Nov 2023 17:31:17 GMT
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.1.0) rt-5gms-application-function/1.3.0
< Location: /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05
< Content-Type: application/json
< Content-Length: 622
< 
{
    "naSessionId":  "cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05",
    "provisioningSessionId":    "ba977c40-8e13-41ee-b9cb-bb3be1d3aa05",
    "serviceDataFlowDescriptions":  [{
            "flowDescription":  {
                "direction":    "DOWNLINK",
                "dstIp":    "10.45.0.3",
                "dstPort":  12345,
                "protocol": 6,
                "srcIp":    "10.45.0.3",
                "srcPort":  123456
            }
        }],
    "mediaType":    "VIDEO",
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "45000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }

}

retrieveNetworkAssistanceSession

Retrieve updated Network Assistance Session.

curl -H 'User-Agent: AF' -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05

> GET /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05 HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> 

< HTTP/1.1 200 OK
< Date: Tue, 28 Nov 2023 17:31:36 GMT
< Connection: close
< Location: /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05
< Content-Type: application/json
< ETag: d7beabb6603b928d124697ba12c36ad9c287c302db92020246fc04107f7f87e8
< Last-Modified: Tue, 28 Nov 2023 17:31:17 GMT
< Cache-Control: max-age=60
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.1.0) rt-5gms-application-function/1.3.0
< Content-Length: 622
< 
{
    "naSessionId":  "cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05",
    "provisioningSessionId":    "ba977c40-8e13-41ee-b9cb-bb3be1d3aa05",
    "serviceDataFlowDescriptions":  [{
            "flowDescription":  {
                "direction":    "DOWNLINK",
                "dstIp":    "10.45.0.3",
                "dstPort":  12345,
                "protocol": 6,
                "srcIp":    "10.45.0.3",
                "srcPort":  123456
            }
        }],
    "mediaType":    "VIDEO",
    "policyTemplateId": "POLICYUUID",
    "requestedQoS": {
        "marBwDlBitRate":   "45000 bps",
        "marBwUlBitRate":   "96000 bps",
        "minDesBwDlBitRate":    "86000 bps",
        "minDesBwUlBitRate":    "86000 bps",
        "mirBwDlBitRate":   "86000 bps",
        "mirBwUlBitRate":   "86000 bps"
    }
}

destroyNetworkAssistanceSession

 $ curl -H 'User-Agent: AF' -X DELETE -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05

> DELETE /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05 HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Date: Tue, 28 Nov 2023 17:31:49 GMT
< Connection: close
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.1.0) rt-5gms-application-function/1.3.0

Retrieve updated Network Assistance Session.

$ curl -H 'User-Agent: AF' -v http://192.168.10.223:7773/3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05

> GET /3gpp-m5/v2/network-assistance/cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05 HTTP/1.1
> Host: 192.168.10.223:7773
> Accept: */*
> User-Agent: AF
> 

< HTTP/1.1 404 Not Found
< Date: Tue, 28 Nov 2023 17:31:55 GMT
< Connection: close
< Server: 5GMSAF-data-network-functions/17 (info.title=M5_NetworkAssistance; info.version=2.1.0) rt-5gms-application-function/1.3.0
< Content-Type: application/problem+json
< Content-Length: 244
< 
{
    "type": "/3gpp-m5/v2",
    "title":    "Unable to retrieve the Network Assistance Session",
    "status":   404,
    "detail":   "The AF has no network assistance session with id [cb85f90a-8e13-41ee-b9cb-bb3be1d3aa05].",
    "instance": "/network-assistance"

}