Commit 9ceae06b authored by Sergio Gimenez's avatar Sergio Gimenez
Browse files

fix: align federation responses with GSMA

parent e54151e2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ def get_federation_details(federation_context_id, bearer_token, partner_api_root
            status_code = federation_response_data["status_code"]
            error_message = federation_response_data["error"]
            raise APIError(status_code, f"Partner API error: {error_message}")
        elif "edgeDiscoveryServiceEndPoint" in federation_response_data:
        elif "offeredAvailabilityZones" in federation_response_data or "platformCaps" in federation_response_data:
            federation_response_data = InlineResponse2001.from_dict(federation_response_data)
            return federation_response_data, 200
        else:
@@ -152,7 +152,7 @@ def update_federation(federation_context_id, body, bearer_token, partner_api_roo
            status_code = federation_response_data["status_code"]
            error_message = federation_response_data["error"]
            raise APIError(status_code, f"Partner API error: {error_message}")
        elif "edgeDiscoveryServiceEndPoint" in federation_response_data:
        elif "offeredAvailabilityZones" in federation_response_data or "platformCaps" in federation_response_data:
            federation_response_data = update_federation_at_originating_op(originating_op_instance, body,
                                                                           federation_response_data)
            federation_response_data = InlineResponse2001.from_dict(federation_response_data)
+8 −8
Original line number Diff line number Diff line
@@ -109,8 +109,6 @@ def create_federation(body, bearer_token, partner_api_root=None): # noqa: E501
        "platformCaps": [
            partnerOPPlatformCaps
        ],
        "edgeDiscoveryServiceEndPoint": {},
        "lcmServiceEndPoint": {},
        "offeredAvailabilityZones": zones_list
    }
    federation_response_data = FederationResponseData.from_dict(response_data)
@@ -147,14 +145,15 @@ def get_federation_details(federation_context_id, bearer_token=None, partner_api
        raise APIError(422, "Unable to get zones list from Edge Cloud Platform")

    response_data = {
        "edgeDiscoveryServiceEndPoint": {},
        "lcmServiceEndPoint": {},
        "allowedMobileNetworkIds": {
            "mcc": originating_op_instance.orig_op_mobile_network_codes_mcc,
            "mncs": originating_op_instance.orig_op_mobile_network_codes_mncs
        },
        "allowedFixedNetworkIds": originating_op_instance.orig_op_fixed_network_codes,
        "offeredAvailabilityZones": zones_list
        "offeredAvailabilityZones": zones_list,
        "platformCaps": [
            partnerOPPlatformCaps
        ]
    }
    federation_response_data = InlineResponse2001.from_dict(response_data)
    return federation_response_data
@@ -279,14 +278,15 @@ def update_federation(federation_context_id, body, bearer_token=None, partner_ap
        raise APIError(500, f"Failed to re-fetch federation instance")

    response_data = {
        "edgeDiscoveryServiceEndPoint": {},
        "lcmServiceEndPoint": {},
        "allowedMobileNetworkIds": {
            "mcc": originating_op_instance.orig_op_mobile_network_codes_mcc,
            "mncs": originating_op_instance.orig_op_mobile_network_codes_mncs
        },
        "allowedFixedNetworkIds": originating_op_instance.orig_op_fixed_network_codes,
        "offeredAvailabilityZones": zones_list
        "offeredAvailabilityZones": zones_list,
        "platformCaps": [
            partnerOPPlatformCaps
        ]
    }
    federation_response_data = InlineResponse2001.from_dict(response_data)

+0 −3
Original line number Diff line number Diff line
@@ -105,9 +105,6 @@ class FederationRequestData(Model):
        :param orig_op_federation_id: The orig_op_federation_id of this FederationRequestData.
        :type orig_op_federation_id: FederationIdentifier
        """
        if orig_op_federation_id is None:
            raise ValueError("Invalid value for `orig_op_federation_id`, must not be `None`")  # noqa: E501

        self._orig_op_federation_id = orig_op_federation_id

    @property
+0 −3
Original line number Diff line number Diff line
@@ -116,9 +116,6 @@ class FederationResponseData(Model):
        :param partner_op_federation_id: The partner_op_federation_id of this FederationResponseData.
        :type partner_op_federation_id: FederationIdentifier
        """
        if partner_op_federation_id is None:
            raise ValueError("Invalid value for `partner_op_federation_id`, must not be `None`")  # noqa: E501

        self._partner_op_federation_id = partner_op_federation_id

    @property
+29 −9
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import util


class InlineResponse2001(Model):
    def __init__(self, edge_discovery_service_end_point: ServiceEndpoint=None, lcm_service_end_point: ServiceEndpoint=None, allowed_mobile_network_ids: MobileNetworkIds=None, allowed_fixed_network_ids: FixedNetworkIds=None, offered_availability_zones: List[ZoneDetails]=None):  # noqa: E501
    def __init__(self, edge_discovery_service_end_point: ServiceEndpoint=None, lcm_service_end_point: ServiceEndpoint=None, allowed_mobile_network_ids: MobileNetworkIds=None, allowed_fixed_network_ids: FixedNetworkIds=None, offered_availability_zones: List[ZoneDetails]=None, platform_caps: List[str]=None):  # noqa: E501
        """InlineResponse2001 - a model defined in Swagger

        :param edge_discovery_service_end_point: The edge_discovery_service_end_point of this InlineResponse2001.  # noqa: E501
@@ -41,13 +41,16 @@ class InlineResponse2001(Model):
        :type allowed_fixed_network_ids: FixedNetworkIds
        :param offered_availability_zones: The offered_availability_zones of this InlineResponse2001.  # noqa: E501
        :type offered_availability_zones: List[ZoneDetails]
        :param platform_caps: The platform_caps of this InlineResponse2001.  # noqa: E501
        :type platform_caps: List[str]
        """
        self.swagger_types = {
            'edge_discovery_service_end_point': ServiceEndpoint,
            'lcm_service_end_point': ServiceEndpoint,
            'allowed_mobile_network_ids': MobileNetworkIds,
            'allowed_fixed_network_ids': FixedNetworkIds,
            'offered_availability_zones': List[ZoneDetails]
            'offered_availability_zones': List[ZoneDetails],
            'platform_caps': List[str]
        }

        self.attribute_map = {
@@ -55,13 +58,15 @@ class InlineResponse2001(Model):
            'lcm_service_end_point': 'lcmServiceEndPoint',
            'allowed_mobile_network_ids': 'allowedMobileNetworkIds',
            'allowed_fixed_network_ids': 'allowedFixedNetworkIds',
            'offered_availability_zones': 'offeredAvailabilityZones'
            'offered_availability_zones': 'offeredAvailabilityZones',
            'platform_caps': 'platformCaps'
        }
        self._edge_discovery_service_end_point = edge_discovery_service_end_point
        self._lcm_service_end_point = lcm_service_end_point
        self._allowed_mobile_network_ids = allowed_mobile_network_ids
        self._allowed_fixed_network_ids = allowed_fixed_network_ids
        self._offered_availability_zones = offered_availability_zones
        self._platform_caps = platform_caps

    @classmethod
    def from_dict(cls, dikt) -> 'InlineResponse2001':
@@ -92,9 +97,6 @@ class InlineResponse2001(Model):
        :param edge_discovery_service_end_point: The edge_discovery_service_end_point of this InlineResponse2001.
        :type edge_discovery_service_end_point: ServiceEndpoint
        """
        if edge_discovery_service_end_point is None:
            raise ValueError("Invalid value for `edge_discovery_service_end_point`, must not be `None`")  # noqa: E501

        self._edge_discovery_service_end_point = edge_discovery_service_end_point

    @property
@@ -115,9 +117,6 @@ class InlineResponse2001(Model):
        :param lcm_service_end_point: The lcm_service_end_point of this InlineResponse2001.
        :type lcm_service_end_point: ServiceEndpoint
        """
        if lcm_service_end_point is None:
            raise ValueError("Invalid value for `lcm_service_end_point`, must not be `None`")  # noqa: E501

        self._lcm_service_end_point = lcm_service_end_point

    @property
@@ -182,3 +181,24 @@ class InlineResponse2001(Model):
        """

        self._offered_availability_zones = offered_availability_zones

    @property
    def platform_caps(self) -> List[str]:
        """Gets the platform_caps of this InlineResponse2001.


        :return: The platform_caps of this InlineResponse2001.
        :rtype: List[str]
        """
        return self._platform_caps

    @platform_caps.setter
    def platform_caps(self, platform_caps: List[str]):
        """Sets the platform_caps of this InlineResponse2001.


        :param platform_caps: The platform_caps of this InlineResponse2001.
        :type platform_caps: List[str]
        """

        self._platform_caps = platform_caps
Loading