mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdown2 changes for vxlan anycast_ip, head-end fdb entries, protodown
Ticket: CM-7087 Reviewed By: CCR-3379 Testing Done: unit testing with clag_vxlan_clos_spec/cfg.py On clag pairing, clagd changes local address of vxlan device to anycast ip. If user does ifreload now, ifupdown2 will overwrite local address with individual ip contained in /etc/netwrok/interfaces. vxlan.py caches anycast_ip configuration so that ifquery -c can skip it from flagging error and ifreload skip overwriting vxlan device's local ip. vxrd provisions head-end replication endpoints by adding bridge fdb entries. If /etc/network/interfaces doesn't have remote-ip attribute, then on ifreload ifupdown2 will delete all vxrd provisioned entries. ifupdown will check for presence of vxrd service and skip add/delete bridge fdb entries for head-end replication On ifreload vxlan device are put in proto-down even if they are up and running. Check for operstate and put it in proto-down only if operstate transitions from down to up.
This commit is contained in:
@@ -5,6 +5,7 @@ from ifupdownaddons.modulebase import moduleBase
|
||||
from ifupdownaddons.iproute2 import iproute2
|
||||
import ifupdown.rtnetlink_api as rtnetlink_api
|
||||
import logging
|
||||
import os
|
||||
from sets import Set
|
||||
|
||||
class vxlan(moduleBase):
|
||||
@@ -32,15 +33,22 @@ class vxlan(moduleBase):
|
||||
'example': ['vxlan-ageing 300'],
|
||||
'default': '300'},
|
||||
}}
|
||||
_clagd_vxlan_anycast_ip = ""
|
||||
|
||||
def __init__(self, *args, **kargs):
|
||||
moduleBase.__init__(self, *args, **kargs)
|
||||
self.ipcmd = None
|
||||
|
||||
def get_dependent_ifacenames(self, ifaceobj, ifaceobjs_all=None):
|
||||
if not self._is_vxlan_device(ifaceobj):
|
||||
return None
|
||||
ifaceobj.link_kind |= ifaceLinkKind.VXLAN
|
||||
if self._is_vxlan_device(ifaceobj):
|
||||
ifaceobj.link_kind |= ifaceLinkKind.VXLAN
|
||||
elif ifaceobj.name == 'lo':
|
||||
clagd_vxlan_list = ifaceobj.get_attr_value('clagd-vxlan-anycast-ip')
|
||||
if clagd_vxlan_list:
|
||||
if len(clagd_vxlan_list) != 1:
|
||||
self.log_warn('%s: multiple clagd-vxlan-anycast-ip lines, using first one'
|
||||
% (ifaceobj.name,))
|
||||
vxlan._clagd_vxlan_anycast_ip = clagd_vxlan_list[0]
|
||||
return None
|
||||
|
||||
def _is_vxlan_device(self, ifaceobj):
|
||||
@@ -56,7 +64,8 @@ class vxlan(moduleBase):
|
||||
svcnodeips=ifaceobj.get_attr_value('vxlan-svcnodeip'),
|
||||
remoteips=ifaceobj.get_attr_value('vxlan-remoteip'),
|
||||
learning=ifaceobj.get_attr_value_first('vxlan-learning'),
|
||||
ageing=ifaceobj.get_attr_value_first('vxlan-ageing'))
|
||||
ageing=ifaceobj.get_attr_value_first('vxlan-ageing'),
|
||||
anycastip=self._clagd_vxlan_anycast_ip)
|
||||
if ifaceobj.addr_method == 'manual':
|
||||
rtnetlink_api.rtnl_api.link_set(ifaceobj.name, "up")
|
||||
|
||||
@@ -99,17 +108,23 @@ class vxlan(moduleBase):
|
||||
ifaceobj.get_attr_value_first('vxlan-id'),
|
||||
vxlanattrs.get('vxlanid'))
|
||||
|
||||
running_attrval = vxlanattrs.get('local')
|
||||
attrval = ifaceobj.get_attr_value_first('vxlan-local-tunnelip')
|
||||
if running_attrval == self._clagd_vxlan_anycast_ip:
|
||||
# if local ip is anycast_ip, then let query_check to go through
|
||||
attrval = self._clagd_vxlan_anycast_ip
|
||||
self._query_check_n_update(ifaceobjcurr, 'vxlan-local-tunnelip',
|
||||
ifaceobj.get_attr_value_first('vxlan-local-tunnelip'),
|
||||
vxlanattrs.get('local'))
|
||||
attrval, running_attrval)
|
||||
|
||||
self._query_check_n_update_addresses(ifaceobjcurr, 'vxlan-svcnodeip',
|
||||
ifaceobj.get_attr_value('vxlan-svcnodeip'),
|
||||
ifaceobj.get_attr_value('vxlan-svcnodeip'),
|
||||
vxlanattrs.get('svcnode', []))
|
||||
|
||||
self._query_check_n_update_addresses(ifaceobjcurr, 'vxlan-remoteip',
|
||||
ifaceobj.get_attr_value('vxlan-remoteip'),
|
||||
vxlanattrs.get('remote', []))
|
||||
if os.system('service vxrd status > /dev/null 2>&1') != 0:
|
||||
# vxlan-remoteip config is allowed only if vxrd is not running
|
||||
self._query_check_n_update_addresses(ifaceobjcurr, 'vxlan-remoteip',
|
||||
ifaceobj.get_attr_value('vxlan-remoteip'),
|
||||
vxlanattrs.get('remote', []))
|
||||
|
||||
learning = ifaceobj.get_attr_value_first('vxlan-learning')
|
||||
if not learning:
|
||||
@@ -141,10 +156,12 @@ class vxlan(moduleBase):
|
||||
if attrval:
|
||||
[ifaceobjrunning.update_config('vxlan-svcnode', a)
|
||||
for a in attrval]
|
||||
attrval = vxlanattrs.get('remote')
|
||||
if attrval:
|
||||
[ifaceobjrunning.update_config('vxlan-remoteip', a)
|
||||
for a in attrval]
|
||||
if os.system('service vxrd status > /dev/null 2>&1') != 0:
|
||||
# vxlan-remoteip config is allowed only if vxrd is not running
|
||||
attrval = vxlanattrs.get('remote')
|
||||
if attrval:
|
||||
[ifaceobjrunning.update_config('vxlan-remoteip', a)
|
||||
for a in attrval]
|
||||
attrval = vxlanattrs.get('learning')
|
||||
if attrval and attrval == 'on':
|
||||
ifaceobjrunning.update_config('vxlan-learning', 'on')
|
||||
|
Reference in New Issue
Block a user