Deleting slices

You can delete a deactivated slice using the delete() method.

NOTE: It's not possible to delete a slice that is active or serving users. So, to delete a slice, first remember to deactivate it.

Deleting a slice

After deactivating a slice, use the following snippet to delete it.

from network_as_code.client import NetworkAsCodeClient
 
from network_as_code.models.device import DeviceIpv4Addr
 
from network_as_code.models.slice import(
    NetworkIdentifier,
    Slice,
    SliceInfo,
    AreaOfService,
    Point,
    Throughput
)
 
...
 
# First, create or get a slice
my_slice = client.slices.create(...)
 
# Get a slice by its ID
slice = client.slices.get(my_slice.name)
 
# If it's active, deactivate it:
slice.deactivate()
 
# Now, you can delete it
slice.delete()

Last updated on May 23, 2024

On this page
Deleting a slice