Nokia logo
DocumentationBlogPricing
Request access

Slice attachment and detachment

Attaching a device to a slice

Device attachment presupposes a slice already exists and that it is active. Learn how to activate a slice here. So, after creating and activating the desired slice according to the steps in the previous page, simply use the slice.attach() method to attach a device.

from network_as_code.client import NetworkAsCodeClient
 
device = client.devices.get(...)
 
slice = client.slices.create(...)
 
slice.attach(device, "https://example.org/notify",
             notification_auth_token="replace-with-your-auth-token")

Detaching a device from a slice

Use the following SDK snippet to detach a device from a slice.

 
slice.activate(...)
 
...
 
# We can also then detach devices
slice.detach(device, "https://example.org/notify")
 

Note that the snippets above assume you have already created and activated a slice 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.

Slice attach and detach parameters

The slice.attach() and slice.detach() methods require the following parameters:

ParametersDescription
deviceMandatory callback parameter that attaches or detaches the device
notification_urlMandatory notification URL that can be informed directly. Learn more about the notification URL and auth token.
notification_auth_tokenOptional password used to identify the sender of the notification

Last updated on October 20, 2023

On this page
Attaching a device to a sliceDetaching a device from a sliceSlice attach and detach parameters