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

31 Commits

Author SHA1 Message Date
a981087c9e ifupdown2: bond-downdelay and bond-updelay need validrange
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   julien@cumulusnetworks.com

Ticket: CM-15012
2017-02-23 03:13:40 +12:00
c3fc3b8f00 addons: bond: adding attribute bond-(up|down)delay
Ticket: CM-8424
Reviewed By: Roopa, Julien
Testing Done: using the config mentioned in bug

updelay

    Specifies the time, in milliseconds, to wait before enabling a
    slave after a link recovery has been detected.  This option is
    only valid for the miimon link monitor.

downdelay

    Specifies the time, in milliseconds, to wait before disabling
    a slave after a link failure has been detected.  This option
    is only valid for the miimon link monitor.

Signed-off-by: Nikhil Gajendrakumar <nikhil@cumulusnetworks.com>

Conflicts:
	ifupdownaddons/bondutil.py
2017-02-01 10:45:56 -08:00
a9633d0591 addons: bond: add support for attribute aliases (bond-ports)
This features will allow attributes to have aliases. Our use case today is
between bond-slaves and bridge-ports, which be a little confusing.
It follows the kernel api and existing linux tools. Bonding driver calls them
slaves and to the bridge driver they are ports.

With NCLU we we would like to be more consistent. We will now also support
"bond-ports"a

Ticket: CM-12763
Reviewed By: Roopa
Testing Done:

$ ifquery -a -c
auto bond0
iface bond0                                                         [pass]
      bond-slaves swp1                                            [pass]

auto bond1
iface bond1                                                         [pass]
      bond-ports swp2                                             [pass]

root@cel-redxp-06:~# ifquery -a -r
auto bond0
iface bond0
      bond-lacp-bypass-allow 0
      bond-slaves swp1
      bond-mode 802.3ad
      bond-use-carrier 1
      bond-lacp-rate 1
      bond-min-links 1
      bond-miimon 100
      bond-xmit-hash-policy layer3+4

auto bond1
iface bond1
      bond-lacp-bypass-allow 0
      bond-slaves swp2
      bond-mode 802.3ad
      bond-use-carrier 1
      bond-lacp-rate 1
      bond-min-links 1
      bond-miimon 100
      bond-xmit-hash-policy layer3+4

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2017-01-06 17:58:49 +03:00
9858b0a680 ifupdown: add missing supporting code for 'link-down [yes|no]'
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>
2017-01-05 11:28:16 -08:00
81d3e0271e Revert "ifupdown: add new 'down [yes|no]' link attribute to keep link down"
This reverts commit 02e00f54bbf9d0ca647c1ed2c39f7af28b6653b7.

reverting this commit to move it to link.py addon module.
down conflicts with usercmds.py 'down'

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2017-01-05 10:50:48 -08:00
02e00f54bb ifupdown: add new '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 '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 'down [yes|no]' is to use it without 'inet manual'..
they are conflicting features anyways.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2017-01-05 08:30:11 -08:00
18700e2676 addons: ifquery: re-ordering bridge-ports and bond-slaves interfaces
Ticket: CM-11953
Reviewed By: Roopa, Nikhil G
Testing Done: ifupdown2-tests and ifupdown2 smokes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
3e960ac241 netlink: moving ip link set master commands to netlink
Ticket:
Reviewed By: Roopa, Daniel W, Nikhil G, Dave O, Scott E
Testing Done: ifupdown2 smokes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
99b652303f addons: bridge/bond: fix ifquery regression where glob and regexes weren't expanded
Ticket:
Reviewed By: Roopa, Nikhil G
Testing Done:

auto br0
iface br0
      bridge-ports tap17 glob tap[2-4].100 tap19 regex tap2.*

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
f46dd16d39 addons: bond: 'ifquery -c' doesn't re-order user's bond-slaves list
Ticket: CM-11953
Reviewed By: Roopa, Nikhil G, Daniel W
Testing Done:

$ ifquery b0
auto b0
iface b0
      bond-slaves swp1 swp2

$ ifreload -a
$ ifquery -a -c
auto b0
iface b0
      bond-slaves swp2 swp1 [pass]

