from pycontrolshed.model import Environment

# There are things we can do to put this configuration into
# a configuration file, but that'll come later.  Let's do 
# everything as explicitly as possible for now.

# Configuration values have been changed to protect the 
# innocent.  Please change the following four lines appropriately.
environment = Environment("development_network",
                          hosts=['127.0.0.2', '127.0.0.2'],
                          username='******')
environment.password = "******"

# We have multiple hosts configured above.  If we want to get
# a list of all the BIGIP devices already connected and ready
# for us to run, we do

bigip_list = environment.all_bigip_connections

# More commonly, we just want to work on the BIGIP device that's
# currently active in the cluster:

bigip = environment.active_bigip_connection

# What partition are we in? 
print bigip.active_partition

# What partitions are available?
for partition_data in bigip.partitions:
    print '%s: %s' % (partition_data['name'], 
                      partition_data['description'])