2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Add api method to request all mac data

This will provide easy way for
client to get FDB data, potentially
for use in conjunction with discovery data.

For now, leave LLDP out, as that isn't currently cached
at the confluent layer.
This commit is contained in:
Jarrod Johnson 2023-01-23 13:37:29 -05:00
parent 2e059b5887
commit 0008998680

View File

@ -601,7 +601,7 @@ def handle_read_api_request(pathcomponents, configmanager):
elif len(pathcomponents) == 2:
if pathcomponents[-1] == 'macs':
return [msg.ChildCollection(x) for x in (# 'by-node/',
'by-mac/', 'by-switch/',
'alldata', 'by-mac/', 'by-switch/',
'rescan')]
elif pathcomponents[-1] == 'neighbors':
return [msg.ChildCollection('by-switch/')]
@ -616,6 +616,8 @@ def handle_read_api_request(pathcomponents, configmanager):
elif len(pathcomponents) == 4:
macaddr = pathcomponents[-1].replace('-', ':')
return dump_macinfo(macaddr)
elif pathcomponents[2] == 'alldata':
return [msg.KeyValueData(_apimacmap)]
elif pathcomponents[2] == 'by-mac':
if len(pathcomponents) == 3:
return [msg.ChildCollection(x.replace(':', '-'))