Example #1
0
    def get(self, request, **kwargs):

        try:
            global handle
            global rackunits
            handle = ucs_login()
            # rackunits = json.dumps(ucs.get_rackcomputes(handle), ensure_ascii=False)

            ucs_logout(handle)

        except:
            ucs_logout(handle)
            raise
        ucs_logout(handle)
        return JsonResponse({'test': 'test'}, safe=False)
Example #2
0
    def get(self, request, dn, **kwargs):
        try:
            global handle
            global chassis
            handle = ucs_login()

            faults = json.dumps(ucs.getChassisStats(handle, dn),
                                ensure_ascii=False)

            ucs_logout(handle)

        except:
            ucs_logout(handle)
            raise
        ucs_logout(handle)
        return JsonResponse(faults, safe=False)
Example #3
0
    def get(self, request, **kwargs):

        try:
            global handle
            global chassis
            handle = ucs_login()

            chassis = json.dumps(ucs.get_chassis(handle), ensure_ascii=False)

            ucs_logout(handle)

        except:
            ucs_logout(handle)
            raise
        ucs_logout(handle)
        return JsonResponse(chassis, safe=False)
Example #4
0
def getUcsInfo(request):
    try:
        global handle
        global ucs_info
        handle = ucs_login()

        ucs_info = json.dumps(ucs.getUcsInfo(handle), ensure_ascii=False)

        ucs_logout(handle)

    except:
        ucs_logout(handle)
        raise

    ucs_logout(handle)

    return JsonResponse(ucs_info, safe=False)
Example #5
0
def getPowerStats(request):
    try:
        global handle
        global ucs_powerstat
        handle = ucs_login()

        ucs_powerstat = json.dumps(ucs.getEquipmentPsuInputStats(handle),
                                   ensure_ascii=False)

        ucs_logout(handle)

    except:
        ucs_logout(handle)
        raise

    ucs_logout(handle)

    return JsonResponse(ucs_powerstat, safe=False)