]> git.proxmox.com Git - mirror_ifupdown2.git/log
mirror_ifupdown2.git
7 years agoaddons: bond: support for classical numerical bond modes
Julien Fortin [Wed, 25 May 2016 15:12:19 +0000 (17:12 +0200)]
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>
7 years agosbin: start-networking: support hotplug class from init script
Julien Fortin [Tue, 24 May 2016 08:48:27 +0000 (10:48 +0200)]
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>
7 years agoaddons: vrf: warn and continue on vrf-helper errors
Roopa Prabhu [Tue, 17 May 2016 20:42:47 +0000 (13:42 -0700)]
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>
7 years agoaddons: bridge: Fix for ifquery -c bridge pvid error to a valid config
Nikhil [Mon, 23 May 2016 16:06:10 +0000 (09:06 -0700)]
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>
7 years agoexamples: generate interfaces: will fetch pci interfaces when porttab is missing
Julien Fortin [Mon, 23 May 2016 08:48:24 +0000 (10:48 +0200)]
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>
7 years agoifupdownmain: fixing too many argument for format string
Julien Fortin [Fri, 20 May 2016 15:03:00 +0000 (17:03 +0200)]
ifupdownmain: fixing too many argument for format string

Ticket: None
Reviewed By:
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoifupdownbase: missing traceback import
Julien Fortin [Fri, 20 May 2016 15:00:50 +0000 (17:00 +0200)]
ifupdownbase: missing traceback import

Ticket: None
Reviewed By:
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoifreload: address module always reconfigures (dels/adds) addresses when user
Sam Tannous [Thu, 19 May 2016 15:14:13 +0000 (08:14 -0700)]
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".

7 years agodebian: avoid zipping of generate_interfaces.py file
Nikhil [Thu, 19 May 2016 00:16:28 +0000 (17:16 -0700)]
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>
7 years agoifupdown: iface: now trimming json values right after parsing
Julien Fortin [Wed, 18 May 2016 11:17:47 +0000 (13:17 +0200)]
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>
7 years agoperformance fix: better handling fd to allow subprocess.close_fds=False and code...
Julien Fortin [Fri, 13 May 2016 17:52:57 +0000 (19:52 +0200)]
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.

7 years agoFixing errors and typos
Julien Fortin [Thu, 12 May 2016 14:00:41 +0000 (16:00 +0200)]
Fixing errors and typos

Ticket: None
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agofixing typos in bonduitls.py and iproute2.py
Julien Fortin [Tue, 10 May 2016 15:42:48 +0000 (17:42 +0200)]
fixing typos in bonduitls.py and iproute2.py

Ticket: None
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoaddons: mstpctl: bpdu filter and bpdu guard enabled by default for vxlan device
Nikhil [Fri, 6 May 2016 05:09:49 +0000 (22:09 -0700)]
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>
8 years agoMerge remote-tracking branch 'cumulus/dev'
Roopa Prabhu [Mon, 6 Jun 2016 20:18:29 +0000 (13:18 -0700)]
Merge remote-tracking branch 'cumulus/dev'

8 years agoStaging cl3u3 version for merge to stable and release
John Berezovik [Sun, 5 Jun 2016 16:03:45 +0000 (09:03 -0700)]
Staging cl3u3 version for merge to stable and release

8 years agoifupdownaddons: iproute2: warn when using keywords and better parsing vlanid in ip...
Julien Fortin [Thu, 2 Jun 2016 14:31:43 +0000 (15:31 +0100)]
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>
8 years agoaddons: vrf: error on no master only when ALL interfaces are being
Roopa Prabhu [Tue, 31 May 2016 23:25:07 +0000 (16:25 -0700)]
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>
8 years agoaddons: vrf: Correcting 'vrf-table' usage example
Nikhil [Wed, 18 May 2016 23:33:08 +0000 (16:33 -0700)]
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>
8 years agoifreload: --currently-up fixes
Roopa Prabhu [Tue, 17 May 2016 00:00:39 +0000 (17:00 -0700)]
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>
8 years agoifupdownmain: return proper error code on syntax check errors
Roopa Prabhu [Sun, 15 May 2016 21:17:56 +0000 (14:17 -0700)]
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>
8 years agoaddons: move some warns to errors and make sure all errors set the exit
Roopa Prabhu [Sun, 15 May 2016 20:28:10 +0000 (13:28 -0700)]
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>
8 years agoifupdownaddons: iproute2: fix set_mtu api to return if --no-act (DRYRUN) is set
Roopa Prabhu [Sun, 15 May 2016 20:49:05 +0000 (13:49 -0700)]
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>
8 years agoaddons: vrf: vrf_slave: up vrf dev only when all interfaces are being
Roopa Prabhu [Sat, 14 May 2016 05:44:50 +0000 (22:44 -0700)]
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>
8 years agoifupdown2: ifreload: enable dry run (--no-act) and other dry run fixes
Roopa Prabhu [Fri, 13 May 2016 05:11:15 +0000 (22:11 -0700)]
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>
8 years agoaddons: bridge: Deprecating attribute bridge-gcint
Nikhil [Wed, 11 May 2016 00:53:41 +0000 (17:53 -0700)]
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>
8 years agoaddons: address virtual: adding 0s to (if necessary) pad address-virtual
Julien Fortin [Tue, 10 May 2016 15:23:28 +0000 (17:23 +0200)]
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>
8 years agoaddons: address: force reapply addresses during dhcp to static trasition
Roopa Prabhu [Tue, 10 May 2016 01:48:52 +0000 (18:48 -0700)]
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>
8 years agoaddons: address: fix call to dhclient is_running
Roopa Prabhu [Mon, 9 May 2016 20:50:56 +0000 (13:50 -0700)]
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>
8 years agoaddons: mstpctl: deprecate mstpctl-ports in favor of bridge-ports
Roopa Prabhu [Mon, 9 May 2016 14:41:20 +0000 (07:41 -0700)]
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>
8 years agodebian: replace all cumulus email ids to dev-support@cumulusnetworks.com
Roopa Prabhu [Sun, 8 May 2016 03:22:47 +0000 (20:22 -0700)]
debian: replace all cumulus email ids to dev-support@cumulusnetworks.com

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: mstpctl: call disable_ipv6 only if mstpctl_ports is specified
Roopa Prabhu [Sun, 8 May 2016 02:32:23 +0000 (19:32 -0700)]
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>
8 years agoifupdownmain: cosmetic fixes to deprecated warning message
Roopa Prabhu [Sun, 8 May 2016 02:31:16 +0000 (19:31 -0700)]
ifupdownmain: cosmetic fixes to deprecated warning message

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdownmain: fix error check when an iface is removed but still exists as a dependency
Roopa Prabhu [Sun, 8 May 2016 01:27:05 +0000 (18:27 -0700)]
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>
8 years agoaddons: address: reset mtu to default for physical interfaces which are
Roopa Prabhu [Thu, 5 May 2016 22:49:41 +0000 (15:49 -0700)]
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>
8 years agoaddons: vrf: flush addresses and down slaves before deleting vrf device
Roopa Prabhu [Thu, 5 May 2016 20:29:02 +0000 (13:29 -0700)]
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>
8 years agodocs: examples: generate_interfaces: display unsupported message when porttab file...
Julien Fortin [Wed, 4 May 2016 23:44:32 +0000 (01:44 +0200)]
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>
8 years agodebian: changelog: update for new release: 1.1-cl3u2
Julien Fortin [Wed, 4 May 2016 18:17:17 +0000 (20:17 +0200)]
debian: changelog: update for new release: 1.1-cl3u2

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoDeprecating `mstpctl-stp` attribute
Julien Fortin [Tue, 3 May 2016 15:40:30 +0000 (17:40 +0200)]
Deprecating `mstpctl-stp` attribute

Ticket: CM-10476
Reviewed By: Roopa
Testing Done: Using mstpctl-stp attribute in a stanza will display a warning

8 years agobridge: display warning when (in vlan unware bridge) an untagged bridge is not configured
Julien Fortin [Fri, 29 Apr 2016 19:22:52 +0000 (21:22 +0200)]
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.

8 years agomstp: performances: now globaly caching "mstpctl showportdetail <bridgename> json...
Julien Fortin [Fri, 29 Apr 2016 19:21:45 +0000 (21:21 +0200)]
mstp: performances: now globaly caching "mstpctl showportdetail <bridgename> json" calls

Ticket: CM-10273
Reviewed By: Roopa
Testing Done: Smoke + test from the ticket

8 years agonew ifupdown2.conf variable to adjust logical devices MTU
Julien Fortin [Fri, 29 Apr 2016 19:19:42 +0000 (21:19 +0200)]
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

8 years agoaddons: vrf: do not write vrf map to disk during query operation
Roopa Prabhu [Thu, 28 Apr 2016 22:49:46 +0000 (15:49 -0700)]
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>
8 years agoaddons: vrf: add a check and error for reserved system table names
Roopa Prabhu [Wed, 27 Apr 2016 23:05:09 +0000 (16:05 -0700)]
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>
8 years agoaddons: adding '--with-defaults' option for base ifquery
Nikhil [Tue, 26 Apr 2016 22:00:08 +0000 (15:00 -0700)]
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>
8 years agoaddons: bridge: fixing: bridge disable_ipv6 is not handle on down anymore.
Julien Fortin [Tue, 26 Apr 2016 15:10:09 +0000 (17:10 +0200)]
addons: bridge: fixing: bridge disable_ipv6 is not handle on down anymore.

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

