Пример #1
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Display the Rack resources

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HP OneView Authorized Login Domain''')

    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    get_racks(fac)
Пример #2
0
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Display the datacenter resources

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HP OneView Authorized Login Domain''')
    parser.add_argument('-f', dest='force', action='store_true',
                        required=False,
                        help='''
    Force rack deletion''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-d', dest='delete_all', action='store_true',
                        help='''
    Delete ALL racks''')
    group.add_argument('-n', dest='name',
                        help='''
    Rack name to delete''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.delete_all:
        del_all_racks(fac, args.force)
        sys.exit()

    del_rack(fac, args.name, args.force)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Add an iPDU Power Device

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-ih', dest='ipdu', required=True,
                        help='''
    Hostname or IP address of the iPDU to add''')
    parser.add_argument('-iu', dest='username', required=True,
                        help='''
    Administrative username for the iPDU''')
    parser.add_argument('-ip', dest='password', required=True,
                        help='''
    Administrative password for the iPDU''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_iPDU(fac, args.ipdu, args.username, args.password)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Display the power device resources

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    get_powerdevices(fac)
Пример #5
0
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Add a new Data Center resource

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HP OneView Authorized Login Domain''')
    parser.add_argument('-n', dest='name',
                        required=True,
                        help='''
    Name of the Data Center''')
    parser.add_argument('-co', dest='cool', type=int,
                        default=0,
                        required=False,
                        help='''
    Maximum cooling capacity for the data center in watts''')
    parser.add_argument('-cm', dest='coolMultiplier',
                        required=False,
                        default=1.5, type=float,
                        help='''
    The ratio of cooling costs to power costs of the IT equipment. This
    value represents the relative cost of cooling the system compared to
    the cost of powering the system. The default value of 1.5 indicates
    that it costs 1.5 as much to cool the system as it does to power the
    system. This value is multiplied by the kilowatt - hours used by the
    system to obtain the cooling kilowatt - hours that are used in the
    analysis section of graphs that display power consumption.''')
    parser.add_argument('-ct', dest='cost', type=float,
                        required=False,
                        help='''
    Enegery cost per kilowatt-hour''')
    parser.add_argument('-cu', dest='currency',
                        default='USD',
                        required=False,
                        help='''
    The currency unit for energy cost, default is "USD"''')
    parser.add_argument('-lv', dest='lineVoltage', type=int,
                        default=220,
                        required=False,
                        help='''
    The default power line voltage used for watts/amps translation
    when voltage is not otherwise available (for example when summarizing
    power at the rack or data center level), default is 220''')
    parser.add_argument('-wi', dest='width', type=int,
                        required=True,
                        help='''
    Data Center width in millimeters''')
    parser.add_argument('-de', dest='depth', type=int,
                        required=True,
                        help='''
    Data Center depth in millimeters''')
    parser.add_argument('-dt', dest='deratingType',
                        required=True, choices=['NaJp', 'Custom', 'None'],
                        default='NaJp',
                        help='''
    The default power line voltage used for watts/amps
    translation when voltage is not otherwise available (for
    example when summarizing power at the rack or data
    center level''')
    parser.add_argument('-dp', dest='deratingPercent',
                        required=False, type=float,
                        help='''
    Custom eletrical derating percentage, this value is
    specified by the drating type, unless the type is
    Custom, then is must be specified here''')
    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    if args.depth < 1000 or args.depth > 50000:
        print('Error, the depth of the data center must be between 1000 and 50000 millimeters')
        sys.exit()
    if args.width < 1000 or args.width > 50000:
        print('Error, the width of the data center must be between 1000 and 50000 millimeters')
        sys.exit()
    if args.deratingType == 'Custom' and not args.deratingPercent:
        print('Error, the derating percentage must be specified when using the Custom derating type')
        sys.exit()

    login(con, credential)
    acceptEULA(con)

    add_datacenter(fac, args.name, args.cool, args.coolMultiplier,
                   args.currency, args.cost, args.lineVoltage, args.width,
                   args.depth, args.deratingType, args.deratingPercent)
