Beispiel #1
0
 def test_0021_list_available_port_group_names(self):
     """Test the method Platform.list_port_group_names, this method fetches
     list of portgroup name for a particular vCenter"""
     platform = Platform(TestVC._client)
     port_group_names = \
         platform.list_available_port_group_names(TestVC._vcenter_host_name)
     self.assertTrue(len(port_group_names) > 0)
Beispiel #2
0
 def test_0021_list_available_port_group_names(self):
     """Test the method Platform.list_port_group_names, this method fetches
     list of portgroup name for a particular vCenter"""
     platform = Platform(TestVC._client)
     port_group_names = \
         platform.list_available_port_group_names(TestVC._vcenter_host_name)
     self.assertTrue(len(port_group_names) > 0)
Beispiel #3
0
def list_available_port_groups(ctx, vc_name):
    try:
        restore_session(ctx)
        platform = Platform(ctx.obj['client'])
        port_groups = platform.list_available_port_group_names(
            vim_server_name=vc_name)
        output = {}
        output['available port-groups'] = port_groups
        stdout(output, ctx)
    except Exception as e:
        stderr(e, ctx)
Beispiel #4
0
def list_available_port_groups(ctx, vc_name):
    try:
        restore_session(ctx)
        platform = Platform(ctx.obj['client'])
        port_groups = platform.list_available_port_group_names(
            vim_server_name=vc_name)
        output = {}
        output['available port-groups'] = port_groups
        stdout(output, ctx)
    except Exception as e:
        stderr(e, ctx)
Beispiel #5
0
platform = Platform(client)

# Ensure External Network doesn't exist -----------------------------------------------------------
print("\nFetching External Network...")
try:
    network_resource = platform.get_external_network(
        cfg.system.ext_network.name)
    print("External Network already exists: {0}".format(
        cfg.system.ext_network.name))
except Exception:
    print("External Network {0} does not exist, creating".format(
        cfg.system.ext_network.name))
    # Ensure Port Group exists.
    print("Fetching Port Groups...")
    # Fetch dvportgroups - not startswith('vxw-')
    records = platform.list_available_port_group_names(
        vim_server_name=cfg.system.vcenter)
    if cfg.system.ext_network.portgroup in records:
        print("Port Group {0} found".format(cfg.system.ext_network.portgroup))
        print("Creating External Network {0} ".format(
            cfg.system.ext_network.name))
        network_resource = platform.create_external_network(
            cfg.system.ext_network.name, cfg.system.vcenter,
            [cfg.system.ext_network.portgroup], cfg.system.ext_network.gateway,
            cfg.system.ext_network.mask, [cfg.system.ext_network.range])

    else:
        print("Port Group {0} does not exist, exiting".format(
            cfg.system.ext_network.portgroup))

# Status report -----------------------------------------------------------------------------------
new_external_network = platform.get_external_network(