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

34 Commits

Author SHA1 Message Date
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
caa23e5fed ifupdown2 needs to set fdelay before maxage in bridge mstpctl.py addon module
Ticket: CM-8725
Reviewed By: roopa
Testing Done: tested with user's config on amd64 platform

When setting mstpctl params from user given fdelay and maxage,
ifreload and ifup is setting maxage before fdelay.

Since there is a check for (Bridge Foward Delay - 1 second) >= Bridge Max Age
fdelay must be set before maxage because the fdelay is a default value.
2016-02-08 19:43:20 -05:00
b97687bc96 ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard) in mstpctl
Ticket: CM-7756
Reviewed By: roopa
Testing Done: built powerpc and tested ifupdown2 as well as new tests

Once mstpctl-portbpdufilter or mstpctl-bpduguard is enabled for
an interface, removing the configuration in /etc/network/interfaces
does not toggle the mstpctl state back to no.

The root cause of this problem is that "ifreload" does not check default settings for MSTP configuration
for bridge ports and use a default when that setting is removed from the configuration.

This patch adds a check in the existing loop on attribute values.
If there is no configured value, we check to see if a default exists.
self._modinfo['attrs'][attrname]['default'] exists.
If it exists and it is different then the currently running value
we reset the attribute to its default. This is what a customer would expect if
they removed a configured value.

(also added test in cl-tests to check this functionality)

(cherry picked from commit 63d0f7082d44fedabe002aebbb658751dc655a46)
2015-12-09 14:02:29 -05:00
5f8c03e7a1 ifupdown2: mstpctl: check mstpd running just once during init of mstpctl modules
Ticket: CM-8035
Reviewed By: wkok
Testing Done: Tested mstp commands in interfaces file

(cherry picked from commit 2c3471f2082c8adbdcc395cbd0066680f280b9e5)
2015-12-09 14:02:07 -05: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
2722bb1972 Revert "ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard) in mstpctl"
This reverts commit bbd11771f5571c67c8f110c2b464817ce31155b9.

This introduced an error where if the config has old bridge driver
and configures port attributes on the bridge, the attributes are reset
to defaults after they are configured by the bridge settings.

(cherry picked from commit 651d1980de02fb108975900ed007087d9a79934c)
2015-12-09 13:52:53 -05:00
3482d41e4d Revert "Patch for errors warning "global name 'get_mod_subattr' is not defined"
This reverts commit 5649f0a28422794081e6a6ba1dd889364760ccf0.

(cherry picked from commit bfbb33815ce0e5d0584ce0a10ed38f04234eb43d)
2015-12-09 13:52:00 -05:00
54713cee98 Patch for errors warning "global name 'get_mod_subattr' is not defined
Ticket: CM-8248
Reviewed By: Trivial
Testing Done: None

Fix for

On bootup and during service network restart these warning messages are thrown out.
root@cel-ken-01:/var/log# service networking restart
[....] Reconfiguring network interfaces...warning: global name 'get_mod_subattr' is not defined
warning: global name 'get_mod_subattr' is not defined
warning: global name 'get_mod_subattr' is not defined

warning messages in ifupdown2
2015-11-16 22:22:44 -05:00
267c4cba58 ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard) in mstpctl
Ticket: CM-7756
Reviewed By: roopa
Testing Done: Tested ssim and powerpc images

Once mstpctl-portbpdufilter or mstpctl-bpduguard is enabled for
an interface, removing the configuration in /etc/network/interfaces
does not toggle the mstpctl state back to no.

The root cause of this problem is that "ifreload" does not check default settings for MSTP configuration
for bridge ports and use a default when that setting is removed from the configuration.

This patch adds a check in the existing loop on attribute values.
If there is no configured value, we check to see if a default exists.
self._modinfo['attrs'][attrname]['default'] exists.
If it exists and it is different then the currently running value
we reset the attribute to its default. This is what a customer would expect if
they removed a configured value.
2015-11-16 14:25:56 -05:00
641cbd1e7d rework mstpctl attribute ordering problem with bridge stp processing
Ticket: CM-6626
Reviewed By: CCR-3768
Testing Done: Tested with testcase specified in bug

There was an earlier implementation for this for 2.5.4 (CCR-3599 a quick
fix for 2.5.4).  This patch re-implements the fix.

This patch essentially handles stp set before and after the port is
processed. It replaces the below commit with the patch in this review

{noformat}
commit 3af351f0a005236e747913bb499c6165e3ec43a4
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date:   Tue Sep 29 10:12:07 2015 -0700

    Fix mstp settings ordering issues when bridge stp is toggled on and
off
    (when mstp settings are specified under the port)

    Ticket: CM-6626
    Reviewed By: CCR-3599
    Testing Done: Tested the problem case mentioned in the bug (Plan to
    re-work the fix a bit for 2.5.5)
{noformat}

