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 69F659921F for ; Thu, 20 Apr 2023 23:36:34 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4A8FE2F890 for ; Thu, 20 Apr 2023 23:36:34 +0200 (CEST) Received: from bastionodiso.odiso.net (bastionodiso.odiso.net [IPv6:2a0a:1580:2000::2d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 20 Apr 2023 23:36:32 +0200 (CEST) Received: from kvmformation3.odiso.net (formationkvm3.odiso.net [10.3.94.12]) by bastionodiso.odiso.net (Postfix) with ESMTP id E893282AD; Thu, 20 Apr 2023 23:36:25 +0200 (CEST) Received: by kvmformation3.odiso.net (Postfix, from userid 0) id DC2F1D18A8; Thu, 20 Apr 2023 23:36:25 +0200 (CEST) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Thu, 20 Apr 2023 23:36:18 +0200 Message-Id: <20230420213622.685809-3-aderumier@odiso.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230420213622.685809-1-aderumier@odiso.com> References: <20230420213622.685809-1-aderumier@odiso.com> 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 HEADER_FROM_DIFFERENT_DOMAINS 0.25 From and EnvelopeFrom 2nd level mail domains are different KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [evpnplugin.pm, vxlanplugin.pm] Subject: [pve-devel] [PATCH pve-network 2/6] fix #4425: vxlan|evpn: add vxlan-port option 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: Thu, 20 Apr 2023 21:36:34 -0000 Some users requested it as their physical network equipments don't use standard vxlan port Signed-off-by: Alexandre Derumier --- PVE/Network/SDN/Zones/EvpnPlugin.pm | 4 ++ PVE/Network/SDN/Zones/VxlanPlugin.pm | 9 ++++ .../evpn/vxlanport/expected_controller_config | 41 +++++++++++++++++ .../evpn/vxlanport/expected_sdn_interfaces | 44 +++++++++++++++++++ test/zones/evpn/vxlanport/interfaces | 7 +++ test/zones/evpn/vxlanport/sdn_config | 26 +++++++++++ .../vxlan/vxlanport/expected_sdn_interfaces | 16 +++++++ test/zones/vxlan/vxlanport/interfaces | 7 +++ test/zones/vxlan/vxlanport/sdn_config | 11 +++++ 9 files changed, 165 insertions(+) create mode 100644 test/zones/evpn/vxlanport/expected_controller_config create mode 100644 test/zones/evpn/vxlanport/expected_sdn_interfaces create mode 100644 test/zones/evpn/vxlanport/interfaces create mode 100644 test/zones/evpn/vxlanport/sdn_config create mode 100644 test/zones/vxlan/vxlanport/expected_sdn_interfaces create mode 100644 test/zones/vxlan/vxlanport/interfaces create mode 100644 test/zones/vxlan/vxlanport/sdn_config diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm index a5a7539..b155abc 100644 --- a/PVE/Network/SDN/Zones/EvpnPlugin.pm +++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm @@ -91,6 +91,7 @@ sub options { 'advertise-subnets' => { optional => 1 }, 'disable-arp-nd-suppression' => { optional => 1 }, 'rt-import' => { optional => 1 }, + 'vxlan-port' => { optional => 1 }, mtu => { optional => 1 }, mac => { optional => 1 }, dns => { optional => 1 }, @@ -107,6 +108,7 @@ sub generate_sdn_config { my $tag = $vnet->{tag}; my $alias = $vnet->{alias}; my $mac = $plugin_config->{'mac'}; + my $vxlanport = $plugin_config->{'vxlan-port'}; my $vrf_iface = "vrf_$zoneid"; my $vrfvxlan = $plugin_config->{'vrf-vxlan'}; @@ -133,6 +135,7 @@ sub generate_sdn_config { my @iface_config = (); push @iface_config, "vxlan-id $tag"; push @iface_config, "vxlan-local-tunnelip $ifaceip" if $ifaceip; + push @iface_config, "vxlan-port $vxlanport" if $vxlanport; push @iface_config, "bridge-learning off"; push @iface_config, "bridge-arp-nd-suppress on" if !$plugin_config->{'disable-arp-nd-suppression'}; @@ -220,6 +223,7 @@ sub generate_sdn_config { @iface_config = (); push @iface_config, "vxlan-id $vrfvxlan"; push @iface_config, "vxlan-local-tunnelip $ifaceip" if $ifaceip; + push @iface_config, "vxlan-port $vxlanport" if $vxlanport; push @iface_config, "bridge-learning off"; push @iface_config, "bridge-arp-nd-suppress on" if !$plugin_config->{'disable-arp-nd-suppression'}; push @iface_config, "mtu $mtu" if $mtu; diff --git a/PVE/Network/SDN/Zones/VxlanPlugin.pm b/PVE/Network/SDN/Zones/VxlanPlugin.pm index c523cf7..9a77bb9 100644 --- a/PVE/Network/SDN/Zones/VxlanPlugin.pm +++ b/PVE/Network/SDN/Zones/VxlanPlugin.pm @@ -29,6 +29,12 @@ sub properties { description => "peers address list.", type => 'string', format => 'ip-list' }, + 'vxlan-port' => { + description => "Vxlan tunnel udp port (default 4789).", + minimum => 1, + maximum => 65536, + type => 'integer' + }, }; } @@ -36,6 +42,7 @@ sub options { return { nodes => { optional => 1}, peers => { optional => 0 }, + 'vxlan-port' => { optional => 1 }, mtu => { optional => 1 }, dns => { optional => 1 }, reversedns => { optional => 1 }, @@ -51,6 +58,7 @@ sub generate_sdn_config { my $tag = $vnet->{tag}; my $alias = $vnet->{alias}; my $multicastaddress = $plugin_config->{'multicast-address'}; + my $vxlanport = $plugin_config->{'vxlan-port'}; my @peers; @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'}; my $vxlan_iface = "vxlan_$vnetid"; @@ -71,6 +79,7 @@ sub generate_sdn_config { next if $address eq $ifaceip; push @iface_config, "vxlan_remoteip $address"; } + push @iface_config, "vxlan-port $vxlanport" if $vxlanport; push @iface_config, "mtu $mtu" if $mtu; diff --git a/test/zones/evpn/vxlanport/expected_controller_config b/test/zones/evpn/vxlanport/expected_controller_config new file mode 100644 index 0000000..bd7830a --- /dev/null +++ b/test/zones/evpn/vxlanport/expected_controller_config @@ -0,0 +1,41 @@ +frr version 8.2.2 +frr defaults datacenter +hostname localhost +log syslog informational +service integrated-vtysh-config +! +! +vrf vrf_myzone + vni 1000 +exit-vrf +! +router bgp 65000 + bgp router-id 192.168.0.1 + no bgp default ipv4-unicast + coalesce-time 1000 + neighbor VTEP peer-group + neighbor VTEP remote-as 65000 + neighbor VTEP bfd + neighbor 192.168.0.2 peer-group VTEP + neighbor 192.168.0.3 peer-group VTEP + ! + address-family l2vpn evpn + neighbor VTEP route-map MAP_VTEP_IN in + neighbor VTEP route-map MAP_VTEP_OUT out + neighbor VTEP activate + advertise-all-vni + exit-address-family +exit +! +router bgp 65000 vrf vrf_myzone + bgp router-id 192.168.0.1 +exit +! +route-map MAP_VTEP_IN permit 1 +exit +! +route-map MAP_VTEP_OUT permit 1 +exit +! +line vty +! \ No newline at end of file diff --git a/test/zones/evpn/vxlanport/expected_sdn_interfaces b/test/zones/evpn/vxlanport/expected_sdn_interfaces new file mode 100644 index 0000000..d511bf9 --- /dev/null +++ b/test/zones/evpn/vxlanport/expected_sdn_interfaces @@ -0,0 +1,44 @@ +#version:1 + +auto myvnet +iface myvnet + address 10.0.0.1/24 + hwaddress A2:1D:CB:1A:C0:8B + bridge_ports vxlan_myvnet + bridge_stp off + bridge_fd 0 + mtu 1450 + ip-forward on + arp-accept on + vrf vrf_myzone + +auto vrf_myzone +iface vrf_myzone + vrf-table auto + post-up ip route add vrf vrf_myzone unreachable default metric 4278198272 + +auto vrfbr_myzone +iface vrfbr_myzone + bridge-ports vrfvx_myzone + bridge_stp off + bridge_fd 0 + mtu 1450 + vrf vrf_myzone + +auto vrfvx_myzone +iface vrfvx_myzone + vxlan-id 1000 + vxlan-local-tunnelip 192.168.0.1 + vxlan-port 6000 + bridge-learning off + bridge-arp-nd-suppress on + mtu 1450 + +auto vxlan_myvnet +iface vxlan_myvnet + vxlan-id 100 + vxlan-local-tunnelip 192.168.0.1 + vxlan-port 6000 + bridge-learning off + bridge-arp-nd-suppress on + mtu 1450 diff --git a/test/zones/evpn/vxlanport/interfaces b/test/zones/evpn/vxlanport/interfaces new file mode 100644 index 0000000..66bb826 --- /dev/null +++ b/test/zones/evpn/vxlanport/interfaces @@ -0,0 +1,7 @@ +auto vmbr0 +iface vmbr0 inet static + address 192.168.0.1/24 + gateway 192.168.0.254 + bridge-ports eth0 + bridge-stp off + bridge-fd 0 diff --git a/test/zones/evpn/vxlanport/sdn_config b/test/zones/evpn/vxlanport/sdn_config new file mode 100644 index 0000000..8fc80eb --- /dev/null +++ b/test/zones/evpn/vxlanport/sdn_config @@ -0,0 +1,26 @@ +{ + version => 1, + vnets => { + ids => { + myvnet => { tag => "100", type => "vnet", zone => "myzone" }, + }, + }, + + zones => { + ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vxlan-port' => 6000, 'vrf-vxlan' => 1000, 'mac' => 'A2:1D:CB:1A:C0:8B' } }, + }, + controllers => { + ids => { evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" } }, + }, + + subnets => { + ids => { 'myzone-10.0.0.0-24' => { + 'type' => 'subnet', + 'vnet' => 'myvnet', + 'gateway' => '10.0.0.1', + } + } + } +} + + diff --git a/test/zones/vxlan/vxlanport/expected_sdn_interfaces b/test/zones/vxlan/vxlanport/expected_sdn_interfaces new file mode 100644 index 0000000..572550a --- /dev/null +++ b/test/zones/vxlan/vxlanport/expected_sdn_interfaces @@ -0,0 +1,16 @@ +#version:1 + +auto myvnet +iface myvnet + bridge_ports vxlan_myvnet + bridge_stp off + bridge_fd 0 + mtu 1450 + +auto vxlan_myvnet +iface vxlan_myvnet + vxlan-id 100 + vxlan_remoteip 192.168.0.2 + vxlan_remoteip 192.168.0.3 + vxlan-port 6000 + mtu 1450 diff --git a/test/zones/vxlan/vxlanport/interfaces b/test/zones/vxlan/vxlanport/interfaces new file mode 100644 index 0000000..66bb826 --- /dev/null +++ b/test/zones/vxlan/vxlanport/interfaces @@ -0,0 +1,7 @@ +auto vmbr0 +iface vmbr0 inet static + address 192.168.0.1/24 + gateway 192.168.0.254 + bridge-ports eth0 + bridge-stp off + bridge-fd 0 diff --git a/test/zones/vxlan/vxlanport/sdn_config b/test/zones/vxlan/vxlanport/sdn_config new file mode 100644 index 0000000..aedaa74 --- /dev/null +++ b/test/zones/vxlan/vxlanport/sdn_config @@ -0,0 +1,11 @@ +{ + version => 1, + vnets => { + ids => { + myvnet => { tag => 100, type => "vnet", zone => "myzone" }, + }, + }, + zones => { + ids => { myzone => { ipam => "pve", type => "vxlan", 'vxlan-port' => 6000, peers => "192.168.0.1,192.168.0.2,192.168.0.3" } }, + }, +} -- 2.30.2