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 7CF4F756A4 for ; Wed, 21 Apr 2021 23:49:31 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 78D8A14433 for ; Wed, 21 Apr 2021 23:49:31 +0200 (CEST) Received: from kvmformation3.odiso.net (globalOdiso.M6Lille.odiso.net [89.248.211.242]) by firstgate.proxmox.com (Proxmox) with ESMTP id 927EB14100 for ; Wed, 21 Apr 2021 23:49:27 +0200 (CEST) Received: by kvmformation3.odiso.net (Postfix, from userid 0) id 5A0B78D689; Wed, 21 Apr 2021 23:49:27 +0200 (CEST) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Wed, 21 Apr 2021 23:49:23 +0200 Message-Id: <20210421214926.1789330-4-aderumier@odiso.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210421214926.1789330-1-aderumier@odiso.com> References: <20210421214926.1789330-1-aderumier@odiso.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.168 Adjusted score from AWL reputation of From: address 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 KHOP_HELO_FCRDNS 0.399 Relay HELO differs from its IP's reverse DNS NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [vnetplugin.pm, evpnplugin.pm] Subject: [pve-devel] [PATCH v3 pve-network 3/6] zones: evpn: move vnet mac option to evpn zone plugin 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: Wed, 21 Apr 2021 21:49:31 -0000 This is only used by evpn plugin, and we can have same anycast mac for all vnets like cisco,juniper,arista... Signed-off-by: Alexandre Derumier --- PVE/Network/SDN/VnetPlugin.pm | 6 ------ PVE/Network/SDN/Zones/EvpnPlugin.pm | 17 +++++++++++------ test/zones/evpn/ipv4/expected_sdn_interfaces | 1 + test/zones/evpn/ipv4/sdn_config | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/PVE/Network/SDN/VnetPlugin.pm b/PVE/Network/SDN/VnetPlugin.pm index 34841ae..96a13b4 100644 --- a/PVE/Network/SDN/VnetPlugin.pm +++ b/PVE/Network/SDN/VnetPlugin.pm @@ -70,11 +70,6 @@ sub properties { description => "alias name of the vnet", optional => 1, }, - mac => { - type => 'string', - description => "Anycast router mac address", - optional => 1, format => 'mac-addr' - } }; } @@ -83,7 +78,6 @@ sub options { zone => { optional => 0}, tag => { optional => 1}, alias => { optional => 1 }, - mac => { optional => 1 }, vlanaware => { optional => 1 }, }; } diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm index ca000cf..d68d3ee 100644 --- a/PVE/Network/SDN/Zones/EvpnPlugin.pm +++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm @@ -28,6 +28,11 @@ sub properties { type => 'string', description => "Frr router name", }, + 'mac' => { + type => 'string', + description => "Anycast logical router mac address", + optional => 1, format => 'mac-addr' + }, 'exitnodes' => get_standard_option('pve-node-list'), }; } @@ -40,6 +45,7 @@ sub options { controller => { optional => 0 }, exitnodes => { optional => 1 }, mtu => { optional => 1 }, + mac => { optional => 1 }, dns => { optional => 1 }, reversedns => { optional => 1 }, dnszone => { optional => 1 }, @@ -55,7 +61,7 @@ sub generate_sdn_config { my $alias = $vnet->{alias}; my $ipv4 = $vnet->{ipv4}; my $ipv6 = $vnet->{ipv6}; - my $mac = $vnet->{mac}; + my $mac = $plugin_config->{'mac'}; my $vrf_iface = "vrf_$zoneid"; my $vrfvxlan = $plugin_config->{'vrf-vxlan'}; @@ -184,6 +190,10 @@ sub on_update_hook { if (defined($zone_cfg->{ids}->{$id}->{'vrf-vxlan'}) && $zone_cfg->{ids}->{$id}->{'vrf-vxlan'} eq $vrfvxlan); } + if (!defined($zone_cfg->{ids}->{$zoneid}->{'mac'})) { + my $dc = PVE::Cluster::cfs_read_file('datacenter.cfg'); + $zone_cfg->{ids}->{$zoneid}->{'mac'} = PVE::Tools::random_ether_addr($dc->{mac_prefix}); + } } @@ -206,11 +216,6 @@ sub vnet_update_hook { next if $other_zone->{type} ne 'vxlan' && $other_zone->{type} ne 'evpn'; raise_param_exc({ tag => "vxlan tag $tag already exist in vnet $id in zone $other_zoneid "}) if $other_tag && $tag eq $other_tag; } - - if (!defined($vnet->{mac})) { - my $dc = PVE::Cluster::cfs_read_file('datacenter.cfg'); - $vnet->{mac} = PVE::Tools::random_ether_addr($dc->{mac_prefix}); - } } diff --git a/test/zones/evpn/ipv4/expected_sdn_interfaces b/test/zones/evpn/ipv4/expected_sdn_interfaces index 6d2d3b6..e2d5a75 100644 --- a/test/zones/evpn/ipv4/expected_sdn_interfaces +++ b/test/zones/evpn/ipv4/expected_sdn_interfaces @@ -3,6 +3,7 @@ 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 diff --git a/test/zones/evpn/ipv4/sdn_config b/test/zones/evpn/ipv4/sdn_config index 4c115a9..dd73b5c 100644 --- a/test/zones/evpn/ipv4/sdn_config +++ b/test/zones/evpn/ipv4/sdn_config @@ -7,7 +7,7 @@ }, zones => { - ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000 } }, + ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", '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" } }, -- 2.20.1