Getting Congestion subscriptions
Here, we will show how to get congestion subscriptions using multiple methods. If you previously created a congestion subscription and you need to modify or delete it, you can easily retrieve it by its ID or index. You can do so by using the following examples:
import network_as_code as nac
from datetime import datetime, timezone, timedelta
from network_as_code.models.device import Device, DeviceIpv4Addr
# Create a client and device objects as previously shown
client = nac.NetworkAsCodeClient(...)
my_device = client.devices.get(...)
# Subscribe your device to Congestion notifications
congestion_subscription = client.insights.subscribe_to_congestion_info(...)
# Get a list of congestion subscriptions
subscriptions = client.insights.get_congestion_subscriptions()
# Get a subscription previously created by its ID
one_subscription = client.insights.get_congestion_subscription(
congestion_subscription.id
)
Note that the snippets above assume you have already created a congestion subscription before, which you can learn how to do here. It also implies that you have already created a Network-as-Code client, and identified your mobile network device.
Congestion parameters
Here is a parameters table describing each parameter used in the code:
Parameters | Description |
---|---|
id | It represents the subscription identifier. |
Last updated on July 25, 2024