From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 8C2C39249B for ; Fri, 5 Apr 2024 15:18:50 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6B1D1140D8 for ; Fri, 5 Apr 2024 15:18:20 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 5 Apr 2024 15:18:19 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3D1F24663C for ; Fri, 5 Apr 2024 15:18:19 +0200 (CEST) From: Stefan Lendl To: pve-devel@lists.proxmox.com Date: Fri, 5 Apr 2024 15:17:53 +0200 Message-ID: <20240405131806.388178-1-s.lendl@proxmox.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v3 pve-network 00/12] SDN: Testing VNets as a blackbox and fixing found bugs X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Apr 2024 13:18:50 -0000 This add several tests for SDN VNets. State setup as well as testing results is done only via the API to test on the API boundaries and not against the internal state. Internal state and config files are mocked to avoid requiring access to system files or pmxcfs. The first 4 commits fix functionality, identified as bugs thanks to the tests. The next 7 commits extract various functions to allow mocking them in the tests. The tests are then added as the test_vnets_blackbox test. The last commit removes the old vnets tests which are not working anyway. Tests validate the events of a nic joining a VNet or a nic staring on a VNet. These events are tested with with different subnet configurations. Mainly for IPv4 and/or IPv6 configurations and odd combinations. Further descriptions in the commit. Differences v2 -> v3: * Fix functionalitiy in VNet and Subnet so all tests pass Thanks @s.hanreich for lots of testing * Update and add more tests * Make it build in sbuild Differences v1 -> v2: * Add tests that expect a failure when no IP can be allocated * Removed commented out debug stuff Stefan Hanreich (2): sdn: dhcp: only consider subnets that have dhcp-range configured sdn: dhcp: rollback allocated ips on failure Stefan Lendl (10): sdn: dhcp: get next free ip for a specific IP version sdn: dhcp: request both IPv4 and IPv6 addresses on VM start sdn: zones: extract function that reads datacenter config dns: dnsmasq: extract function to systemctl command. sdn: dnsmasq: extract function that generates the ethers file path sdn: dnsmasq: extract function that updates dnsmasq lease via dbus sdn: api: extract function that creates the sdn directory. debian: blackbox tests depend on libpve-access-control at build tests: test VNets functionality as a blackbox tests: remove old Vnets tests debian/control | 1 + src/PVE/API2/Network/SDN/Zones.pm | 6 +- src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 47 +- src/PVE/Network/SDN/Subnets.pm | 2 +- src/PVE/Network/SDN/Vnets.pm | 29 +- src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 3 +- src/PVE/Network/SDN/Zones/Plugin.pm | 5 + src/PVE/Network/SDN/Zones/SimplePlugin.pm | 2 +- src/test/Makefile | 5 +- src/test/run_test_vnets.pl | 343 --------- src/test/run_test_vnets_blackbox.pl | 894 ++++++++++++++++++++++ 11 files changed, 962 insertions(+), 375 deletions(-) delete mode 100755 src/test/run_test_vnets.pl create mode 100755 src/test/run_test_vnets_blackbox.pl -- 2.44.0