Attaching and detaching applications

Besides attaching a device to a network slice as whole, you can attach specific applications instead. Application attachment enables fine-grained slice control with different connectivity parameters set for different applications on a device.

What does this mean? When you create a network slice with specific connectivity parameters, such as different amounts of bandwidth a device or slice can get, area of service, etc., you can make sure that only specific applications can access these resources.

This is done by attaching both the device and applications to the slice you just created. Then, when you are done, you can detach them in the same way.

For example, if an enterprise is authorized to use a device and create network slices for it, they can also attach specific applications to them. This way, they can prioritize network resources according to their multiple business applications.

NOTE: Before attaching an enterprise app into a slice, make sure the enterprise has the right consent to access the device and create specialized network (slices) for it. Learn how to do it in our Consent & Identity management policy.

Attaching an application to a slice

If you have already created and activated a slice, you can just attach a specific application to it by following this SDK example:

from network_as_code.client import NetworkAsCodeClient
 
from network_as_code.models.device import Device, DeviceIpv4Addr
 
from network_as_code.models.slice import (
    Apps,
    Point,
    AreaOfService,
    NetworkIdentifier,
    Slice,
    SliceInfo,
    Throughput,
    TrafficCategories
)
 
...
 
# The slice needs to be created and activated
my_slice.activate()
 
attachment = my_slice.attach(
    device,
    # Use HTTPS to send notifications
    # about slice attachments.
    notification_url="https://notify.me/here",
    notification_auth_token="replace-with-your-auth-token",
    traffic_categories=TrafficCategories(
        apps=Apps(
            # This is the OS ID used by Android
            os="97a498e3-fc92-5c94-8986-0333d06e4e47",
            apps=["ENTERPRISE", "ENTERPRISE2"]
        )
    )
)

What's behind this technology?

There's a set of rules, which will enable the User Equipment (UE) to know how to route the traffic to specific applications within the network environment. On the network side, Network as Code will configure these UE Route Selection Policy (URSP) rules according to the Operating System Identifier (OSId) and OS specific Application Identifier (OsAppId) to establish the traffic categories. So, all you will need to provide is the OSId, according to the OS you use (Android, iOS, etc.) and the OsAppId (Enterprise app name).

For example, Android's 5G Network Slicing documentation defines their OSId with a 5 (UUID) sequence, which is 97a498e3-fc92-5c94-8986-0333d06e4e47. You can also refer to the iOS documentation for further information on their OSId. Now, for the OsAppId, you will need to pass the enterprise app name.

Getting an application

You can get an attachment also by getting a slice since applications are attached to slices.

# Get an attachment by its ID
attachment = mySlice.get_attachment(id)

Detaching an application from a slice

You can follow the complete steps on how to detach a device from a slice, since it also works for application attachments. Briefly, here is a snippet which summarizes the process of detaching and deleting an application:

# Detach a device
my_slice.detach(device)
 
# Delete an attachment by calling the method
# on the attachment previously created
attachment.delete()
 
# Deactivate and delete a slice
my_slice.deactivate()
 
my_slice.delete()

Attachment parameters

The attach/detachment methods have the following parameters:

traffic_categories is an optional parameter in the format "[OS]/[Category]", which is converted by NaC backend into an OSId and OSAppId for URSP. If this parameter is omitted, the slice will be attached as a default for the device. Otherwise, the slice will be only used for the mentioned traffic categories.

ParametersDescription
deviceDevice ID callback parameter used to perform attachment/detachment
traffic_categories(Optional) It should contain the OSId, according to the OS you use (Android, iOS, etc.) and the OsAppId (Enterprise app name)
appsThe enterprise app name (ID)
osThe OSId identifier according to the OS you use (Android, iOS, etc.)
notification_url(Optional) The recipient's HTTP endpoint, which is a web server configured to receive POST requests.
notification_auth_tokenThe password used to identify the sender of the notification.
idIt's possible to define an identifier for the attachment and use it to get the resource.

Last updated on May 23, 2024