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

KeyError: 'ip' when retrieving endpoints #388

Open
MrFanciful opened this issue Oct 31, 2022 · 0 comments
Open

KeyError: 'ip' when retrieving endpoints #388

MrFanciful opened this issue Oct 31, 2022 · 0 comments

Comments

@MrFanciful
Copy link

MrFanciful commented Oct 31, 2022

Hi

I'm getting the above error when running a script studying for the DevNet Associate exam using the ACI Reservable Sandbox.

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2022.2.3\plugins\python\helpers\pydev\pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2022.2.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:\Users\user\PycharmProjects\devnet_studies\apic\apic_all_endpoints.py", line 14, in
ENDPOINTS = aci.Endpoint.get(SESSION)
File "C:\Users\user\PycharmProjects\devnet_studies\venv\lib\site-packages\acitoolkit\acitoolkit.py", line 5409, in get
endpoints = Endpoint._get(session, endpoint_name, interfaces,
File "C:\Users\user\PycharmProjects\devnet_studies\venv\lib\site-packages\acitoolkit\acitoolkit.py", line 5369, in _get
endpoint.ip = str(ep['ip'])
KeyError: 'ip'

I'm using Python 3.10.8 and have corrected the "from collections import Sequence" to import it from collections.abc
I've read over #374 but don't see a solution there. I've also got the latest version of the acitoolkit v0.4 installed.

My very simple code is below pulled from the office cert guide.

import sys
import acitoolkit.acitoolkit as aci

APIC_URL = 'https://10.10.20.14'
USERNAME = 'admin'
PASSWORD = 'C1sco12345'

SESSION = aci.Session(APIC_URL, USERNAME, PASSWORD)
RESP = SESSION.login()
if not RESP.ok:
print("Couldn't log in to APIC")
sys.exit(0)

ENDPOINTS = aci.Endpoint.get(SESSION)

print(f"{'MAC Address':19s}{'| ':1}{'IP Address':14s}{'| ':1}{'Encap':10s}{'| ':1}{'Tenant':8s}{'| ':1}{'App Profile':17s}"
f"{'| ':1}{'EPG':10s}")

2022-10-31 10_12_20-devnet_studies – C__Users_dlawson_PycharmProjects_devnet_studies_venv_Lib_site-p

2022-10-31 10_15_50-devnet_studies – C__Users_dlawson_PycharmProjects_devnet_studies_venv_Lib_site-p

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