Skip to content

Commit

Permalink
Fix the passible variable type conversion for the turn on/off api
Browse files Browse the repository at this point in the history
  • Loading branch information
sujinmkang committed Mar 30, 2020
1 parent a2680c1 commit df9168b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/common/plugins/psu_controller/snmp_psu_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,13 @@ def get_psu_controller_type(self):
current_val = val.prettyPrint()
if current_oid == SYSDESCR:
psu = current_val
print(psu)
if psu == None:
self.psuType = None
return
if 'Sentry Switched CDU' in psu:
self.psuType = "SENTRY"
print(self.psuType)
if 'APC Web/SNMP Management Card' in psu:
self.psuType = "APC"
print(self.psuType)
return

def psuCntrlOid(self):
Expand Down Expand Up @@ -162,7 +159,7 @@ def turn_on_psu(self, psu_id):
cmdgen.CommandGenerator().setCmd(
cmdgen.CommunityData('private'),
cmdgen.UdpTransportTarget((self.controller, 161)),
(port_oid, self.CONTROL_ON),
(port_oid, rfc1902.Integer(self.CONTROL_ON)),
)
if errorIndication or errorStatus != 0:
logging.debug("Failed to turn on PSU %s, exception: %s" % (str(psu_id), str(errorStatus)))
Expand Down Expand Up @@ -195,7 +192,7 @@ def turn_off_psu(self, psu_id):
cmdgen.CommandGenerator().setCmd(
cmdgen.CommunityData('private'),
cmdgen.UdpTransportTarget((self.controller, 161)),
(port_oid, self.CONTROL_OFF),
(port_oid, rfc1902.Integer(self.CONTROL_OFF)),
)
if errorIndication or errorStatus != 0:
logging.debug("Failed to turn on PSU %s, exception: %s" % (str(psu_id), str(errorStatus)))
Expand Down

0 comments on commit df9168b

Please sign in to comment.