Creating a slice
A slice (or specialized network) can be customized to a myriad of use cases in a much larger network.
After installing NaC and creating the
client
and device
objects,
create a slice
object using the slice creation method,
and include the parameter values described below to identify the slice.
Good to know: In this example, we will create an Enhanced Mobile Broadband (eMBB) slice type, which will allow 5G to provide devices with much faster data rates compared to 4G. You can also provide your preferred API endpoint (URL) to receive slice status notifications.
It's also good to know that every slice has a life cycle. This allows you to manage your applications and get notifications for when a slice is available, operating, pending, and so on.
import network_as_code as nac
from network_as_code.models.device import Device, DeviceIpv4Addr
from network_as_code.models.slice import (
Point,
AreaOfService,
NetworkIdentifier,
Slice,
SliceInfo,
Throughput
)
client = nac.NetworkAsCodeClient(...)
my_device = client.devices.get(...)
# Creation of a slice:
# We use the country code (MCC) and network code (MNC) to identify the network
# Different types of slices can be requested using service type and differentiator
# The area of the slice must also be described in geo-coordinates
my_slice = client.slices.create(
name="slice-name",
network_id = NetworkIdentifier(mcc="236", mnc="30"),
slice_info = SliceInfo(service_type="eMBB", differentiator="123456"),
area_of_service=AreaOfService(polygon=[
Point(latitude=42.0, longitude=42.0),
Point(latitude=41.0, longitude=42.0),
Point(latitude=42.0, longitude=41.0),
Point(latitude=42.0, longitude=42.0)
]),
# Use HTTPS to send notifications
notification_url="http://notify.me/here",
notification_auth_token="replace-with-your-auth-token"
)
Slice parameters
Parameters | Description |
---|---|
name | The slice name later called for operations, such as activation, deactivation, deletion, etc. |
network_id | The network identifier for the Network Operator and country. |
slice_info | Slice information on the service type and the differentiator if slices carry the same SST value |
area_of_service | Define the area of service with geographic coordinates to where the network slice will be active. |
notification_url | The recipient's HTTP endpoint, which is a web server configured to receive POST requests. |
notification_auth_token | The password used to identify the sender of the notification. |
TIP: You can read more about the slicing terminology (e.g.: Network ID, slice type/info) on the Network Slicing index page.
Creating a slice with network Throughput
It is also possible to create a slice with (OPTIONAL) parameters to specify the amount of bandwidth the slice or device can get. This will allow specifying the amount of traffic that can go through the slice in one direction.
Just use and adapt the following code snippet example:
import network_as_code as nac
from network_as_code.models.device import Device, DeviceIpv4Addr
from network_as_code.models.slice import(
NetworkIdentifier,
Slice,
SliceInfo,
AreaOfService,
Point,
Throughput
)
client = nac.NetworkAsCodeClient(...)
my_device = client.devices.get(...)
# Creation of a slice:
# We use the country code (MCC) and network code (MNC) to identify the network
# Different types of slices can be requested using service type and differentiator
# Area of the slice must also be described in geo-coordinates
my_slice = client.slices.create(
name="slice-name",
network_id = NetworkIdentifier(mcc="236", mnc="30"),
slice_info = SliceInfo(service_type="eMBB", differentiator="123456"),
area_of_service = AreaOfService(polygon=[
Point(latitude=47.344, longitude=104.349),
Point(latitude=35.344, longitude=76.619),
Point(latitude=12.344, longitude=142.541),
Point(latitude=19.43, longitude=103.53)
]),
slice_downlink_throughput = Throughput(guaranteed=3415, maximum=1234324),
slice_uplink_throughput = Throughput(guaranteed=3415, maximum=1234324),
device_downlink_throughput = Throughput(guaranteed=3415, maximum=1234324),
device_uplink_throughput = Throughput(guaranteed=3415, maximum=1234324),
max_data_connections=10,
max_devices=5
)
Slice Throughput parameters
Throughput parameters | Description |
---|---|
slice_uplink_throughput or slice_downlink_throughput | Specify the amount of bandwidth the slice can get. |
device_uplink_throughput or device_downlink_throughput | Specify the amount of bandwidth the device can get. |
max_data_connections | Maximum number of data connection sessions in the slice. |
max_devices | Maximum number of devices in the slice. |
Note that the snippets above assume you have already created a Network-as-Code client and identified your mobile network device.