From 1ea0b33d339c76b3882967156c6b4fb661a60b22 Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Sun, 12 Oct 2008 18:45:59 +0200 Subject: [PATCH] [hptools] Ajout d'une classe sw_prise Analogue sw_chbre, cette classe permet de rcuprer directement la conf du switch et de la prise donne. darcs-hash:20081012164559-ffbb2-40a6f43b9a6934f1a4bba46c5628720629d11375.gz --- gestion/hptools.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gestion/hptools.py b/gestion/hptools.py index abb67e5c..a7399384 100755 --- a/gestion/hptools.py +++ b/gestion/hptools.py @@ -414,6 +414,24 @@ class sw_chbre(hpswitch) : if nom != self.nom() : self.nom(nom) +class sw_prise(sw_chbre): + def __init__(self, prise): + bat = prise[0].lower() + prise = prise[1:] + self.prise_brute = prise + self.switch = 'bat%s-%i.adm.crans.org' % (bat , int(prise[0])) + if prise[-1] == '-' : + #Prise en 10 + self.prise = int(prise[1:-1]) + self.prise10Mb = True + else : + self.prise = int(prise[1:]) + self.prise10Mb = False + + # Config snmp + self.get, self.set, self.walk = config_snmp_secrete(snmp,self.switch) + + if __name__ == '__main__' : import sys, getopt, sre