From 341cfae1d2d612b2722d8dc8b01834f69527181d Mon Sep 17 00:00:00 2001 From: Murat Karabulut <88037779+gmuratk@users.noreply.github.com> Date: Fri, 7 Jun 2024 14:37:24 -0400 Subject: [PATCH 1/3] Create connected-network-type.yaml --- .../connected-network-type.yaml | 416 ++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 code/API_definitions/connected-network-type.yaml diff --git a/code/API_definitions/connected-network-type.yaml b/code/API_definitions/connected-network-type.yaml new file mode 100644 index 0000000..5efef02 --- /dev/null +++ b/code/API_definitions/connected-network-type.yaml @@ -0,0 +1,416 @@ +openapi: 3.0.3 +info: + title: Connected Network Type + description: | + This API provides the customer with the ability to query to which Mobile Communication Technology it is connected to. + + # Introduction + + ## Connected Network Type + + API consumer is able to inquire device's connected network type. + + # Relevant terms and definitions + + * **Device**: A device refers to any physical entity that can connect to a network and participate in network communication. + At least one identifier for the device (user equipment) out of four options: IPv4 address, IPv6 address, Phone number, or Network Access Identifier assigned by the mobile network operator for the device. + + * **Network Type** : Network Type is intended to provide insight to connected network's capabilities from standards perspective. Actual network capabilities may differ based on implementation and MUST be checked with the connected network provider. + - `2G`, if device is connected to the 2G network + - `3G`, if device is connected to the 3G network + - `4GLTE`, if device is connected to the 4G network + - `5GNSA`, if device's is connected to the 4G network but using 5G New Radio (NR) capability + - `5GSA`, if device is connected to the 5G network + - `NON3GPP4G`, if device is connected to the 4G network via WiFi network + - `NON3GPP5G`, if device's is connected to the 5G network via WiFi network + + + * **LastStatusTime** : This property specifies the time when the status was last updated. Its presence in the response indicates the freshness of the information, while its absence implies the information may be outdated or its freshness is uncertain. + + # API Functionality + + The API exposes following capabilities: + + ## Connected Network Type + + The endpoint `POST /retrieve-network-type` allows to get connected Network Type. + + + ## Further info and support + + (FAQs will be added in a later version of the documentation) + + termsOfService: http://swagger.io/terms/ + contact: + email: project-email@sample.com + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + version: wip +externalDocs: + description: Product documentation at CAMARA + url: https://github.com/camaraproject/ + +servers: + - url: "{apiRoot}/network-type-retrieval/v0" + variables: + apiRoot: + default: http://localhost:9091 + description: API root +tags: + - name: Connected Network Type + description: Operations to get the network type device is connected to +paths: + /retrieve-network-type: + post: + tags: + - Connected network type + summary: "Get the connected network type" + description: Get the connected network type + operationId: getConnectedNetworkType + parameters: + - $ref: '#/components/parameters/x-correlator' + security: + - openId: + - connected-network-type:read + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RequestConnectedNetworkType" + required: true + responses: + "200": + description: Contains connected network type + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ConnectedNetworkTypeResponse" + examples: + Connected-to-4G: + value: + lastStatusTime: "2024-02-20T10:41:38.657Z" + connectedNetworkType: 4G + Connected-To-5GNSA: + value: + lastStatusTime: "2024-02-20T10:41:38.657Z" + connectedNetworkType: 5GNSA + Connected-To-Non3gpp4g: + value: + lastStatusTime: "2024-02-20T10:41:38.657Z" + connectedNetworkType: NON3GPP4G + Not-Connected: + value: + lastStatusTime: "2024-02-20T10:41:38.657Z" + connectedNetworkType: NOT_CONNECTED + "400": + $ref: "#/components/responses/Generic400" + "401": + $ref: "#/components/responses/Generic401" + "403": + $ref: "#/components/responses/ConnectedNetworkTypePermissionDenied403" + "404": + $ref: "#/components/responses/ConnectedStatusNotFound404" + "422": + $ref: "#/components/responses/ConnectedStatusUnprocessableEntity422" + "500": + $ref: "#/components/responses/Generic500" + "503": + $ref: "#/components/responses/Generic503" +components: + securitySchemes: + openId: + type: openIdConnect + openIdConnectUrl: https://example.com/.well-known/openid-configuration + parameters: + x-correlator: + name: x-correlator + in: header + description: Correlation id for the different services + schema: + type: string + headers: + x-correlator: + description: Correlation id for the different services + schema: + type: string + schemas: + LastStatusTime: + description: Last time that the associated connected Network Type was updated + type: string + format: date-time + example: "2024-02-20T10:41:38.657Z" + + ConnectedNetworkTypeResponse: + type: object + required: + - connectedNetworkType + properties: + lastStatusTime: + $ref: "#/components/schemas/LastStatusTime" + connectedNetworkType: + $ref: "#/components/schemas/ConnectedNetworkType" + + ConnectedNetworkType: + description: | + * NOT_CONNECTED: The device is not connected to network + * 2G: 2nd Generation Mobile Communication Technology + * 3G: 3rd Generation Mobile Communication Technology + * 4GLTE: 4th Generation Mobile Communication Technology aka LTE + * 5GNSA:4th Generation Mobile Communication Technology aka LTE with device connected 5G New Radio (NR) + * 5GSA: 5th Generation Mobile Communication Technology + * NON3GPP4G: Device connected via non-3GPP Radio Access Technology but connected to 4G Network (e.g. WiFi Calling) + * NON3GPP5G: Device connected via non-3GPP Radio Access Technology but connected to 5G Network (e.g. WiFi Calling) + type: string + enum: + - 2G + - 3G + - 4GLTE + - 5GNSA + - 5GSA + - NON3GPP4G + - NON3GPP5G + - NOT-CONNECTED + + Device: + description: | + End-user equipment able to connect to a mobile network. Examples of devices include smartphones or IoT sensors/actuators. + + The developer can choose to provide the below specified device identifiers: + + * `ipv4Address` + * `ipv6Address` + * `phoneNumber` + * `networkAccessIdentifier` + + NOTE: the MNO might support only a subset of these options. The API invoker can provide multiple identifiers to be compatible across different MNOs. In this case the identifiers MUST belong to the same device. + type: object + properties: + phoneNumber: + $ref: "#/components/schemas/PhoneNumber" + networkAccessIdentifier: + $ref: "#/components/schemas/NetworkAccessIdentifier" + ipv4Address: + $ref: "#/components/schemas/DeviceIpv4Addr" + ipv6Address: + $ref: "#/components/schemas/DeviceIpv6Address" + minProperties: 1 + + PhoneNumber: + description: A public identifier addressing a telephone subscription. In mobile networks it corresponds to the MSISDN (Mobile Station International Subscriber Directory Number). In order to be globally unique it has to be formatted in international format, according to E.164 standard, prefixed with '+'. + type: string + pattern: '^\+[1-9][0-9]{4,14}$' + example: "+123456789" + + NetworkAccessIdentifier: + description: A public identifier addressing a subscription in a mobile network. In 3GPP terminology, it corresponds to the GPSI formatted with the External Identifier ({Local Identifier}@{Domain Identifier}). Unlike the telephone number, the network access identifier is not subjected to portability ruling in force, and is individually managed by each operator. + type: string + example: "123456789@domain.com" + + DeviceIpv4Addr: + type: object + description: | + The device should be identified by either the public (observed) IP address and port as seen by the application server, or the private (local) and any public (observed) IP addresses in use by the device (this information can be obtained by various means, for example from some DNS servers). + + If the allocated and observed IP addresses are the same (i.e. NAT is not in use) then the same address should be specified for both publicAddress and privateAddress. + + If NAT64 is in use, the device should be identified by its publicAddress and publicPort, or separately by its allocated IPv6 address (field ipv6Address of the Device object) + + In all cases, publicAddress must be specified, along with at least one of either privateAddress or publicPort, dependent upon which is known. In general, mobile devices cannot be identified by their public IPv4 address alone. + properties: + publicAddress: + $ref: "#/components/schemas/SingleIpv4Addr" + privateAddress: + $ref: "#/components/schemas/SingleIpv4Addr" + publicPort: + $ref: "#/components/schemas/Port" + anyOf: + - required: [publicAddress, privateAddress] + - required: [publicAddress, publicPort] + example: + publicAddress: "84.125.93.10" + publicPort: 59765 + + SingleIpv4Addr: + description: A single IPv4 address with no subnet mask + type: string + format: ipv4 + example: "84.125.93.10" + + Port: + description: TCP or UDP port number + type: integer + minimum: 0 + maximum: 65535 + + DeviceIpv6Address: + description: | + The device should be identified by the observed IPv6 address, or by any single IPv6 address from within the subnet allocated to the device (e.g. adding ::0 to the /64 prefix). + type: string + format: ipv6 + example: 2001:db8:85a3:8d3:1319:8a2e:370:7344 + + RequestConnectedNetworkType: + type: object + properties: + device: + $ref: "#/components/schemas/Device" + required: + - device + + ErrorInfo: + type: object + required: + - status + - code + - message + properties: + status: + type: integer + description: HTTP response status code + code: + type: string + description: Code given to this error + message: + type: string + description: Detailed error description + + responses: + Generic400: + description: Problem with the client request + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 400 + code: "INVALID_ARGUMENT" + message: "Client specified an invalid argument, request body or query param" + Generic401: + description: Authentication problem with the client request + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 401 + code: "UNAUTHENTICATED" + message: "Request not authenticated due to missing, invalid, or expired credentials" + ConnectedNetworkTypePermissionDenied403: + description: | + Client does not have sufficient permission. + In addition to regular scenario of `PERMISSION_DENIED`, other scenarios may exist: + - Phone number cannot be deducted from access token context.(`{"code": "NUMBER_VERIFICATION.INVALID_TOKEN_CONTEXT","message": "Phone number cannot be deducted from access token context"}`) + headers: + X-Correlator: + description: Correlation id for the different services + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorInfo' + examples: + PermissionDenied: + value: + status: 403 + code: "PERMISSION_DENIED" + message: "Client does not have sufficient permissions to perform this action" + InvalidTokenContext: + value: + status: 403 + code: INVALID_TOKEN_CONTEXT + message: Invalid access token context + ConnectedStatusNotFound404: + description: Resource Not Found + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + examples: + NotFound: + value: + status: 404 + code: NOT_FOUND + message: "The specified resource is not found" + DeviceIdentifierNotFound: + value: + status: 404 + code: DEVICE_NOT_FOUND + message: Some identifier cannot be matched to a device + Generic409: + description: Conflict + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 409 + code: CONFLICT + message: "The specified resource is in a conflict" + ConnectedStatusUnprocessableEntity422: + description: Unprocessable Entity + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + examples: + UnsupportedDeviceIdentifiers: + value: + status: 422 + code: UNSUPPORTED_DEVICE_IDENTIFIERS + message: "None of the provided device identifiers is supported by the implementation" + InconsistentDeviceIdentifiers: + value: + status: 422 + code: DEVICE_IDENTIFIERS_MISMATCH + message: Device identifiers mismatch + DeviceNotSupported: + value: + status: 422 + code: DEVICE_NOT_APPLICABLE + message: Service not applicable to the device + Generic500: + description: Server error + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 500 + code: "INTERNAL" + message: "Server error" + Generic503: + description: Service unavailable. Typically the server is down. + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 503 + code: "UNAVAILABLE" + message: "Service unavailable" From 3c980bbd0631b9ea55a64a30b91d26e7e1188b0a Mon Sep 17 00:00:00 2001 From: Murat Karabulut <88037779+gmuratk@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:35:59 -0400 Subject: [PATCH 2/3] Update connected-network-type.yaml --- code/API_definitions/connected-network-type.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/API_definitions/connected-network-type.yaml b/code/API_definitions/connected-network-type.yaml index 5efef02..5be015b 100644 --- a/code/API_definitions/connected-network-type.yaml +++ b/code/API_definitions/connected-network-type.yaml @@ -90,10 +90,10 @@ paths: schema: $ref: "#/components/schemas/ConnectedNetworkTypeResponse" examples: - Connected-to-4G: + Connected-to-4GLTE: value: lastStatusTime: "2024-02-20T10:41:38.657Z" - connectedNetworkType: 4G + connectedNetworkType: 4GLTE Connected-To-5GNSA: value: lastStatusTime: "2024-02-20T10:41:38.657Z" From f7b1c142c774dbbfe2ac31d96a75be0fc482e86c Mon Sep 17 00:00:00 2001 From: Murat Karabulut <88037779+gmuratk@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:37:32 -0400 Subject: [PATCH 3/3] Update connected-network-type.yaml --- code/API_definitions/connected-network-type.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/API_definitions/connected-network-type.yaml b/code/API_definitions/connected-network-type.yaml index 5be015b..96f6e6d 100644 --- a/code/API_definitions/connected-network-type.yaml +++ b/code/API_definitions/connected-network-type.yaml @@ -173,8 +173,8 @@ components: - 5GSA - NON3GPP4G - NON3GPP5G - - NOT-CONNECTED - + - NOT_CONNECTED + Device: description: | End-user equipment able to connect to a mobile network. Examples of devices include smartphones or IoT sensors/actuators.