Deleting a network

A network can be deleted by first locating it using the find_network() function. This will return a network object that represents the network to be deleted. We can then delete all the subnets associated with that network and then delete the whole network definition.

The following code snippet deletes the subnets, followed by the network:

def delete_network(conn):
    network = conn.network.find_network('packtpub-network')

# Delete all subnets in the network for subnet in network.subnet_ids: conn.network.delete_subnet(subnet, ignore_missing=False)

# Delete the network conn.network.delete_network(network, ignore_missing=False)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.98.234