[hptools] Rcupration des vlans actifs sur une prise
darcs-hash:20080930134757-ffbb2-266b6ceff7b1deadee865f3c829b93fb282db664.gz
This commit is contained in:
parent
6782d50179
commit
e5bb0a47a9
1 changed files with 17 additions and 0 deletions
|
@ -17,6 +17,7 @@ from annuaires import chbre_prises, all_switchs
|
|||
from os.path import exists
|
||||
from os import system
|
||||
from re import findall
|
||||
from config import vlans
|
||||
|
||||
try:
|
||||
path.append('/usr/scripts/gestion/secrets')
|
||||
|
@ -360,6 +361,22 @@ class hpswitch :
|
|||
else: code += 1
|
||||
|
||||
self.set(oid,'i',code)
|
||||
|
||||
def vlans(self, prise = None):
|
||||
"""Récupère les vlans activés sur la prise 'prise'"""
|
||||
if not prise:
|
||||
prise = self.prise
|
||||
prise = int(prise)
|
||||
oid_base = 'SNMPv2-SMI::enterprises.11.2.14.11.5.1.7.1.15.3.1.1'
|
||||
oid_format = oid_base + '.%(vlan)d.%(prise)d'
|
||||
oids = self.walk(oid_base)
|
||||
result = []
|
||||
for vlan_name, vlan in vlans.iteritems():
|
||||
if oid_format % {'vlan': vlan, 'prise': prise} in oids:
|
||||
result.append(vlan_name)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class sw_chbre(hpswitch) :
|
||||
def __init__(self,chbre) :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue