Loading services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py +6 −6 Original line number Diff line number Diff line Loading @@ -61,15 +61,15 @@ def registrations_post(body): # noqa: E501 current_app.logger.info("Registering Provider Domain") supp_feat_dict = APIProviderEnrolmentDetails.return_supp_feat_dict(body['suppFeat']) current_app.logger.info(supp_feat_dict) if request.is_json: # if supp_feat_dict['RNAA'] and 'apiProvName' not in body.keys(): # current_app.logger.error("RNAA feature not properly configured. apiProvName not exist") # return bad_request_error(detail="Bad Request", cause="Required attribute not detected", invalid_params=[ # {"param": "apiProvName", "reason": "Not detected"}]) body = APIProviderEnrolmentDetails.from_dict(request.get_json()) # noqa: E501 # Feature negotiation determined_supp_feat = APIProviderEnrolmentDetails.supp_feat_negotiation(body.supp_feat) supp_feat_dict = APIProviderEnrolmentDetails.return_supp_feat_dict(determined_supp_feat) body.supp_feat = hex(int(determined_supp_feat,2))[2:] current_app.logger.info(supp_feat_dict) res = provider_management_ops.register_api_provider_enrolment_details(body, username, uuid) Loading services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details.py +14 −5 Original line number Diff line number Diff line Loading @@ -64,21 +64,30 @@ class APIProviderEnrolmentDetails(Model): self._api_prov_name = api_prov_name @classmethod def return_supp_feat_dict(cls, supp_feat): def supp_feat_negotiation(cls, supp_feat): # convert hex string to int supp_feat_in_hex = int(supp_feat, 16) # CAPIF supported features capif_supp_feat = int("f" * len(supp_feat), 16) # current_app.logger.info(capif_supp_feat) # current_app.logger.info(supp_feat_in_hex) # bitwise AND to determine the supported features supp_feat_in_hex = supp_feat_in_hex & capif_supp_feat supp_feat_in_bin = bin(supp_feat_in_hex << (len(supp_feat)*4 - len(bin(supp_feat_in_hex)[2:])))[2:] # Convert the determined supported features field to string (with the same length as the initial) # supp_feat_in_bin = bin(supp_feat_in_hex << (len(supp_feat) * 4 - len(bin(supp_feat_in_hex)[2:])))[2:] supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) # current_app.logger.info(supp_feat_in_hex) # current_app.logger.info(supp_feat_in_bin) return supp_feat_in_bin @classmethod def return_supp_feat_dict(cls, supp_feat): return { "RNAA": True if supp_feat_in_bin[0] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[1] == "1" else False, "RNAA": True if supp_feat[0] == "1" else False, "PatchUpdate": True if supp_feat[1] == "1" else False, } @classmethod Loading Loading
services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py +6 −6 Original line number Diff line number Diff line Loading @@ -61,15 +61,15 @@ def registrations_post(body): # noqa: E501 current_app.logger.info("Registering Provider Domain") supp_feat_dict = APIProviderEnrolmentDetails.return_supp_feat_dict(body['suppFeat']) current_app.logger.info(supp_feat_dict) if request.is_json: # if supp_feat_dict['RNAA'] and 'apiProvName' not in body.keys(): # current_app.logger.error("RNAA feature not properly configured. apiProvName not exist") # return bad_request_error(detail="Bad Request", cause="Required attribute not detected", invalid_params=[ # {"param": "apiProvName", "reason": "Not detected"}]) body = APIProviderEnrolmentDetails.from_dict(request.get_json()) # noqa: E501 # Feature negotiation determined_supp_feat = APIProviderEnrolmentDetails.supp_feat_negotiation(body.supp_feat) supp_feat_dict = APIProviderEnrolmentDetails.return_supp_feat_dict(determined_supp_feat) body.supp_feat = hex(int(determined_supp_feat,2))[2:] current_app.logger.info(supp_feat_dict) res = provider_management_ops.register_api_provider_enrolment_details(body, username, uuid) Loading
services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/models/api_provider_enrolment_details.py +14 −5 Original line number Diff line number Diff line Loading @@ -64,21 +64,30 @@ class APIProviderEnrolmentDetails(Model): self._api_prov_name = api_prov_name @classmethod def return_supp_feat_dict(cls, supp_feat): def supp_feat_negotiation(cls, supp_feat): # convert hex string to int supp_feat_in_hex = int(supp_feat, 16) # CAPIF supported features capif_supp_feat = int("f" * len(supp_feat), 16) # current_app.logger.info(capif_supp_feat) # current_app.logger.info(supp_feat_in_hex) # bitwise AND to determine the supported features supp_feat_in_hex = supp_feat_in_hex & capif_supp_feat supp_feat_in_bin = bin(supp_feat_in_hex << (len(supp_feat)*4 - len(bin(supp_feat_in_hex)[2:])))[2:] # Convert the determined supported features field to string (with the same length as the initial) # supp_feat_in_bin = bin(supp_feat_in_hex << (len(supp_feat) * 4 - len(bin(supp_feat_in_hex)[2:])))[2:] supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) # current_app.logger.info(supp_feat_in_hex) # current_app.logger.info(supp_feat_in_bin) return supp_feat_in_bin @classmethod def return_supp_feat_dict(cls, supp_feat): return { "RNAA": True if supp_feat_in_bin[0] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[1] == "1" else False, "RNAA": True if supp_feat[0] == "1" else False, "PatchUpdate": True if supp_feat[1] == "1" else False, } @classmethod Loading