Skip to content

pulling mac address table per vlan on Cisco Switch #3

@arezazadeh

Description

@arezazadeh

Hi,

i have been trying to pull mac address information from Cisco Switch, with the code below:

 oid = ObjectType(ObjectIdentity("1.3.6.1.2.1.17.4.3.1.1"))
    next(nextCmd(
        SnmpEngine(),
        UsmUserData('username', authKey='pass', privKey='pass', authProtocol=usmHMACMD5AuthProtocol,
                    privProtocol=usmAesCfb128Protocol),
        UdpTransportTarget((target, 161)),
        ContextData(contextName='vlan-200'),
        0, 25,
        oid,
        lexicographicMode=False,
    ))

but it throw the below error, i cant figure out what the issue is

Traceback (most recent call last):
  File "C:/py_test_folder/test.py", line 115, in <module>
    print(get_bulk_oid(host_name, mac_oid))
  File "C:/py_test_folder/test.py", line 39, in get_bulk_oid
    cdp_remote_host = next(nextCmd(
  File "C:\Users\neteng\.virtualenvs\py_test_folder\lib\site-packages\pysnmp\hlapi\asyncore\sync\cmdgen.py", line 349, in nextCmd
    initialVars = [x[0] for x in vbProcessor.makeVarBinds(snmpEngine, varBinds)]
  File "C:\Users\neteng\.virtualenvs\py_test_folder\lib\site-packages\pysnmp\hlapi\varbinds.py", line 33, in makeVarBinds
    elif isinstance(varBind[0], ObjectIdentity):
TypeError: 'int' object is not subscriptable

appreciate any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions