from builtins import range
import logging

from vspk import v6 as vsdk
from vspk.utils import set_log_level

set_log_level(logging.ERROR)

session = vsdk.NUVSDSession(username='******',
                            password='******',
                            enterprise='csp',
                            api_url='https://localhost:8443')
session.start()
csproot = session.user

# Create a vCenter
vcenter = vsdk.NUVCenter(name='My vCenter')
csproot.create_child(vcenter)

# Create few data centers
for i in range(0, 2):
    datacenter = vsdk.NUVCenterDataCenter(name='DC %s' % i)

    # Create few clusters
    for cluster_index in range(0, 2):
        cluster = vsdk.NUVCenterCluster(name="Cluster %s" % cluster_index)
        datacenter.create_child(cluster)

        # Create an hypervisor
        hypervisor = vsdk.NUVCenterHypervisor(name='HypervisorTest',
                                              hypervisor_ip='2.1.1.1',
Beispiel #2
0
def setup_logging():
    import logging
    from vspk.utils import set_log_level
    set_log_level(logging.DEBUG, logging.StreamHandler())