Example:
{noformat}

auto host1
iface host1
    mtu 9000
    bond-slaves glob swp[25-26]
    bond-mode 802.3ad
    bond-miimon 100
    bond-use-carrier 1
    bond-lacp-rate 1
    bond-min-links 1
    bond-xmit-hash-policy layer3+4
    clag-id 1
    mstpctl-portadminedge yes
    mstpctl-bpduguard yes

auto bridge
iface bridge
    mtu 9000
    bridge-vlan-aware yes
    bridge-ports peerlink host1
    bridge-stp on
    bridge-vids 1000-3000
    bridge-pvid 1

info log stmts:
--------------------
info: host1: ignoring mstpctl-portadminedge config (stp on bridge bridge
is not on yet)
info: host1: ignoring mstpctl-bpduguard config (stp on bridge bridge is
not on yet)
<snip>
info: bridge: processing bridge config for port host1
info: bridge: processing mstp config for port host1
info: executing /sbin/mstpctl showportdetail bridge host1
admin-edge-port
info: executing /sbin/mstpctl setportadminedge bridge host1 yes
info: executing /sbin/mstpctl showportdetail bridge host1
bpdu-guard-port
info: executing /sbin/mstpctl setbpduguard bridge host1 yes

{noformat}
2015-11-13 10:01:28 -08:00
74a4a724c3 Revert "Fix mstp settings ordering issues when bridge stp is toggled on and off"
This reverts commit 3af351f0a005236e747913bb499c6165e3ec43a4.
2015-11-13 10:01:28 -08:00
97a907c5fe Fix mstp settings ordering issues when bridge stp is toggled on and off
(when mstp settings are specified under the port)

Ticket: CM-6626
Reviewed By: CCR-3599
Testing Done: Tested the problem case mentioned in the bug (Plan to
re-work the fix a bit for 2.5.5)

problem:
    mstp parameters can be specified under the port or under the bridge
    When they are specified under the bridge, there should be no problem
(When you process the bridge, all things on the bridge port are set in
order)
    When they are specified under the port:
    we check if the bridge is up, if yes, and stp is already configured,
we process mstpctl settings
    This check today only checks running stp_state
    We should also check the user configured stp state for the bridge
    Note that the problem exists only if the bridge and ports are
already up and user executes ifup again and when we need to re-evaluate
the bridge port settings

solution:
    When the bridge port is being checked for mstp settings, not only
check running stp state, but also check user specified stp state and
correct bridge stp state before proceeding with mstp configuration

Few things to note with this patch:
    - If user changed stp state on bridge to 'on', and did `ifup
    <bridge_port>'`,
    though the user has not ifup'ed the bridge yet, the bridge stp state
    will be applied (very few people will run into this and practically this
    should not be a problem atall. But from correctness POV it is
    a voilation. ).

    - To avoid this, the other solution would have been to let the bridge
    port code be as is, but handle this during bringing up the bridge,
    but, this can confuse the user, because when processing the
    bridge_port, you will still throw warnings even if the port stp config
    is later reapplied when the bridge comes up

    - note that the patch only handles the case when stp state is not on and
    somebody turned it on.  For the case where stp state was on and somebody
    turned it off, this patch wont throw warnings for the mstpctl config. But
    it will not cause any issues because once stp is off things will be ok
    everywhere. I want to keep any changes here out of this patch. I will
    document this in the bug...and see if i can handle this in 2.5.5
2015-09-29 10:22:58 -07:00
42a9d19335 Add a check to see if it is indeed a bridge port before applying mstpctl
config

Ticket: CM-6965
Reviewed By: CCR-3472
Testing Done: Tested with interfaces file specified in the bug
2015-09-09 11:43:19 -07:00
be1faadac3 Fix addons man page for a few mstpctl defaults
Ticket: CM-5813
Reviewed By: sashok
Testing Done: build and tested man page
2015-04-27 15:38:07 -07:00
4c773918da ifupdown2 loses interfaces on second down of swp port
Ticket: CM-5693
Reviewed By: roopa
Testing Done: tested bridge and bonds with interfaces with configs

Both bridge and mstpctl modules set priv_flags on interfaces
that have configs (like link-speed) even when used as bridge-ports.
And this collision causes statemanager.ifaceobj_sync() to never get called
because ifaceobj.priv_flags is 1 (we return immediately):
The fix was to create a new iface module_flags array to carry module info.
2015-04-23 20:27:44 -04:00
404cc695a5 Move disable ipv6 error to info in mstpctl module (test scripts are
still using mstpctl-ports)

Ticket: CM-4622
Reviewed By:
Testing Done: Tested bridge sanity
2015-01-03 22:35:45 -08:00
f6a0fa151b Added a few more try-except clauses during bridge config to continue on
failures