8 years agoifreload: enable CACHE flag during up of interfaces
Roopa Prabhu [Tue, 26 Apr 2016 05:27:31 +0000 (22:27 -0700)]
ifreload: enable CACHE flag during up of interfaces

Ticket: CM-10273
Reviewed By: julien
Testing Done: Tested with scale config in the bug

8 years agoaddons: mgmtvrf with static IP needs to support 'gateway'
Nikhil [Tue, 26 Apr 2016 01:48:01 +0000 (18:48 -0700)]
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>
8 years agoaddons: addressvirtual: fixing: duplicate address-virtual lines cause switch to lockup
Julien Fortin [Mon, 25 Apr 2016 15:39:57 +0000 (17:39 +0200)]
addons: addressvirtual: fixing: duplicate address-virtual lines cause switch to lockup

Ticket: CM-10478
Reviewed By: Roopa
Testing Done: Tested with the interface file provided in the ticket and a custom one.

8 years agoaddons: bridge: fix 'query' handler to check if the interface is a bridge
Roopa Prabhu [Mon, 25 Apr 2016 00:38:00 +0000 (17:38 -0700)]
addons: bridge: fix 'query' handler to check if the interface is a bridge

Ticket: CM-7840
Reviewed By: julien, nikhil
Testing Done: Tested ifquery with and without --with-defaults option

8 years agoifquery: support for --with-defaults in the base output
Roopa Prabhu [Mon, 25 Apr 2016 00:24:31 +0000 (17:24 -0700)]
ifquery: support for --with-defaults in the base output

Ticket: CM-7840
Reviewed By: julien, nikhil
Testing Done: Tested ifquery with and without --with-defaults option

commit "6e16e5ae90f2" introduced --with-defaults for ifquery --check
output. But the base ifquery --with-defaults should also include
the default policy attributes we support. This patch adds infrastructure
to query default attributes --with-defaults in base ifquery output.

example:
{noformat}
$ifquery br0
auto br0
iface br0 inet static
bridge-ports swp1 swp2

$ifquery br0 --with-defaults
auto br0
iface br0 inet static
bridge-ports swp1 swp2
bridge-stp yes

{noformat}

8 years agoaddons: bridge: disabling ipv6 on bridge if any VXLAN port
Julien Fortin [Sun, 24 Apr 2016 22:32:59 +0000 (00:32 +0200)]
addons: bridge: disabling ipv6 on bridge if any VXLAN port

Ticket: CM-7594
Reviewed By: Roopa
Testing Done: Creating a bridge with and without vxlan

8 years agoaddons: vrf: fix check for max vrf dev count
Roopa Prabhu [Sun, 24 Apr 2016 05:57:41 +0000 (22:57 -0700)]
addons: vrf: fix check for max vrf dev count

Ticket: CM-10465
Reviewed By: julien, nikhil
Testing Done: Tested creating more than 64 vrf devices

example config:
{noformat}
%for v in range(1, 66):
auto vrf${v}
iface vrf${v}
        vrf-table auto
%endfor
{noformat}

also, since vrf module already does a link up on vrf dev, remove
link up of vrf dev from ifupdownmain scheduler callback

8 years agoaddons: bridge: call bridge vlan show only if we have attributes that need them
Roopa Prabhu [Sun, 24 Apr 2016 05:32:14 +0000 (22:32 -0700)]
addons: bridge: call bridge vlan show only if we have attributes that need them

Ticket: CM-10273
Reviewed By:
Testing Done: Tested with scale interfaces file in the bug

This reduces 250 unnecessary 'bridge -c vlan show' commands

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdownaddons: modulebase: move port expr message to debug
Roopa Prabhu [Sun, 24 Apr 2016 05:31:13 +0000 (22:31 -0700)]
ifupdownaddons: modulebase: move port expr message to debug

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vlan: remove reserved VLAN check for builtin interfaces
slaffer [Sun, 24 Apr 2016 03:19:48 +0000 (20:19 -0700)]
addons: vlan: remove reserved VLAN check for builtin interfaces

Ticket: CM-10387
Reviewed By: roopa, wkok
Testing Done: slaffer

addons/vlan.py checks if a builtin interface's VLAN ID is within the
switchd reserved VLAN range. This stops a user configuring any port-
local VLANs within that range, despite it being a valid configuration
in both a hardware and kernel sense.

This commit removes the check for builtin interfaces only. The check
of the bridge-vids list for a vlan-aware bridge still resides and
correctly operates in addons/bridge.py.