$ ifquery -a -c
auto b0
iface b0
      bond-slaves swp1 swp2 [pass]

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:38 +01:00
b6b8bd2b77 addons may provide a list of ifupdown scripts to ignore
Ticket:
Reviewed By: Roopa, Nikhil G
Testing Done:

ifupdown2's python addons are replacing some/most of the old ifupdown shell
scripts. When addon_scripts_support is set to 1, ifupdown2 will execute every
scripts present in /etc/network/if-$ACTION.d/ if a script exists with a name
identical to an ifupdown2 addon, this script won't be executed.

Sometimes an ifupdown2 addons doesn't have the same name as the ifupdown script
it's supposed to replace. Or maybe one addon is replacing several scripts.
For example: bond.py is replacing /etc/network/if-*.d/ifenslave

Now each addon is able to provide a list of script to ignore.

[16:54:40] root:ifupdown2 # ifquery bond0
iface bond0
      bond-slaves tap0 tap1

[16:54:49] root:ifupdown2 # ifreload -a -d &> /tmp/ifreload.log
[16:54:54] root:ifupdown2 # cat /tmp/ifreload.log | grep ifenslave
debug: tap1: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: tap1: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: lo: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: lo: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: eth0: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: eth0: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: tap0: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: tap0: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
[16:54:55] root:ifupdown2 #
...
apply patch
...
[16:55:16] root:ifupdown2 # ifreload -a -d &> /tmp/ifreload.log
[16:55:18] root:ifupdown2 # cat /tmp/ifreload.log | grep ifenslave
[16:55:19] root:ifupdown2 #

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-27 11:05:37 +02:00
482b2fab80 attribute syntax check using validvals/validrange and keywords
Ticket: CM-8101
Reviewed By: CCR-4949
Testing Done: smoke tests + ran ifup -a -s on every interface configuration file from GSS cl-supports collection

This commit is introducing ~20 keywords. The value of the different attributes
will be check against raw values and <keywords>:

'<mac>'
'<text>'
'<ipv4>'
'<ipv6>'
'<auto>': "auto"
'<ipaddr>': ipv4/6 with preflix len
'<number>'
'<interface>'
'<ipv4-vrf-text>': equivalent to: <ipv4> "vrf" <text>
'<number-ipv4-list>': example: "100=172.16.100.1 101=172.16.101.1"
'<interface-list>': example: "swp1 swp2 swp3"
'<ipv4/prefixlen>'
'<ipv6/prefixlen>'
'<ipaddr/prefixlen>'
'<number-range-list>': example: "2000 2200-3000"
'<interface-range-list>': example: "swp1=100 swp2=100" ('validrange' : ['0', '65535'])
'<mac-ipaddr/prefixlen-list>'
'<number-interface-list>': example: "4 swp1 swp2"
'<interface-yes-no-list>': example: "swp1=yes swp2=no"
'<interface-yes-no-0-1-list>'
'<interface-yes-no-auto-list>'

It's possible to combine a keyword with a range from validrange. example:
validrange: 10-50
validvals: <intrface-range-list>
value: swp1=21 swp2=42 ...

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-01 09:28:16 +02:00
8c20f6c69e Revert "Revert "addons: bond: reverting validvals "<mac>" change""
This reverts commit b19c6c100a3ccec5c858342b8349f1ee441bf153.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-07-18 21:00:29 +01:00
b19c6c100a Revert "addons: bond: reverting validvals "<mac>" change"
This reverts commit 3861c72cf6132ba79147911c7fe3498cab57de3e.
2016-07-11 20:37:41 +01:00
3861c72cf6 addons: bond: reverting validvals "<mac>" change
Ticket: CM-11331
Reviewed By:
Testing Done:
2016-06-16 03:37:36 +01:00
594fb088e8 small easy: support (0|1) or (off|on) attribute while keeping backward compatibility
Ticket: CM-8866
Reviewed By: Roopa
Testing Done:

added support for:
* bond-lacp-bypass-allow (0|1)
* bond-use-carrier (0|1)
* bridge-mcqifaddr (0|1)
* bridge-mcquerier (0|1)
* bridge-mcrouter (0|1)
* bridge-mcsnoop (0|1)
* bridge-portmcrouter (0|1)
* link-autoneg (off|on)
* vxlan-learning (off|on)

