incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rg...@apache.org
Subject svn commit: r1005582 - /incubator/tashi/trunk/src/zoni/hardware/raritanpdu.py
Date Thu, 07 Oct 2010 19:12:50 GMT
Author: rgass
Date: Thu Oct  7 19:12:50 2010
New Revision: 1005582

URL: http://svn.apache.org/viewvc?rev=1005582&view=rev
Log:
The PDU port number that is entered in the Zoni DB matches what is printed on
the PDU.  Numbering starts from 1. 

Add a check to find if the PDU port and snmp labeled port match.  Just found
that 2 of our Raritan PDU identifiers start numbering from 0.  This check will
make sure the PDU port number in the DB matches the identifier given with SNMP.


Modified:
    incubator/tashi/trunk/src/zoni/hardware/raritanpdu.py

Modified: incubator/tashi/trunk/src/zoni/hardware/raritanpdu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/hardware/raritanpdu.py?rev=1005582&r1=1005581&r2=1005582&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/hardware/raritanpdu.py (original)
+++ incubator/tashi/trunk/src/zoni/hardware/raritanpdu.py Thu Oct  7 19:12:50 2010
@@ -47,6 +47,10 @@ class raritanDominionPx(SystemManagement
 		self.oid_name = ",2"
 		self.oid_set = ",3"
 		self.oid_status = ",3"
+
+		if self.getOffset():
+			self.port = host['pdu_port'] - 1
+
 		#  this works
 		#errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd(cmdgen.CommunityData('my-agent',
'public', 0), cmdgen.UdpTransportTarget(('pdu0-r1r1', 161)), (1,3,6,1,4,1,13742,4,1,2,2,1,3,2))
 
@@ -55,14 +59,10 @@ class raritanDominionPx(SystemManagement
 		#result = netsnmp.snmpwalk(oid, Version = 2,DestHost="localhost",Community="public")
 		#print result
 
-
-
-
-
 		#var = netsnmp.Varbind('sysDescr.0')
 		#res = netsnmp.snmpget(var, ...:Version=1,...:DestHost = 'pdu0-r1r1',...: Community = 'prs-domain')
 		#print res
-		
+
 		#print cmdgen
 		#set snmp = /usr/bin/snmpset -v 2c -c intel pdu .1.3.6.1.4.1.13742.4.1.2.2.1.3.$outletnumber
i $state
 		#name snmp = /usr/bin/snmpset -v 2c -c intel pdu .1.3.6.1.4.1.13742.4.1.2.2.1.2.$outletnumber
i $state
@@ -71,6 +71,23 @@ class raritanDominionPx(SystemManagement
 		#self.powerStatus = None
 		#print self.__dict__
 
+	''' 
+	Just discovered that some PDUs start numbering ports in the SNMP mib
+	with 0.  Adding a check to update the port number to match the labels on the
+	physical plugs which start numbering with 1.
+	'''
+	def getOffset(self):
+		thisoid = eval(str(self.oid) + str(self.oid_status) + "," + str(0))
+		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd(
\
+		cmdgen.CommunityData('my-agent', self.user, 0), \
+		cmdgen.UdpTransportTarget((self.pdu_name, 161)), thisoid)
+		output = varBinds[0][1]
+		if output == -1:
+			return 0
+		else:
+			return 1
+
+
 	def getPowerStatus(self):
 		thisoid = eval(str(self.oid) + str(self.oid_status) + "," + str(self.port))
 		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd(
\



Mime
View raw message