Skip to content

KeyError: 'ip' when retrieving endpoints #388

@MrFanciful

Description

@MrFanciful

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

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