these 2 are not yet supported by ifupdown2:
* bond-lacp-bypass-all-active (0|1)
* bond-lacp-fallback-allow (0|1)

This one is left untouched. yes/no doesn't make sense for this attribute.
* bond-lacp-rate (0|1)

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:36 +01:00
c6370b563b Add validvals to addons, to be used by iface/ifedit wrapper
Ticket: CM-8669
Reviewed By: Julien
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>
2016-06-16 03:37:35 +01:00
2864d6f361 Replace rtnetlink modules with python-nlmanager calls
Ticket: CM-7360
Reviewed By: CCR-4721
Testing Done: smoke / testifreload / Tested on amd64 platform (by Sam)

This patch replaces all calls to rtnetlink with python-nlmanager.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:35 +01:00
1a13da934b addons: bond: support for classical numerical bond modes
Ticket: CM-7965
Reviewed By: Roopa, Nikhil G
Testing Done: ifup/down/reload/query iface attr bond-mode with numerical/string values

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:35 +01:00
bf3eda91db addons: move some warns to errors and make sure all errors set the exit
code correctly

Ticket: CM-7168
Reviewed By: julien
Testing Done: Tested ifupdown2 negative testcases and ran ifupdown2 smoke

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-15 13:54:53 -07:00
a7322fd960 ifupdown2: Allow lacp parameters to be set on 802.3ad bonds
Ticket: CM-10437
Reviewed By: CCR-4480
Testing Done: Created a bond and made sure it's lacp_rate could be set fast or
slow wioth or without specifying the mode.

The current code assumes that for a bond to be in 802.3ad mode the "bond-mode"
parameter has to be specified in the list of bond attributes being set. Only
then will ifupdown2 allow the lacp_rate and lacp_bypass attributes to be set.
But since we have changed the default mode to be 802.3ad, the mode attribute no
longer needs to be specified for a bond to be in 802.3ad mode.

So, instead of doing a check for the configuration attributes to determine the
mode, the linkinfo cache is checked. And the cache is refreshed, just in case
the mode attribute has been specified and just previously been set. The order in
which the attributes are set is fixed for bonds, and the mode is always set
prior to the lacp_rate and lacp_bypass attributes.

Also, while testing this I noticed another assumption about the default value of
an attribute: min_links. A warning is displayed when min_links is not specified
or set to 0, and the mode is set to 802.3ad. Well, now that the default for
min_links is 1 it doesn't have to be specified, even if the mode is set to
802.3ad. So ifupdown2 checks the current state of min_links if it is not
specified as one of the attibutes. If it is 0, either by being specified as an
attribute or not being specified but having that value, and the mode is set to
802.3ad, a warning is displayed.

And there was this other little problem where if a bond already existed in the
linkcache it wouldn't be refreshed, even if the refresh=True parameter was
specified in the _bond_linkinfo_fill function.
2016-04-15 11:50:37 -07:00
fc5e1735c0 ifupdown: add new ifupdownflags class to carry ifupdown flags
Ticket: cleanup
Reviewed By:
Testing Done: Tested ifupdown sanity

This gets rid of some ugly previous flag handling which was
passed through modules. This creates a global instance of
flags that all addon modules and helper modules can use.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-14 22:30:53 -07:00
4ce08bc737 When bringing up a bond with a clag id rtnetlink_api is raising an exception
Ticket: CM-9615
Reviewed By: CCR-4272
Testing Done:

The protodown calls to rtnetlink_api now have a try/except.
2016-03-10 02:04:48 +01:00
1553a88121 addons: bond: replace bond-ad-sys-priority and bond-ad-sys-mac-addr with equivalent upstream attributes
Ticket: CM-9677
Reviewed By: nikhil
Testing Done: Tested with bond config file in CM-9677

This patch replaces the following attributes:
bond-ad-sys-priority with bond-ad-actor-sys-prio
bond-ad-sys-mac-addr with bond-ad-actor-system

The new attributes correspond to the new sysfs files below:
/sys/class/net/sidelink/bonding/ad_actor_sys_prio
/sys/class/net/sidelink/bonding/ad_actor_system

