Utilisation des rfrences dans la MIB (plus simple pour rechercher ensuite)
darcs-hash:20041011203850-41617-db21fd487e324c935bf233b459d13fe054ae7a4f.gz
This commit is contained in:
parent
84fcb44645
commit
5af2c8f33e
1 changed files with 6 additions and 6 deletions
|
@ -256,7 +256,7 @@ class hpswitch :
|
|||
if not prise : prise = self.prise
|
||||
if self.__debug : self.__logDest.write("HP DEBUG : show_prise_mac(prise=%s)\n" % prise)
|
||||
try:
|
||||
data = self.walk('SNMPv2-SMI::enterprises.11.2.14.11.5.1.9.4.2.1.2.%s' % prise)
|
||||
data = self.walk('STATISTICS-MIB::hpSwitchPortFdbAddress.%s' % prise)
|
||||
return map(lambda x:":".join(x[1:-2].lower().split(" ")),data.values())
|
||||
except ValueError:
|
||||
# Pas de MAC trouvée
|
||||
|
@ -272,7 +272,7 @@ class hpswitch :
|
|||
mac[6:8], mac[8:10], mac[10:12])
|
||||
|
||||
# On interroge le switch
|
||||
data = self.walk('SNMPv2-SMI::enterprises.11.2.14.11.5.1.9.4.2.1.2');
|
||||
data = self.walk('STATISTICS-MIB::hpSwitchPortFdbAddress');
|
||||
|
||||
# On cherche dans data la bonne adresse MAC
|
||||
for (onesnmp, onemac) in data.iteritems():
|
||||
|
@ -357,15 +357,15 @@ class hpswitch :
|
|||
"""
|
||||
if self.__debug : self.__logDest.write("HP DEBUG : multicast(ip=%s)\n" % ip)
|
||||
if ip :
|
||||
data = self.walk('SNMPv2-SMI::enterprises.11.2.14.11.5.1.9.10.3.1.1.1%s' % ip)
|
||||
data = self.walk('STATISTICS-MIB::hpIgmpStatsPortIndex2.%s' % ip)
|
||||
return { ip : data.values() }
|
||||
|
||||
else :
|
||||
data = self.walk('SNMPv2-SMI::enterprises.11.2.14.11.5.1.9.10.3.1.1.1')
|
||||
data = self.walk('STATISTICS-MIB::hpIgmpStatsPortIndex2')
|
||||
result = {}
|
||||
# On veut tout
|
||||
for oid, port in data.items() :
|
||||
try : ip = '.'.join(oid.split('.')[13:17])
|
||||
try : ip = '.'.join(oid.split('.')[2:6])
|
||||
except : continue
|
||||
result.setdefault(ip,[])
|
||||
result[ip].append(port)
|
||||
|
@ -402,7 +402,7 @@ class hpswitch :
|
|||
if etat == 'up' :
|
||||
nb += 1
|
||||
return nb
|
||||
return self.get(oid + '.' + prise) == 'up'
|
||||
return self.get(oid + '.' + str(prise)) == 'up'
|
||||
|
||||
def is_enable(self,prise=0) :
|
||||
""" Retoune True ou False suivant si la prise est activée ou non
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue