X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FNetwork%2FSDN%2FZones%2FEvpnPlugin.pm;h=5338a1bd247e7382841465f17e4dcb1a01932217;hb=88d9562ba7640dd5a4ae79d2724bb539c472eb6a;hp=219100888a83f45f2af9f418c91a1f16fb5945c9;hpb=5d3e0248bb8112e467ddaa5807d98dff06de3dfa;p=pve-network.git diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm index 2191008..5338a1b 100644 --- a/PVE/Network/SDN/Zones/EvpnPlugin.pm +++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm @@ -37,6 +37,10 @@ sub options { 'vrf-vxlan' => { optional => 0 }, 'controller' => { optional => 0 }, mtu => { optional => 1 }, + dns => { optional => 1 }, + reversedns => { optional => 1 }, + dnszone => { optional => 1 }, + ipam => { optional => 0 }, }; } @@ -82,7 +86,8 @@ sub generate_sdn_config { my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid, 1); foreach my $subnetid (sort keys %{$subnets}) { my $subnet = $subnets->{$subnetid}; - my $cidr = $subnetid =~ s/-/\//r; + my $cidr = $subnet->{cidr}; + my $gateway = $subnet->{gateway}; if ($gateway) { push @iface_config, "address $gateway" if !defined($address->{$gateway}); @@ -176,10 +181,24 @@ sub on_update_hook { sub vnet_update_hook { - my ($class, $vnet) = @_; + my ($class, $vnet_cfg, $vnetid, $zone_cfg) = @_; + + my $vnet = $vnet_cfg->{ids}->{$vnetid}; + my $tag = $vnet->{tag}; - raise_param_exc({ tag => "missing vxlan tag"}) if !defined($vnet->{tag}); - raise_param_exc({ tag => "vxlan tag max value is 16777216"}) if $vnet->{tag} > 16777216; + raise_param_exc({ tag => "missing vxlan tag"}) if !defined($tag); + raise_param_exc({ tag => "vxlan tag max value is 16777216"}) if $tag > 16777216; + + # verify that tag is not already defined globally (vxlan-id are unique) + foreach my $id (keys %{$vnet_cfg->{ids}}) { + next if $id eq $vnetid; + my $othervnet = $vnet_cfg->{ids}->{$id}; + my $other_tag = $othervnet->{tag}; + my $other_zoneid = $othervnet->{zone}; + my $other_zone = $zone_cfg->{ids}->{$other_zoneid}; + 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');