Old values will be accepted with a deprecated warning:
warning: attribute bond-ad-sys-priority is deprecated. Use bond-ad-actor-sys-prio instead
warning: attribute bond-ad-sys-mac-addr is deprecated. Use bond-ad-actor-system instead
2016-03-03 16:44:33 -08:00
7b2469dbf3 Removed lacp bypass priority mode
Ticket: CM-9494
Reviewed By: CCR-4184
Testing Done:

Also removed legacy 'fallback' options.
Now lacp bypass is enabled and disabled on a bond with:

    bond-lacp-bypass-allow [0|1]
2016-02-26 07:32:01 -08:00
1c89fd85ff Remove clag_enable dependancy from ifupdown2.
Ticket: CM-9078
Reviewed By: CCR-4110
Testing Done: clag bond add/del and clag slave add/del

This change basically does the following -
1. Proto-down swpX pre-clag-bond-enslave
2. Proto-up swpX post-clag-bond-release

Setting/clearing of clag-id will result in similar proto-state changes
and those are handled by clagd.

Note:
I really wanted to keep these changes out of ifupdown2 but the
order of setting is critical i.e. protodown has to happen enslave to
prevent additional flaps/STP TCNs. Theoretically #2 can be done by clagd
but there is no easy way to do #1.
2016-02-17 12:54:48 -08:00
bb22d4d339 Modified lacp-bypass-all-active support to use the new sysfs
node /sys/class/net/bondx/bonding/lacp_bypass.

Ticket: CM-9266
Reviewed-by: trivial
Testing-done:
2016-02-12 10:19:38 -08:00
a63b57d5a5 Disable old LACP bypass options
Ticket: CM-9266
Reviewed-by: trivial
Testing-done:

For now disable old LACP bypass options so that ifreload does
not give errors, as the corresponding sysfs nodes do not exist in
the latest 4.1.y kernel.
2016-02-10 20:58:23 -08:00
e7cd7b3bf1 Cleanup clag enable references.
Ticket: CM-9078
Reviewed By: Trivial
Testing Done: bond ifdown/ifup on s6000

This needs to be replaced with protodown of clag bond slaves
pre-enslave (TBD; coming soon).
2016-02-05 16:01:59 -08:00
0c8332bc5e ifupdown2: fix a few regex parsing error messages
Ticket:
Reviewed By: CCR-3804
Testing Done: Tested regex parsing failures

This is mostly a cosmetic fix. we were failing with weird/unclear errors
on unable to parse regex expressions correctly.
This patch mainly adds the interface name to the message and plus adds
an info message showing the actual regex being used in searches.

example config:
{noformat}
auto br-roopa
iface br-roopa
  bridge-vlan-aware yes
  bridge-ports regex '(\\Aswp3\\Z|\\Aswp4\\Z)'
  bridge-pvid 20
{noformat}

before the patch:
warning: br-roopa: error getting dependent interfaces (unbalanced
parenthesis)

after the patch (not pretty but easier to debug)

info: br-roopa: evaluating port expr '['regex', "'(", 'Aswp3', 'Z|',
'Aswp4', "Z)'"]'
warning: br-roopa: error getting dependent interfaces (br-roopa: error
searching regex ''(' in swp38 (unbalanced parenthesis))

(cherry picked from commit bcca6f753a25494666d53f1f2f3c855ffa41d7f0)
2015-12-09 13:53:07 -05:00
6cb589dfdf Allow customer set bond defaults for CL with ifupdown2
Ticket: CM-6723
Reviewed By: roopa
Testing Done: unit tested and testifupdown2 test suite

This patch installs bond interface defaults in

     /etc/network/ifupdown2/policy.d/bond_defaults.json

and allows users to modify this file.   Users can then leave out these
bond attributes in their configs to save typing and space.

It also changes the ifenslave and ifenslaveutil module to bond and
bondutil, respectively to be consistent with other modules
(and also because customers think of "bond" interfaces not
"ifenslave" interfaces.)

For example, the default file installed looks like the following:

{
    "README": "This file is user generated and modifiable.",
    "bond": {
        "defaults": {
                "bond-mode": "802.3ad",
                "bond-miimon": "100",
                "bond-use-carrier": "1",
                "bond-lacp-rate": "0",
                "bond-min-links": "1",
                "bond-xmic-hash-policy": "layer3+4"
         }
    }
}
Please enter the commit message for your changes. Lines starting
2015-07-22 18:38:07 -04:00