8 years agoaddons: vrf: fix vrf-helper args at boot
Roopa Prabhu [Sat, 23 Apr 2016 16:12:36 +0000 (09:12 -0700)]
addons: vrf: fix vrf-helper args at boot

Ticket:
Reviewed By: dsa
Testing Done: tested boot with vrf devs and checking vrf-helper args

Call it with the 'boot' arg at boot:
/usr/lib/vrf/vrf-helper create blue 1002 boot

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons,ifupdown,sbin: adding ifquery --with-defaults option
Nikhil [Wed, 20 Apr 2016 10:02:26 +0000 (03:02 -0700)]
addons,ifupdown,sbin: adding ifquery --with-defaults option

Ticket: CM-7840
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

This patch adds a new argument '--with-defaults' to 'ifquery'
when 'ifquery --with-defaults' is executed, running states of all interface
attributes are compared against respective configured attributes from
/etc/network/interfaces file, if configured. Otherwise, compared against
default attributes from policy file

This patch also: (1) fixes ifquery check failure for bridge-* stp attributes.
(2) removes vrf-default-route and vrf-cgroup attributes from ifupdown2 policy
and just have the vrf-helper attribute

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
8 years agoaddons: vrf: fix check in vrf map initialization when no running vrfs present
Roopa Prabhu [Tue, 19 Apr 2016 22:25:23 +0000 (15:25 -0700)]
addons: vrf: fix check in vrf map initialization when no running vrfs present

Ticket: CM-10178
Review: trivial
Testing: tested with failing testcase in the CM

This patch fixes a check in vrf map initialization code which did
not account for running vrfs correctly. This caused the case where
there were no running vrfs but stale map file to fail.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
addons,ifupdown,sbin: adding ifquery --with-defaults option

Ticket: CM-7840
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

This patch adds a new argument '--with-defaults' to 'ifquery'
when 'ifquery --with-defaults' is executed, running states of all interface
attributes are compared against respective configured attributes from
/etc/network/interfaces file, if configured. Otherwise, compared against
default attributes from policy file

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
8 years agoaddons: vrf: remove vrf service code. vrf-helper already handles
Roopa Prabhu [Thu, 21 Apr 2016 20:09:33 +0000 (13:09 -0700)]
addons: vrf: remove vrf service code. vrf-helper already handles
services

Ticket: CM-10533
Reviewed By: dsa
Testing Done: Tested sanity

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agostart-networking: ifup mgmt class interfaces if present
Roopa Prabhu [Thu, 21 Apr 2016 19:58:53 +0000 (12:58 -0700)]
start-networking: ifup mgmt class interfaces if present

Ticket: CM-9919
Reviewed By: dsa, daniel
Testing Done: Checked that mgmt class interfaces are brought up at boot
if present

Note that this only indicates that:
- 'mgmt' is a reserved class
- if any interfaces are tagged as 'mgmt', they will be brought up at
  boot

With this we can put out documentation saying that mgmt devices
can be put into its own class for easier management of mgmtvrf.

{noformat}
$cat /etc/network/interfaces
auto lo
iface lo inet loopback

allow-mgmt eth0
iface eth0 inet dhcp
     vrf mgmt

allow-mgmt mgmt
iface mgmt
     address 127.0.0.1/8
     vrf-table auto

$ifquery -l --allow=mgmt
eth0
mgmt

$ifquery  -l -a
lo

$ifreload --allow=mgmt
$ifup --allow=mgmt

{noformat}

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdown2: fix ifquery --list
Roopa Prabhu [Thu, 21 Apr 2016 19:45:22 +0000 (12:45 -0700)]
ifupdown2: fix ifquery --list

Ticket:
Reviewed By: julien
Testing Done: Tested ifquery -l and checked that it is compatible with
ifupdown

ifquery list lists all matching interfaces. By default that is all auto
interfaces:
example:

{noformat}
$cat /etc/network/interfaces
auto lo
iface lo inet loopback

allow-mgmt eth0
iface eth0 inet dhcp
     vrf mgmt

allow-mgmt mgmt
iface mgmt
     address 127.0.0.1/8
     vrf-table auto

$ifquery  -l --allow=mgmt
eth0
mgmt

$ifquery -a -l
lo
{noformat}

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agodebian: move /sbin/start-networking to /usr/share/ifupdown2/sbin
Roopa Prabhu [Tue, 19 Apr 2016 22:46:09 +0000 (15:46 -0700)]
debian: move /sbin/start-networking to /usr/share/ifupdown2/sbin

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: fix check in vrf map initialization when no running vrfs present
Roopa Prabhu [Tue, 19 Apr 2016 22:25:23 +0000 (15:25 -0700)]
addons: vrf: fix check in vrf map initialization when no running vrfs present

