Resolve "Audit API supported feature negotiation"

Proposers

  • Guillermo Sanz López (Telefónica)

Description

This issue aims to integrate the Supported Feature Negotiation capabilities into the Audit Service offered via CAPIF.

Demo or definition of done

Requests to create a security context negotiate the supported features.

References

  1. [3GPP TS 29.222 V19.2.0]

Acknowledgements

This work is funded by the European Commission through the 6G-Sandbox project with Grant Agreement number 101096328.

Closes #132 (closed)

Edited by Guillermo Sanz López

Merge request reports

Loading
+18 −0
Changes for services/TS29222_CAPIF_Auditing_API/logs/core/auditoperations.py: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,17 @@ from .resources import Resource
from .responses import bad_request_error, internal_server_error, make_response, not_found_error


TOTAL_FEATURES = 2
SUPPORTED_FEATURES_HEX = "1"

def return_negotiated_supp_feat_dict(supp_feat):
    final_supp_feat = bin(int(supp_feat, 16) & int(SUPPORTED_FEATURES_HEX, 16))[2:].zfill(TOTAL_FEATURES)[::-1]
    return {
        "EnQueryInvokeLog": True if final_supp_feat[0] == "1" else False,
        "SliceBasedAPIExposure": True if final_supp_feat[1] == "1" else False,
        "Final": hex(int(final_supp_feat[::-1], 2))[2:]
    }

class AuditOperations (Resource):

    def get_logs(self, query_parameters):
@@ -55,6 +66,13 @@ class AuditOperations (Resource):
            if not result['logs']:
                return not_found_error(detail="Parameters do not match any log entry", cause="No logs found")

            client_features = query_parameters.get('supported_features')
            if client_features:
                negotiated = return_negotiated_supp_feat_dict(client_features)
                result['supported_features'] = negotiated["Final"]
            else:
                result['supported_features'] = client_features

            invocation_log = InvocationLog(result['aef_id'], result['api_invoker_id'], result['logs'],
                                           result['supported_features'])
            res = make_response(object=serialize_clean_camel_case(invocation_log), status=200)
Loading