Commit Graph

1620 Commits

Author SHA1 Message Date
Julien Fortin
117d7654af addons: vlan: ifquery will try to get the vlan-id from the ifacename if vlan-id attr is missing
Ticket: CM-11485
Reviewed By: Roopa
Testing Done: config from the github issue

First reported here https://github.com/CumulusNetworks/ifupdown2/issues/10
ifquery just like ifupdown should try to get the vlan-id from the iface name
if vlan-id attr is not specified.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-21 15:23:15 +01:00
Julien Fortin
c9b929f97e addons: vrf: moving replacing rtnetlink_api call with the new netlink api
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:39:12 +01:00
Julien Fortin
3861c72cf6 addons: bond: reverting validvals "<mac>" change
Ticket: CM-11331
Reviewed By:
Testing Done:
2016-06-16 03:37:36 +01:00
Julien Fortin
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
Daniel Walton
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
Julien Fortin
198ded6a35 Import python-nlmanager mirror copy
Ticket: CM-7360
Reviewed By: CCR-4721
Testing Done: smoke / testifreload / Tested on amd64 platform (by Sam)

For now, we use a mirror copy of nlmanager sources to make sure we don't
depend on it as an external package

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:35 +01:00
Julien Fortin
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
Nikhil
be27627277 addons: vrf: Fix to kill current ssh on 'sudo ifreload -a' to enable mgmt VRF
Ticket: CM-11080
Reviewed By: roopa, dsa, dave olson, daniel, julien
Testing Done: yes, with mgmt VRF configured

This patch parses '/usr/bin/pstree -Aps <pid>' output to find
the pid of current ssh session, and send 'sudo ifreload -a'
to background before killing itself.

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-06-16 03:37:35 +01:00
Julien Fortin
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
Julien Fortin
d02acd0226 sbin: start-networking: support hotplug class from init script
Ticket: CM-9296
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:35 +01:00
Roopa Prabhu
40804f1a07 addons: vrf: warn and continue on vrf-helper errors
Ticket: CM-11003
Reviewed By: dsa
Testing Done: tested ifup and ifdown of vrf dev

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-06-16 03:37:34 +01:00
Nikhil
e633ffbba2 addons: bridge: Fix for ifquery -c bridge pvid error to a valid config
Ticket: CM-8623
Reviewed By: Roopa Prabhu, Julien Fortin
Testing Done: yes, using the below mentioned config.

This patch fixes 'ifquery -c' error, bridge pvid error, which is an
unrelated error for the following valid config.

This patch also removes 'bridge-pvid', if configured, from 'bridge-vids' set.
In the below example, 510 is removed from the set bridge-vids 510-550.
The new bridge-vids set is 511-550.

auto swp1
iface swp1 inet6 dhcp
        address 14.0.0.5/30
        down ip addr flush dev swp1

auto Bridge1
iface Bridge1
        address 0.0.0.0/0
        down ip addr flush dev Bridge1
        bridge-vlan-aware yes
        bridge-ports swp1
        bridge-pvid 510
        bridge-vids 510-550
        bridge-stp on
        mstpctl-portnetwork swp1=yes

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-06-16 03:37:34 +01:00
Julien Fortin
e909bd85c3 examples: generate interfaces: will fetch pci interfaces when porttab is missing
Ticket: CM-10751
Reviewed By: Roopa, Nikhil
Testing Done: exec script without porttab

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:34 +01:00
Julien Fortin
55d9fae146 ifupdownmain: fixing too many argument for format string
Ticket: None
Reviewed By:
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:34 +01:00
Julien Fortin
c326d03cc7 ifupdownbase: missing traceback import
Ticket: None
Reviewed By:
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:34 +01:00
Sam Tannous
42ae783899 ifreload: address module always reconfigures (dels/adds) addresses when user
Ticket: CM-8561
Reviewed By: kanna, julien
Testing Done: Tested on amd64 switch

ifreload always deletes and adds back a host IP address
if that address is specified without a "/" and without a "netmask" config.

The problem is fixed so that _inet_address_convert_to_cidr() handles a missing
"/" and a missing "netmask" config. The host addresses is no longer added to a
list of addresses we will del/add. The patch was simply to add a case for the
missing "/" and a missing "netmask".
2016-06-16 03:37:34 +01:00
Nikhil
e367482f2e debian: avoid zipping of generate_interfaces.py file
Ticket: CM-10751
Reviewed By: Roopa Prabhu, Julien Fortin
Testing Done: Yes, by extracting and installing .deb onto dell-s3000-02

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-06-16 03:37:34 +01:00
Julien Fortin
fc68074fa5 ifupdown: iface: now trimming json values right after parsing
Ticket: None
Reviewed By: Roopa
Testing Done: smoke/testifupdown2.py:TestMakoJson

ifupdown2.TestMakoJson test was failing because the json values werent trimmed
Because of a trailing whitespace, a list of iface had an empty value, ifupdown2
was throwing an exception.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:34 +01: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
Julien Fortin
afe5125163 Fixing errors and typos
Ticket: None
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:33 +01:00
Julien Fortin
6263596cd8 fixing typos in bonduitls.py and iproute2.py
Ticket: None
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
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
Roopa Prabhu
d6dd6fe653 Merge remote-tracking branch 'cumulus/dev' 2016-06-06 13:18:39 -07:00
John Berezovik
9ef35dcd9f Merge pull request #3 in CRMC/ifupdown2 from dev to release/cl-stable
* commit '1cf891d101dab5569129c7f9d61d60bc53b67ffd':
  Staging cl3u3 version for merge to stable and release
  ifupdownaddons: iproute2: warn when using keywords and better parsing vlanid in ip link show output
  addons: vrf: error on no master only when ALL interfaces are being brought up
2016-06-05 09:05:13 -07:00
John Berezovik
1cf891d101 Staging cl3u3 version for merge to stable and release 2016-06-05 09:03:45 -07:00
Julien Fortin
79772050dd ifupdownaddons: iproute2: warn when using keywords and better parsing vlanid in ip link show output
Ticket: CM-11214
Reviewed By: Roopa
Testing Done: Tested with customer configuration

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-02 15:31:43 +01:00
Roopa Prabhu
e0a7f7a413 addons: vrf: error on no master only when ALL interfaces are being
brought up

Ticket: CM-11016
Reviewed By: julien, nikhil
Testing Done: tested with config in the CM bug

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-31 16:25:07 -07:00
Roopa Prabhu
4280a55299 Merge branch 'dev' into release/cl-stable 2016-05-20 15:30:11 -07:00
Nikhil
fffec8bbab addons: vrf: Correcting 'vrf-table' usage example
Ticket: CM-11041
Reviewed By: Roopa Prabhu
Testing Done: yes, all ifupdown2 commands for a vrf deive

<DETAILED DESCRIPTION (REPLACE)>

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-05-18 16:33:08 -07:00
Roopa Prabhu
cd8a666eab Merge branch 'dev' into release/cl-stable 2016-05-16 21:24:22 -07:00
Roopa Prabhu
4e07a2d530 ifreload: --currently-up fixes
Ticket:
Review: julien, nikhil
Testing: tested reloading currently up interfaces

simplify code:
interfaces-to-reload = saved-interfaces - interfaces-not-present-in-interfaces-file

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-16 17:00:39 -07:00
Roopa Prabhu
15b6bfed99 Merge branch 'dev' into release/cl-stable 2016-05-16 14:18:17 -07:00
Roopa Prabhu
666c614171 ifupdownmain: return proper error code on syntax check errors
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 14:17:56 -07:00
Roopa Prabhu
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
Roopa Prabhu
84414544de ifupdownaddons: iproute2: fix set_mtu api to return if --no-act (DRYRUN) is set
Ticket: CM-10965
Reviewed By: julien
Testing Done: Tested set mtu with dry run

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-15 13:52:51 -07:00
Roopa Prabhu
5384c99e20 Merge branch 'dev' into release/cl-stable 2016-05-15 11:00:03 -07:00
Roopa Prabhu
d2b357167d addons: vrf: vrf_slave: up vrf dev only when all interfaces are being
brought up

Ticket: CM-10954, CM-10953
Reviewed By: julien
Testing Done: ran ifupdown2 smoke and vrf ifup/ifdown testing

- vrf master if not around is brought up when the first slave is brought up
by design (because we want the slaves to be
enslaved to a vrf master before addresses are configured).
and master is not brought up by first because interfaces
are brought up down to top in the dependency tree.

- This patch makes sure a slave brings up a vrf master only
when all interfaces are specified. When an individual interface
is brought up, skip master bring up and throw an error.

- Since the addon modules also need to use the ALL and WITH_DEPENDS
  flags, this patch moves them to the existing global ifupdownflags
  class

- vrf module uses the ifupdownflags.ALL flag to not bring up the master
when only the slave is being brought up

example:
ifup <vrf>     			# brings up the vrf device
ifup <vrf> --with-depends 	# brings up the vrf dev and
				# its slaves
ifup <vrf_slave>		# if vrf master is not around,
				# an error is thrown
ifup <vrf_slave> --with-depends # will still not bring up the vrf master

ifdown <vrf>			# deletes vrf dev and flushes the
				# addresses on vrf slaves
ifup <vrf>			# brings up vrf dev and does not
				# up the adresses on the slaves
ifup <vrf> --with-depends	# will bring up vrf and reapply config
				# on slaves (including addresses)

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-13 23:42:28 -07:00
Roopa Prabhu
cbdde74e16 ifupdown2: ifreload: enable dry run (--no-act) and other dry run fixes
Ticket: CM-10965
Reviewed By: julien
Testing Done: Tested dry-run option

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-13 23:42:23 -07:00
Nikhil
95d9805c82 addons: bridge: Deprecating attribute bridge-gcint
Ticket: CM-8718
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown2 .deb file onto dell-s3000-02

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-05-10 17:53:41 -07:00
Roopa Prabhu
8c9efa85dc Merge branch 'dev' into release/cl-stable 2016-05-10 09:50:55 -07:00
Julien Fortin
b66881465d addons: address virtual: adding 0s to (if necessary) pad address-virtual
Ticket: CM-10853
Reviewed By: Roopa
Testing Done: Tested with the provided interface file and different
address-virtual value.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-05-10 17:27:37 +02:00
Roopa Prabhu
77021aa1ce addons: address: force reapply addresses during dhcp to static trasition
Ticket: CM-10857
Reviewed By: julien, nikhil
Testing Done: Tested moving from a dhcp to static addr method for eth0

before the patch:
- when moving from dhcp to static address method, after releasing the dhcp
address, it takes a few seconds for the dhcp address to go away. When we
query addresses to configure, there is a chance that we may end up
getting the dhcp address for a few seconds. Which is ok until when the
static address to be configured is same as the dhcp address.
In which case we end up not configuring the static address because we
think it is already configured (per the running list).

After this patch:
- when moving from dhcp to static address method, we always re-apply the
address config avoiding the chance of not configuring an address due to a
dhcp address sticking around.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-09 18:48:52 -07:00
Roopa Prabhu
7c1135eae3 addons: address: fix call to dhclient is_running
Ticket: CM-10857
Reviewed By: julien, nikhil
Testing Done: Tested moving from a static to dhcp addr method for eth0

the check to see if dhclient is running on an interface was failing.
which caused the following problem:
- interface when moved from dhcp to static addr_method was
not killing the existing dhcp process
- and a subsequent move from static to dhcp addr_method quit starting
dhcp because a dhclient process was already running
- but the original dhcp ip was already removed because of the
static address config which leaves eth0 in a weird state

After this patch:
- move from dhcp to static addr_method will release any
existing dhcp leases on an interface
- a subsequent move from static to dhcp will request a new
dhcp lease

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-09 13:50:56 -07:00
Roopa Prabhu
48689b55e8 addons: mstpctl: deprecate mstpctl-ports in favor of bridge-ports
Ticket:
Reviewed By:
Testing Done: ran l2 smoke

usage of mstpctl-ports will now give you a warning:
warning: attribute mstpctl-ports is deprecated. use bridge-ports instead.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-09 07:41:20 -07:00
Roopa Prabhu
c4ecd1d877 Merge branch 'dev' into release/cl-stable 2016-05-07 20:25:59 -07:00
Roopa Prabhu
8f361f7d4c debian: replace all cumulus email ids to dev-support@cumulusnetworks.com
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-07 20:22:47 -07:00
Roopa Prabhu
a2ffd24f27 Merge branch 'dev' into release/cl-stable 2016-05-07 20:03:23 -07:00
Roopa Prabhu
d5c0f70366 addons: mstpctl: call disable_ipv6 only if mstpctl_ports is specified
Ticket:
Reviewed By: trivial
Testing Done: tested sanity and bridge bringup and reload

bridge module already disables ipv6 on ports when bridge-ports is
specified. Making this change because i saw redundant calls to
disable_ipv6 on bridge ports by modules bridge and mstpctl
when bridge-ports is specified. It is slowing down ifreload

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-07 19:32:23 -07:00
Roopa Prabhu
f57b980458 ifupdownmain: cosmetic fixes to deprecated warning message
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-07 19:31:16 -07:00
Roopa Prabhu
7ef04d1b2e ifupdownmain: fix error check when an iface is removed but still exists as a dependency
Ticket: CM-8095
Reviewed By: julien, nikhil
Testing Done: Tested ifupdown2 sanity and unclean removal of interfaces from the
interfaces file

example: for the below interfaces file,
{noformat}
auto bond2
iface bond2 inet static
    address 100.0.0.2/16
    bond-slaves swp3 swp4

auto bridge
iface bridge
        bridge-vlan-aware yes
        bridge-ports swp1 swp2 bond2
        bridge-vids 12 505
        bridge-stp on

auto swp1
iface swp1
       mtu 9000

{noformat}

when iface sections for bond2 and swp1 are removed from the interfaces file
but left as dependents of bridge, on an ifreload:

prior to this patch:
===================
- ifreload would throw a warning for both bond2 and swp1
warning: bond2: misconfig ? removed but still exists as a dependency of
['bridge']
warning: swp1: misconfig ? removed but still exists as a dependency of
['bridge']

after the patch:
================
- ifreload  will now correctly throw a warning only for bond2
warning: bond2: misconfig ? removed but still exists as a dependency of
['bridge']

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-07 19:11:17 -07:00