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

604 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Roopa Prabhu
00c12960b4 addons: address: reset mtu to default for physical interfaces which are
not bond slaves

Ticket: CM-9449
Reviewed By: julien
Testing Done: Tested resetting mtu on physical interfaces to default

default mtu is already present in address.json policy file. This patch
continues to take a cautious and conservative approach to
reset mtu of only physical interfaces if different from default mtu
and mtu is not given by the user. bond slaves get their mtu from
the bond when bond has a configured mtu. so this patch only
resets mtu on physical interfaces which are not bond slaves.

{noformat}
$cat /var/lib/ifupdown2/policy.d/address.json
{
    "address": {
	"defaults": { "mtu": "1500" }
    }
}
{noformat}

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-05 15:49:41 -07:00
Roopa Prabhu
2365b3c937 addons: vrf: flush addresses and down slaves before deleting vrf device
Ticket: CM-10785
Reviewed By: julien nikhil dsa dwalton
Testing Done: tested vrf device down and reload

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-05 14:31:13 -07:00
Julien Fortin
3f917631c3 docs: examples: generate_interfaces: display unsupported message when porttab file is not found
Ticket: CM-10751
Reviewed By: Roopa, Nikhil
Testing Done: tested the script with and without porttab file

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-05-05 01:47:04 +02:00
Julien Fortin
612aadeac9 debian: changelog: update for new release: 1.1-cl3u2
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-05-04 20:18:42 +02:00
Julien Fortin
4bdf2d1cde Deprecating mstpctl-stp attribute
Ticket: CM-10476
Reviewed By: Roopa
Testing Done: Using mstpctl-stp attribute in a stanza will display a warning
2016-05-03 17:40:30 +02:00
Julien Fortin
24aa45e5a3 bridge: display warning when (in vlan unware bridge) an untagged bridge is not configured
Ticket: CM-8173
Reviewed By: Roopa
Testing Done: smoke + vlan aware and non-aware bridges with untagged bridge without untagged bridge.
2016-04-29 21:22:52 +02: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
9e0be374dc new ifupdown2.conf variable to adjust logical devices MTU
Ticket: CM-8736
Reviewed By: Roopa
Testing Done: Smoke tests + the ones from the ticket

By default ifupdown2 will adjust logical devices MTU
based on the physical interface they are running on top of.
set this flag to 0 to disable this behaviour
adjust_logical_dev_mtu=1
2016-04-29 21:19:42 +02:00
Roopa Prabhu
eb3ce8c871 addons: vrf: do not write vrf map to disk during query operation
Ticket: CM-10569
Reviewed By: julien, nikhil
Testing Done: Tested ifquery -c as non root user

unlike ifup/ifdown/ifreload, ifquery can be called by a
non-root user. so make sure we dont write the root owned
vrf map file during ifquery

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-28 15:49:46 -07:00
Roopa Prabhu
f6466fcb90 addons: vrf: add a check and error for reserved system table names
Ticket:
Reviewed By: dsa, nikhil, julien
Testing Done: Tested with system reserved table names

example: err msg:
$ifquery default
auto default
iface default
	vrf-table auto

error: default: cannot use system reserved ['253', '0', '254',
'255'] table names

This patch makes all tables in  /etc/iproute2/rt_tables reserved

$cat /etc/iproute2/rt_tables
255	local
254	main
253	default
0	unspec

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-27 20:07:21 -07:00
Nikhil
baa909c6d0 addons: adding '--with-defaults' option for base ifquery
Ticket: CM-7840
Reviewed By: Roopa Prabhu
Testing Done: yes, with different configurations for physical & logical devices

This patch adds 'ifquery --with-defaults' to print the policy default
values for unconfigured attributes.

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-26 15:04:17 -07:00
Julien Fortin
082b4bf760 addons: bridge: fixing: bridge disable_ipv6 is not handle on down anymore.
Ticket: CM-7594
Reviewed By: Roopa
Testing Done:
2016-04-26 17:10:09 +02:00
Roopa Prabhu
8a360f1b98 ifreload: enable CACHE flag during up of interfaces
Ticket: CM-10273
Reviewed By: julien
Testing Done: Tested with scale config in the bug
2016-04-25 22:54:20 -07:00
Nikhil
016e9325b6 addons: mgmtvrf with static IP needs to support 'gateway'
Ticket: CM-10281
Reviewed By: Roopa Prabhu
Testing Done: Tested with the configuration mentioned in the bug id

Due to bug CM-10188, defualt route via gateway is not installed in time.
It needs 2 sec delay, and fix to CM-10188 shall rectify this issue.

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-25 18:48:01 -07:00