Part of libcloud.compute.drivers.opennebula View Source View In Hierarchy
Provide a common interface for handling networks of all types.
Network objects are analogous to physical switches connecting two or more physical nodes together. The Network object provides the interface in libcloud through which we can manipulate networks in different cloud providers in the same way. Network objects don't actually do much directly themselves, instead the network driver handles the connection to the network.
You don't normally create a network object yourself; instead you use a driver and then have that create the network for you.
>>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> driver = DummyNetworkDriver() >>> network = driver.create_network() >>> network = driver.list_networks()[0] >>> network.name 'dummy-1'
Method | __init__ | Undocumented |
Method | get_uuid | Unique hash for this network. |
Method | destroy | Destroy this network. |
Method | __repr__ | Undocumented |
The hash is a function of an SHA1 hash of the network's ID and its driver which means that it should be unique between all networks. In some subclasses (e.g. GoGrid) there is no ID available so the public IP address is used. This means that, unlike a properly done system UUID, the same UUID may mean a different system install at a different time
>>> from libcloud.network.drivers.dummy import DummyNetworkDriver >>> driver = DummyNetworkDriver() >>> network = driver.create_network() >>> network.get_uuid() 'd3748461511d8b9b0e0bfa0d4d3383a619a2bb9f'
Note, for example, that this example will always produce the same UUID!
Returns | Unique identifier for this instance. (type: string ) |
Destroy this network.
This calls the networks's driver and destroys the network.
>>> from libcloud.network.drivers.dummy import DummyNetworkDriver >>> driver = DummyNetworkDriver() >>> network = driver.create_network() >>> network.destroy() True
Returns | True is the network was destroyed, else False. (type: bool ) |