Пример #6
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Add a new Data Center resource

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-n',
                        dest='name',
                        required=True,
                        help='''
    Name of the Data Center''')
    parser.add_argument('-co',
                        dest='cool',
                        type=int,
                        default=0,
                        required=False,
                        help='''
    Maximum cooling capacity for the data center in watts''')
    parser.add_argument('-cm',
                        dest='coolMultiplier',
                        required=False,
                        default=1.5,
                        type=float,
                        help='''
    The ratio of cooling costs to power costs of the IT equipment. This
    value represents the relative cost of cooling the system compared to
    the cost of powering the system. The default value of 1.5 indicates
    that it costs 1.5 as much to cool the system as it does to power the
    system. This value is multiplied by the kilowatt - hours used by the
    system to obtain the cooling kilowatt - hours that are used in the
    analysis section of graphs that display power consumption.''')
    parser.add_argument('-ct',
                        dest='cost',
                        type=float,
                        required=False,
                        help='''
    Enegery cost per kilowatt-hour''')
    parser.add_argument('-cu',
                        dest='currency',
                        default='USD',
                        required=False,
                        help='''
    The currency unit for energy cost, default is "USD"''')
    parser.add_argument('-lv',
                        dest='lineVoltage',
                        type=int,
                        default=220,
                        required=False,
                        help='''
    The default power line voltage used for watts/amps translation
    when voltage is not otherwise available (for example when summarizing
    power at the rack or data center level), default is 220''')
    parser.add_argument('-wi',
                        dest='width',
                        type=int,
                        required=True,
                        help='''
    Data Center width in millimeters''')
    parser.add_argument('-de',
                        dest='depth',
                        type=int,
                        required=True,
                        help='''
    Data Center depth in millimeters''')
    parser.add_argument('-dt',
                        dest='deratingType',
                        required=True,
                        choices=['NaJp', 'Custom', 'None'],
                        default='NaJp',
                        help='''
    The default power line voltage used for watts/amps
    translation when voltage is not otherwise available (for
    example when summarizing power at the rack or data
    center level''')
    parser.add_argument('-dp',
                        dest='deratingPercent',
                        required=False,
                        type=float,
                        help='''
    Custom eletrical derating percentage, this value is
    specified by the drating type, unless the type is
    Custom, then is must be specified here''')
    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    if args.depth < 1000 or args.depth > 50000:
        print(
            'Error, the depth of the data center must be between 1000 and 50000 millimeters'
        )
        sys.exit()
    if args.width < 1000 or args.width > 50000:
        print(
            'Error, the width of the data center must be between 1000 and 50000 millimeters'
        )
        sys.exit()
    if args.deratingType == 'Custom' and not args.deratingPercent:
        print(
            'Error, the derating percentage must be specified when using the Custom derating type'
        )
        sys.exit()

    login(con, credential)
    acceptEULA(con)

    add_datacenter(fac, args.name, args.cool, args.coolMultiplier,
                   args.currency, args.cost, args.lineVoltage, args.width,
                   args.depth, args.deratingType, args.deratingPercent)