Ticket: CM-10178
Review: trivial
Testing: tested with failing testcase in the CM

This patch fixes a check in vrf map initialization code which did
not account for running vrfs correctly. This caused the case where
there were no running vrfs but stale map file to fail.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoDry-run upgrade test
John Berezovik [Tue, 19 Apr 2016 21:37:39 +0000 (14:37 -0700)]
Dry-run upgrade test

8 years agoifupdownaddons: mstpctlutil: changing log level to catch subprocess exception.
Julien Fortin [Tue, 19 Apr 2016 13:18:35 +0000 (15:18 +0200)]
ifupdownaddons: mstpctlutil: changing log level to catch subprocess exception.

8 years agoifupdownaddons: mstpctlutil: changing log level to catch subprocess exception.
Julien Fortin [Tue, 19 Apr 2016 13:05:34 +0000 (15:05 +0200)]
ifupdownaddons: mstpctlutil: changing log level to catch subprocess exception.

8 years agoifupdownaddons: mstpctlutil: fixing 'UnboundLocalError: local variable referenced...
Julien Fortin [Tue, 19 Apr 2016 00:36:15 +0000 (02:36 +0200)]
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)

8 years agoaddons: vxlan: fixing error: _query_check_n_update_addresses() takes exactly 5 argume...
Julien Fortin [Mon, 18 Apr 2016 14:50:56 +0000 (16:50 +0200)]
addons: vxlan: fixing error: _query_check_n_update_addresses() takes exactly 5 arguments (6 given)

Ticket: None
Reviewed By: Roopa
Testing Done: This error happened when running ifquery -c -a with

auto vx-42
iface vx-42
    vxlan-id 42
    vxlan-local-tunnelip 27.0.0.11
    mtu 1500

8 years agoaddons: vrf: move to vrf-helper for cgroup and default routes
Roopa Prabhu [Mon, 18 Apr 2016 06:53:07 +0000 (23:53 -0700)]
addons: vrf: move to vrf-helper for cgroup and default routes

Ticket: CM-10288
Reviewed By: dsa
Testing Done: Tested vrf and mgmt vrf sanity

8 years agoaddons: dhcp: check if vrf device exists before calling dhclient with vrf exec
Roopa Prabhu [Mon, 18 Apr 2016 06:45:59 +0000 (23:45 -0700)]
addons: dhcp: check if vrf device exists before calling dhclient with vrf exec

Ticket: CM-10292
Reviewed By:
Testing Done: Tested mgmt vrf and other sanity tests

8 years agodebian: add /var/lib/ifupdown2/hooks dir
Roopa Prabhu [Sun, 17 Apr 2016 03:39:58 +0000 (20:39 -0700)]
debian: add /var/lib/ifupdown2/hooks dir

This can be used to execute third party scripts.
One such script /var/lib/ifupdown2/hooks/get_reserved_vlan_range.sh
if exists is used by the vlan module to get the reserved
vlan range on the system.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: fix reuse of table id and misc fixes
Roopa Prabhu [Sun, 17 Apr 2016 02:53:44 +0000 (19:53 -0700)]
addons: vrf: fix reuse of table id and misc fixes

Ticket: CM-10329 and others
Reviewed By: julien, nikhil
Testing Done: Tested vrf sanity and negative cases

- This patch also fixes duplicate rule additions (every reload
was causing ip rules to be added)
- This patch also adds support for vrf_helper which is commented
out due to some problems.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: address: disable reseting of mtu based on default mtu
Roopa Prabhu [Fri, 15 Apr 2016 22:56:24 +0000 (15:56 -0700)]
addons: address: disable reseting of mtu based on default mtu

Ticket: CM-10471
Reviewed By:
Testing Done: Tested with failing config in CM-10471

Recent commit "84f33af6e1f53d ("address.py: default value for mtu when
mtu attribute is removed") CM-9449" enabled setting of device mtu to default
mtu if mtu is not given in the interfaces file.

logical devices like bridges and vlan devices rely on mtu
from their lower devices. ie mtu travels from
lower devices to upper devices. For bonds mtu travels from
upper to lower devices. running mtu depends on upper and
lower device mtu. With all this implicit mtu
config by the kernel in play, it becomes almost impossible
to compare running mtu with the default mtu.
This commit disables this resetting of mtu based on default mtu.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdown2: Allow lacp parameters to be set on 802.3ad bonds
Scott Emery [Thu, 14 Apr 2016 23:03:06 +0000 (16:03 -0700)]
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.

8 years agoaddress.py: default value for mtu when mtu attribute is removed
Julien Fortin [Fri, 15 Apr 2016 08:16:53 +0000 (10:16 +0200)]
address.py: default value for mtu when mtu attribute is removed

Ticket: CM-9449
Reviewed By: Roopa
Testing Done: Adding/removing mtu attribute to ifaces while doing ifup/ifdown/ifquery/ifreload

8 years agoifupdown: add new ifupdownflags class to carry ifupdown flags
Roopa Prabhu [Thu, 14 Apr 2016 21:45:47 +0000 (14:45 -0700)]
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>
8 years agoaddons: bridge: re-visit bridge port vid settings when vlan filtering is toggled
Roopa Prabhu [Thu, 14 Apr 2016 06:56:49 +0000 (23:56 -0700)]
addons: bridge: re-visit bridge port vid settings when vlan filtering is toggled

Ticket: CM-9059
Reviewed By: julien, nikhil
Testing Done: Tested with test case in the bridge

8 years agoaddons: vrf: change vrf default route metric to 8192
Roopa Prabhu [Wed, 13 Apr 2016 18:35:31 +0000 (11:35 -0700)]
addons: vrf: change vrf default route metric to 8192

Ticket: CM-10386
Reviewed By: dsa, vivek
Testing Done: sanity test

8 years agoaddons: dhcp: add vrf awareness
Roopa Prabhu [Tue, 5 Apr 2016 23:11:41 +0000 (16:11 -0700)]
addons: dhcp: add vrf awareness

Ticket: CM-10292, CM-10282
Reviewed By: dsa, nikhil, julien
Testing Done: Tested dhcp config on an vrf slave

- Add support for policy module_globals variable
  "vrf-exec-cmd-prefix". It is read into per module
  self.vrf_exec_cmd_prefix variable

- If self.vrf_exec_cmd_prefix is present and interface is a
  vrf slave, use ifupdown2 will call such command in vrf
  context using:
    "%s %s %s" %(<vrf-exec-cmd-prefix>, <vrfname>, <cmd>)

- This also fixes calling of dhcp refresh when a dhcp slave is
  removed from a vrf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vxlan: fix ifquery --check failure on vxlan-svcnodeip
Nikhil [Fri, 8 Apr 2016 22:59:42 +0000 (15:59 -0700)]
addons: vxlan: fix ifquery --check failure on vxlan-svcnodeip

Ticket: CM-10336
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
8 years agofixing: ifupdown2 (subprocesses) lives on after control-c + Parsing cmd string with...
Julien Fortin [Sun, 10 Apr 2016 16:55:56 +0000 (18:55 +0200)]
fixing: ifupdown2 (subprocesses) lives on after control-c + Parsing cmd string with shlex.split instead of string.split

Ticket: CM-9905
Reviewed By: CCR-4363
Testing Done: ^C ifupdown2 while ifreload-ing interfaces test files (~500ifaces) + smoke tests

8 years agoifupdownaddons: iproute2: when you invalidate the cache, make sure the cache flag...
Roopa Prabhu [Wed, 6 Apr 2016 15:19:10 +0000 (08:19 -0700)]
ifupdownaddons: iproute2: when you invalidate the cache, make sure the cache flag is reset

Ticket: CM-10302
Reviewed By: julien
Testing Done: Tested ifdown of an interface and make sure the addresses
are deleted

cache_invalidate can be called when an interface gets deleted
or on any other deletion event (this is because we dont really
know, what other things have been implicitly deleted by the kernel).
on ifdown, the cache can get invalidated. But if we dont
reset the cache flag, the fill cache functions can still think
the cache is valid and can return None for any queries.
This was happening to address queries, which resulted in
leaving behind configured addresses. because ifdown
thought that there were no running addresses on the interface.

8 years agoifupdownmain: check upperfaceobj role before printing the warning
Roopa Prabhu [Mon, 4 Apr 2016 20:24:59 +0000 (13:24 -0700)]
ifupdownmain: check upperfaceobj role before printing the warning

Ticket: found during other testing
Reviewed By: trivial
Testing Done: Tested ifreload with dependency errors and dependencies
with upperiface being a master and also vlan device

This patch avoids false positives when set role is called twice
for an interface which is a vrf slave but also has a vlan device on
top of it.

8 years agoaddons: vrf: ifquery fixes for vrf
Nikhil [Mon, 4 Apr 2016 09:15:56 +0000 (02:15 -0700)]
addons: vrf: ifquery fixes for vrf

Ticket: CM-10175
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb onto dell-s3000-02

This patch is a git revert of commit 934c4c49c0e77289e7d56349c44d14ca2c307621.
In addition to that, order of _addr_filter() function call arguments are
changed to match the function definition.

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
8 years agoaddons: vrf: ifquery fixes for vrf
Nikhil [Wed, 30 Mar 2016 23:56:37 +0000 (16:56 -0700)]
addons: vrf: ifquery fixes for vrf

Ticket: CM-10175
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb onto dell-s3000-02

This patch fixes inappropriate ifquery fails.
This patch also include a review comment update for addressvirtual.py
[CCR-4310], ticket: [CM-8658]
Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
8 years agoifupdown2: rtnetlink_api: fix api log message to contain commands in iproute2 format
Roopa Prabhu [Mon, 4 Apr 2016 02:35:51 +0000 (19:35 -0700)]
ifupdown2: rtnetlink_api: fix api log message to contain commands in iproute2 format

Ticket: trivial
Reviewed By: wkok
Testing Done: Tested ifupdown2 sanity and checked log messages from rtnetlink api

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This is cherry-pick of commit 269ff43d09ca4 from cumulus2.5

8 years agoifupdownmain: bridgevlan: dont squash vlan iface_types with ifaces of
Roopa Prabhu [Sun, 3 Apr 2016 22:31:34 +0000 (15:31 -0700)]
ifupdownmain: bridgevlan: dont squash vlan iface_types with ifaces of
the same name

Ticket: CM-10051
Reviewed By: julien, nikhil
Testing Done: tested that bridge vlan attributes get applied correctly + ran ssim test testifupdown2.py

This was introduced by a patch that squashed multiple iface objects
into a single object.

That led to the below interfaces getting squashed into one. Which is not
the right thing to do:

{noformat}
auto Newbr.325
iface Newbr.325
        address 24.0.0.22/30
        address 3101:abc:bcad:1::3/64

auto Newbr.325
vlan Newbr.325
        bridge-igmp-querier-src 194.31.10.45
{noformat}

The 'vlan Newbr.325' ifaceobject needs to be kept separately and it is
of type BRIDGE_VLAN. so, this patch just makes sure these interfaces are
kept separately in the squash function.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdownaddons: iproute2: add optional refresh flag to addr get api
Roopa Prabhu [Sun, 3 Apr 2016 22:43:07 +0000 (15:43 -0700)]
ifupdownaddons: iproute2: add optional refresh flag to addr get api

Ticket:
Reviewed By: trivial
Testing Done: tested address gets with refresh flag + ran ssim test testifupdown2.py

- also fixes refresh flag handling in cache _addr_fill function
- this api can be used to get addresses from the cache by first
refreshing the cache. So the caller gets fresh running addresses.
(its not used right now but came up during the need to re-apply
addresses for ipv6 vrf slaves since their addresses may disappear)

8 years agodebian: Add new SKIP_DOWN_AT_SYSRESET /etc/init.d/networking config option to skip...
Roopa Prabhu [Sun, 3 Apr 2016 17:29:33 +0000 (10:29 -0700)]
debian: Add new SKIP_DOWN_AT_SYSRESET /etc/init.d/networking config option to skip deconfiguring interfaces

Ticket: CM-5900
Reviewed By: CCR-2921
Testing Done: Tested 'service networking stop' during system reboot and shutdown

this is cherry-pick of cumulus-3.2.y commit ac231e966a04eb78153d9b53f0d236a149c7bba5

8 years agoRevert "addons: vrf: ifquery fixes for vrf"
Nikhil [Sat, 2 Apr 2016 04:29:48 +0000 (21:29 -0700)]
Revert "addons: vrf: ifquery fixes for vrf"

This reverts commit 934c4c49c0e77289e7d56349c44d14ca2c307621.

    Ticket: CM-10175
    Reviewed By: Roopa Prabhu
    Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

default addr fix for vrf check is deleting lo addrs accidentally
info: rtnetlink: setting link lo up
info: executing ip addr del ::1/128 dev lo
info: executing ip addr del 127.0.0.1/8 dev lo
info: eth0: running ops ...

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
8 years agoaddons: bridge: make sure bridge port enslavement is done by the bridge
Roopa Prabhu [Fri, 1 Apr 2016 04:39:55 +0000 (21:39 -0700)]
addons: bridge: make sure bridge port enslavement is done by the bridge
when it is non-vlan filtering bridge

Ticket: CM-10083
Reviewed By: nikhil, julien
Testing Done: Tested ifreload testcase with CM-10083

Without this patch a bridge port could enslave itself to the bridge
when it finds that the bridge is around. This is a required feature
for vlan filtering bridge because vlan filtering bridge port attributes
are specified under the bridge port and the bridge port needs the power
to enslave to the bridge and apply bridge port attrs.

For the non-vlan filtering bridge, a few bridge port combinations are
not allowed by default (eg, mixing different vlans under the same bridge).
The bridge has the understanding of which ports are allowed. so only it
should have the power to enslave bridge ports. This patch enforces that
power. With this patch the sequence of deleting and enslaving bridge
ports is done at the bridge with deletes followed by adds.

