def step_impl(context, key, minutes): transfer_reason_oid = ( context.hardware[key].get_oid_by_name("BatteryRunTimeRemaining").oid) convert_to_minutes = lambda ticks: ticks / 6000 varbind_value = query_snmp_interface(transfer_reason_oid) assert_that(minutes, close_to(convert_to_minutes(varbind_value), 0.001))
def step_impl(context, key, t_reason): # Test both snmp interface and ups instance transfer_reason_oid = ( context.hardware[key].get_oid_by_name("InputLineFailCause").oid) varbind_value = query_snmp_interface(transfer_reason_oid) assert_that(context.hardware[key].transfer_reason.name, equal_to(t_reason)) assert_that(context.hardware[key].InputLineFailCause(varbind_value).name, equal_to(t_reason))
def _check_volt_threshold(context, key, threshold, old_volt, volt_change): # query snmp to grab oid and threshold oid value th_oid = context.hardware[key].get_oid_by_name(threshold).oid th_value = query_snmp_interface(th_oid) new_volt = int(th_value) + volt_change context.engine.handle_voltage_update(old_voltage=old_volt, new_voltage=new_volt) # wait for completion of event loop if new_volt != old_volt: event = context.tracker.load_done_queue.get() logging.info(event)