Browse Source

Disable pep8 import check for pyroute2 library

Since version 0.6.2, pyroute2 library dynamically imports the needed
modules when loaded. A static analysis will fail when checking the
import references.

Change-Id: I5aaf9494a2d5c2533199e6b92d4df8fe785f83a3
Closes-Bug: #1930750
changes/68/794668/2
Rodolfo Alonso Hernandez 2 weeks ago
committed by Rodolfo Alonso
parent
commit
074c131b57
9 changed files with 38 additions and 28 deletions
  1. +2
    -1
      neutron/agent/l2/extensions/fdb_population.py
  2. +2
    -1
      neutron/agent/l3/dvr_local_router.py
  3. +2
    -1
      neutron/agent/l3/router_info.py
  4. +2
    -1
      neutron/agent/linux/bridge_lib.py
  5. +2
    -1
      neutron/agent/linux/interface.py
  6. +7
    -5
      neutron/agent/linux/ip_lib.py
  7. +5
    -3
      neutron/agent/linux/tc_lib.py
  8. +14
    -14
      neutron/privileged/agent/linux/ip_lib.py
  9. +2
    -1
      neutron/privileged/agent/linux/tc_lib.py

+ 2
- 1
neutron/agent/l2/extensions/fdb_population.py View File

@ -20,7 +20,8 @@ from neutron_lib import constants
from neutron_lib.utils import helpers
from oslo_config import cfg
from oslo_log import log as logging
from pyroute2.netlink import exceptions as netlink_exceptions
from pyroute2.netlink import exceptions \
as netlink_exceptions # pylint: disable=no-name-in-module
from neutron.agent.linux import bridge_lib
from neutron.conf.agent import l2_ext_fdb_population


+ 2
- 1
neutron/agent/l3/dvr_local_router.py View File

@ -19,7 +19,8 @@ import netaddr
from neutron_lib import constants as lib_constants
from oslo_log import log as logging
from oslo_utils import excutils
from pyroute2.netlink import exceptions as pyroute2_exc
from pyroute2.netlink import exceptions \
as pyroute2_exc # pylint: disable=no-name-in-module
from neutron.agent.l3 import dvr_fip_ns
from neutron.agent.l3 import dvr_router_base


+ 2
- 1
neutron/agent/l3/router_info.py View File

@ -21,7 +21,8 @@ from neutron_lib.exceptions import l3 as l3_exc
from neutron_lib.utils import helpers
from oslo_log import log as logging
from oslo_utils import netutils
from pyroute2.netlink import exceptions as pyroute2_exc
from pyroute2.netlink import exceptions \
as pyroute2_exc # pylint: disable=no-name-in-module
from neutron._i18n import _
from neutron.agent.l3 import namespaces


+ 2
- 1
neutron/agent/linux/bridge_lib.py View File

@ -20,7 +20,8 @@ import collections
import functools
import os
from pyroute2.netlink import exceptions as netlink_exceptions
from pyroute2.netlink import exceptions \
as netlink_exceptions # pylint: disable=no-name-in-module
from neutron.agent.linux import ip_lib
from neutron.privileged.agent.linux import ip_lib as priv_ip_lib


+ 2
- 1
neutron/agent/linux/interface.py View File

@ -21,7 +21,8 @@ from neutron_lib import constants
from neutron_lib import exceptions
from oslo_log import log as logging
from oslo_utils import excutils
from pyroute2.netlink import exceptions as pyroute2_exc
from pyroute2.netlink import exceptions \
as pyroute2_exc # pylint: disable=no-name-in-module
from neutron.agent.common import ovs_lib
from neutron.agent.linux import ip_lib


+ 7
- 5
neutron/agent/linux/ip_lib.py View File

@ -25,11 +25,13 @@ from neutron_lib import exceptions
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import netutils
from pyroute2.netlink import exceptions as netlink_exceptions
from pyroute2.netlink import rtnl
from pyroute2.netlink.rtnl import ifaddrmsg
from pyroute2.netlink.rtnl import ifinfmsg
from pyroute2 import netns
from pyroute2.netlink import exceptions \
as netlink_exceptions # pylint: disable=no-name-in-module
from pyroute2.netlink import rtnl # pylint: disable=no-name-in-module
from pyroute2.netlink.rtnl import \
ifaddrmsg # pylint: disable=no-name-in-module
from pyroute2.netlink.rtnl import ifinfmsg # pylint: disable=no-name-in-module
from pyroute2 import netns # pylint: disable=no-name-in-module
from neutron._i18n import _
from neutron.agent.common import utils


+ 5
- 3
neutron/agent/linux/tc_lib.py View File