example verbose snippent from ifreload output:
ip -force -batch - [link set dev swp49s0 nomaster
link set dev swp49s1 nomaster
link set dev swp49s0.300 master Oldbr
addr flush dev swp49s0.300
link set dev sidelink.300 master Oldbr
addr flush dev sidelink.300
link set dev swp49s1.300 master Oldbr
addr flush dev swp49s1.300
link set dev swp4 master Oldbr
addr flush dev swp4]

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: redo iproute2 vrf interface map handling
Roopa Prabhu [Thu, 31 Mar 2016 23:09:37 +0000 (16:09 -0700)]
addons: vrf: redo iproute2 vrf interface map handling

Ticket: CM-10188, CM-10061
Reviewed By: dsa, nikhil, julien
Testing Done: Tested static routes with vrf names for tables

This patch does the following:
- if a single vrf device is present in the config,
builds the vrf map by reading vrf interfaces from the kernel (with
existing link cache. Builds a shadow vrf only attribute cache)
- reads existing table map and adjusts it if required
- main change is the iproute2 map file on disk is updated
immediately on vrf creation, so that static routes used along with the
vrf slaves can use the vrf name for the table. This also helps dhclient dns
hook script which may use mgmt table name directly.
- cleans up default routes on down

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: more fixes and cleanups for mgmt and data vrf handling
Roopa Prabhu [Thu, 31 Mar 2016 06:32:59 +0000 (23:32 -0700)]
addons: vrf: more fixes and cleanups for mgmt and data vrf handling

Ticket: CM-10188, CM-9881
Reviewed By: nikhil, julien, dsa, daniel
Testing Done: Tested mgmt vrf bringup, teardown, static routes at boot
etc

This patch fixes a few things:
- kill existing ssh clients on enslavement change for mgmt vrf (original patch by NikhilG)
- bring vrf master up first during vrf slave enslavement if
master does not exist. This was originally done only for
vrf dhcp slaves. With this patch we do it for all vrf slaves.
needed for static routes on vrf slaves (CM-10188).
- cleanup: reorganize code and a few cleanups and corner case handling

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Nikhil Gajendrakumar <nikhil@cumulusnetworks.com>
8 years agoifupdownmain: redo shared dependent checks
Roopa Prabhu [Wed, 30 Mar 2016 18:54:58 +0000 (11:54 -0700)]
ifupdownmain: redo shared dependent checks

Ticket: CM-10027
Reviewed By: julien, nikhil
Testing Done: Tested with an interfaces file with shared dependents

In the process of fixing this saw a few more issues with link kind
handing. Its better to separate kind from interface private flags
like bond slave and bridge port. this patch cleans up all that handling.

Example errors:
error: misconfig..? swp5.2 vrfslave  is enslaved to multiple interfaces
['vrf1012', 'br2']
error: misconfig..? swp5.2 bridgeport  is enslaved to multiple
interfaces ['vrf1012', 'br2']

8 years agoifupdownmain: don't down vrf master in sched callback ops
Roopa Prabhu [Fri, 25 Mar 2016 04:55:58 +0000 (21:55 -0700)]
ifupdownmain: don't down vrf master in sched callback ops

This was bringing down vrf master earlier than required
leading to ssh session hangs in case of management vrf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: ifquery fixes for vrf
Nikhil [Wed, 30 Mar 2016 23:56:37 +0000 (16:56 -0700)]
addons: vrf: ifquery fixes for vrf

Ticket: CM-10175
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb onto dell-s3000-02

This patch fixes inappropriate ifquery fails.
This patch also include a review comment update for addressvirtual.py
[CCR-4310], ticket: [CM-8658]
Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
8 years agoaddons/bridge.py: fixing potential None type issue
Julien Fortin [Tue, 29 Mar 2016 02:29:24 +0000 (04:29 +0200)]
addons/bridge.py: fixing potential None type issue

8 years agosbin/ifupdown2: cleanup unreachable code and refactor update_ifupdown2_argparser...
Julien Fortin [Mon, 28 Mar 2016 23:50:47 +0000 (01:50 +0200)]
sbin/ifupdown2: cleanup unreachable code and refactor update_ifupdown2_argparser to update_common_argparser

Ticket: CM-8564

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoaddons/bridge.py: warn and ignore bridge-ports duplicate lines
Julien Fortin [Mon, 28 Mar 2016 22:47:03 +0000 (00:47 +0200)]
addons/bridge.py: warn and ignore bridge-ports duplicate lines

Ticket: CM-8744
Reviewed By: CCR-4321

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>