Commit Graph

64 Commits

Author SHA1 Message Date
Julien Fortin
a0ff28e527 sonarlink: remove unused variable
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2023-05-04 13:21:55 +02:00
Julien Fortin
421e9573b5 SONAR: fix iface.py: Import only needed names or import the module and then use its members.
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2023-05-04 13:21:55 +02:00
Julien Fortin
e8b9d3ab5d sonarlink: use opposite operator != instead of 'not'
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2023-05-04 13:21:55 +02:00
Julien Fortin
7c8627f876 SONAR: Specify an exception class to catch or reraise the exception
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2023-05-04 13:21:55 +02:00
Julien Fortin
35a4278ffb addons: vxlan: remote-ip: purge entry removed by user
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 12:17:59 +02:00
Julien Fortin
2fbbfa7211 addons: vxlan: vxlan-vni: support vni change on existing config
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 12:17:16 +02:00
Julien Fortin
0500d5d882 addons: vxlan: add support for l3vxi via vxlan-vni
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 12:12:17 +02:00
Julien Fortin
970c72e437 addons: vxlan: fix lib.addon.Vxlan import (fixes: #217)
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-08-26 13:44:05 +02:00
Julien Fortin
9ca87c5e8b addons: vxlan: ifquery-check: mcastgrp-map: use bridge vni show
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:54:09 +02:00
Julien Fortin
3376c23335 addons: vxlan: remove stale code (bridge fdb show call)
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:53:38 +02:00
Julien Fortin
b3a93dfce1 addons: vxlan: fix name 'vni_mcastgrp_map' is not defined
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:53:04 +02:00
Julien Fortin
d910b87c50 addons: vxlan: mcastgrp-map: remove validval attribute
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:51:45 +02:00
Julien Fortin
e7ecab23d9 addons: vxlan: refactoring code to allow updating an existing SVD
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:51:12 +02:00
Roopa Prabhu
20aabf550c addons: vxlan: fix mcast group get api during vni filter set
the mcast group set code was not using the right api
to get mcast groups.

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:48:24 +02:00
Julien Fortin
238e048507 addons: vxlan: remoteip-map: check user config against old config and not running state
'bridge flood macs are deleted everytime ifreload is triggered even without any changes to e/n/i config'
this was happening because ifupdown2 was checking the live fdb entries and calculating the delta between
the new and old config. Now we are simply checking the old and new ifupdown2 (/e/n/i) config to avoid
messing with macs added by the control plane

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:47:44 +02:00
Julien Fortin
d4403f1e77 addons: vxlan: ifquery-check: don't check fdb running state if mcastgrp-map or remoteip map are not configured
fdb entries can be added by FRR, so we won't be checking the running
state if there's no record of a user configuration in /e/n/i

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:47:08 +02:00
Julien Fortin
2b867068c6 addons: vxlan: allow svd config update
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:46:32 +02:00
Roopa Prabhu
8743434a25 addons: vxlan: add null list check when mcastgrp map not present
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
2021-07-01 19:45:43 +02:00
Julien Fortin
782aff35ce addons: vxlan: support for vxlan-support-mix-dev-types policy (default yes)
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:08:55 +02:00
Julien Fortin
db4371de3c addons: vxlan: error out when an unsupported mix of SVD and TVDs are configured
Currently mixing SVDs and TVDs on the same system is not supported,
regardless of whether they are in the same vlan-aware bridge or
across different ones. NVUE will configure all VNIs as SVDs by
default so this would hopefully only arise if a user edits
/etc/network/interfaces and manages their configuration with ifupdown2.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:08:04 +02:00
Roopa Prabhu
af8d5db22b addons: vxlan: use new vni filter api to set mcast groups per vni
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:00:17 +02:00
Julien Fortin
1b7f1f34e4 addons: vxlan: add 'Exception' to try/catch
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 18:13:55 +02:00
Julien Fortin
66eb9ce3c5 addons: vxlan: add support for new attribute: vxlan-remoteip-map
syntax:
vxlan-remoteip-map 1000-1005=10.0.0.1,10.0.0.42-10.0.0.45,10.0.0.90-10.0.0.95
vxlan-remoteip-map vni-range=ip-range,comma-separated

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:42:48 +02:00
Roopa Prabhu
8e167b9e32 addons: vxlan: process mcast groups after the addition of vnifilter
The pre-mature setting of mcast fdbs led to inconsistent state in
mcast grp registration resulting in a deadlock seen in #2638104

more kernel changes towards #2638104 are in progress

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:37:26 +02:00
Roopa Prabhu
7f0310a7a5 bridge: support values of auto, auto+, auto- for vni in bridge-vlan-vni-map
<vlan>=<vni>
<vlan>=auto  /* sets vni = vlan */
<vlan>=auto+2 /* sets vni = vlan+2 */
<vlan>=auto-2 /* sets vni = vlan-2 */

example:
$ifquery vxlan1
auto vxlan1
iface vxlan1
        vxlan-local-tunnelip 27.0.0.30
        bridge-vlan-vni-map 1000-1009=auto+2 2000-2020=auto-2
        mstpctl-portbpdufilter yes
        mstpctl-bpduguard yes

$ifup -v vxlan1
...
info: executing /sbin/bridge -force -batch - [vlan add vid 1000-1009 dev
vxlan1
vlan add dev vxlan1 vid 1000-1009 tunnel_info id 1002-1011
vlan add vid 2000-2020 dev vxlan1
vlan add dev vxlan1 vid 2000-2020 tunnel_info id 1998-2018]
...

changes include:
- supporting the new syntax
- moved vlan vni map handling into a utility function
to be used by bridge tunnel_info and vxlan vnifilter

Reviewed by: slaffer, david marshal, qzil, julien
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:36:46 +02:00
Julien Fortin
e6edcd2113 addons: vxlan: ifquery-check support for vxlan-mcastgrp-map
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:34:37 +02:00
Roopa Prabhu
9144496d01 vxlan: fix ttl for single vxlan device
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:33:29 +02:00
Quentin Zilberberg
6015cce25b addons: vxlan: add support for vni/IP range and multi lines on SVD mcast group config
vxlan-mcastgrp-map config enhancements:
 - support for multi-line vxlan multicast group config.
 - support for vni range config.
 - support for mcast grp range config.
 - support for mcast network config.

Example:
    vxlan-mcastgrp-map 10001=239.5.2.1
    vxlan-mcastgrp-map 10002=239.5.2.2
    vxlan-mcastgrp-map 10003=239.5.2.3
    vxlan-mcastgrp-map 10005-10008=239.10.39.121
    vxlan-mcastgrp-map 10010-10020=239.10.39.152-239.10.39.162
    vxlan-mcastgrp-map 10005-10002=239.10.0.0/24

Reviewed-by: Julien Fortin <jfortin@nvidia.com>, Roopa Prabhu <roopa@nvidia.com>, Scott Laffer <slaffer@nvidia.com>
Signed-off-by: Scott Laffer <slaffer@nvidia.com>, Quentin Zilberberg <qzil@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:28:52 +02:00
Roopa Prabhu
84c47c4ff0 addons: vxlan: add support for vni filter on single vxlan device
- create single vxlan device with vnifilter flag
- install vni filter with vnis from bridge-vxlan-vni-map
- vni filter can only be applied when the vxlan interface
is in down state
- toggling of vni filter is unsupported (maybe in the future)
- vni filter on a single vxlan or collect metadata/external
device is a new kernel feature yet to be upstreamed
- move vlan/vni id math helpers to utils.py

Reviewed-by: Julien Fortin <jfortin@nvidia.com>
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:27:45 +02:00
Julien Fortin
56f3434979 addons: vxlan: improve mcastgrp-map handling of fdb entries
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:24:32 +02:00
Julien Fortin
1609696fe3 addons: vxlan: add support for vxlan-mcastgrp-map with ipmr-lo dummy physdev
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:23:51 +02:00
Julien Fortin
aa4c8a2d94 addons: vxlan: single-device: update log.warning when device already exists
updating an existing singe-vxlan-device is not supported yet, we should warn
the user accordingly.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:21:06 +02:00
Julien Fortin
59ab29fbd1 addons: vxlan: inherit clagd-vxlan-anycast-ip from lo for clag vxlans (introduces old_ifaceobjs to get_dependent_ifacenames)
When clagd anycast ip configuration changes on an existing setup, we have two issues:
- populate_dependency_info is run twice (in the ifreload case), first on the new
ifaceobjs, then on the old ifaceobjs. Thus hitting vxlan.get_dependent_ifacenames twice
where vxlan._clagd_vxlan_anycast_ip is set (the first time properly, then reset to it's
old value).
The fix: add a "old_ifaceobjs" flag to avoid resetting vxlan._clagd_vxlan_anycast_ip

- when clagd anycast ip changes, clagd also updates the vxlan's ip but there's a chance
that the ifupdown2 cache won't get the netlink notification in time before UP ops are
running on the vxlans, running on a stale cache is no bueno.
The fix: add additional checks to see if we should trust the cache of not.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:29:40 +02:00
Sam Osterkil
b20f983630 Support value-in-range with <number> keyword
This allows syntax checking to pass for fields like vxlan-ttl/vxlan-tos
which can be a number in a range OR a string value representing a special
meaning (0-255 or "auto", for instance).  Without this, you can only pass
a --syntax-check for such fields if your value is one of those literally
specified because, for instance, "64" is not "auto", "0", or "255":

invalid value "64": valid attribute values: ['0', '255']
info: exit status 1

Note that _applying_ such configuration still works, because netlink's
acceptance criteria are independent of ifupdown2's.
2021-06-01 14:11:59 -06:00
Julien Fortin
a8dd54b0fa addons: vxlan: vxlan-tos, vxlan-udp-csum refactoring and fixes
fix vxlan-tos inherit = 1 (was set to 0)
and other fixes to make sure we don't unnecessarily set
those attributes on vxlan creation

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-21 00:04:14 +02:00
Sam Osterkil
e521508b41 addons: vxlan: support ToS and udpcsum 2021-04-29 20:16:46 -06:00
Markus Hauschild
969257a4fb addons: vxlan: fix vxlan-svcnodeip help text
Signed-off-by: Markus Hauschild <markus@moepman.eu>
2020-11-16 18:59:47 +01:00
Julien Fortin
ca43693778 addons: vxlan: new attribute: vxlan-mcastgrp-map
"vxlan-mcastgrp-map": {
    "help": "vxlan multicast group for single-vxlan device",
    "validvals": ["<number-ipv4-list>"],
    "example": ["vxlan-mcastgrp-map 1000=239.1.1.100 1001=239.1.1.200"],
}

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-08-06 14:32:07 +02:00
Julien Fortin
792b9a0700 addons: vxlan: add vxlan-mcastgrp support for single-vxlan device
this patch adds support for the vxlan-mcastgrp attribute on single
vxlan device. Prior to this commit the vxlan-mcastgrp was only
applied to regular vxlans.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-08-06 14:20:41 +02:00
Julien Fortin
a7e5fb2597 addons: vxlan: fix AttributeError: 'NoneType' object has no attribute 'ip'
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-08-06 14:19:58 +02:00
Julien Fortin
caac1e90b0 addons: vxlan: single-vxlan: remove local ip cidr before executing iproute2 link add
When creating a single-vxlan device we were sending local tunnel ip address with ip
network prefix. This patch avoid the following error:

error: cmd '/bin/ip link add dev vxlan0 type vxlan external local 27.0.0.9/32 dstport 4789' failed: returned 1 (Error: any valid address is expected rather than "27.0.0.9/32".
)

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-08-06 14:17:08 +02:00
Julien Fortin
0c019b802d
Merge branch 'master' into issue-43/support-for-vxlan-ipv6-attributes 2020-07-01 16:55:38 +02:00
Julien Fortin
3218f49d81 use "except Exception:" instead of "except:"
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-06-24 01:12:24 +02:00
Julien Fortin
406583375e addons: vxlan: add support for ipv6 attributes svcnodeip6 and mcastgrp6
vxlan-svcnodeip6": {
    "help": "vxlan svc node ip",
    "validvals": ["<ipv6>"],
    "example": ["vxlan-svcnodeip6 2001:DB8:8086:6502::"]
}

"vxlan-mcastgrp6": {
    "help": "vxlan multicast group",
    "validvals": ["<ip6>"],
    "example": ["vxlan-mcastgrp ff02::15c"],
}

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-15 04:32:38 +02:00
Julien Fortin
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
Julien Fortin
dc74cedae4 addons: vxlan: ifquery-running: fix incorrect diplayed data
Signed-off-by: Scott Laffer <slaffer@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 18:11:14 +02:00
Julien Fortin
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
Julien Fortin
45864399b0 Revert "python3: ipaddress is now part of the standard library (removing python-ipaddr)"
This reverts commit 5dded70eaa.
2019-12-17 17:35:51 +01:00
Julien Fortin
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
Julien Fortin
bd441a519d python3: pypi support: except ImportError and ModuleNotFoundError
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:25:32 +01:00