Skip to content

Commit

Permalink
changing ipaddr to ipaddress
Browse files Browse the repository at this point in the history
  • Loading branch information
Visnu Rajendran (virajend) committed Dec 20, 2019
1 parent 6972997 commit 5a45499
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,9 @@ def is_ipv4_address(ipaddress):
:return: bool
"""
try:
ipaddr.IPv4Address(ipaddress)
ipaddress.IPv4Address(ipaddress)
return True
except ipaddr.AddressValueError as err:
except ipaddress.AddressValueError as err:
return False


Expand All @@ -471,9 +471,9 @@ def is_ipv6_address(ipaddress):
:return: bool
"""
try:
ipaddr.IPv6Address(ipaddress)
ipaddress.IPv6Address(ipaddress)
return True
except ipaddr.AddressValueError as err:
except ipaddress.AddressValueError as err:
return False


Expand Down Expand Up @@ -527,11 +527,11 @@ def get_bgp_neighbor_ip_to_name(ip, static_neighbors, dynamic_neighbors):
return static_neighbors[ip]
elif is_ipv4_address(unicode(ip)):
for subnet in dynamic_neighbors["v4"].keys():
if ipaddr.IPv4Address(unicode(ip)) in ipaddr.IPv4Network(unicode(subnet)):
if ipaddress.IPv4Address(unicode(ip)) in ipaddress.IPv4Network(unicode(subnet)):
return dynamic_neighbors["v4"][subnet]
elif is_ipv6_address(unicode(ip)):
for subnet in dynamic_neighbors["v6"].keys():
if ipaddr.IPv6Address(unicode(ip)) in ipaddr.IPv6Network(unicode(subnet)):
if ipaddress.IPv6Address(unicode(ip)) in ipaddress.IPv6Network(unicode(subnet)):
return dynamic_neighbors["v6"][subnet]
else:
return "NotAvailable"
Expand Down

0 comments on commit 5a45499

Please sign in to comment.