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

30 Commits

Author SHA1 Message Date
100fab20b6 addons: link: use iproute2 to create custom devices (fixes #156)
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-15 17:49:56 +02:00
5890ab714e addons: link: porting 'veth-peer-name' attribute to python3 branch
original commit ported to the python3 branch:

commit bffa619b11ae7aa9e567c26c255c17ac6df2c495
Author: Maximilian Wilhelm <max@rfc2324.org>
Date:   Sat Jan 14 19:08:01 2017 +0100

    Add option 'veth-peer-name' to veth links and ensure proper configuration.

      The option »veth-peer-name« forces an veth peer link to be created with
      a specific interface name. As the interface name of the "local" part of
      the veth link pair already is defined by the name of the interface stanza
      this option is added to, now both sides are clearly named.

      As there is a bidirectional dependency of both link pairs - both cannot
      exist without the other - this presents a problem when setting up all
      interfaces. Depending on which interface is set up first there might be
      a problem when only on dependency is specified. Therefore adding the
      »veth-peer-name« option to both interface of the veth link pair ensures
      that regardless of which side is configured first the peer name will be
      set correctly. This intentionally creates a circular dependency which is
      handled accordingly.

      Fixing the config check for veth link-type while at it :)

    Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 04:08:04 +02:00
e537a6e6d6 add support for single vxlan device (bridge-vlan-vni-map)
new attribute:

"bridge-vlan-vni-map": {
    "help": "Single vxlan support",
    "example": "bridge-vlan-vni-map 1000-1001=1000-1001",
}

example of config:

auto bridge
iface bridge
      bridge-vlan-aware yes
      bridge-ports vxlan0 swp1
      bridge-stp on
      bridge-vids 1000-1001
      bridge-pvid 1

auto vxlan0
iface vxlan0
      vxlan-local-tunnelip 27.0.0.9
      bridge-learning off
      # vlan 1000-1001 maps to vni 1000-1001
      bridge-vlan-vni-map 1000-1001=1000-1001

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 02:18:39 +02:00
b8ab3d5d7b main: catch ArgvParseError and don't display traceback
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 01:59:53 +02:00
4d9f4e59f3 addons: dchp: add debug logs and retry mechanism for dhclient (controled by policy)
ifupdown2 now tries to monitor the dhclient call to see if an ip address was
successfully assigned on the requested device. The number of retry can be
customized using the "dhclient_retry_on_failure" policy variable (which defaults to 0)

This commit also add debugging capabilities by automatically enabling sysloging when
configuring dhcp at boot (with PERFMODE option).

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 01:53:22 +02:00
9808982edf addons: bond: add support for es-sys-mac and es-bonds
ES bonds have the same "init state" requirements as CLAG bonds -
1. A bond needs to be designated as an "es-bond" for this purpose.
For clag-bonds we used "clag-id" attr (to designate a bond as a "clag-bond").
For ES bonds we will use "es-sys-mac" attr.

2. Slaves added to an "ES bond" must have protodown-on.
This is again similar to CLAG bonds

3. And vice-versa i.e. when a slave is removed from an "es-bond",
protodown-on must be cleared.

4. When es-sys-mac is first set on a bond, all the bond-slaves must be
placed in "protodown-on" state. This is needed whether FRR is running at that point or not.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:27:21 +02:00
16de4e7988 Merge branch 'master' into python3
* master:
  addons: address: process MTU before addrgen and adddresses
  ifupdownmain: support for marking interfaces as mgmt interfaces
  addons: bridge: fix TypeError: sequence item 0: expected string, int found
  addons: bridge: set bridge MTU after bridge creation addons: bridge: get bridge MTU from address policy not bridge
  addons: mstpctl: check mstpctl-stp and bridge-stp and fix bridge cache update
  lib: nlcache: fix dry_run exception
  addons: address: add support for a separate default mtu policy for eth interfaces
  debian: changelog: new 2.0.2-1 entry
  addons: ethtool: add support for "ethtool_ignore_errors" policy
  LinkUtils: mac_str_to_int: fix string to int conversion
  addons: dhcp: if mgmt vrf context exec dhclient in default vrf
2020-03-26 03:02:53 +01:00
24931ffa21 addons: mstpctl: check mstpctl-stp and bridge-stp and fix bridge cache update
When an stp is enabled on an existing bridge mstpctl attributes are not always
configured by ifreload. This is due to a timing issue (cache) and some issue in
the mstpctl addon.

- Cache: when changing an existing bridge (done via netlink) we wait for the
kernel ack but we don't update our current cache with the new bridge attributes
This is bad because it means that the bridge cache data are stale until we
receive the notification from the kernel.

- Mstp addon: mstpctl-stp was deprecated in favor of bridge-stp, but in some
place, the mstpctl.py code checks for mstpctl-stp but not for bridge-stp. This
commit fixes the area related to this issue but this should be revisited in
a later commit

Ticket: CM-28951
Reviewed By: Roopa
Testing Done: precommit, smoke, evpn-smoke

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:39:03 +01:00
8598c690e3 lib: nlcache: fix dry_run exception
Ticket: CM-28312
Testing Done: Test from the ticket

