Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulling mac address table per vlan on Cisco Switch #3

Open
arezazadeh opened this issue Apr 15, 2021 · 0 comments
Open

pulling mac address table per vlan on Cisco Switch #3

arezazadeh opened this issue Apr 15, 2021 · 0 comments

Comments

@arezazadeh
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant