Commit f8f5dff1 authored by Peter V. Saveliev's avatar Peter V. Saveliev

ipdb: per plugin RTNLGRP requirements

Bug-Url: https://github.com/svinota/pyroute2/pull/314
parent bcc91cac
......@@ -7,6 +7,7 @@ from pyroute2.common import basestring
from pyroute2.common import dqn2int
from pyroute2.common import View
from pyroute2.config import TransactionalBase
from pyroute2.netlink import rtnl
from pyroute2.netlink import NLM_F_ACK
from pyroute2.netlink import NLM_F_REQUEST
from pyroute2.netlink.exceptions import NetlinkError
......@@ -23,6 +24,12 @@ from pyroute2.ipdb.exceptions import CommitException
from pyroute2.ipdb.exceptions import PartialCommitException
groups = rtnl.RTNLGRP_LINK |\
rtnl.RTNLGRP_NEIGH |\
rtnl.RTNLGRP_IPV4_IFADDR |\
rtnl.RTNLGRP_IPV6_IFADDR
def _get_data_fields():
ret = []
for data in ('bridge_data',
......
......@@ -673,6 +673,8 @@ class IPDB(object):
del self._deferred[key]
for module in self._plugins:
if (module.groups & self.nl_bind_groups) != module.groups:
continue
for plugin in module.spec:
self._deferred[plugin['name']] = module.spec
if plugin['name'] in self._loaded:
......
......@@ -7,6 +7,7 @@ from socket import AF_INET6
from socket import AF_INET
from pyroute2.common import AF_MPLS
from pyroute2.common import basestring
from pyroute2.netlink import rtnl
from pyroute2.netlink import nlmsg
from pyroute2.netlink import nlmsg_base
from pyroute2.netlink.rtnl import rt_type
......@@ -21,6 +22,9 @@ from pyroute2.ipdb.transactional import SYNC_TIMEOUT
from pyroute2.ipdb.linkedset import LinkedSet
log = logging.getLogger(__name__)
groups = rtnl.RTNLGRP_IPV4_ROUTE |\
rtnl.RTNLGRP_IPV6_ROUTE |\
rtnl.RTNLGRP_MPLS_ROUTE
class Metrics(Transactional):
......
import logging
import threading
from collections import namedtuple
from pyroute2.netlink import rtnl
from pyroute2.netlink.rtnl.fibmsg import fibmsg
from pyroute2.netlink.rtnl.fibmsg import FR_ACT_NAMES
from pyroute2.ipdb.exceptions import CommitException
from pyroute2.ipdb.transactional import Transactional
log = logging.getLogger(__name__)
groups = rtnl.RTNLGRP_IPV4_RULE |\
rtnl.RTNLGRP_IPV6_RULE
RuleKey = namedtuple('RuleKey',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment