move to ipaddress
Python3.3 introduced a very nice standard library called ipaddress that serves for a very similar purpose to netaddr. By moving to it, we are future proofing our code and making Python3 users of kuryr-lib not have to install an external library. Change-Id: I9e995b3804e60bea199e150e70f828d5f6e2bed4 Implements: blueprint netaddr-to-ipaddress Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
This commit is contained in:
parent
dbe2284ce6
commit
aa641a29ca
@ -12,11 +12,12 @@
|
||||
|
||||
import os
|
||||
|
||||
import netaddr
|
||||
import ipaddress
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import excutils
|
||||
import pyroute2
|
||||
import six
|
||||
|
||||
from kuryr.lib import exceptions
|
||||
from kuryr.lib import utils
|
||||
@ -137,7 +138,7 @@ def port_bind(endpoint_id, neutron_port, neutron_subnets,
|
||||
if IP_ADDRESS_KEY in fixed_ip and (SUBNET_ID_KEY in fixed_ip):
|
||||
subnet_id = fixed_ip[SUBNET_ID_KEY]
|
||||
subnet = subnets_dict[subnet_id]
|
||||
cidr = netaddr.IPNetwork(subnet['cidr'])
|
||||
cidr = ipaddress.ip_network(six.text_type(subnet['cidr']))
|
||||
peer_veth.add_ip(fixed_ip[IP_ADDRESS_KEY], cidr.prefixlen)
|
||||
peer_veth.set_mtu(mtu)
|
||||
peer_veth.address = neutron_port[MAC_ADDRESS_KEY].lower()
|
||||
|
@ -3,8 +3,8 @@
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
Babel>=2.3.4 # BSD
|
||||
ipaddress>=1.0.7;python_version<'3.3' # PSF
|
||||
keystoneauth1 >= 2.10.0 # Apache-2.0
|
||||
netaddr!=0.7.16,>=0.7.12 # BSD
|
||||
neutron-lib>=0.3.0 # Apache-2.0
|
||||
oslo.concurrency>=3.8.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0 # Apache-2.0
|
||||
@ -13,3 +13,4 @@ oslo.utils>=3.16.0 # Apache-2.0
|
||||
pbr>=1.6 # Apache-2.0
|
||||
pyroute2>=0.4.3 # Apache-2.0 (+ dual licensed GPL2)
|
||||
python-neutronclient>=4.2.0 # Apache-2.0
|
||||
six>=1.9.0 # MIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user