Skip to content
Snippets Groups Projects
Commit a0a0b144 authored by Erik Reid's avatar Erik Reid
Browse files

don't convert equipment that doesn't look like a hostname

parent c7c7be82
No related branches found
No related tags found
No related merge requests found
......@@ -276,6 +276,17 @@ def load_snmp_indexes(hostname=None):
def ims_equipment_to_hostname(equipment):
"""
changes names like MX1.AMS.NL to mx1.ams.nl.geant.net
leaves CPE names alone (e.g. 'INTERXION Z-END')
:param equipment: the IMS equipment name string
:return: hostname, or the input string if it doesn't look like a host
"""
if re.match(r'.*\s.*', equipment):
# doesn't look like a hostname
return equipment
hostname = equipment.lower()
if not re.match(r'.*\.geant\.(net|org)$', hostname):
hostname = f'{hostname}.geant.net'
......
......@@ -30,7 +30,7 @@ These endpoints are intended for use by BRIAN.
.. autofunction:: inventory_provider.routes.poller.gws_direct
/poller/gws/direct
/poller/gws/indirect
---------------------------------
.. autofunction:: inventory_provider.routes.poller.gws_indirect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment