mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Added ifupdown2 support for vxlan-ageing config
Ticket: CM-5105 Reviewed By: roopa Testing Done: tested configs before and after change We needed a configuration option to add vxlan-ageing to ifupdown2 configs. This patch adds the option to change the vxlan-ageing timer currently set with "ip link" commands. (cherry picked from commit 9832462c365bd2b900b98f5675d407d1b11c4a95) Conflicts: packages/ifupdown2/addons/vxlan.py packages/ifupdown2/ifupdownaddons/iproute2.py
This commit is contained in:
@@ -27,6 +27,9 @@ class vxlan(moduleBase):
|
|||||||
{'help' : 'vxlan learning on/off',
|
{'help' : 'vxlan learning on/off',
|
||||||
'example': ['vxlan-learning off'],
|
'example': ['vxlan-learning off'],
|
||||||
'default': 'on'},
|
'default': 'on'},
|
||||||
|
'vxlan-ageing' :
|
||||||
|
{'help' : 'vxlan aging timer',
|
||||||
|
'example': ['vxlan-ageing 300']},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
def __init__(self, *args, **kargs):
|
def __init__(self, *args, **kargs):
|
||||||
@@ -45,7 +48,8 @@ class vxlan(moduleBase):
|
|||||||
localtunnelip=ifaceobj.get_attr_value_first('vxlan-local-tunnelip'),
|
localtunnelip=ifaceobj.get_attr_value_first('vxlan-local-tunnelip'),
|
||||||
svcnodeips=ifaceobj.get_attr_value('vxlan-svcnodeip'),
|
svcnodeips=ifaceobj.get_attr_value('vxlan-svcnodeip'),
|
||||||
remoteips=ifaceobj.get_attr_value('vxlan-remoteip'),
|
remoteips=ifaceobj.get_attr_value('vxlan-remoteip'),
|
||||||
learning=ifaceobj.get_attr_value_first('vxlan-learning'))
|
learning=ifaceobj.get_attr_value_first('vxlan-learning'),
|
||||||
|
ageing=ifaceobj.get_attr_value_first('vxlan-ageing'))
|
||||||
if ifaceobj.addr_method == 'manual':
|
if ifaceobj.addr_method == 'manual':
|
||||||
rtnetlink_api.rtnl_api.link_set(ifaceobj.name, "up")
|
rtnetlink_api.rtnl_api.link_set(ifaceobj.name, "up")
|
||||||
|
|
||||||
@@ -100,6 +104,10 @@ class vxlan(moduleBase):
|
|||||||
ifaceobj.get_attr_value('vxlan-remoteip'),
|
ifaceobj.get_attr_value('vxlan-remoteip'),
|
||||||
vxlanattrs.get('remote', []))
|
vxlanattrs.get('remote', []))
|
||||||
|
|
||||||
|
self._query_check_n_update(ifaceobjcurr, 'vxlan-ageing',
|
||||||
|
ifaceobj.get_attr_value('vxlan-ageing'),
|
||||||
|
vxlanattrs.get('ageing'))
|
||||||
|
|
||||||
learning = ifaceobj.get_attr_value_first('vxlan-learning')
|
learning = ifaceobj.get_attr_value_first('vxlan-learning')
|
||||||
if not learning:
|
if not learning:
|
||||||
learning = 'on'
|
learning = 'on'
|
||||||
@@ -132,7 +140,9 @@ class vxlan(moduleBase):
|
|||||||
attrval = vxlanattrs.get('learning')
|
attrval = vxlanattrs.get('learning')
|
||||||
if attrval and attrval == 'on':
|
if attrval and attrval == 'on':
|
||||||
ifaceobjrunning.update_config('vxlan-learning', 'on')
|
ifaceobjrunning.update_config('vxlan-learning', 'on')
|
||||||
|
attrval = vxlanattrs.get('ageing')
|
||||||
|
if attrval:
|
||||||
|
ifaceobjrunning.update_config('vxlan-ageing', vxlanattrs.get('ageing'))
|
||||||
|
|
||||||
_run_ops = {'pre-up' : _up,
|
_run_ops = {'pre-up' : _up,
|
||||||
'post-down' : _down,
|
'post-down' : _down,
|
||||||
|
@@ -71,12 +71,15 @@ class iproute2(utilsBase):
|
|||||||
vattrs = {'vxlanid' : citems[i+2],
|
vattrs = {'vxlanid' : citems[i+2],
|
||||||
'svcnode' : [],
|
'svcnode' : [],
|
||||||
'remote' : [],
|
'remote' : [],
|
||||||
|
'ageing' : citems[i+2],
|
||||||
'learning': 'on'}
|
'learning': 'on'}
|
||||||
for j in range(i+2, len(citems)):
|
for j in range(i+2, len(citems)):
|
||||||
if citems[j] == 'local':
|
if citems[j] == 'local':
|
||||||
vattrs['local'] = citems[j+1]
|
vattrs['local'] = citems[j+1]
|
||||||
elif citems[j] == 'svcnode':
|
elif citems[j] == 'svcnode':
|
||||||
vattrs['svcnode'].append(citems[j+1])
|
vattrs['svcnode'].append(citems[j+1])
|
||||||
|
elif citems[j] == 'ageing':
|
||||||
|
vattrs['ageing'].append(citems[j+1])
|
||||||
elif citems[j] == 'nolearning':
|
elif citems[j] == 'nolearning':
|
||||||
vattrs['learning'] = 'off'
|
vattrs['learning'] = 'off'
|
||||||
# get vxlan peer nodes
|
# get vxlan peer nodes
|
||||||
@@ -487,7 +490,8 @@ class iproute2(utilsBase):
|
|||||||
localtunnelip=None,
|
localtunnelip=None,
|
||||||
svcnodeips=None,
|
svcnodeips=None,
|
||||||
remoteips=None,
|
remoteips=None,
|
||||||
learning='on'):
|
learning='on',
|
||||||
|
ageing=None):
|
||||||
if svcnodeips and remoteips:
|
if svcnodeips and remoteips:
|
||||||
raise Exception("svcnodeip and remoteip is mutually exclusive")
|
raise Exception("svcnodeip and remoteip is mutually exclusive")
|
||||||
args = ''
|
args = ''
|
||||||
@@ -496,9 +500,11 @@ class iproute2(utilsBase):
|
|||||||
if svcnodeips:
|
if svcnodeips:
|
||||||
for s in svcnodeips:
|
for s in svcnodeips:
|
||||||
args += ' svcnode %s' %s
|
args += ' svcnode %s' %s
|
||||||
|
if ageing:
|
||||||
|
args += ' ageing %s' %ageing
|
||||||
if learning == 'off':
|
if learning == 'off':
|
||||||
args += ' nolearning'
|
args += ' nolearning'
|
||||||
|
|
||||||
if self.link_exists(name):
|
if self.link_exists(name):
|
||||||
cmd = 'link set dev %s type vxlan dstport %d' %(name, VXLAN_UDP_PORT)
|
cmd = 'link set dev %s type vxlan dstport %d' %(name, VXLAN_UDP_PORT)
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user