1
0
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:
Sam Tannous
2015-03-05 12:54:55 -05:00
parent 3380b84370
commit 88a5c4c89d
2 changed files with 20 additions and 4 deletions

View File

@@ -27,6 +27,9 @@ class vxlan(moduleBase):
{'help' : 'vxlan learning on/off',
'example': ['vxlan-learning off'],
'default': 'on'},
'vxlan-ageing' :
{'help' : 'vxlan aging timer',
'example': ['vxlan-ageing 300']},
}}
def __init__(self, *args, **kargs):
@@ -45,7 +48,8 @@ class vxlan(moduleBase):
localtunnelip=ifaceobj.get_attr_value_first('vxlan-local-tunnelip'),
svcnodeips=ifaceobj.get_attr_value('vxlan-svcnodeip'),
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':
rtnetlink_api.rtnl_api.link_set(ifaceobj.name, "up")
@@ -100,6 +104,10 @@ class vxlan(moduleBase):
ifaceobj.get_attr_value('vxlan-remoteip'),
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')
if not learning:
learning = 'on'
@@ -132,7 +140,9 @@ class vxlan(moduleBase):
attrval = vxlanattrs.get('learning')
if attrval and attrval == '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,
'post-down' : _down,

View File

@@ -71,12 +71,15 @@ class iproute2(utilsBase):
vattrs = {'vxlanid' : citems[i+2],
'svcnode' : [],
'remote' : [],
'ageing' : citems[i+2],
'learning': 'on'}
for j in range(i+2, len(citems)):
if citems[j] == 'local':
vattrs['local'] = citems[j+1]
elif citems[j] == 'svcnode':
vattrs['svcnode'].append(citems[j+1])
elif citems[j] == 'ageing':
vattrs['ageing'].append(citems[j+1])
elif citems[j] == 'nolearning':
vattrs['learning'] = 'off'
# get vxlan peer nodes
@@ -487,7 +490,8 @@ class iproute2(utilsBase):
localtunnelip=None,
svcnodeips=None,
remoteips=None,
learning='on'):
learning='on',
ageing=None):
if svcnodeips and remoteips:
raise Exception("svcnodeip and remoteip is mutually exclusive")
args = ''
@@ -496,6 +500,8 @@ class iproute2(utilsBase):
if svcnodeips:
for s in svcnodeips:
args += ' svcnode %s' %s
if ageing:
args += ' ageing %s' %ageing
if learning == 'off':
args += ' nolearning'