Ticket: CM-4382
Reviewed By:
Testing Done: Tested with bridge port addition failure example in the
bug report
2014-12-27 20:39:17 -08:00
a070c90ec3 Multiple fixes and cleanup
Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifupdown2 sanity

- moved 'admin up' delays that we introduced recently to be
configurable via two ifupdown2.conf attributes
    # Let link master (bridges, bonds) own the link state of slaves
    link_master_slave=1

    # Delay admin state change till the end
    delay_admin_state_change=0

- reduced some redundant traversal of dependency trees

- fixed a few bugs in query check
2014-12-17 12:39:38 -08:00
3e6ea735cc continue passing the object to other modules if one of the modules fails
Ticket: CM-4336
Reviewed By:
Testing Done: Tested with the missing port testcase from CM-4336
2014-12-01 14:54:12 -08:00
16d854b461 Fix a few minor ifquery check failures
Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifupdown2 sanity and query check failures.
2014-11-19 17:25:26 -08:00
4c39c7b84a Fix ordering of mstpctl attributes by moving to a OrderedDict
Ticket: CM-3737
Reviewed By:
Testing Done: Tested with config given in the bug
2014-11-19 14:42:14 -08:00
d8e3554dde minor fixes for ifquery and stp handling
Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifupdown2 sanity
2014-11-15 15:42:52 -08:00
e759a20abf Fix defaults for mstpctl-portp2p
Ticket: CM-4141
Reviewed By:
Testing Done: Tested ifquery running for mstpctl-portp2p
2014-11-08 06:14:56 -08:00
7adb4b77ab Fix mstpctl attribute names in ifquery running output
Ticket: CM-4141
Reviewed By:
Testing Done: Tested with test case in CM-4141 + sanity testing
2014-11-06 16:10:21 -08:00
19f90a917a Fix mstpctl port attribute ifquery check
Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifquery check mstpctl attributes on bridge port
2014-11-04 11:31:30 -08:00
9e012f9e8a some more ifquery support (for vxlan devices etc)
Ticket: CM-3784
Reviewed By:
Testing Done: Tested ifquery check/running and sanity
2014-10-31 11:28:07 -07:00
07ff144260 Remove stale debug
Ticket: CM-3346
Reviewed By:
Testing Done:
2014-10-29 12:57:57 -07:00
98b5ee73fc misc fixes
Ticket: CM-3346
Reviewed By:
Testing Done: ifupdown2 sanity with new bridge driver
2014-10-29 12:51:21 -07:00
e160136944 Bug fixes and some query support
Ticket: CM-3346
Reviewed By:
Testing Done: sanity testing and syntax testing for new bridge driver
2014-10-28 16:10:00 -07:00
fe91c3484f remove code that makes a bridge port inherit stp/mstp/igmp attributes from bridge
Ticket: CM-4035
Reviewed By:
Testing Done: Tested ifupdown2 sanity
2014-10-24 14:21:54 -07:00
84ca006f82 First phase checkin for new format for vlan aware bridge
Ticket: CM-3346
Reviewed By:
Testing Done: Sanity test + test new bridge format

There are a bunch of open issues with `vlan` interface handling.
Below is the format.

auto swp1
iface swp1
    bridge-access 300
    mstpctl-pathcost 0
    mstpctl-adminedge yes
    mstpctl-autoedge yes
    mstpctl-p2p yes
    mstpctl-bpduguard yes
    mstpctl-treeprio 64
    mstpctl-network yes
    mstpctl-bpdufilter yes

auto swp2
iface swp2
    bridge-vids 301
    bridge-pvid 302
    bridge-pathcost 10
    bridge-priority 10
    bridge-multicast-router 0
    bridge-multicast-fast-leave 1

auto br0
iface br0
    bridge-vlan-aware yes
    bridge-stp on
    bridge-ports swp1 swp2
    bridge-vids 2001

auto br0.2001
iface br0.2001
    address 10.0.14.2
    hwaddress 00:03:00:00:00:12
    address-virtual 00:00:5e:00:01:01 11.0.4.1/24

auto br0.2001
vlan br0.2001
    bridge-igmp-querier-src 172.16.101.1
2014-10-24 10:11:07 -07:00
d101ece27b Remove stale mstp adminadge attributes
Ticket: CM-3346
Reviewed By: sashok
Testing Done: sanity test
2014-10-09 19:26:10 -07:00
39804250c7 A few more fixes to the vlan aware bridge case
Ticket: CM-3346
Reviewed By:
Testing Done: Tested with new and old bridge formats
2014-10-09 19:10:20 -07:00
15ef32ea14 Move ifupdown2addons into ifupdown2 pacakge
Ticket: CM-3864
Reviewed By:
Testing Done: Tested build and install

open item:
- cleanup stale ifupdown2-addons package files
2014-10-09 16:02:46 -07:00