Modifying slices
You can modify the parameters for an existing slice with the modify()
method.
Modifying a slice
In the following SDK snippet,
first we get an existing slice that we need to modify.
Next, we modify some slice parameters, such as
slice throughput
, maximum number of data connections
and devices
.
So, we use the modify()
method to make these changes.
Learn more about the parameters that can be modified below.
import network_as_code as nac
from network_as_code.models.slice import (
Point,
AreaOfService,
NetworkIdentifier,
Slice,
SliceInfo,
Throughput
)
client = nac.NetworkAsCodeClient(...)
my_device = client.devices.get(...)
my_slice = client.slices.create(...)
# Get the slice you want to modify.
slice = client.slices.get(my_slice.name)
# Remember to reconfigure all the parameters you wish to modify,
# The modify() method does not preserve previously configure ones.
slice.modify(
max_data_connections = 12,
max_devices = 3,
slice_downlink_throughput=Throughput(guaranteed=10, maximum=10),
slice_uplink_throughput=Throughput(guaranteed=10, maximum=10),
device_downlink_throughput=Throughput(guaranteed=10, maximum=10),
device_uplink_throughput=Throughput(guaranteed=10, maximum=10)
)
Slice parameters
These are the slice parameters that can be modified using the modify()
method and a brief description of them.
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 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.
Good to know: There are different states in a slice life cycle, learn what they are and how you can react to them.