RAS
darcs-hash:20050813124610-4ec08-d030af145239a47d43be895e99d766d39aec5850.gz
This commit is contained in:
parent
fb58f8e8ea
commit
caeec469ff
1 changed files with 11 additions and 11 deletions
|
@ -16,18 +16,18 @@ mac = ":".join([i.zfill(2) for i in sys.argv[1].split(":")]).lower()
|
||||||
# classe d'interrogation des switchs
|
# classe d'interrogation des switchs
|
||||||
class interroge_switch (threading.Thread) :
|
class interroge_switch (threading.Thread) :
|
||||||
def __init__ (self, switch, mac = None) :
|
def __init__ (self, switch, mac = None) :
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.switch = switch
|
self.switch = switch
|
||||||
self.mac = mac
|
self.mac = mac
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
def run (self) :
|
def run (self) :
|
||||||
sw = hpswitch(self.switch)
|
sw = hpswitch(self.switch)
|
||||||
prise = sw.where_is_mac(mac)
|
prise = sw.where_is_mac(mac)
|
||||||
if prise != None :
|
if prise != None :
|
||||||
# on a trouvé une prise, on affiche si c'est pas un uplink
|
# on a trouvé une prise, on affiche si c'est pas un uplink
|
||||||
if 'uplink' not in sw.nom(None, prise) or switch == 'backbone' :
|
if 'uplink' not in sw.nom(None, prise) or switch == 'backbone' :
|
||||||
print "%-10s => prise %-2s : %s" % (self.switch, str(prise), sw.nom(None, prise))
|
print "%-10s => prise %-2s : %s" % (self.switch, str(prise), sw.nom(None, prise))
|
||||||
|
|
||||||
# on onterroge trois fois car il donne pas toujours les clients
|
# on onterroge trois fois car il donne pas toujours les clients
|
||||||
for switch in ['backbone'] + all_switchs():
|
for switch in ['backbone'] + all_switchs():
|
||||||
|
@ -37,4 +37,4 @@ while len(threading.enumerate()) > 1 :
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
print
|
print
|
||||||
system('whos mac=%s' % mac)
|
system('/usr/scripts/gestion/whos.py mac=%s' % mac)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue