new upstream 2.8.0
This commit is contained in:
parent
fc7f4b43c1
commit
b2b0c9995a
836 changed files with 137090 additions and 30018 deletions
52
scripts/python/module/test_nutclient.py.in
Executable file
52
scripts/python/module/test_nutclient.py.in
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!@PYTHON@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This source code is provided for testing/debuging purpose ;)
|
||||
|
||||
import PyNUT
|
||||
import sys
|
||||
import os
|
||||
|
||||
if __name__ == "__main__" :
|
||||
NUT_PORT = int(os.getenv('NUT_PORT', '3493'))
|
||||
NUT_USER = os.getenv('NUT_USER', None)
|
||||
NUT_PASS = os.getenv('NUT_PASS', None)
|
||||
|
||||
print( "PyNUTClient test..." )
|
||||
#nut = PyNUT.PyNUTClient( debug=True, port=NUT_PORT )
|
||||
nut = PyNUT.PyNUTClient( login=NUT_USER, password=NUT_PASS, debug=True, port=NUT_PORT )
|
||||
#nut = PyNUT.PyNUTClient( login="upsadmin", password="upsadmin", debug=True, port=NUT_PORT )
|
||||
|
||||
print( 80*"-" + "\nTesting 'GetUPSList' :")
|
||||
result = nut.GetUPSList( )
|
||||
print( "\033[01;33m%s\033[0m\n" % result )
|
||||
|
||||
# [dummy]
|
||||
# driver = dummy-ups
|
||||
# desc = "Test device"
|
||||
# port = /src/nut/data/evolution500.seq
|
||||
print( 80*"-" + "\nTesting 'GetUPSVars' for 'dummy' (should be registered in upsd.conf) :")
|
||||
result = nut.GetUPSVars( "dummy" )
|
||||
print( "\033[01;33m%s\033[0m\n" % result )
|
||||
|
||||
print( 80*"-" + "\nTesting 'GetUPSCommands' :")
|
||||
result = nut.GetUPSCommands( "dummy" )
|
||||
print( "\033[01;33m%s\033[0m\n" % result )
|
||||
|
||||
print( 80*"-" + "\nTesting 'GetRWVars' :")
|
||||
result = nut.GetRWVars( "dummy" )
|
||||
print( "\033[01;33m%s\033[0m\n" % result )
|
||||
|
||||
print( 80*"-" + "\nTesting 'RunUPSCommand' (Test front panel) :")
|
||||
try :
|
||||
result = nut.RunUPSCommand( "UPS1", "test.panel.start" )
|
||||
except :
|
||||
result = sys.exc_info()[1]
|
||||
print( "\033[01;33m%s\033[0m\n" % result )
|
||||
|
||||
print( 80*"-" + "\nTesting 'SetUPSVar' (set ups.id to test):")
|
||||
try :
|
||||
result = nut.SetRWVar( "UPS1", "ups.id", "test" )
|
||||
except :
|
||||
result = sys.exc_info()[1]
|
||||
print( "\033[01;33m%s\033[0m\n" % result )
|
||||
Loading…
Add table
Add a link
Reference in a new issue