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

91 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
Julien Fortin
a4a53f4b45 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
2016-04-10 18:55:56 +02:00
Roopa Prabhu
74d8271b1f 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.
2016-04-06 08:19:10 -07:00
Nikhil
bafcc12d84 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>
2016-04-04 02:20:44 -07:00
Nikhil
586535e8db 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>
2016-04-04 02:20:44 -07:00
Roopa Prabhu
d49a18d1b9 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)
2016-04-03 19:20:44 -07:00
Nikhil
050838834b 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>
2016-04-01 21:33:16 -07:00
Roopa Prabhu
05ac52f075 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>
2016-03-31 21:56:39 -07:00
Nikhil
934c4c49c0 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>
2016-03-30 19:13:58 -07:00
Roopa Prabhu
122ef35bf9 addons: vrf: release any dhcp leases before vrf slave enslavement
Ticket: CM-9929
Reviewed By:
Testing Done: Tested vrf dhcp slave enslavement on ifreload

algo:
- when a vrf slave enslavement changes, before performing the
  new master enslavement,
- check if vrf slave has dhcp configured
- if yes, release dhclient running on the vrf slave
2016-03-17 16:18:14 -07:00
Roopa Prabhu
b3745e05ed modulebase: add ifaceobj.set_status calls in log_error and log_warn
Ticket:
Reviewed By: trivial
Testing Done:

This can be used by callers to set iface object status.
2016-03-10 11:10:50 -08:00
Roopa Prabhu
1553a88121 addons: bond: replace bond-ad-sys-priority and bond-ad-sys-mac-addr with equivalent upstream attributes
Ticket: CM-9677
Reviewed By: nikhil
Testing Done: Tested with bond config file in CM-9677

This patch replaces the following attributes:
bond-ad-sys-priority with bond-ad-actor-sys-prio
bond-ad-sys-mac-addr with bond-ad-actor-system

The new attributes correspond to the new sysfs files below:
/sys/class/net/sidelink/bonding/ad_actor_sys_prio
/sys/class/net/sidelink/bonding/ad_actor_system

Old values will be accepted with a deprecated warning:
warning: attribute bond-ad-sys-priority is deprecated. Use bond-ad-actor-sys-prio instead
warning: attribute bond-ad-sys-mac-addr is deprecated. Use bond-ad-actor-system instead
2016-03-03 16:44:33 -08:00
Nikhil
659097a03b ifupdownaddons: iproute2: Fix for error while enslaving 'eth0' to a vrf
Ticket: CM-9594
Reviewed By: Roopa Prabhu
Testing Done: Yes, by installing ifupdown2 deb onto cel-e1031-01

This patch fixes the failure to execute the command
'ip link set dev eth0 nomaster' when 'eth0' is associated with any vrf

This patch also include a review comment update for CCR-4210
2016-03-02 10:32:45 -08:00
Roopa Prabhu
2b5894580b ifupdownaddons: fix parsing of vlan attributes
Ticket: CM-8729
Reviewed By: trivial
Testing Done: Tested with a config with vlan-raw-device

'ip -o -d link show' introduced a new attribute between
'vlan and id'. This makes the move to json or netlink
even more necessary.

The fixes were done for the following format:
61: vlan100@swp1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UP mode DEFAULT group default \    link/ether
00:e0:ec:27:4e:b7 brd ff:ff:ff:ff:ff:ff promiscuity 0 \    vlan protocol
802.1Q id 100 <REORDER_HDR> addrgenmode eui64
2016-03-01 22:55:16 -08:00
Roopa Prabhu
15bb78054f mstpctlutil: fix strip on NoneType warning
saw this during execution of the below command:
ifup --no-act -a

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-02-26 15:43:02 -08:00
Roopa Prabhu
768b4ec52f vrf: handle slaves when vrf device is brought up
The vrf device may not be up when ifup is executed on the
slaves. This commit makes sure:
- vrf slaves dont try to enslave themselves when vrf device is
not present
- And vrf master enslaves any missing slaves during ifup of vrf master
- Also make vrf device the link master, this will make sure
the vrf device brings the vrf slave links up. This is needed to work
around the ipv6 address flush issue

Closes: CM-9493
Review: dsa, nikhil, wkok (via git send-mail)
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-02-26 15:42:42 -08:00
Wilson Kok
7b2469dbf3 Removed lacp bypass priority mode
Ticket: CM-9494
Reviewed By: CCR-4184
Testing Done:

Also removed legacy 'fallback' options.
Now lacp bypass is enabled and disabled on a bond with:

    bond-lacp-bypass-allow [0|1]
2016-02-26 07:32:01 -08:00
Balakrishnan Raman
c07383d142 service node address config for vxlan device using "remote" attribute
Ticket: CM-9520
Reviewed By: CCR-4152
Testing Done: verified service node configuration

Use "remote" attribute in iproute2 command to provision
service node address for service node based replication. Changes also
include allowing only one service node per vxlan device, so its user's
responsiblity to select one service node per vxlan device if there
are multiple nodes to distribute the load.
2016-02-25 22:03:06 -08:00
Nikhil
54616d3f51 addons: vrf: support for vrf-default-route attribute
Ticket:CM-9106
Reviewed By: Roopa Prabhu and Dave Olson
Testing Done: Yes, by installing ifupdown and cumulus-tools deb on to cel-e1031-01

This patch adds per vrf default route: "ip route add table <tbid> unreachable default"

It also accepts a policy file with vrf-default-route [yes/no]

This also includes ifquery fixes for running and check.
2016-02-23 16:02:31 -08:00
Wilson Kok
5d0f83e36e Set vlan-filtering on bridge before adding bridge ports
Ticket: CM-6806
Reviewed By: CCR-4126
Testing Done:

Currently, when doing ifup of a bridge, the bridge is created
and ports are added to bridge before vlan_filtering is set on
the bridge. This causes extra churn on switchd which has to
configure the hardware one way and then tear it down and
reconfigure it again in the new way. For mlx, it causes even
more problems.

This patch moves the vlan_filtering setting of bridge to before
member ports are being added to the bridge, and it uses the new
iproute2 command for setting the attribute instead of through
sysfs.
2016-02-19 14:17:16 -08:00
Roopa Prabhu
5e01fb8056 ifupdownaddons: iproute2: support for vrf linkinfo
Closes: CM-8518
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Nikhil Gajendrakumar <nikhil@cumulusnetworks.com>
2016-02-19 13:47:29 -08:00
Sam Tannous
6c5e92aa70 ifquery running not showing vlan ranges in 3.0
Ticket: CM-9097
Reviewed By: Trivial
Testing Done: Tested on Chris' config

In 3.0, the bridge vlan show command does not print
VLAN ranges unless you use the "-c" option.
This patch modifies the bridge vlan show call in
iproute2.py to use "-c".
2016-02-18 16:49:40 -05:00
wkok
bb22d4d339 Modified lacp-bypass-all-active support to use the new sysfs
node /sys/class/net/bondx/bonding/lacp_bypass.

Ticket: CM-9266
Reviewed-by: trivial
Testing-done:
2016-02-12 10:19:38 -08:00
Scott Emery
969aac98f7 ifupdown2: After loading bonding driver, continue to create bond
Ticket: CM-9182
Reviewed By: Trivial
Testing Done: ifup'd bond when bonding module was not yet loaded.

The bond support in ifupdown2 would check to see if the bonding module is
loaded when creating a bond. If it was not it would load the driver and return.
The correct operation is to load the driver and then continue to create the
bond.
2016-02-08 12:48:37 -08:00
Anuradha Karuppiah
e7cd7b3bf1 Cleanup clag enable references.
Ticket: CM-9078
Reviewed By: Trivial
Testing Done: bond ifdown/ifup on s6000

