Loading services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py +1 −7 Original line number Original line Diff line number Diff line Loading @@ -62,14 +62,8 @@ def registrations_post(body): # noqa: E501 current_app.logger.info("Registering Provider Domain") current_app.logger.info("Registering Provider Domain") if request.is_json: if request.is_json: body = APIProviderEnrolmentDetails.from_dict(request.get_json()) # noqa: E501 body = APIProviderEnrolmentDetails.from_dict(request.get_json()) # noqa: E501 # Feature negotiation supp_feat_dict = APIProviderEnrolmentDetails.return_supp_feat_dict(body.supp_feat) 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) 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 +26 −20 Original line number Original line Diff line number Diff line Loading @@ -63,31 +63,37 @@ class APIProviderEnrolmentDetails(Model): self._fail_reason = fail_reason self._fail_reason = fail_reason self._api_prov_name = api_prov_name self._api_prov_name = api_prov_name @classmethod # @classmethod def supp_feat_negotiation(cls, supp_feat): # def supp_feat_negotiation(cls, supp_feat): # convert hex string to int # # convert hex string to int supp_feat_in_hex = int(supp_feat, 16) # supp_feat_in_hex = int(supp_feat, 16) # CAPIF supported features # # CAPIF supported features capif_supp_feat = int("f" * len(supp_feat), 16) # 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 # bitwise AND to determine the supported features # # Convert the determined supported features field to string (with the same length as the initial) supp_feat_in_hex = supp_feat_in_hex & capif_supp_feat # supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) # 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:] # # current_app.logger.info(supp_feat_in_hex) supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) # # current_app.logger.info(supp_feat_in_bin) # return supp_feat_in_bin # current_app.logger.info(supp_feat_in_hex) # current_app.logger.info(supp_feat_in_bin) return supp_feat_in_bin @classmethod @classmethod def return_supp_feat_dict(cls, supp_feat): def return_supp_feat_dict(cls, supp_feat): TOTAL_FEATURES = 2 supp_feat_in_hex = int(supp_feat, 16) # # CAPIF supported features # capif_supp_feat = int("f" * len(supp_feat), 16) # or capif_supp_feat = int("1", 16) for only RNAA # # 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)[2:].zfill(TOTAL_FEATURES)[::-1] return { return { "RNAA": True if supp_feat[0] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[0] == "1" else False, "PatchUpdate": True if supp_feat[1] == "1" else False, "RNAA": True if supp_feat_in_bin[1] == "1" else False } } @classmethod @classmethod Loading services/TS29222_CAPIF_Discover_Service_API/service_apis/models/discovered_apis.py +4 −3 Original line number Original line Diff line number Diff line Loading @@ -32,13 +32,14 @@ class DiscoveredAPIs(Model): @classmethod @classmethod def return_supp_feat_dict(cls, supp_feat): def return_supp_feat_dict(cls, supp_feat): TOTAL_FEATURES = 3 supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_bin = bin(supp_feat_in_hex)[2:] supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(TOTAL_FEATURES)[::-1] return { return { "RNAA": True if supp_feat_in_bin[0] == "1" else False, "ApiSupportedFeatureQuery": True if supp_feat_in_bin[0] == "1" else False, "VendSpecQueryParams": True if supp_feat_in_bin[1] == "1" else False, "VendSpecQueryParams": True if supp_feat_in_bin[1] == "1" else False, "ApiSupportedFeatureQuery": True if supp_feat_in_bin[2] == "1" else False, "RNAA": True if supp_feat_in_bin[2] == "1" else False } } @classmethod @classmethod Loading services/TS29222_CAPIF_Publish_Service_API/published_apis/models/service_api_description.py +11 −18 Original line number Original line Diff line number Diff line Loading @@ -95,30 +95,23 @@ class ServiceAPIDescription(Model): @classmethod @classmethod def return_supp_feat_dict(cls, supp_feat): def return_supp_feat_dict(cls, supp_feat): # supp_feat_in_hex = int(supp_feat, 16) TOTAL_FEATURES = 9 # supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_hex = int(supp_feat, 16) capif_supp_feat = int("f" * len(supp_feat), 16) # d18 supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(TOTAL_FEATURES)[::-1] # current_app.logger.info(capif_supp_feat) # current_app.logger.info(supp_feat_in_hex) 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:] supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat) * 4) return { return { "VendorExt": True if supp_feat_in_bin[0] == "1" else False, "ApiSupportedFeaturePublishing": True if supp_feat_in_bin[0] == "1" else False, "RNAA": True if supp_feat_in_bin[1] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[1] == "1" else False, "EdgeApp_2": True if supp_feat_in_bin[2] == "1" else False, "ExtendedIntfDesc": True if supp_feat_in_bin[2] == "1" else False, "ApiStatusMonitoring": True if supp_feat_in_bin[3] == "1" else False, "MultipleCustomOperations": True if supp_feat_in_bin[3] == "1" else False, "ProtocDataFormats_Ext1": True if supp_feat_in_bin[4] == "1" else False, "ProtocDataFormats_Ext1": True if supp_feat_in_bin[4] == "1" else False, "MultipleCustomOperations": True if supp_feat_in_bin[5] == "1" else False, "ApiStatusMonitoring": True if supp_feat_in_bin[5] == "1" else False, "ExtendedIntfDesc": True if supp_feat_in_bin[6] == "1" else False, "EdgeApp_2": True if supp_feat_in_bin[6] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[7] == "1" else False, "RNAA": True if supp_feat_in_bin[7] == "1" else False, "ApiSupportedFeaturePublishing": True if supp_feat_in_bin[8] == "1" else False, "VendorExt": True if supp_feat_in_bin[8] == "1" else False } } @classmethod @classmethod def from_dict(cls, dikt) -> 'ServiceAPIDescription': def from_dict(cls, dikt) -> 'ServiceAPIDescription': """Returns the dict as a model """Returns the dict as a model Loading services/TS29222_CAPIF_Security_API/capif_security/models/service_security.py +13 −0 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,19 @@ class ServiceSecurity(Model): self._websock_notif_config = websock_notif_config self._websock_notif_config = websock_notif_config self._supported_features = supported_features self._supported_features = supported_features @classmethod def return_supp_feat_dict(cls, supp_feat): TOTAL_FEATURES = 4 supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(TOTAL_FEATURES)[::-1] return { "Notification_test_event": True if supp_feat_in_bin[0] == "1" else False, "Notification_websocket": True if supp_feat_in_bin[1] == "1" else False, "SecurityInfoPerAPI": True if supp_feat_in_bin[2] == "1" else False, "RNAA": True if supp_feat_in_bin[3] == "1" else False } @classmethod @classmethod def from_dict(cls, dikt) -> 'ServiceSecurity': def from_dict(cls, dikt) -> 'ServiceSecurity': """Returns the dict as a model """Returns the dict as a model Loading Loading
services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/controllers/default_controller.py +1 −7 Original line number Original line Diff line number Diff line Loading @@ -62,14 +62,8 @@ def registrations_post(body): # noqa: E501 current_app.logger.info("Registering Provider Domain") current_app.logger.info("Registering Provider Domain") if request.is_json: if request.is_json: body = APIProviderEnrolmentDetails.from_dict(request.get_json()) # noqa: E501 body = APIProviderEnrolmentDetails.from_dict(request.get_json()) # noqa: E501 # Feature negotiation supp_feat_dict = APIProviderEnrolmentDetails.return_supp_feat_dict(body.supp_feat) 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) 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 +26 −20 Original line number Original line Diff line number Diff line Loading @@ -63,31 +63,37 @@ class APIProviderEnrolmentDetails(Model): self._fail_reason = fail_reason self._fail_reason = fail_reason self._api_prov_name = api_prov_name self._api_prov_name = api_prov_name @classmethod # @classmethod def supp_feat_negotiation(cls, supp_feat): # def supp_feat_negotiation(cls, supp_feat): # convert hex string to int # # convert hex string to int supp_feat_in_hex = int(supp_feat, 16) # supp_feat_in_hex = int(supp_feat, 16) # CAPIF supported features # # CAPIF supported features capif_supp_feat = int("f" * len(supp_feat), 16) # 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 # bitwise AND to determine the supported features # # Convert the determined supported features field to string (with the same length as the initial) supp_feat_in_hex = supp_feat_in_hex & capif_supp_feat # supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) # 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:] # # current_app.logger.info(supp_feat_in_hex) supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) # # current_app.logger.info(supp_feat_in_bin) # return supp_feat_in_bin # current_app.logger.info(supp_feat_in_hex) # current_app.logger.info(supp_feat_in_bin) return supp_feat_in_bin @classmethod @classmethod def return_supp_feat_dict(cls, supp_feat): def return_supp_feat_dict(cls, supp_feat): TOTAL_FEATURES = 2 supp_feat_in_hex = int(supp_feat, 16) # # CAPIF supported features # capif_supp_feat = int("f" * len(supp_feat), 16) # or capif_supp_feat = int("1", 16) for only RNAA # # 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)[2:].zfill(TOTAL_FEATURES)[::-1] return { return { "RNAA": True if supp_feat[0] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[0] == "1" else False, "PatchUpdate": True if supp_feat[1] == "1" else False, "RNAA": True if supp_feat_in_bin[1] == "1" else False } } @classmethod @classmethod Loading
services/TS29222_CAPIF_Discover_Service_API/service_apis/models/discovered_apis.py +4 −3 Original line number Original line Diff line number Diff line Loading @@ -32,13 +32,14 @@ class DiscoveredAPIs(Model): @classmethod @classmethod def return_supp_feat_dict(cls, supp_feat): def return_supp_feat_dict(cls, supp_feat): TOTAL_FEATURES = 3 supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_bin = bin(supp_feat_in_hex)[2:] supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(TOTAL_FEATURES)[::-1] return { return { "RNAA": True if supp_feat_in_bin[0] == "1" else False, "ApiSupportedFeatureQuery": True if supp_feat_in_bin[0] == "1" else False, "VendSpecQueryParams": True if supp_feat_in_bin[1] == "1" else False, "VendSpecQueryParams": True if supp_feat_in_bin[1] == "1" else False, "ApiSupportedFeatureQuery": True if supp_feat_in_bin[2] == "1" else False, "RNAA": True if supp_feat_in_bin[2] == "1" else False } } @classmethod @classmethod Loading
services/TS29222_CAPIF_Publish_Service_API/published_apis/models/service_api_description.py +11 −18 Original line number Original line Diff line number Diff line Loading @@ -95,30 +95,23 @@ class ServiceAPIDescription(Model): @classmethod @classmethod def return_supp_feat_dict(cls, supp_feat): def return_supp_feat_dict(cls, supp_feat): # supp_feat_in_hex = int(supp_feat, 16) TOTAL_FEATURES = 9 # supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat)*4) supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_hex = int(supp_feat, 16) capif_supp_feat = int("f" * len(supp_feat), 16) # d18 supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(TOTAL_FEATURES)[::-1] # current_app.logger.info(capif_supp_feat) # current_app.logger.info(supp_feat_in_hex) 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:] supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(len(supp_feat) * 4) return { return { "VendorExt": True if supp_feat_in_bin[0] == "1" else False, "ApiSupportedFeaturePublishing": True if supp_feat_in_bin[0] == "1" else False, "RNAA": True if supp_feat_in_bin[1] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[1] == "1" else False, "EdgeApp_2": True if supp_feat_in_bin[2] == "1" else False, "ExtendedIntfDesc": True if supp_feat_in_bin[2] == "1" else False, "ApiStatusMonitoring": True if supp_feat_in_bin[3] == "1" else False, "MultipleCustomOperations": True if supp_feat_in_bin[3] == "1" else False, "ProtocDataFormats_Ext1": True if supp_feat_in_bin[4] == "1" else False, "ProtocDataFormats_Ext1": True if supp_feat_in_bin[4] == "1" else False, "MultipleCustomOperations": True if supp_feat_in_bin[5] == "1" else False, "ApiStatusMonitoring": True if supp_feat_in_bin[5] == "1" else False, "ExtendedIntfDesc": True if supp_feat_in_bin[6] == "1" else False, "EdgeApp_2": True if supp_feat_in_bin[6] == "1" else False, "PatchUpdate": True if supp_feat_in_bin[7] == "1" else False, "RNAA": True if supp_feat_in_bin[7] == "1" else False, "ApiSupportedFeaturePublishing": True if supp_feat_in_bin[8] == "1" else False, "VendorExt": True if supp_feat_in_bin[8] == "1" else False } } @classmethod @classmethod def from_dict(cls, dikt) -> 'ServiceAPIDescription': def from_dict(cls, dikt) -> 'ServiceAPIDescription': """Returns the dict as a model """Returns the dict as a model Loading
services/TS29222_CAPIF_Security_API/capif_security/models/service_security.py +13 −0 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,19 @@ class ServiceSecurity(Model): self._websock_notif_config = websock_notif_config self._websock_notif_config = websock_notif_config self._supported_features = supported_features self._supported_features = supported_features @classmethod def return_supp_feat_dict(cls, supp_feat): TOTAL_FEATURES = 4 supp_feat_in_hex = int(supp_feat, 16) supp_feat_in_bin = bin(supp_feat_in_hex)[2:].zfill(TOTAL_FEATURES)[::-1] return { "Notification_test_event": True if supp_feat_in_bin[0] == "1" else False, "Notification_websocket": True if supp_feat_in_bin[1] == "1" else False, "SecurityInfoPerAPI": True if supp_feat_in_bin[2] == "1" else False, "RNAA": True if supp_feat_in_bin[3] == "1" else False } @classmethod @classmethod def from_dict(cls, dikt) -> 'ServiceSecurity': def from_dict(cls, dikt) -> 'ServiceSecurity': """Returns the dict as a model """Returns the dict as a model Loading