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

12 Commits

Author SHA1 Message Date
Julien Fortin
bfceb63543 ifupdownaddons: mstpctl: treeportprio value is cached. It prevents ifupdown2 from executing mstpctl settreeportprio commands when the running value is the same as the one previously cached
Ticket: CM-11773
Reviewed By: Roopa, Nikhil G
Testing Done: smoke + hand testings :

$ cat /etc/network/interfaces
auto br2
iface br2
      bridge-vlan-aware yes
      bridge-vids 100
      bridge-pvid  1
      bridge-ports swp1 swp4 swp5
      bridge-stp on
$ ifreload -a -v
[...]
info: netlink: set link swp1 up
info: netlink: set link swp4 up
info: netlink: set link swp5 up
info: br2: applying mstp configuration specific to ports
info: br2: processing mstp config for port swp1
info: executing /sbin/mstpctl showportdetail br2 json
info: executing /sbin/mstpctl settreeportprio br2 swp1 0 128
info: br2: processing mstp config for port swp4
info: executing /sbin/mstpctl settreeportprio br2 swp4 0 128
info: br2: processing mstp config for port swp5
info: executing /sbin/mstpctl settreeportprio br2 swp5 0 128
info: netlink: set link br2 up
[...]
$

/sbin/mstpctl settreeportprio br2 swpX 0 128 is executed for every port.
ifupdown2 tries to set this attr to 128 (the default value). This is a
problem at scale. We shouldn't try to set this value if the running value
is already 128.

With the attached patch:

$ ifreload -a
[...]
info: netlink: set link swp1 up
info: netlink: set link swp4 up
info: netlink: set link swp5 up
info: executing /sbin/mstpctl showportdetail br2 json
info: br2: applying mstp configuration specific to ports
info: br2: processing mstp config for port swp1
info: br2: processing mstp config for port swp4
info: br2: processing mstp config for port swp5
info: netlink: set link br2 up
[...]
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-01 09:49:08 +02:00
Nikhil
22945dd634 addons: mstpctl: complete ifquery -r support
Ticket: CM-7841
Reviewed By: roopa, julien
Testing Done: tested all the bridge attributes

added 'ifquery -r' support for 'mstpctl-portpathcost', 'mstpctl-treeportcost', 'mstpctl-portautoedge', 'mstpctl-portbpdufilter', 'mstpctl-portnetwork'

Below is the sample configuration and output

root@dell-s3000-02:~# ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto br0
iface br0
  bridge-vlan-aware yes
  bridge-ports swp42 swp43
  mstpctl-fdelay 14
  mstpctl-txholdcount 5
  mstpctl-forcevers rstp
  mstpctl-maxhops 14
  mstpctl-treeprio 32768
  mstpctl-maxage 19
  mstpctl-hello 3
  mstpctl-ageing 200

auto swp42
iface swp42
  mstpctl-portadminedge yes
  mstpctl-portbpdufilter yes
  mstpctl-portnetwork yes
  mstpctl-portautoedge yes
  mstpctl-treeportprio 127
  mstpctl-portpathcost 10
  mstpctl-portrestrtcn yes
  mstpctl-portrestrrole yes
  mstpctl-bpduguard yes
  mstpctl-treeportcost 100
  mstpctl-portp2p yes

auto swp43
iface swp43
  mstpctl-portadminedge yes
  mstpctl-portbpdufilter yes
  mstpctl-portnetwork yes
  mstpctl-portautoedge yes
  mstpctl-treeportprio 127
  mstpctl-portpathcost 10
  mstpctl-portrestrtcn yes
  mstpctl-portrestrrole yes
  mstpctl-bpduguard yes
  mstpctl-treeportcost 100
  mstpctl-portp2p yes

root@dell-s3000-02:~# ifquery -ra
auto swp42
iface swp42
  mstpctl-portautoedge yes
  mstpctl-portbpdufilter yes
  mstpctl-portpathcost 10
  mstpctl-treeportcost 100
  mstpctl-portnetwork yes
  mstpctl-portadminedge yes
  mstpctl-portp2p yes
  mstpctl-portrestrrole yes
  mstpctl-portrestrtcn yes
  mstpctl-bpduguard yes
  link-speed 0
  link-duplex half
  link-autoneg off

auto swp43
iface swp43
  mstpctl-portautoedge yes
  mstpctl-portbpdufilter yes
  mstpctl-portpathcost 10
  mstpctl-treeportcost 100
  mstpctl-portnetwork yes
  mstpctl-portadminedge yes
  mstpctl-portp2p yes
  mstpctl-portrestrrole yes
  mstpctl-portrestrtcn yes
  mstpctl-bpduguard yes
  link-speed 0
  link-duplex half
  link-autoneg off

auto br0
iface br0
  vxlan-ageing 300
  bridge-vlan-aware yes
  bridge-mcqifaddr 0
  bridge-mcquerier 0
  bridge-mcsnoop 1
  bridge-mcrouter 1
  bridge-stp yes
  bridge-ports swp43 swp42
  mstpctl-portadminedge  swp42=yes swp43=yes
  mstpctl-fdelay 14
  mstpctl-portnetwork  swp42=yes swp43=yes
  mstpctl-txholdcount 5
  mstpctl-maxage 19
  mstpctl-portbpdufilter  swp42=yes swp43=yes
  mstpctl-maxhops 14
  mstpctl-portrestrtcn  swp42=yes swp43=yes
  mstpctl-portpathcost  swp42=10 swp43=10
  mstpctl-portautoedge  swp42=yes swp43=yes
  mstpctl-hello 3
  mstpctl-portrestrrole  swp42=yes swp43=yes
  mstpctl-bpduguard  swp42=yes swp43=yes
  mstpctl-ageing 200
  mstpctl-treeportcost  swp42=100 swp43=100
  mstpctl-portp2p  swp42=yes swp43=yes

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-07-11 09:52:26 -07:00
Julien Fortin
a193d8d1c0 performance fix: better handling fd to allow subprocess.close_fds=False and code re-organisation
Ticket: None
Reviewed By: CCR-4692
Testing Done: smoke + scale tests

If called with close_fds=True the subprocess module will try to close every fd
from 3 to MAXFD before executing the specified command. This is done in Python
not even with a C-implementation which truly affecting performances.

This patch aims to better handle the file descriptor used by ifupdown2. Either
by closing them after use or by setting the close-on-exec flag for the file
descriptor, which causes the file descriptor to be automatically
(and atomically) closed when any of the exec-family functions succeed.

With the actual patch all tests are passing, I can't think of any future issue
but if any a possible future modification might be to use the parameter
'preexec_fn', which allows us to set function which will be executed in the
child process before executing the command line. We can always manually close
any remaining open file descriptors with something like:

>>> os.listdir('/proc/self/fd/')
['0', '1', '2', ‘3’, etc..]
>>> for fd in os.listdir('/proc/self/fd/')
>>>    if int(fd) > 2:
>>>    	  os.close(fd)

This patch is also totally re-organising the use of subprocesses. By removing
all subprocess code redundancy.
2016-06-16 03:37:33 +01:00
Nikhil
2e4dc7247c addons: mstpctl: bpdu filter and bpdu guard enabled by default for vxlan device
Ticket: CM-7678
Reviewed By: Roopa Prabhu
Testing Done: yes, with vlan aware/unaware bridge on dell-s3000-02

This patch enables bpdu filter and bpdu guard enabled for vxland device under
the bridge if these two attributes are unconfigured

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-06-16 03:37:31 +01:00
Julien Fortin
b47ce90d95 mstp: performances: now globaly caching "mstpctl showportdetail <bridgename> json" calls
Ticket: CM-10273
Reviewed By: Roopa
Testing Done: Smoke + test from the ticket
2016-04-29 21:21:45 +02:00
Julien Fortin
1927d237ee ifupdownaddons: mstpctlutil: changing log level to catch subprocess exception. 2016-04-19 15:18:35 +02:00
Julien Fortin
0605af50a3 ifupdownaddons: mstpctlutil: changing log level to catch subprocess exception. 2016-04-19 15:05:34 +02:00
Julien Fortin
83be0f8af8 ifupdownaddons: mstpctlutil: fixing 'UnboundLocalError: local variable referenced before assignment'. Also, now catching subprocess.CalledProcessError exception and general Exception.
Ticket: None
Reviewed By: Roopa
Testing Done: ifreload -a (vxlan interface file)
2016-04-19 02:36:15 +02:00
Roopa Prabhu
15bb78054f mstpctlutil: fix strip on NoneType warning
saw this during execution of the below command:
ifup --no-act -a

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-02-26 15:43:02 -08:00
Sam Tannous
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
Roopa Prabhu
2ca1b8847a Checkin missing mstpctlutil.py changes for e1e1cf57295dee2ec0df4b1e61c6a7c4e6969402
Ticket: CM-4141
Reviewed By:
Testing Done:
2014-11-09 13:54:33 -08:00
Roopa Prabhu
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