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

571 Commits

Author SHA1 Message Date
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
Julien Fortin
f466af7a8c 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.
2016-04-25 17:39:57 +02:00
Roopa Prabhu
24e32bfc6b 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
2016-04-24 17:38:00 -07:00
Roopa Prabhu
634764bd88 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}
2016-04-24 17:34:44 -07:00
Julien Fortin
ea9e3c0f15 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
2016-04-25 00:32:59 +02:00
Roopa Prabhu
c8a3b44e94 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
2016-04-23 23:21:50 -07:00
Roopa Prabhu
f05e1e6d05 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>
2016-04-23 22:34:58 -07:00
Roopa Prabhu
77d9d6645a ifupdownaddons: modulebase: move port expr message to debug
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-23 22:34:58 -07:00
slaffer
d770f1d53b 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.
2016-04-23 20:20:52 -07:00
Roopa Prabhu
c4e05f9f8c 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>
2016-04-23 09:12:36 -07:00
Nikhil
6e16e5ae90 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>
2016-04-22 12:01:51 -07:00
Roopa Prabhu
669b422add 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>
2016-04-22 11:44:04 -07:00
Roopa Prabhu
fdf548b091 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>
2016-04-21 13:18:19 -07:00
Roopa Prabhu
6642399fee 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>
2016-04-21 13:11:22 -07:00
Roopa Prabhu
4c56a7c1a7 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>
2016-04-21 12:51:35 -07:00
Roopa Prabhu
90c6eab5f1 debian: move /sbin/start-networking to /usr/share/ifupdown2/sbin
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-19 16:00:35 -07:00
Roopa Prabhu
4934af352a 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>
2016-04-19 15:32:32 -07:00
John Berezovik
7b2e838e95 Dry-run upgrade test 2016-04-19 14:37:39 -07: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
Julien Fortin
8e59521814 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
2016-04-18 16:53:44 +02:00
Roopa Prabhu
6369e77414 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
2016-04-17 23:53:07 -07:00
Roopa Prabhu
3cf287b8e1 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
2016-04-17 23:45:59 -07:00
Roopa Prabhu
f332cfbee8 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>
2016-04-16 20:39:58 -07:00
Roopa Prabhu
25e2386e43 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>
2016-04-16 20:12:56 -07:00
Roopa Prabhu
13e2253070 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>
2016-04-15 15:56:24 -07:00
Scott Emery
a7322fd960 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.
2016-04-15 11:50:37 -07:00
Julien Fortin
84f33af6e1 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
2016-04-15 10:16:53 +02:00
Roopa Prabhu
fc5e1735c0 ifupdown: add new ifupdownflags class to carry ifupdown flags
Ticket: cleanup
Reviewed By:
Testing Done: Tested ifupdown sanity

This gets rid of some ugly previous flag handling which was
passed through modules. This creates a global instance of
flags that all addon modules and helper modules can use.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-14 22:30:53 -07:00
Roopa Prabhu
96a71b65cb 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
2016-04-13 23:56:49 -07:00
Roopa Prabhu
39ee399b45 addons: vrf: change vrf default route metric to 8192
Ticket: CM-10386
Reviewed By: dsa, vivek
Testing Done: sanity test
2016-04-13 11:35:31 -07:00
Roopa Prabhu
717cee3187 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>
2016-04-12 23:13:41 -07:00
Nikhil
f50f16fa71 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>
2016-04-11 03:05:27 -07:00