Skip to Content
Hybrid Cloud for Developers
book

Hybrid Cloud for Developers

by Manoj Hirway
April 2018
Intermediate to advanced content levelIntermediate to advanced
280 pages
8h 37m
English
Packt Publishing
Content preview from Hybrid Cloud for Developers

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)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hybrid Cloud for Architects

Hybrid Cloud for Architects

Alok Shrivastwa
OpenStack: Building a Cloud Environment

OpenStack: Building a Cloud Environment

Alok Shrivastwa, Sunil Sarat, Kevin Jackson, Cody Bunch, Egle Sigler, Tony Campbell

Publisher Resources

ISBN: 9781788830874Supplemental Content