1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

new ifupdown2 link module to create dummy devices

Ticket: CM-3525
Reviewed By: CCR-3326
Testing Done: Tested creating dummy devices using ifupdown2

This is modification to gospos loopback module. It solves the same
purpose ie using linux dummy device like a loopback device but there were
objections on calling it loopback so i have renamed it to link and i have changed it
into a generic module that can do any 'ip link'. Can be extended for
link args in the future.

below example creates a loopy device

$ifquery loopy
auto loopy
iface loopy
link-type dummy

$ifup loopy
$ifquery -c loopy
auto loopy
iface loopy [pass]
link-type dummy [pass]

(cherry picked from commit 1151420408a53c106d29183a1e0da5562c8b03a3)
This commit is contained in:
Roopa Prabhu
2015-08-12 23:30:55 -07:00
parent 7496605db3
commit 2ec2da0cf9
4 changed files with 34 additions and 10 deletions

View File

@@ -67,7 +67,11 @@ class iproute2(utilsBase):
elif citems[i] == 'link/ether': linkattrs['hwaddress'] = citems[i+1]
elif citems[i] == 'vlan' and citems[i+1] == 'id':
linkattrs['linkinfo'] = {'vlanid' : citems[i+2]}
linkattrs['kind'] = 'vlan'
elif citems[i] == 'dummy':
linkattrs['kind'] = 'dummy'
elif citems[i] == 'vxlan' and citems[i+1] == 'id':
linkattrs['kind'] = 'vxlan'
vattrs = {'vxlanid' : citems[i+2],
'svcnode' : [],
'remote' : [],
@@ -568,6 +572,9 @@ class iproute2(utilsBase):
def link_get_mtu(self, ifacename):
return self._cache_get('link', [ifacename, 'mtu'])
def link_get_kind(self, ifacename):
return self._cache_get('link', [ifacename, 'kind'])
def link_get_hwaddress(self, ifacename):
address = self._cache_get('link', [ifacename, 'hwaddress'])
# newly created logical interface addresses dont end up in the cache