servers/filter_plugins/netbox.py
Timotej Lazar ce7903e43a ceph: improve cluster setup
Remove separate NetBox lookups. Explicitly allow connections between
cluster nodes. Tigthen temporary allowed IPv6 ranges.
2024-03-01 08:45:51 +01:00

16 lines
514 B
Python

#!/usr/bin/python
class FilterModule(object):
'''Various utilities for manipulating NetBox data'''
def filters(self):
return {
'device_address': self.device_address
}
def device_address(self, device):
'''Return loopback IP addresses for an L3 attached device'''
for iface in device['interfaces']:
for addr in iface['ip_addresses']:
if addr.get('role') and addr['role'].get('value') == 'loopback':
yield addr