コード例 #1
0
ファイル: set_imc_smnp.py プロジェクト: movinalot/ucs-code
def update_snmp():
    """ Update IMC SNMP and Trap Destination """
    handle = ImcHandle(IMC_HOST, IMC_USER, IMC_PASS)
    handle.login()

    imc_snmp = handle.query_dn('sys/svc-ext/snmp-svc')
    imc_snmp.admin_state = 'enabled'
    imc_snmp.community = 'public'
    handle.set_mo(imc_snmp)

    imc_snmp_trap_dest = handle.query_dn('sys/svc-ext/snmp-svc/snmp-trap-1')
    imc_snmp_trap_dest.admin_state = 'enabled'
    imc_snmp_trap_dest.hostname = '10.10.10.10'
    imc_snmp_trap_dest.version = 'v2c'
    handle.set_mo(imc_snmp_trap_dest)

    handle.logout()
コード例 #2
0
ファイル: kubam-standalone.py プロジェクト: vallard/KUBAM-IMC
def install(server, attrs):
    print("Logging in to %s" % server)
    print(attrs["user"], attrs["password"])
    handle = ImcHandle(server, attrs["user"], attrs["password"], auto_refresh=True, force=True)
    try:
        handle.login()
    except ImcException as e:
        
        print("error logging in: %s" % e.error_descr, e.error_code)
        return
    except Exception as e:
        print "Error with server login.  Could be your firmware is too old?"
        return

    print("successfully logged into %s" % server)
    mount_media(handle, attrs["hostname"]) 
    set_boot(handle)
    handle.logout()
コード例 #3
0
                raid_level=raid_params['raid_level'],
                size=raid_params['size'],
                drive_group=raid_params['drive_group'],
                write_policy="Write Through",
                admin_state="trigger")
            handle.set_mo(mo)

            if raid_params['boot_drive'] == 'yes':
                print "Set virtual drive %s as boot drive" % raid_params[
                    'drive_name']
                from imcsdk.mometa.storage.StorageVirtualDrive import StorageVirtualDrive
                mo = StorageVirtualDrive(parent_mo_or_dn=raid_params['dn'],
                                         id="0",
                                         admin_action="set-boot-drive")
                handle.set_mo(mo)
        handle.logout()
        pause = raw_input('')

        # Redfish API operations
        # ----------------------
        # check CIMC fw version and update if not at desired version
        cimc_uri = "%s/redfish/v1/Managers/CIMC" % base_uri
        ro = requests.get(cimc_uri,
                          verify=False,
                          auth=(settings_file['user'], settings_file['pw']))
        ro_json = ro.json()
        if ro_json['FirmwareVersion'] != settings_file['fw_config'][
                'cimc_version']:
            print "Current CIMC version %s, but desired version is %s" % (
                ro_json['FirmwareVersion'],
                settings_file['fw_config']['cimc_version'])