From 87bee34dd9b9c19ba98cf1840ca735081b436706 Mon Sep 17 00:00:00 2001 From: Tim Way <1091435+timway@users.noreply.github.com> Date: Fri, 9 Apr 2021 14:27:37 -0500 Subject: [PATCH] Handling the Removal of the 'ip' Key in the 'fvCEp' Object for ACI 5.1 Addresses the Dec 15, 2020 remark in https://www.cisco.com/c/en/us/td/docs/dcn/aci/apic/5x/release-notes/cisco-apic-release-notes-511.html * In ACI 5.1 the fvCEp object no longer contains a key for IP * The replacement code tries the original assignment and if that fails grabs the first fvIp object and uses that 'addr' * Because a fvCEp object can contain multiple fvIp objects it may be ideal to be more selective on which IP is grabbed or a way to handle an endpoint having multiple IPs. --- acitoolkit/acitoolkit.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/acitoolkit/acitoolkit.py b/acitoolkit/acitoolkit.py index 3c4b0f61..c7063835 100755 --- a/acitoolkit/acitoolkit.py +++ b/acitoolkit/acitoolkit.py @@ -5385,7 +5385,13 @@ def _get(session, endpoint_name, interfaces, endpoints, epg = EPG(str(ep['dn']).split('/')[3][4:], app_profile) endpoint = Endpoint(str(ep['name']), parent=epg) endpoint.mac = str(ep['mac']) - endpoint.ip = str(ep['ip']) + try: + endpoint.ip = str(ep['ip']) + except KeyError: + for child in children: + if "fvIp" in child: + endpoint.ip = str(child['fvIp']['attributes']['addr']) + break endpoint.encap = str(ep['encap']) endpoint.timestamp = str(ep['modTs']) for child in children: