Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/aruba-cx' into arub…
Browse files Browse the repository at this point in the history
…a-cx
  • Loading branch information
dainok committed Nov 3, 2023
2 parents cf1bf56 + 2606f8e commit b1f7021
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions netdoc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ def normalize_route_type(route_type):
"l",
"a c",
"a h",
"a ~",
"vrrp-engine",
"vrrp_engine",
]:
Expand Down
18 changes: 18 additions & 0 deletions scripts/discovery_fqdn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import socket

from ipam.models import IPAddress

ip_addresses = IPAddress.objects.filter(dns_name="")
for ip_address_o in ip_addresses:
ip_address = str(ip_address_o.address.ip)
try:
result = socket.gethostbyaddr(ip_address)
# Host found
fqdn = result[0].lower()
print(f"{ip_address} is {fqdn}")
ip_address_o.dns_name = fqdn
ip_address_o.save()
except Exception:
# Host not found
pass

0 comments on commit b1f7021

Please sign in to comment.