noc.sa.profiles.AlliedTelesis.AT8000S.get_vlans

Module Contents

class noc.sa.profiles.AlliedTelesis.AT8000S.get_vlans.Script

Bases: noc.core.script.base.BaseScript

name = AlliedTelesis.AT8000S.get_vlans
interface
rx_vlan_line

Need fix for cmp(x[“vlan_id”], y[“vlan_id”])

def execute_snmp(self):

oids = {} # Get OID -> VLAN ID mapping for oid, v in self.snmp.getnext(“1.3.6.1.2.1.17.7.1.4.2.1.3”): # dot1qVlanFdbId

oids[oid.split(“.”)[-1]] = v

# Get VLAN names result = [{“vlan_id”: 1, “name”: “1”}] for oid, v in self.snmp.getnext(“1.3.6.1.2.1.17.7.1.4.3.1.1”): # dot1qVlanStaticName

o = oid.split(“.”)[-1] result += [{“vlan_id”: int(oids[o]), “name”: v.strip()}]

return sorted(result, lambda x, y: cmp(x[“vlan_id”], y[“vlan_id”]))

execute_cli(self)