mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: dhcp: add vrf awareness
Ticket: CM-10292, CM-10282 Reviewed By: dsa, nikhil, julien Testing Done: Tested dhcp config on an vrf slave - Add support for policy module_globals variable "vrf-exec-cmd-prefix". It is read into per module self.vrf_exec_cmd_prefix variable - If self.vrf_exec_cmd_prefix is present and interface is a vrf slave, use ifupdown2 will call such command in vrf context using: "%s %s %s" %(<vrf-exec-cmd-prefix>, <vrfname>, <cmd>) - This also fixes calling of dhcp refresh when a dhcp slave is removed from a vrf Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import shlex
|
||||
|
||||
from ifupdown.utils import utils
|
||||
from ifupdown.iface import *
|
||||
import ifupdown.policymanager as policymanager
|
||||
#from ifupdownaddons.iproute2 import *
|
||||
#from ifupdownaddons.dhclient import *
|
||||
#from ifupdownaddons.bridgeutils import *
|
||||
@@ -38,6 +39,11 @@ class moduleBase(object):
|
||||
self.CACHE = kargs.get('cache', False)
|
||||
self.CACHE_FLAGS = kargs.get('cacheflags', 0x0)
|
||||
|
||||
# vrfs are a global concept and a vrf context can be applicable
|
||||
# to all global vrf commands. Get the default vrf-exec-cmd-prefix
|
||||
# here so that all modules can use it
|
||||
self.vrf_exec_cmd_prefix = policymanager.policymanager_api.get_module_globals('vrf', attr='vrf-exec-cmd-prefix')
|
||||
|
||||
def log_warn(self, str, ifaceobj=None):
|
||||
""" log a warning if err str is not one of which we should ignore """
|
||||
if not self.ignore_error(str):
|
||||
|
Reference in New Issue
Block a user