def test_hosts_setattr_unicode(self):
     env = Environment('test')
     env.hosts = u'192.168.1.1, 192.168.1.2'
     eq_(2, len(env.hosts))
     eq_(env.hosts[0], u'192.168.1.1')
     eq_(env.hosts[1], u'192.168.1.2')
 def test_hosts_setattr_list(self):
     env = Environment('test')
     env.hosts = ['192.168.1.1', '192.168.1.2']
     eq_(2, len(env.hosts))
     eq_(env.hosts[0], '192.168.1.1')
     eq_(env.hosts[1], '192.168.1.2')
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'])