@ -21,9 +21,11 @@ from neutron_lib import exceptions
from neutron_lib.exceptions import qos as qos_exc
from neutron_lib.services.qos import constants as qos_consts
from oslo_log import log as logging
from pyroute2.iproute import linux as iproute_linux
from pyroute2.netlink import rtnl
from pyroute2.netlink.rtnl.tcmsg import common as rtnl_common
from pyroute2.iproute import linux \
as iproute_linux # pylint: disable=no-name-in-module
from pyroute2.netlink import rtnl # pylint: disable=no-name-in-module
from pyroute2.netlink.rtnl.tcmsg import common \
as rtnl_common # pylint: disable=no-name-in-module
from neutron._i18n import _
from neutron.agent.linux import ip_lib


+ 14
- 14
neutron/privileged/agent/linux/ip_lib.py View File

@ -17,13 +17,13 @@ import socket
from neutron_lib import constants
from oslo_log import log as logging
import pyroute2
from pyroute2 import netlink
from pyroute2.netlink import exceptions as netlink_exceptions
from pyroute2.netlink import rtnl
from pyroute2.netlink.rtnl import ifinfmsg
from pyroute2.netlink.rtnl import ndmsg
from pyroute2 import NetlinkError
from pyroute2 import netns
from pyroute2 import netlink # pylint: disable=no-name-in-module
from pyroute2.netlink import exceptions \
as netlink_exceptions # pylint: disable=no-name-in-module
from pyroute2.netlink import rtnl # pylint: disable=no-name-in-module
from pyroute2.netlink.rtnl import ifinfmsg # pylint: disable=no-name-in-module
from pyroute2.netlink.rtnl import ndmsg # pylint: disable=no-name-in-module
from pyroute2 import netns # pylint: disable=no-name-in-module
from neutron._i18n import _
from neutron import privileged
@ -210,7 +210,7 @@ def _run_iproute_link(command, device, namespace=None, **kwargs):
with get_iproute(namespace) as ip:
idx = get_link_id(device, namespace)
return ip.link(command, index=idx, **kwargs)
except NetlinkError as e:
except netlink.NetlinkError as e:
_translate_ip_device_exception(e, device, namespace)
raise
except OSError as e:
@ -224,7 +224,7 @@ def _run_iproute_neigh(command, device, namespace, **kwargs):
with get_iproute(namespace) as ip:
idx = get_link_id(device, namespace)
return ip.neigh(command, ifindex=idx, **kwargs)
except NetlinkError as e:
except netlink_exceptions.NetlinkError as e:
_translate_ip_device_exception(e, device, namespace)
raise
except OSError as e:
@ -238,7 +238,7 @@ def _run_iproute_addr(command, device, namespace, **kwargs):
with get_iproute(namespace) as ip:
idx = get_link_id(device, namespace)
return ip.addr(command, index=idx, **kwargs)
except NetlinkError as e:
except netlink_exceptions.NetlinkError as e:
_translate_ip_device_exception(e, device, namespace)
raise
except OSError as e:
@ -265,7 +265,7 @@ def add_ip_address(ip_version, ip, prefixlen, device, namespace, scope,
family=family,
broadcast=broadcast,
scope=get_scope_name(scope))
except NetlinkError as e:
except netlink_exceptions.NetlinkError as e:
if e.code == errno.EEXIST:
raise IpAddressAlreadyExists(ip=ip, device=device)
raise
@ -281,7 +281,7 @@ def delete_ip_address(ip_version, ip, prefixlen, device, namespace):
address=ip,
mask=prefixlen,
family=family)
except NetlinkError as e:
except netlink_exceptions.NetlinkError as e:
# when trying to delete a non-existent IP address, pyroute2 raises
# NetlinkError with code EADDRNOTAVAIL (99, 'Cannot assign requested
# address')
@ -314,7 +314,7 @@ def create_interface(ifname, namespace, kind, **kwargs):
link_key = "vxlan_link" if kind == "vxlan" else "link"
kwargs[link_key] = get_link_id(physical_interface, namespace)
return ip.link("add", ifname=ifname, kind=kind, **kwargs)
except NetlinkError as e:
except netlink_exceptions.NetlinkError as e:
if e.code == errno.EEXIST:
raise InterfaceAlreadyExists(device=ifname)
raise
@ -452,7 +452,7 @@ def delete_neigh_entry(ip_version, ip_address, mac_address, device, namespace,
lladdr=mac_address,
family=family,
**kwargs)
except NetlinkError as e:
except netlink_exceptions.NetlinkError as e:
# trying to delete a non-existent entry shouldn't raise an error
if e.code == errno.ENOENT:
return


+ 2
- 1
neutron/privileged/agent/linux/tc_lib.py View File

@ -17,7 +17,8 @@ import socket
from neutron_lib import constants as n_constants
import pyroute2
from pyroute2 import protocols as pyroute2_protocols
from pyroute2 import protocols \
as pyroute2_protocols # pylint: disable=no-name-in-module
from neutron._i18n import _
from neutron import privileged


Loading…
Cancel
Save