mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: moving vxlan creation from iproute2 to netlink (via nlmanager)
Ticket: CM-8035 Reviewed By: CCR-4896 Testing Done: ifupdown smoke, -t vxlan tests Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -66,19 +66,52 @@ class vxlan(moduleBase):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _up(self, ifaceobj):
|
def _vxlan_create(self, ifaceobj):
|
||||||
vxlanid = ifaceobj.get_attr_value_first('vxlan-id')
|
vxlanid = ifaceobj.get_attr_value_first('vxlan-id')
|
||||||
if vxlanid:
|
if vxlanid:
|
||||||
self.ipcmd.link_create_vxlan(ifaceobj.name, vxlanid,
|
group = ifaceobj.get_attr_value_first('vxlan-svcnodeip')
|
||||||
localtunnelip=ifaceobj.get_attr_value_first('vxlan-local-tunnelip'),
|
|
||||||
svcnodeip=ifaceobj.get_attr_value_first('vxlan-svcnodeip'),
|
netlink.link_add_vxlan(ifaceobj.name, vxlanid,
|
||||||
remoteips=ifaceobj.get_attr_value('vxlan-remoteip'),
|
local=ifaceobj.get_attr_value_first('vxlan-local-tunnelip'),
|
||||||
learning=utils.get_onoff_bool(ifaceobj.get_attr_value_first('vxlan-learning')),
|
learning=utils.get_onoff_bool(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)
|
group=group)
|
||||||
|
|
||||||
|
remoteips = ifaceobj.get_attr_value('vxlan-remoteip')
|
||||||
|
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.ipcmd.get_vxlan_peers(ifaceobj.name, group))
|
||||||
|
if remoteips:
|
||||||
|
new_peers = set(remoteips)
|
||||||
|
del_list = cur_peers.difference(new_peers)
|
||||||
|
add_list = new_peers.difference(cur_peers)
|
||||||
|
else:
|
||||||
|
del_list = cur_peers
|
||||||
|
add_list = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
for addr in del_list:
|
||||||
|
self.ipcmd.bridge_fdb_del(ifaceobj.name,
|
||||||
|
'00:00:00:00:00:00',
|
||||||
|
None, True, addr)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
for addr in add_list:
|
||||||
|
self.ipcmd.bridge_fdb_append(ifaceobj.name,
|
||||||
|
'00:00:00:00:00:00',
|
||||||
|
None, True, addr)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if ifaceobj.addr_method == 'manual':
|
if ifaceobj.addr_method == 'manual':
|
||||||
netlink.link_set_updown(ifaceobj.name, "up")
|
netlink.link_set_updown(ifaceobj.name, "up")
|
||||||
|
|
||||||
|
def _up(self, ifaceobj):
|
||||||
|
self._vxlan_create(ifaceobj)
|
||||||
|
|
||||||
def _down(self, ifaceobj):
|
def _down(self, ifaceobj):
|
||||||
try:
|
try:
|
||||||
self.ipcmd.link_delete(ifaceobj.name)
|
self.ipcmd.link_delete(ifaceobj.name)
|
||||||
|
@@ -597,30 +597,6 @@ class iproute2(utilsBase):
|
|||||||
else:
|
else:
|
||||||
utils.exec_command('ip %s' % cmd)
|
utils.exec_command('ip %s' % cmd)
|
||||||
|
|
||||||
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, svcnodeip))
|
|
||||||
if remoteips:
|
|
||||||
new_peers = set(remoteips)
|
|
||||||
del_list = cur_peers.difference(new_peers)
|
|
||||||
add_list = new_peers.difference(cur_peers)
|
|
||||||
else:
|
|
||||||
del_list = cur_peers
|
|
||||||
add_list = []
|
|
||||||
|
|
||||||
try:
|
|
||||||
for addr in del_list:
|
|
||||||
self.bridge_fdb_del(name, '00:00:00:00:00:00', None, True, addr)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
for addr in add_list:
|
|
||||||
self.bridge_fdb_append(name, '00:00:00:00:00:00', None, True, addr)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# XXX: update linkinfo correctly
|
# XXX: update linkinfo correctly
|
||||||
self._cache_update([name], {})
|
self._cache_update([name], {})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user