mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
service node address config for vxlan device using "remote" attribute
Ticket: CM-9520 Reviewed By: CCR-4152 Testing Done: verified service node configuration Use "remote" attribute in iproute2 command to provision service node address for service node based replication. Changes also include allowing only one service node per vxlan device, so its user's responsiblity to select one service node per vxlan device if there are multiple nodes to distribute the load.
This commit is contained in:
@ -62,7 +62,7 @@ class vxlan(moduleBase):
|
||||
if vxlanid:
|
||||
self.ipcmd.link_create_vxlan(ifaceobj.name, vxlanid,
|
||||
localtunnelip=ifaceobj.get_attr_value_first('vxlan-local-tunnelip'),
|
||||
svcnodeips=ifaceobj.get_attr_value('vxlan-svcnodeip'),
|
||||
svcnodeip=ifaceobj.get_attr_value_first('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'),
|
||||
@ -117,9 +117,9 @@ class vxlan(moduleBase):
|
||||
self._query_check_n_update(ifaceobjcurr, 'vxlan-local-tunnelip',
|
||||
attrval, running_attrval)
|
||||
|
||||
self._query_check_n_update_addresses(ifaceobjcurr, 'vxlan-svcnodeip',
|
||||
ifaceobj.get_attr_value('vxlan-svcnodeip'),
|
||||
vxlanattrs.get('svcnode', []))
|
||||
self._query_check_n_update(ifaceobjcurr, 'vxlan-svcnodeip',
|
||||
ifaceobj.get_attr_value_first('vxlan-svcnodeip'),
|
||||
vxlanattrs.get('svcnode'))
|
||||
|
||||
if not systemUtils.is_service_running(None, '/var/run/vxrd.pid'):
|
||||
# vxlan-remoteip config is allowed only if vxrd is not running
|
||||
@ -155,8 +155,7 @@ class vxlan(moduleBase):
|
||||
ifaceobjrunning.update_config('vxlan-local-tunnelip', attrval)
|
||||
attrval = vxlanattrs.get('svcnode')
|
||||
if attrval:
|
||||
[ifaceobjrunning.update_config('vxlan-svcnode', a)
|
||||
for a in attrval]
|
||||
ifaceobjrunning.update_config('vxlan-svcnode', attrval)
|
||||
if not systemUtils.is_service_running(None, '/var/run/vxrd.pid'):
|
||||
# vxlan-remoteip config is allowed only if vxrd is not running
|
||||
attrval = vxlanattrs.get('remote')
|
||||
|
@ -74,21 +74,21 @@ class iproute2(utilsBase):
|
||||
elif citems[i] == 'vxlan' and citems[i+1] == 'id':
|
||||
linkattrs['kind'] = 'vxlan'
|
||||
vattrs = {'vxlanid' : citems[i+2],
|
||||
'svcnode' : [],
|
||||
'svcnode' : None,
|
||||
'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] == 'remote':
|
||||
vattrs['svcnode'] = citems[j+1]
|
||||
elif citems[j] == 'ageing':
|
||||
vattrs['ageing'] = citems[j+1]
|
||||
elif citems[j] == 'nolearning':
|
||||
vattrs['learning'] = 'off'
|
||||
# get vxlan peer nodes
|
||||
peers = self.get_vxlan_peers(ifname)
|
||||
peers = self.get_vxlan_peers(ifname, vattrs['svcnode'])
|
||||
if peers:
|
||||
vattrs['remote'] = peers
|
||||
linkattrs['linkinfo'] = vattrs
|
||||
@ -482,7 +482,7 @@ class iproute2(utilsBase):
|
||||
self.exec_command('ip %s' %cmd)
|
||||
self._cache_update([name], {})
|
||||
|
||||
def get_vxlan_peers(self, dev):
|
||||
def get_vxlan_peers(self, dev, svcnodeip):
|
||||
cmd = 'bridge fdb show brport %s' % dev
|
||||
cur_peers = []
|
||||
try:
|
||||
@ -493,7 +493,7 @@ class iproute2(utilsBase):
|
||||
ppat = re.compile('\s+dst\s+(\d+.\d+.\d+.\d+)\s+')
|
||||
for l in output.split('\n'):
|
||||
m = ppat.search(l)
|
||||
if m:
|
||||
if m and m.group(1) != svcnodeip:
|
||||
cur_peers.append(m.group(1))
|
||||
except:
|
||||
self.logger.warn('error parsing ip link output')
|
||||
@ -506,17 +506,16 @@ class iproute2(utilsBase):
|
||||
|
||||
def link_create_vxlan(self, name, vxlanid,
|
||||
localtunnelip=None,
|
||||
svcnodeips=None,
|
||||
svcnodeip=None,
|
||||
remoteips=None,
|
||||
learning='on',
|
||||
ageing=None,
|
||||
anycastip=None):
|
||||
if svcnodeips and remoteips:
|
||||
if svcnodeip and remoteips:
|
||||
raise Exception("svcnodeip and remoteip is mutually exclusive")
|
||||
args = ''
|
||||
if svcnodeips:
|
||||
for s in svcnodeips:
|
||||
args += ' svcnode %s' %s
|
||||
if svcnodeip:
|
||||
args += ' remote %s' %svcnodeip
|
||||
if ageing:
|
||||
args += ' ageing %s' %ageing
|
||||
if learning == 'off':
|
||||
@ -532,8 +531,8 @@ class iproute2(utilsBase):
|
||||
if anycastip and running_localtunnelip and anycastip == running_localtunnelip:
|
||||
localtunnelip = running_localtunnelip
|
||||
running_svcnode = vxlanattrs.get('svcnode')
|
||||
if running_svcnode and not svcnodeips:
|
||||
args += ' svcnode 0.0.0.0'
|
||||
if running_svcnode and not svcnodeip:
|
||||
args += ' noremote'
|
||||
else:
|
||||
cmd = 'link add dev %s type vxlan id %s dstport %d' %(name, vxlanid, VXLAN_UDP_PORT)
|
||||
|
||||
@ -549,7 +548,7 @@ class iproute2(utilsBase):
|
||||
if not systemUtils.is_service_running(None, '/var/run/vxrd.pid'):
|
||||
#figure out the diff for remotes and do the bridge fdb updates
|
||||
#only if provisioned by user and not by vxrd
|
||||
cur_peers = set(self.get_vxlan_peers(name))
|
||||
cur_peers = set(self.get_vxlan_peers(name, svcnodeip))
|
||||
if remoteips:
|
||||
new_peers = set(remoteips)
|
||||
del_list = cur_peers.difference(new_peers)
|
||||
|
Reference in New Issue
Block a user