This needs to be replaced with protodown of clag bond slaves
pre-enslave (TBD; coming soon).
2016-02-05 16:01:59 -08:00
Scott Emery
a0a8d7e094 ifupdown2: Modify implementation of nowait option
Ticket: None
Reviewed By: CCR-4058
Testing Done: ifup'd interface with both dhcp-wait: "no" and dhcp-wait: "yes"
and not specified at all.

A previous patch implemented the nowait option for DHCP. This patch changes the
name of the option to "dhcp-wait" and makes the default, if nothing is specified
in the policy files, to be "yes", which means dhclient will be called without
the "-nw" option, causing it to wait for up to a minute for a response from the
DHCP server before continuing.

The format of the JSON in the policy file for this option was also changed so
that it conforms to the other ifupdown2 policy options. This format is now:

{
    "dhcp": {
        "defaults": { "dhcp-wait": "no" }
    }
}

Also, the documented argument values are "yes" and "no". Any other values, will
be interpreted as "yes".

A subsequent patch in cl-basefiles will be made to include this fragment in
/var/lib/ifupdown2/policy.d/dhcp.json so that Cumulus Linux will default to
not waiting for DHCP to complete.
2016-02-03 16:38:18 -08:00
Scott Emery
6d359159c3 ifupdown2: Add nowait attribute for dhcp addon
Ticket: None
Reviewed By: CCR-4058
Testing Done: ifup'd interface with both nowait=0 and nowait=1 and not specified
at all.

The Mellanox platform, as well as some others probably, has two management
interfaces: eth0 and eth1. The customer may plug a cable into either one of
these interfaces, and very rarely both of them. If only one cable is plugged in
and we don't know which one, then /etc/network/interfaces must be configured
by default to automatically bring up both interfaces using DHCP. But when an
interface does not have link, it stalls the boot process for 60 seconds while
dhclient times out.

This patch changes the default dhclient behavior to not wait for DHCP to
complete, by using the "-nw" option when calling dhclient. This means that
dhclient will immediately return and DHCP will complete in the background.

A module attribute has been added for the DHCP addon called "nowait", which
defaults to 1. If this attribute is set to 0, then dhclient will revert to its
previous behavior and delay up to a minute while DHCP completes. This attribute
can be specified in a policy file, e.g. /etc/network/ifupdown2/policy.d/dhcp.json,
with contents such as:

{
  "dhcp" :
  {
    "nowait" : 0
  }
}
2016-02-01 16:42:28 -08:00
Roopa Prabhu
8465de9077 addons: support for new addon module for vrf
This patch adds initial support for vrf in ifupdown2.

Example interfaces file section:
auto swp1.100
iface swp1.100
    vrf blue

auto blue
iface blue
    vrf-table 10

iproute2 vrf map is generated under:
/etc/iproute2/rt_tables.d/ifupdown2.vrf_map

this patch also adds prelimnary support for 'vrf-table auto'.
But this needs more work.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-01-28 22:01:59 -08:00
Roopa Prabhu
9a8ad21aab ifupdown2: modulebase: fix parse_glob arguments
Ticket: CM-8413
Reviewed By: trivial
Testing Done: Tested failing glob expression in the bug report

Fixes bcca6f753a25 ("ifupdown2: fix a few regex parsing error messages")

(cherry picked from commit 997b0438104bacf12e2db6bdc29c7ea1fec4d91b)
2015-12-09 14:02:54 -05:00
Sam Tannous
b97687bc96 ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard) in mstpctl
Ticket: CM-7756
Reviewed By: roopa
Testing Done: built powerpc and tested ifupdown2 as well as new tests

Once mstpctl-portbpdufilter or mstpctl-bpduguard is enabled for
an interface, removing the configuration in /etc/network/interfaces
does not toggle the mstpctl state back to no.

