From fb5b674573359f3be513c15f089cd00ba594d803 Mon Sep 17 00:00:00 2001 From: bernat Date: Thu, 14 Oct 2004 09:09:18 +0200 Subject: [PATCH] Prise est gnralement un entier, parfois pass sous forme de chaine darcs-hash:20041014070918-d1718-ea3c95bdab492bb2e2544408fac69667db9e5b3f.gz --- gestion/hptools.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gestion/hptools.py b/gestion/hptools.py index 796cfbed..3859f038 100644 --- a/gestion/hptools.py +++ b/gestion/hptools.py @@ -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('STATISTICS-MIB::hpSwitchPortFdbAddress.%s' % prise) + data = self.walk('STATISTICS-MIB::hpSwitchPortFdbAddress.%d' % int(prise)) return map(lambda x:":".join(x[1:-2].lower().split(" ")),data.values()) except ValueError: # Pas de MAC trouvée @@ -386,13 +386,13 @@ class hpswitch : """ Active une prise """ if not prise : prise = self.prise if self.__debug : self.__logDest.write("HP DEBUG : enable(prise=%s)\n" % prise) - return self.set('IF-MIB::ifAdminStatus.%i' % prise, 'i', 1) + return self.set('IF-MIB::ifAdminStatus.%d' % int(prise), 'i', 1) def disable(self,prise=0) : """ Désactive une prise """ if not prise : prise = self.prise if self.__debug : self.__logDest.write("HP DEBUG : disable(prise=%s)\n" % prise) - return self.set('IF-MIB::ifAdminStatus.%i' % prise, 'i', 2) + return self.set('IF-MIB::ifAdminStatus.%d' % int(prise), 'i', 2) def __is(self,oid,prise) : if not prise : prise = self.prise @@ -410,17 +410,17 @@ class hpswitch : def is_enable(self,prise=0) : """ Retoune True ou False suivant si la prise est activée ou non Si prise=all retourne le nombre de prises activées sur le switch """ - return self.__is('IF-MIB::ifAdminStatus',prise) + return self.__is('IF-MIB::ifAdminStatus',int(prise)) def is_up(self,prise=0) : """ Retoune True ou False suivant si la prise est up Si prise=all retourne le nombre de prises up sur le switch """ - return self.__is('IF-MIB::ifOperStatus',prise) + return self.__is('IF-MIB::ifOperStatus',int(prise)) def nom(self,nom=None,prise=0) : """ Retourne ou attribue le nom à la prise fournie """ if not prise : prise = self.prise - oid = 'IF-MIB::ifAlias.%s' % prise + oid = 'IF-MIB::ifAlias.%d' % int(prise) if nom==None : return self.get(oid) else : @@ -433,7 +433,7 @@ class hpswitch : duplex est FD, HD ou auto """ if not prise : prise = self.prise - oid = 'CONFIG-MIB::hpSwitchPortFastEtherMode.%s' % prise + oid = 'CONFIG-MIB::hpSwitchPortFastEtherMode.%d' % int(prise) if mode == None : return self.get(oid)