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)
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)
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)
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)
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)