The root cause of this problem is that "ifreload" does not check default settings for MSTP configuration
for bridge ports and use a default when that setting is removed from the configuration.

This patch adds a check in the existing loop on attribute values.
If there is no configured value, we check to see if a default exists.
self._modinfo['attrs'][attrname]['default'] exists.
If it exists and it is different then the currently running value
we reset the attribute to its default. This is what a customer would expect if
they removed a configured value.

(also added test in cl-tests to check this functionality)

(cherry picked from commit 63d0f7082d44fedabe002aebbb658751dc655a46)
2015-12-09 14:02:29 -05:00
Roopa Prabhu
5f8c03e7a1 ifupdown2: mstpctl: check mstpd running just once during init of mstpctl modules
Ticket: CM-8035
Reviewed By: wkok
Testing Done: Tested mstp commands in interfaces file

(cherry picked from commit 2c3471f2082c8adbdcc395cbd0066680f280b9e5)
2015-12-09 14:02:07 -05:00
Roopa Prabhu
200453838b ifupdown2: clagd: check clag service restart status and print warning if
not running

Ticket: CM-8211
Reviewed By: CCR-3876
Testing Done: Tested clagd parameters change from ifupdown2

$ifquery bond10.4094
auto bond10.4094
iface bond10.4094
    address 169.254.0.27/24
    clagd-peer-ip 169.254.0.28
    clagd-sys-mac 44:38:39:ff:40:94
    clagd-backup-ip 172.27.28.1
    clagd-priority 4096
    clagd-args --peerTimeout 4o

$ifup -v  bond10.4094
info: Executing /usr/sbin/service clagd restart
info: executing /usr/sbin/service clagd status
[FAIL] clagd is not running ... failed!
warning: bond10.4094: clagd failed to start..Please check clagd log for
details

$tail -f /var/log/clagd.log
2015-11-25T22:14:44.014582+00:00 cel-redxp-06 clagd[30875]: Invoked
with: /usr/sbin/clagd --daemon 169.254.0.28 bond10.4094
44:38:39:ff:40:94 --priority 4096 --backupIp 172.27.28.1 --peerTimeout
4o
2015-11-25T22:14:44.020579+00:00 cel-redxp-06 clagd[30875]: There was an
error in the command line parameters.
2015-11-25T22:14:44.020609+00:00 cel-redxp-06 clagd[30875]: argument
--peerTimeout/-t: invalid int value: '4o'
2015-11-25T22:14:44.020618+00:00 cel-redxp-06 clagd[30875]: exit with
status -1

(cherry picked from commit ac4f4a129a9125eeaf17a48a200ad8ac44bf7ef6)

Conflicts:
	packages/clag/ifupdown/clagd.py
2015-12-09 14:00:58 -05:00
Roopa Prabhu
0c8332bc5e ifupdown2: fix a few regex parsing error messages
Ticket:
Reviewed By: CCR-3804
Testing Done: Tested regex parsing failures

This is mostly a cosmetic fix. we were failing with weird/unclear errors
on unable to parse regex expressions correctly.
This patch mainly adds the interface name to the message and plus adds
an info message showing the actual regex being used in searches.

example config:
{noformat}
auto br-roopa
iface br-roopa
  bridge-vlan-aware yes
  bridge-ports regex '(\\Aswp3\\Z|\\Aswp4\\Z)'
  bridge-pvid 20
{noformat}

before the patch:
warning: br-roopa: error getting dependent interfaces (unbalanced
parenthesis)

after the patch (not pretty but easier to debug)

info: br-roopa: evaluating port expr '['regex', "'(", 'Aswp3', 'Z|',
'Aswp4', "Z)'"]'
warning: br-roopa: error getting dependent interfaces (br-roopa: error
searching regex ''(' in swp38 (unbalanced parenthesis))

(cherry picked from commit bcca6f753a25494666d53f1f2f3c855ffa41d7f0)
2015-12-09 13:53:07 -05:00