Skip to content

Commit

Permalink
Amend getting the local interface DD ID for topology
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedt committed Oct 30, 2024
1 parent 8ec468e commit 7f71145
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion cisco_aci/datadog_checks/cisco_aci/ndm.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def create_topology_link_metadata(lldp_adj_eps, cdp_adj_eps, device_map, namespa
lldp_adj_ep = LldpAdjEp(**lldp_adj_ep.get("lldpAdjEp", {}))

local_device_id = device_map.get(lldp_adj_ep.attributes.local_device_dn)
local_interface_id = "{}:{}".format(local_device_id, lldp_adj_ep.attributes.local_port_index)
local_interface_id = "{}:{}".format(local_device_id, lldp_adj_ep.attributes.local_port_id)

remote_entry_unique_id = "{}.{}".format(
lldp_adj_ep.attributes.local_port_index, lldp_adj_ep.attributes.remote_port_index
Expand Down Expand Up @@ -114,7 +114,19 @@ def create_topology_link_metadata(lldp_adj_eps, cdp_adj_eps, device_map, namespa
)


def get_interface_dd_id(device_id: str, port_id: str) -> str:
"""
Create the interface DD ID based off of the device DD ID and port ID
ex: default:10.0.200.1:cisco_aci-eth1/1
"""
return '{}:cisco_aci-{}'.format(device_id, port_id)


def get_device_ip_mapping(devices):
"""
Create a mapping of node ID to device ID
ex: pod-1-node-1 -> default:10.100.0.1
"""
devices_map = {}
for device in devices:
key = device.pod_node_id
Expand Down
4 changes: 2 additions & 2 deletions cisco_aci/tests/fixtures/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
'dd_id': 'default:10.0.200.0',
},
'interface': {
'dd_id': 'default:10.0.200.0:49',
'dd_id': 'default:10.0.200.0:eth1/49',
'id': 'eth1/49',
'id_type': 'interface_name',
},
Expand Down Expand Up @@ -308,7 +308,7 @@
'dd_id': 'default:10.0.200.1',
},
'interface': {
'dd_id': 'default:10.0.200.1:49',
'dd_id': 'default:10.0.200.1:eth1/49',
'id': 'eth1/49',
'id_type': 'interface_name',
},
Expand Down

0 comments on commit 7f71145

Please sign in to comment.