scripts/gestion/locate-mac.py
salles a7bc696514 Mise en forme correcte de l'adresse mac
darcs-hash:20041112185335-72cb0-2456059855950cf3be218faa13bdad45e9badf07.gz
2004-11-12 19:53:35 +01:00

17 lines
516 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
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