Show Table of Contents
2.5. Example: Listing the Logical Networks Collection using Python
The
API class provides access to a logical networks collection, named networks. This collection contains all logical networks in the environment.
Example 2.4. Listing the logical networks collection using Python
This Python example lists the logical networks in the
networks collection. It also outputs some basic information about each network in the collection.
from ovirtsdk.api import API
from ovirtsdk.xml import params
try:
api = API(url="https://HOST",
username="USER@DOMAIN",
password="PASS",
ca_file="ca.crt")
n_list = api.networks.list()
for n in n_list:
print "%s (%s)" % (n.get_name(), n.get_id())
api.disconnect()
except Exception as ex:
print "Unexpected error: %s" % ex
In an environment where only the default management network exists, the example outputs:
ovirtmgmt (00000000-0000-0000-0000-000000000009)

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.