5
0
mirror of git://git.proxmox.com/git/pve-network.git synced 2025-01-04 09:17:59 +03:00
Commit Graph

481 Commits

Author SHA1 Message Date
Alexandre Derumier
1869d5e7fa fix #5324: non vlanaware zone: add mtu to veth links
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-11-15 16:08:33 +01:00
Thomas Lamprecht
e0e0f4fa86 bump version to 0.9.8
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-23 19:39:58 +02:00
Stefan Hanreich
e19974f446 dhcp: dnsmasq: send mtu option via dhcp
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-22 15:22:08 +02:00
Stefan Hanreich
41e8c887c1 zones: add method for getting MTU
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-22 15:22:08 +02:00
Stefan Hanreich
33f79ff473 dhcp: fix function signatures in abstract class
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-22 15:22:08 +02:00
Thomas Lamprecht
ce667efbf9 bump version to 0.9.7
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 13:59:30 +02:00
Alexandre Derumier via pve-devel
7638f25336 fix #5364: bgp|evpn: derivated router-id from mac address for ipv6 underlay
for ipv4, we use the iface ipv4 router-id as router-id need to 32bit.

That's doesn't work for pure ipv6 underlay network.

since https://www.rfc-editor.org/rfc/rfc6286, we can use any 32bit id,
it's just need to be unique in the ASN.

Simply use the last 4 bytes of iface mac address as unique id

changelog V2: add missing test

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 13:56:48 +02:00
Alexandre Derumier via pve-devel
c508ffa2de fix #5361: evpn: fix ipv6 route-map
Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 13:56:48 +02:00
Alexandre Derumier via pve-devel
c2473c7d65 fix #5344: isis: add isis networkid parser
Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 13:56:48 +02:00
Alexandre Derumier via pve-devel
51c766f8a0 fix #5319: frr.local: add support for bgp-community
Need to be inserted after ip prefix-list and before route map

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 13:56:48 +02:00
Johannes Cornelis Draaijer via pve-devel
00bf3203a1 api: sdn: fix missing types for 'pending' fields.
Signed-off-by: Johannes Cornelis Draaijer <jcdra1@gmail.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 13:56:48 +02:00
Stefan Lendl
835a1ff226 tests: remove old Vnets tests
The did not work and were primarily testing against internal state.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
e4914916bc tests: test VNets functionality as a blackbox
Add several tests for Vnets in test_vnets_blackbox. State setup as well
as testing results is done only via the API to test on the API
boundaries not not against the internal state. Internal state is mocked
to avoid requiring access to system files or pmxcfs.

Mocking is done by reading and writing to a hash that holds the entire
state of SDN. The state is reset after every test run.

Testing is done via helper functions: nic_join and nic_start.
When a nic joins a Vnet, currently it always - and only - calls
add_next_free_cidr(). The same is true if a nic starts on Vnet, which
only calles add_dhcp_mapping.

These test functions homogenize the parameter list in contrast to the
current calls to the current functions.  The intention for the functions
is that they can be moved to Vnets.pm to be called from QemuServer and
LXC!

The tests are composed of a test function which can be parameterized. To
call the test function, the run_test function takes the function pointer
and passes the rest of the arguments to the test functions. It also
takes care of resetting the test state.
This allows fine-grained parameterization per-test directly in the code
instead of separated files that require the entire state to be passed
in.

The tests setup the SDN by creating a simple zone and a simple vnet. The
nic_join and nic_start function is called with different subnet
configuration wiht and without a dhcp-range configured and with or
without an already present IP in the IPAM.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
0f6bc593aa debian: blackbox tests depend on libpve-access-control at build
For mocking RPCEnvironment in sbuild.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
11d2ac73ff sdn: api: extract function that creates the sdn directory.
create_etc_interfaces_sdn_dir creates the /etc/pve/sdn directory.
This allows mocking in tests to prevent system fs access in tests

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
40f020660d sdn: dnsmasq: extract function that updates dnsmasq lease via dbus
Extract the dbus based interactions with dnsmasq so that it can be
mocked in tests.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
23e7fe3197 sdn: dnsmasq: extract function that generates the ethers file path
Extracted to a function so it can be mocked in tests.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
cac88dfa47 dns: dnsmasq: extract function to systemctl command.
systemctl_service() is a wrapper around PVE::Tools::run_command to allow
mocking the systemctl interactions in tests.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
2f37fddc0e sdn: zones: extract function that reads datacenter config
The datacenter_config() functions in SDN::Zones::Plugin is a simple
wrapper that reads datacenter.cfg via cfs.
This allows mocking datacenter.cfg in tests.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Hanreich
27b54a086b sdn: dhcp: rollback allocated ips on failure
If DHCP is configured for IPv4 and IPv6, failing to obtain an IPv6 IP
does not roll back the allocation made for IPv4. This patch rolls back
any changes made in case of failure, so that IP allocation is actually
atomic.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Stefan Lendl <s.lendl@proxmox.com>
Tested-by: Stefan Lendl <s.lendl@proxmox.com>
Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Hanreich
c60a7dc432 sdn: dhcp: only consider subnets that have dhcp-range configured
If DHCP is enabled on a zone with subnets, but no subnet has a
dhcp-range configured, then starting a VM will fail because no IP can
be allocated. This patch fixes this by only considering subnets that
have a dhcp-range configured and only failing if there is at least one
subnet with a dhcp-range configured.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Stefan Lendl <s.lendl@proxmox.com>
Tested-by: Stefan Lendl <s.lendl@proxmox.com>
Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
5fd3da139b sdn: dhcp: request both IPv4 and IPv6 addresses on VM start
If previously an IP was allocated in the IPAM, but a new subnet added
for the other IP version, we need to allocate an IP in the new subnet.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
e06301af3a sdn: dhcp: get next free ip for a specific IP version
Specify the IP version (4|6) for which an IP shall be requested from the IPAM.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-08 17:57:18 +02:00
Stefan Lendl
00370995cb gitignore: build artifacts from sbuild
source package *.dsc
build log *.build
tarball *.tar.xz

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Tested-By: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-04 16:50:08 +02:00
Stefan Lendl
1b37d31170 tests: run tests in sbuild
Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Tested-By: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-04 16:50:08 +02:00
Stefan Lendl
1c3f1a7ed9 tests: mocking more functions to avoid system access
previously extracted functions are now mocked in the zone tests

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Tested-By: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-04 16:50:08 +02:00
Stefan Lendl
96d7d81d6c evpn: extract read_local_frr_config
to allow mocking local fs access

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Tested-By: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-04 16:50:08 +02:00
Stefan Lendl
d06ee817a7 controllers: extract read_etc_network_interfaces
to allow mocking local fs access

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Tested-By: Stefan Hanreich <s.hanreich@proxmox.com>
2024-04-04 16:50:08 +02:00
Thomas Lamprecht
2d0cb1a3a2 bump version to 0.9.6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-22 10:15:32 +01:00
Thomas Lamprecht
ddd3d0f726 test: run through perltidy
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-22 10:08:31 +01:00
Stefan Hanreich
74dcbe9c08 sdn: powerdns: fix counting records of existing rrset
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-03-05 06:26:23 +01:00
Stefan Hanreich
2ca78c7556 sdn: powerdns: remove priority from tests
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-03-05 06:26:23 +01:00
Thomas Lamprecht
e92b11a2e5 dns: style and code clean-up powerdns plugin
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-04 17:07:36 +01:00
Stefan Hanreich
244fb03d3a fix #5275: remove priority field from powerdns
Since v3.4.2 the priority field has been removed and since v4.9 they
are actively rejected by PowerDNS. Stop sending this field in order to
make the PowerDNS plugin work with versions >= 4.9 again. [1]