error: link_set_bridge_info_data_dry_run() takes exactly 3 arguments (4 given)
error: link_set_brport_with_info_slave_data_dry_run() got an unexpected keyword argument 'kind'

seems like when updating a method, it's associated dry-run method wasn't
updated accordingly. Maybe there is a way to programmatically check that
I will look into it.

warning: bridge: skipping port X invalid ether addr
warning: interface not recognized - please check interface configuration
Won't show on dry-run anymore

Log info for commands executed with utils.exec_command() weren't prefixed with
DRY-RUN.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:38:54 +01:00
ff6e951d4f Merge pull request #143 from aderumier/python3
add openvswitch addons
2020-03-04 16:52:41 +01:00
ca45cd9e83 lib: nlcache: fix dry_run exception
error: link_set_bridge_info_data_dry_run() takes exactly 3 arguments (4 given)
error: link_set_brport_with_info_slave_data_dry_run() got an unexpected keyword argument 'kind'

seems like when updating a method, it's associated dry-run method wasn't
updated accordingly. Maybe there is a way to programmatically check that
I will look into it.

warning: bridge: skipping port X invalid ether addr
warning: interface not recognized - please check interface configuration
Won't show on dry-run anymore

Log info for commands executed with utils.exec_command() weren't prefixed with
DRY-RUN.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-02-24 15:01:40 +01:00
5a55e3629c openvswitch : manually add link to cache after creation 2020-02-17 12:54:38 +01:00
09a6a3fd46 lib: addon: translate aliases to attribute name (fixes #133)
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-02-07 18:40:28 +01:00
07325f6b5e Merge branch 'master-next' into python3
* master-next:
  Add XFRM to IFLA_INFO_KIND and reverse change to iproute2 class.
  This patch fixes the XFRM addon for ifupdown2 version 2. The nlpacket for XFRM had a bug, I also changed iproute2 to add the XFRM interface to the local cache after creation. Since XFRM has no IFLA_LINKINFO I made the argument optional. Otherwise no further operation will be done like adding an IP.
2020-02-03 17:18:57 +01:00
8dcaeb6439 Add XFRM to IFLA_INFO_KIND and reverse change to iproute2 class. 2020-02-03 17:06:32 +01:00
6552d825e0 This patch fixes the XFRM addon for ifupdown2 version 2.
The nlpacket for XFRM had a bug, I also changed iproute2 to add
the XFRM interface to the local cache after creation.
Since XFRM has no IFLA_LINKINFO I made the argument optional.
Otherwise no further operation will be done like adding an IP.

I also removed an unecessary variable in the addon.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech,de>
2020-02-03 14:23:44 +01:00
4955b6017a Merge branch 'master-next' into python3
* master-next:
  addons: address: convert ip addresses from statemanager to IPNetwork objects
  main: add extra log info to output the exit status
2020-01-21 09:33:20 +01:00
9873823902 main: add extra log info to output the exit status
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-01-21 09:29:09 +01:00
0e936c3ffa python3: replacing ipaddr with custom ipnetwork.IPNetwork object
As mentioned in a previous commit:
python3 ipaddress behave differently from python2-ipaddr, this is
a serious problem for us since it breaks most of the ip addresses
code.

>>> import ipaddress
>>> ipaddress.ip_network("10.10.10.242/10", False)
IPv4Network('10.0.0.0/10')

This is a problem for us, so we need to use a custom IPNetwork object.
Our custom IPNetwork object uses ipaddress.IPAddress under the hood

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-01-08 11:09:08 +01:00
45864399b0 Revert "python3: ipaddress is now part of the standard library (removing python-ipaddr)"
This reverts commit 5dded70eaa1be660f80ebb50bfdb35e86d7e1fac.
2019-12-17 17:35:51 +01:00
5dded70eaa python3: ipaddress is now part of the standard library (removing python-ipaddr)
IPNetwork doesn't exists anymore and is replaced by ip_network. IPv?Network (4 and 6)
objects take an optional argument "strict" that defaults to True. If strict is set
and the ip address has the host bit set it will raise an exception. This is bad
for ifupdown2, so we need to replace all calls to IPNetwork and IPv?Network with
function who will set strict to False. That way we can limit the number of changes
for this patch.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:27:51 +01:00
bd441a519d python3: pypi support: except ImportError and ModuleNotFoundError
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:25:32 +01:00
e36ad206ac python3: utils.exec_command now returns str and not bytes
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:20:27 +01:00
c46af1c992 python3: logging: the 'warn' method is deprecated, use warning instead
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:19:05 +01:00
47881fc0bb python3: nlcache: keeping ifname as str (and not bytes) to keep the cache working with minimal disruption
Spoiler alert: it is still super disrupted.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:01:12 +01:00
b47b030330 python3: nlcache: can't compare NoneType with integer using > or < anymore
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:01:04 +01:00
7f87d9d869 python3: nlcache: cache key (ifname) should of type str not bytes
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 16:59:39 +01:00
3b01ed7618 python3: 2to3 changes
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 16:55:49 +01:00
35681c0608 python3: shebang update
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 16:40:10 +01:00
223ba5af1d ifupdown2 2.0.0-1
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 13:46:18 +01:00