scripts/gestion/locate-mac.py
salles 1252255ac0 On sait en plus si l'adresse mac est celle d'un adhrent ou pas.
darcs-hash:20041112191934-72cb0-fbd46026c775d8e238c94184b39caf134d8f8bd3.gz
2004-11-12 20:19:34 +01:00

21 lines
568 B
Python
Executable file

#! /usr/bin/env python
# -*- coding: iso-8859-15 -*-
# Localise une adresse MAC sur les différents switchs
from annuaires import reverse, all_switchs
from hptools import hpswitch
from sys import argv
from os import system
mac = ":".join([i.zfill(2) for i in argv[1].split(":")]).lower()
for switch in ['backbone'] + all_switchs():
sw = hpswitch(switch)
prise = sw.where_is_mac(mac)
if prise != None:
print "%-10s: %d (%s)" % (switch, prise, sw.nom(None, prise))
else:
print "%-10s: non trouvé" % switch
system("whos mac=%s" % mac)