[1] https://doc.powerdns.com/authoritative/upgrading.html#api-changes

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
2024-03-04 15:47:57 +01:00
Alexandre Derumier
b18b34aad5 ipam: netbox : fix ip_is_gateway
Originally-by: Jasper Yu <007seadog@gmail.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-02-20 15:06:09 +01:00
Thomas Lamprecht
7343076a62 ipam: whitespace/indentation clean ups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-02-20 14:40:00 +01:00
Alexandre Derumier
e4e8158722 ipam: phpipam: add_range_next_freeip
Currently is not possible in phpipam to search in specific range,
fallback to full subnet search

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-02-20 14:40:00 +01:00
Alexandre Derumier
9e65d5f597 ipam: phpipam: add get_ip_from_mac error handling
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-02-20 14:40:00 +01:00
Alexandre Derumier
f38c18f7af ipam: phpipam: add subnet create error handling
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-02-20 14:39:45 +01:00
Alexandre Derumier
b906257d4a ipams : add_next_freeip : return ip not cidr
we want same result than add_next_free_range

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-01-22 12:06:55 +01:00
Alexandre Derumier
6e96fd3314 sdn: prefer proxy from datacenter.cfg for api calls
We only setup proxies from the environment previously, but also check
the one configured in the cluster-wide datacenter.cfg and prefer that
over anything else.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-01-22 12:05:40 +01:00
Thomas Lamprecht
9f4525c350 sdn: code & indentation cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-01-22 12:05:34 +01:00
Alexandre Derumier
d7d1181ed5 controllers: evpn: fix null routes order && ipv6
- don't duplicate ip
- ipv6 use "ipv6 route"
- order correctly

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-01-22 11:57:37 +01:00
Alexandre Derumier
dbacff605f controllers: evpn: frr config cleanup
Some values have been reordered in last version

- bump version to 8.5.2
- move no bgp graceful-restart notification
- move neighbor VTEP activate

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-01-22 11:57:37 +01:00
Alexandre Derumier
e614da43f1 controllers: evpn: bugfix: use prefix-list in route-map instead evpn match
"match evpn" in route-map is broken since 8.5.0
https://github.com/FRRouting/frr/issues/14419

the patch
272c6d5db1
is converting type-2 && type-5 evpn routes to prefix-prefix.
(fixing prefix-list not working previously, but breaking "match evpn")

So, simply use prefix-list now, as "match epvn" was a workaround anyway.

reported on the forum, where user have routing loop between the 2 exit-nodes:
https://forum.proxmox.com/threads/sdn-with-evpn-controller-routing-loop-when-using-multiple-exit-nodes.137362/

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-01-22 11:57:37 +01:00
Alexandre Derumier
b5471f5a2f controllers: evpn: add ipv6 prefix-list support
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2024-01-22 11:57:37 +01:00
Thomas Lamprecht
3b45559e00 buildsys: add explicit default target
Currently the dinstall was the default target due to being the first
one listed, that's rather unusual compared to all of our other repos,
so align this one to our unwritten norm of using the `deb` one as
default target.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-01-22 11:51:44 +01:00
Thomas Lamprecht
8ded42918d bump version to 0.9.5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-29 15:20:34 +01:00
Thomas Lamprecht
764dba5033 tests: zone: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-29 12:48:24 +01:00
Thomas Lamprecht
1ed61845d4 tests: zone: include error if test interfaces file cannot be opened
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-29 12:48:24 +01:00