initial changes towards removing ipaddress and using netaddr
This commit is contained in:
parent
93ce2a3755
commit
f431254e15
10 changed files with 47 additions and 67 deletions
|
@ -2,9 +2,9 @@
|
|||
nrl.py: defines services provided by NRL protolib tools hosted here:
|
||||
http://www.nrl.navy.mil/itd/ncs/products
|
||||
"""
|
||||
import netaddr
|
||||
|
||||
from core import utils
|
||||
from core.nodes import ipaddress
|
||||
from core.nodes.ipaddress import Ipv4Prefix
|
||||
from core.services.coreservices import CoreService
|
||||
|
||||
|
@ -38,7 +38,7 @@ class NrlService(CoreService):
|
|||
continue
|
||||
for a in ifc.addrlist:
|
||||
a = a.split("/")[0]
|
||||
if ipaddress.is_ipv4_address(a):
|
||||
if netaddr.valid_ipv4(a):
|
||||
pre = Ipv4Prefix("%s/%s" % (a, prefixlen))
|
||||
return str(pre)
|
||||
# raise ValueError, "no IPv4 address found"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue