Nokia logo
DocumentationBlogPricing
Request access

Checking connectivity status

The Device Status feature allows querying and reporting information on several aspects of data connectivity for a device, so you can monitor its status updates, such as when it goes online or offline.

Getting device connectivity status

The SDK below allows you to subscribe client devices to Device Status connectivity events.

import network_as_code as nac
 
from network_as_code.models.device import Device, DeviceIpv4Addr
 
client = nac.NetworkAsCodeClient(
    token="<your-application-key-here>"
)
 
device = client.devices.get("device@bestcsp.net",
                            ipv4_address = DeviceIpv4Addr(public_address="192.0.2.3",
                                                          private_address="192.0.2.204",
                                                          public_port=80)
)
 
subscription = client.connectivity.subscribe(
    event_type="CONNECTIVITY",
    device=device,
    max_num_of_reports=5,
    notification_url="https://example.com/notifications",
    notification_auth_token="replace-with-your-auth-token"
)

Device object parameters

The snippet above identified a mobile network device in multiple ways (IP addresses, port, etc). Learn how to create a device object and understand how the DeviceIPv4Addr model works using NAT technology.

Connectivity subscription parameters

Above, we created a subscription object for connectivity status and supplied the necessary parameters to the client.connectivity.subscribe() method. The parameters table below describes which data each parameter expects to receive.

ParametersDescription
event_typeThe status type you want to check, which is "CONNECTIVITY" in this case.
deviceDevice ID callback parameter.
max_num_of_reportsHow many reports will be sent to the endpoint.
notification_urlHere you can inform a webhook endpoint to receive Device Status notifications.
notification_auth_tokenA password used to identify the sender of the notification.

Last updated on October 12, 2023

On this page
Getting device connectivity statusDevice object parametersConnectivity subscription parameters