Пример #7
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Add a new Rack resource

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HP OneView Authorized Login Domain''')
    parser.add_argument('-n',
                        dest='name',
                        required=True,
                        help='''
    Name of the Rack''')
    parser.add_argument('-sn',
                        dest='sn',
                        required=False,
                        help='''
    Serial Number of the Rack''')
    parser.add_argument('-th',
                        dest='thermal',
                        required=False,
                        help='''
    The maximum acceptable watts of heat output for the rack''')
    parser.add_argument('-he',
                        dest='height',
                        type=int,
                        default=2004,
                        required=False,
                        help='''
    Rack height in millimeters''')
    parser.add_argument('-de',
                        dest='depth',
                        type=int,
                        default=1000,
                        required=False,
                        help='''
    Rack depth in millimeters''')
    parser.add_argument('-wi',
                        dest='width',
                        type=int,
                        default=600,
                        required=False,
                        help='''
    Rack width in millimeters''')
    parser.add_argument('-us',
                        dest='uheight',
                        type=int,
                        default=42,
                        required=False,
                        help='''
    The number of u-slots in the rack between 1 and 60, default is 42''')

    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    if args.uheight < 1 or args.uheight > 60:
        print('Error, the number of u-slots must be between 1 and 60')
        sys.exit()

    login(con, credential)
    acceptEULA(con)

    add_rack(fac, args.name, args.sn, args.thermal, args.height, args.depth,
             args.width, args.uheight)
Пример #8
0
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Add a new Rack resource

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-n', dest='name',
                        required=True,
                        help='''
    Name of the Rack''')
    parser.add_argument('-sn', dest='sn',
                        required=False,
                        help='''
    Serial Number of the Rack''')
    parser.add_argument('-th', dest='thermal',
                        required=False,
                        help='''
    The maximum acceptable watts of heat output for the rack''')
    parser.add_argument('-he', dest='height', type=int, default=2004,
                        required=False,
                        help='''
    Rack height in millimeters''')
    parser.add_argument('-de', dest='depth', type=int, default=1000,
                        required=False,
                        help='''
    Rack depth in millimeters''')
    parser.add_argument('-wi', dest='width', type=int, default=600,
                        required=False,
                        help='''
    Rack width in millimeters''')
    parser.add_argument('-us', dest='uheight', type=int, default=42,
                        required=False,
                        help='''
    The number of u-slots in the rack between 1 and 60, default is 42''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    if args.uheight < 1 or args.uheight > 60:
        print('Error, the number of u-slots must be between 1 and 60')
        sys.exit()

    login(con, credential)
    acceptEULA(con)

    add_rack(fac, args.name, args.sn, args.thermal, args.height, args.depth,
             args.width, args.uheight)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Add a non iPDU Power Device

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-n', dest='name',
                        required=True,
                        help='''
    Name of the Data Center''')
    parser.add_argument('-dt', dest='deviceType',
                        choices=['BranchCircuit', 'BreakerPanel',
                                 'HPIpduAcModule', 'HPIpduCore',
                                 'HPIpduLoadSegment', 'HPIpduOutlet',
                                 'HPIpduOutletBar', 'LoadSegment', 'Outlet',
                                 'PowerFeed', 'PowerStrip', 'RackPdu',
                                 'RackUps'],
                        default='BranchCircuit',
                        required=False,
                        help='''
    The type that this power delivery device represents,
    default is BranchCircuit''')
    parser.add_argument('-fi', dest='feedIdentifier',
                        required=False,
                        help='''
    A user provided power feed identifier string. This is an
    arbitrary string that the user may specify to describe how
    this power device is connected into their power infrastructure''')
    parser.add_argument('-lv', dest='lineVoltage', type=int,
                        required=False,
                        help='''
    The line voltage (input) of this power device in volts.
    If unspecified, the default line voltage will be used
    for power calculations.''')
    parser.add_argument('-mo', dest='model',
                        required=False,
                        help='''
    Model name of the power device''')
    parser.add_argument('-pn', dest='partNumber',
                        required=False,
                        help='''
    Part number of the power device''')
    parser.add_argument('-pt', dest='phaseType',
                        required=True,
                        choices=['SinglePhase', 'SinglePhaseIntl',
                                 'ThreePhaseDelta', 'ThreePhaseUnknown',
                                 'ThreePhaseWye', 'Unknown'],
                        help='''
    The phase type of this power device. This value is used in
    conjunction with the capacity and line voltage to determine
    the total output power for this device in watts.''')
    parser.add_argument('-rc', dest='ratedCapacity',
                        required=True, type=int,
                        help='''
    The rated capacity of this power delivery device in Amps.
    This may come from the inherent capacity of the device, or
    by an explicit circuit breaker rating between 0 and 9999.''')
    parser.add_argument('-sn', dest='serialNumber',
                        required=False,
                        help='''
    Serial number of the power device''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    if args.ratedCapacity < 0 or args.ratedCapacity > 9999:
        print('Error, the rated cpacity must be between 0 and 9999 Amps')
        sys.exit()

    login(con, credential)
    acceptEULA(con)

    add_powerdevice(fac, args.name, args.deviceType, args.feedIdentifier,
                    args.lineVoltage, args.model,  args.partNumber,
                    args.phaseType, args.ratedCapacity, args.serialNumber)
Пример #10
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description="""
    Display the datacenter resources

    Usage: """,
    )
    parser.add_argument(
        "-a",
        dest="host",
        required=True,
        help="""
    HP OneView Appliance hostname or IP address""",
    )
    parser.add_argument(
        "-u",
        dest="user",
        required=False,
        default="Administrator",
        help="""
    HP OneView Username""",
    )
    parser.add_argument(
        "-p",
        dest="passwd",
        required=True,
        help="""
    HP OneView Password""",
    )
    parser.add_argument(
        "-c",
        dest="cert",
        required=False,
        help="""
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format""",
    )
    parser.add_argument(
        "-y",
        dest="proxy",
        required=False,
        help="""
    Proxy (host:port format""",
    )
    parser.add_argument(
        "-f",
        dest="force",
        action="store_true",
        required=False,
        help="""
    Force rack deletion""",
    )
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument(
        "-d",
        dest="delete_all",
        action="store_true",
        help="""
    Delete ALL racks""",
    )
    group.add_argument(
        "-n",
        dest="name",
        help="""
    Rack name to delete""",
    )

    args = parser.parse_args()
    credential = {"userName": args.user, "password": args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(":")[0], args.proxy.split(":")[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.delete_all:
        del_all_racks(fac, args.force)
        sys.exit()

    del_rack(fac, args.name, args.force)
Пример #11
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Add an iPDU Power Device

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-ih',
                        dest='ipdu',
                        required=True,
                        help='''
    Hostname or IP address of the iPDU to add''')
    parser.add_argument('-iu',
                        dest='username',
                        required=True,
                        help='''
    Administrative username for the iPDU''')
    parser.add_argument('-ip',
                        dest='password',
                        required=True,
                        help='''
    Administrative password for the iPDU''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_iPDU(fac, args.ipdu, args.username, args.password)
Пример #12
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description="""
    Display the datacenter resources

    Usage: """,
    )
    parser.add_argument(
        "-a",
        dest="host",
        required=True,
        help="""
    HP OneView Appliance hostname or IP address""",
    )
    parser.add_argument(
        "-u",
        dest="user",
        required=False,
        default="Administrator",
        help="""
    HP OneView Username""",
    )
    parser.add_argument(
        "-p",
        dest="passwd",
        required=True,
        help="""
    HP OneView Password""",
    )
    parser.add_argument(
        "-c",
        dest="cert",
        required=False,
        help="""
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format""",
    )
    parser.add_argument(
        "-y",
        dest="proxy",
        required=False,
        help="""
    Proxy (host:port format""",
    )

    args = parser.parse_args()
    credential = {"userName": args.user, "password": args.passwd}

    con = hpov.connection(args.host)
    fac = hpov.facilities(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(":")[0], args.proxy.split(":")[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    get_datacenters(fac)