コード例 #1
0
ファイル: selvmos.py プロジェクト: cpuskarz/epgpgattr
def main():
    global content, hosts, hostPgDict, sel_os
    # Login into vctr with hard coded creds
    host, user, password, prt = creds.vm_GetArgs()
    creds.cred()
    serviceInstance = SmartConnect(host=host, user=user, pwd=password, port=prt)
    atexit.register(Disconnect, serviceInstance)
    content = serviceInstance.RetrieveContent()

    # get input
    menu()
    user_selection = raw_input("Enter A, B or, (default is Microsoft Windows 8 (32-bit): ")
    default_os = "Microsoft Windows 8 (32-bit)"
    if user_selection.lower() == "a":
        sel_os = "Ubuntu Linux (64-bit)"
    elif user_selection.lower() == "b":
        sel_os = "Microsoft Windows 8 (32-bit)"
    elif user_selection.lower() == "c":
        sel_os = "CentOS 4/5/6/7 (64-bit)"
    else:
        sel_os = default_os

    print "#########"
    hosts = GetVMHosts(content)
    hostPgDict = GetHostsPortgroups(hosts)
    vms = GetVMs(content)
    print "#########"
    for vm in vms:
        PrintVmInfo(vm)
    print ""
コード例 #2
0
ファイル: aci-sel-os-pg.py プロジェクト: cpuskarz/epgpgattr
def main():
    global content, hosts, hostPgDict, sel_os, vms, SI, vmUuid, sel_pg

    # Login into vctr with hard coded creds
    host, user, password, prt = creds.vm_GetArgs()
    creds.cred()
    serviceInstance = SmartConnect(host=host, user=user, pwd=password, port=prt)
    SI = serviceInstance
    atexit.register(Disconnect, serviceInstance)
    content = serviceInstance.RetrieveContent()

    os.system('cls')
    menu()
    user_selection = raw_input("Enter A, B, C etc.. (default is Microsoft Windows Server 2012 (64-bit): ")
    default_os = "Microsoft Windows 8 (64-bit)"
    if user_selection.lower() == "a":
        sel_os = "Ubuntu Linux (64-bit)"
    elif user_selection.lower() == "b":
        sel_os = "Microsoft Windows 8 (64-bit)"
    elif user_selection.lower() == "c":
        sel_os = "CentOS 4/5/6/7 (64-bit)"
    else: sel_os = default_os

    print ""
    pg_name_sel = raw_input("Enter PORT GROUP NAME (case sensitive): ")
    sel_pg = pg_name_sel

    print ""
    print '#' * 120
    print ""
    hosts = GetVMHosts(content)
    hostPgDict = GetHostsPortgroups(hosts)
    vms = GetVMs(content)
    print ""

    for vm in vms:
        PrintVmInfo(vm)

    print ""
    print ""

    epg_split = pg_name_sel.split('|')
    if len(epg_split) == 1:
        epg = epg_split[0]
    else:
        epg = epg_split[2]

    print "> PORTGROUP/EPG = " + epg


    get_aci_epg(epg)