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

addons: link: add new 'link-down [yes|no]' link attribute to keep link down

Ticket: CM-13434
Reviewed by: julien, nikhil, daniel
Testing Done: ifreload and multiple down [yes|no] sequences under
physical and logical interfaces (ifupdown2-tests test case is
pending)

This also moves the fix done for CM-4125 (inet manual handling for
logical devices) into a single place under ifupdownmain.

attribute 'link-down [yes|no]' will not work in all cases when 'inet
manual' is used. This is only to preserve the semantics of 'inet manual'.
Best use of 'link-down [yes|no]' is to use it without 'inet manual'..
they are conflicting features anyways.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This commit is contained in:
Roopa Prabhu
2017-01-05 10:52:31 -08:00
parent f0e5bd8708
commit 417e5675c4

View File

@@ -18,7 +18,11 @@ class link(moduleBase):
'link-type' :
{'help' : 'type of link as in \'ip link\' command.',
'validvals' : ['dummy', 'veth'],
'example' : ['link-type <dummy|veth>']}}}
'example' : ['link-type <dummy|veth>']},
'link-down' :
{'help': 'keep link down',
'example' : ['link-down yes/no'],
'validvals' : ['yes', 'no']}}}
def __init__(self, *args, **kargs):
moduleBase.__init__(self, *args, **kargs)
@@ -29,6 +33,10 @@ class link(moduleBase):
return True
return False
def get_dependent_ifacenames(self, ifaceobj, ifacenames_all=None):
if ifaceobj.get_attr_value_first('link-down') == 'yes':
ifaceobj.link_privflags |= ifaceLinkPrivFlags.KEEP_LINK_DOWN
def _up(self, ifaceobj):
self.ipcmd.link_create(ifaceobj.name,
ifaceobj.get_attr_value_first('link-type'))