Slice creation
Slice status
In Network as Code, a network slice will be in one of the following states:
Slice Status | Description |
---|---|
PENDING | DO Center is working on planning or installing the network slice |
AVAILABLE | Slice has been provisioned, but it is not active for users yet |
OPERATING | Slice has been activated and is accepting or serving users |
DELETED | Slice has been deactivated, and it's in the process of removal or has been removed |
FAILED | Slice could not be provisioned correctly by the network |
Creating a slice
After installing NaC and creating the client
and device
objects, create a slice
object using the client.slices.create()
method,
and use the parameters 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.
import network_as_code as nac
from network_as_code.models.slice import Point, AreaOfService, NetworkIdentifier, SliceInfo
client = nac.NetworkAsCodeClient(...)
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
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)
]),
notification_url="http://notify.me/here",
notification_auth_token="replace-with-your-auth-token"
)
Slice creation parameters
Parameters | Description |
---|---|
name | The name that will identify the slice, which can be later called for operations, such as slice activation, deactivation or deletion. |
network_id | The network identifier for the Network Operator and country. E.g.: mcc="236", mnc="30" . The MCC/MNC numbers used here are just examples for our tests. |
slice_info | Slice information on the service type and differentiator. E.g.: `service_type="eMBB", differentiator="123456". These are also just example values. |
area_of_service | Define the area of service with geographic coordinates as parameters as below, it will indicate the location where the network slice will be active. |
notification_url | The recipient's HTTP endpoint, which is a web server configured to receive POST requests. Learn more about it here. |
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 using the Throughput
model
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:
from network_as_code.client import NetworkAsCodeClient
from network_as_code.models.slice import NetworkIdentifier, Slice, SliceInfo, AreaOfService, Point, Throughput
client = nac.NetworkAsCodeClient(...)
device = client.devices.get(...)
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 slice_downlink_throughput | Specify the amount of bandwidth the device can get. |
max_data_connections | Maximum number of data connection sessions in the slice. |
max_device | 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.