Я использовал следующие MIB для запроса данных VLAN:< /p>
Код: Выделить всё
CISCO-VLAN-BRIDGING-MIB (1.3.6.1.4.1.9.9.214)
CISCO-VLAN-GROUP-MIB (1.3.6.1.4.1.9.9.46)
CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB (1.3.6.1.4.1.9.9.68)
CISCO-VLAN-MEMBERSHIP-MIB (1.3.6.1.4.1.9.9.68)
CISCO-VLAN-TRANSLATION-MIB (1.3.6.1.4.1.9.9.150)
Код: Выделить всё
import asyncio
from pysnmp.hlapi.v1arch.asyncio import *
async def run():
snmpDispatcher = SnmpDispatcher()
iterator = await getCmd(
snmpDispatcher,
CommunityData("Redacted", mpModel=0),
await UdpTransportTarget.create(("Redacted", 161)),
("1.3.6.1.4.1.9.9.68", None),
)
errorIndication, errorStatus, errorIndex, varBinds = iterator
if errorIndication:
print(errorIndication)
elif errorStatus:
print(
"{} at {}".format(
errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or "?",
)
)
else:
for varBind in varBinds:
print(" = ".join([x.prettyPrint() for x in varBind]))
snmpDispatcher.transportDispatcher.closeDispatcher()
asyncio.run(run())
Подробнее здесь: https://stackoverflow.com/questions/790 ... co-routers