public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes
@ 2023-04-20 21:36 Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 1/6] fix #4657 : evpn: fix exit-node with multiple vrf Alexandre Derumier
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Alexandre Derumier @ 2023-04-20 21:36 UTC (permalink / raw)
  To: pve-devel

This is a resend of the 4 last patches for pve-network
+ 2 new patches


Alexandre Derumier (6):
  fix #4657 : evpn: fix exit-node with multiple vrf
  fix #4425: vxlan|evpn: add vxlan-port option
  fix #4662 : frr: fix config generation ordering
  fix #4389 : evpn: exit nodes : null routes subnets from other zones
  fix #4683 : zones: qinq: fix vlan-protocol with bridge vlan aware
  network reload: fix UPID parsing

 PVE/API2/Network/SDN.pm                       |  3 +-
 PVE/Network/SDN/Controllers/BgpPlugin.pm      |  2 +-
 PVE/Network/SDN/Controllers/EvpnPlugin.pm     | 83 ++++++++++------
 PVE/Network/SDN/Vnets.pm                      |  4 +-
 PVE/Network/SDN/Zones/EvpnPlugin.pm           |  4 +
 PVE/Network/SDN/Zones/QinQPlugin.pm           |  8 +-
 PVE/Network/SDN/Zones/VxlanPlugin.pm          |  9 ++
 .../ebgp_loopback/expected_controller_config  |  3 +-
 .../evpn/exitnode/expected_controller_config  |  1 +
 .../expected_controller_config                |  4 +-
 .../exitnode_snat/expected_controller_config  |  1 +
 .../expected_controller_config                | 98 +++++++++++++++++++
 .../exitnodenullroute/expected_sdn_interfaces | 81 +++++++++++++++
 test/zones/evpn/exitnodenullroute/interfaces  |  7 ++
 test/zones/evpn/exitnodenullroute/sdn_config  | 42 ++++++++
 .../multiplezones/expected_controller_config  | 49 ++++++++++
 .../multiplezones/expected_sdn_interfaces     | 81 +++++++++++++++
 test/zones/evpn/multiplezones/interfaces      |  7 ++
 test/zones/evpn/multiplezones/sdn_config      | 37 +++++++
 .../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 +++++
 .../expected_sdn_interfaces                   |  4 +
 .../vxlan/vxlanport/expected_sdn_interfaces   | 16 +++
 test/zones/vxlan/vxlanport/interfaces         |  7 ++
 test/zones/vxlan/vxlanport/sdn_config         | 11 +++
 27 files changed, 640 insertions(+), 40 deletions(-)
 create mode 100644 test/zones/evpn/exitnodenullroute/expected_controller_config
 create mode 100644 test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
 create mode 100644 test/zones/evpn/exitnodenullroute/interfaces
 create mode 100644 test/zones/evpn/exitnodenullroute/sdn_config
 create mode 100644 test/zones/evpn/multiplezones/expected_controller_config
 create mode 100644 test/zones/evpn/multiplezones/expected_sdn_interfaces
 create mode 100644 test/zones/evpn/multiplezones/interfaces
 create mode 100644 test/zones/evpn/multiplezones/sdn_config
 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

-- 
2.30.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pve-devel] [PATCH pve-network 1/6] fix #4657 : evpn: fix exit-node with multiple vrf
  2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
@ 2023-04-20 21:36 ` Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 2/6] fix #4425: vxlan|evpn: add vxlan-port option Alexandre Derumier
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Derumier @ 2023-04-20 21:36 UTC (permalink / raw)
  To: pve-devel

Currently, if a node is primary exit-node for 1 vrf,
and secondary exit-node for another vrf,

the deny route-map is filtering routes imports for both
vrf.

This patch add filtering only for vrf where the node is secondary.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/Network/SDN/Controllers/EvpnPlugin.pm                        | 1 +
 test/zones/evpn/exitnode/expected_controller_config              | 1 +
 .../zones/evpn/exitnode_local_routing/expected_controller_config | 1 +
 test/zones/evpn/exitnode_snat/expected_controller_config         | 1 +
 4 files changed, 4 insertions(+)

diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 727aeaa..9d39b9b 100644
--- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -168,6 +168,7 @@ sub generate_controller_zone_config {
 	if (!$exitnodes_primary || $exitnodes_primary eq $local_node) {
 	    #filter default type5 route coming from other exit nodes on primary node or both nodes if no primary is defined.
 	    my $routemap_config = ();
+	    push @{$routemap_config}, "match evpn vni $vrfvxlan";
 	    push @{$routemap_config}, "match evpn route-type prefix";
 	    my $routemap = { rule => $routemap_config, action => "deny" };
 	    unshift(@{$config->{frr_routemap}->{'MAP_VTEP_IN'}}, $routemap);
diff --git a/test/zones/evpn/exitnode/expected_controller_config b/test/zones/evpn/exitnode/expected_controller_config
index 48830a3..2c3f19e 100644
--- a/test/zones/evpn/exitnode/expected_controller_config
+++ b/test/zones/evpn/exitnode/expected_controller_config
@@ -53,6 +53,7 @@ router bgp 65000 vrf vrf_myzone
 exit
 !
 route-map MAP_VTEP_IN deny 1
+ match evpn vni 1000
  match evpn route-type prefix
 exit
 !
diff --git a/test/zones/evpn/exitnode_local_routing/expected_controller_config b/test/zones/evpn/exitnode_local_routing/expected_controller_config
index f671b63..c557a7e 100644
--- a/test/zones/evpn/exitnode_local_routing/expected_controller_config
+++ b/test/zones/evpn/exitnode_local_routing/expected_controller_config
@@ -38,6 +38,7 @@ router bgp 65000 vrf vrf_myzone
 exit
 !
 route-map MAP_VTEP_IN deny 1
+ match evpn vni 1000
  match evpn route-type prefix
 exit
 !
diff --git a/test/zones/evpn/exitnode_snat/expected_controller_config b/test/zones/evpn/exitnode_snat/expected_controller_config
index 48830a3..2c3f19e 100644
--- a/test/zones/evpn/exitnode_snat/expected_controller_config
+++ b/test/zones/evpn/exitnode_snat/expected_controller_config
@@ -53,6 +53,7 @@ router bgp 65000 vrf vrf_myzone
 exit
 !
 route-map MAP_VTEP_IN deny 1
+ match evpn vni 1000
  match evpn route-type prefix
 exit
 !
-- 
2.30.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pve-devel] [PATCH pve-network 2/6] fix #4425: vxlan|evpn: add vxlan-port option
  2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 1/6] fix #4657 : evpn: fix exit-node with multiple vrf Alexandre Derumier
@ 2023-04-20 21:36 ` Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 3/6] fix #4662 : frr: fix config generation ordering Alexandre Derumier
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Derumier @ 2023-04-20 21:36 UTC (permalink / raw)
  To: pve-devel

Some users requested it as their physical network equipments
don't use standard vxlan port

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pve-devel] [PATCH pve-network 3/6] fix #4662 : frr: fix config generation ordering
  2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 1/6] fix #4657 : evpn: fix exit-node with multiple vrf Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 2/6] fix #4425: vxlan|evpn: add vxlan-port option Alexandre Derumier
@ 2023-04-20 21:36 ` Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 4/6] fix #4389 : evpn: exit nodes : null routes subnets from other zones Alexandre Derumier
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Derumier @ 2023-04-20 21:36 UTC (permalink / raw)
  To: pve-devel

vrf and router bgp vrf need to be ordered by vrf name

ip protocol need to be at the end

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/Network/SDN/Controllers/BgpPlugin.pm      |  2 +-
 PVE/Network/SDN/Controllers/EvpnPlugin.pm     | 67 ++++++++-------
 .../ebgp_loopback/expected_controller_config  |  3 +-
 .../expected_controller_config                |  3 +-
 .../multiplezones/expected_controller_config  | 49 +++++++++++
 .../multiplezones/expected_sdn_interfaces     | 81 +++++++++++++++++++
 test/zones/evpn/multiplezones/interfaces      |  7 ++
 test/zones/evpn/multiplezones/sdn_config      | 37 +++++++++
 8 files changed, 217 insertions(+), 32 deletions(-)
 create mode 100644 test/zones/evpn/multiplezones/expected_controller_config
 create mode 100644 test/zones/evpn/multiplezones/expected_sdn_interfaces
 create mode 100644 test/zones/evpn/multiplezones/interfaces
 create mode 100644 test/zones/evpn/multiplezones/sdn_config

diff --git a/PVE/Network/SDN/Controllers/BgpPlugin.pm b/PVE/Network/SDN/Controllers/BgpPlugin.pm
index 0b8cf1a..e001faa 100644
--- a/PVE/Network/SDN/Controllers/BgpPlugin.pm
+++ b/PVE/Network/SDN/Controllers/BgpPlugin.pm
@@ -119,7 +119,7 @@ sub generate_controller_config {
 
     if ($loopback) {
 	$config->{frr_prefix_list}->{loopbacks_ips}->{10} = "permit 0.0.0.0/0 le 32";
-	push(@{$config->{frr}->{''}}, "ip protocol bgp route-map correct_src");
+	push(@{$config->{frr_ip_protocol}}, "ip protocol bgp route-map correct_src");
 
 	my $routemap_config = ();
 	push @{$routemap_config}, "match ip address prefix-list loopbacks_ips";
diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 9d39b9b..1944178 100644
--- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -247,7 +247,7 @@ sub generate_controller_vnet_config {
 	my $cidr = $subnet->{cidr};
 	push @controller_config, "ip route $cidr 10.255.255.2 xvrf_$zoneid";
     }
-    push(@{$config->{frr}->{''}}, @controller_config);
+    push(@{$config->{frr_ip_protocol}}, @controller_config);
 }
 
 sub on_delete_hook {
@@ -291,41 +291,14 @@ sub find_bgp_controller {
 }
 
 
-sub sort_frr_config {
-    my $order = {};
-    $order->{''} = 0;
-    $order->{'vrf'} = 1;
-    $order->{'ipv4 unicast'} = 1;
-    $order->{'ipv6 unicast'} = 2;
-    $order->{'l2vpn evpn'} = 3;
-
-    my $a_val = 100;
-    my $b_val = 100;
-
-    $a_val = $order->{$a} if defined($order->{$a});
-    $b_val = $order->{$b} if defined($order->{$b});
-
-    if ($a =~ /bgp (\d+)$/) {
-	$a_val = 2;
-    }
-
-    if ($b =~ /bgp (\d+)$/) {
-	$b_val = 2;
-    }
-
-    return $a_val <=> $b_val;
-}
-
 sub generate_frr_recurse{
    my ($final_config, $content, $parentkey, $level) = @_;
 
    my $keylist = {};
-   $keylist->{vrf} = 1;
    $keylist->{'address-family'} = 1;
    $keylist->{router} = 1;
 
    my $exitkeylist = {};
-   $exitkeylist->{vrf} = 1;
    $exitkeylist->{'address-family'} = 1;
 
    my $simple_exitkeylist = {};
@@ -343,7 +316,8 @@ sub generate_frr_recurse{
    $padding = ' ' x ($paddinglevel) if $paddinglevel;
 
    if (ref $content eq  'HASH') {
-	foreach my $key (sort sort_frr_config keys %$content) {
+	foreach my $key (sort keys %$content) {
+	    next if $key eq 'vrf';
 	    if ($parentkey && defined($keylist->{$parentkey})) {
 		push @{$final_config}, $padding."!";
 		push @{$final_config}, $padding."$parentkey $key";
@@ -364,6 +338,39 @@ sub generate_frr_recurse{
     }
 }
 
+sub generate_frr_vrf {
+   my ($final_config, $vrfs) = @_;
+
+   return if !$vrfs;
+
+   my @config = ();
+
+   foreach my $id (sort keys %$vrfs) {
+	my $vrf = $vrfs->{$id};
+	push @config, "!";
+	push @config, "vrf $id";
+	foreach my $rule (@$vrf) {
+	    push @config, " $rule";
+
+	}
+	push @config, "exit-vrf";
+    }
+
+    push @{$final_config}, @config;
+}
+
+sub generate_frr_ip_protocol {
+   my ($final_config, $ips) = @_;
+
+   return if !$ips;
+
+   my @config = ();
+   push @{$final_config}, "!";
+   foreach my $rule (sort @$ips) {
+	push @{$final_config}, $rule;
+   }
+}
+
 sub generate_frr_routemap {
    my ($final_config, $routemaps) = @_;
 
@@ -422,10 +429,12 @@ sub generate_controller_rawconfig {
 	parse_merge_frr_local_config($config, $local_conf);
     }
 
+    generate_frr_vrf($final_config, $config->{frr}->{vrf});
     generate_frr_recurse($final_config, $config->{frr}, undef, 0);
     generate_frr_list($final_config, $config->{frr_access_list}, "access-list");
     generate_frr_list($final_config, $config->{frr_prefix_list}, "ip prefix-list");
     generate_frr_routemap($final_config, $config->{frr_routemap});
+    generate_frr_ip_protocol($final_config, $config->{frr_ip_protocol});
 
     push @{$final_config}, "!";
     push @{$final_config}, "line vty";
diff --git a/test/zones/evpn/ebgp_loopback/expected_controller_config b/test/zones/evpn/ebgp_loopback/expected_controller_config
index 548d532..47836f8 100644
--- a/test/zones/evpn/ebgp_loopback/expected_controller_config
+++ b/test/zones/evpn/ebgp_loopback/expected_controller_config
@@ -4,7 +4,6 @@ hostname localhost
 log syslog informational
 service integrated-vtysh-config
 !
-ip protocol bgp route-map correct_src
 !
 vrf vrf_myzone
  vni 1000
@@ -65,5 +64,7 @@ route-map correct_src permit 1
  set src 192.168.0.1
 exit
 !
+ip protocol bgp route-map correct_src
+!
 line vty
 !
\ No newline at end of file
diff --git a/test/zones/evpn/exitnode_local_routing/expected_controller_config b/test/zones/evpn/exitnode_local_routing/expected_controller_config
index c557a7e..ef3948d 100644
--- a/test/zones/evpn/exitnode_local_routing/expected_controller_config
+++ b/test/zones/evpn/exitnode_local_routing/expected_controller_config
@@ -4,7 +4,6 @@ hostname localhost
 log syslog informational
 service integrated-vtysh-config
 !
-ip route 10.0.0.0/24 10.255.255.2 xvrf_myzone
 !
 vrf vrf_myzone
  vni 1000
@@ -48,5 +47,7 @@ exit
 route-map MAP_VTEP_OUT permit 1
 exit
 !
+ip route 10.0.0.0/24 10.255.255.2 xvrf_myzone
+!
 line vty
 !
\ No newline at end of file
diff --git a/test/zones/evpn/multiplezones/expected_controller_config b/test/zones/evpn/multiplezones/expected_controller_config
new file mode 100644
index 0000000..d6dfa73
--- /dev/null
+++ b/test/zones/evpn/multiplezones/expected_controller_config
@@ -0,0 +1,49 @@
+frr version 8.2.2
+frr defaults datacenter
+hostname localhost
+log syslog informational
+service integrated-vtysh-config
+!
+!
+vrf vrf_myzone
+ vni 1000
+exit-vrf
+!
+vrf vrf_myzone2
+ vni 1001
+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
+!
+router bgp 65000 vrf vrf_myzone2
+ 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/multiplezones/expected_sdn_interfaces b/test/zones/evpn/multiplezones/expected_sdn_interfaces
new file mode 100644
index 0000000..e279b0a
--- /dev/null
+++ b/test/zones/evpn/multiplezones/expected_sdn_interfaces
@@ -0,0 +1,81 @@
+#version:1
+
+auto myvnet
+iface myvnet
+	address 10.0.0.1/24
+	bridge_ports vxlan_myvnet
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	ip-forward on
+	arp-accept on
+	vrf vrf_myzone
+
+auto myvnet2
+iface myvnet2
+	address 172.16.0.1/24
+	bridge_ports vxlan_myvnet2
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	ip-forward on
+	arp-accept on
+	vrf vrf_myzone2
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+
+auto vrf_myzone2
+iface vrf_myzone2
+	vrf-table auto
+	post-up ip route add vrf vrf_myzone2 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 vrfbr_myzone2
+iface vrfbr_myzone2
+	bridge-ports vrfvx_myzone2
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	vrf vrf_myzone2
+
+auto vrfvx_myzone
+iface vrfvx_myzone
+	vxlan-id 1000
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
+
+auto vrfvx_myzone2
+iface vrfvx_myzone2
+	vxlan-id 1001
+	vxlan-local-tunnelip 192.168.0.1
+	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
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
+
+auto vxlan_myvnet2
+iface vxlan_myvnet2
+	vxlan-id 101
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
diff --git a/test/zones/evpn/multiplezones/interfaces b/test/zones/evpn/multiplezones/interfaces
new file mode 100644
index 0000000..66bb826
--- /dev/null
+++ b/test/zones/evpn/multiplezones/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/multiplezones/sdn_config b/test/zones/evpn/multiplezones/sdn_config
new file mode 100644
index 0000000..6ffdfb9
--- /dev/null
+++ b/test/zones/evpn/multiplezones/sdn_config
@@ -0,0 +1,37 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                        myvnet2 => { tag => "101", type => "vnet", zone => "myzone2" },
+                      },
+             },
+
+  zones   => {
+		ids => { 
+			myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000 },
+			myzone2 => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1001 },
+		}
+             },
+  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',
+			},
+			'myzone2-172.16.0.0-24' => {
+			    'type' => 'subnet',
+			    'vnet' => 'myvnet2',
+			    'gateway' => '172.16.0.1',
+			},
+		}
+  }
+
+}
+
+
-- 
2.30.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pve-devel] [PATCH pve-network 4/6] fix #4389 : evpn: exit nodes : null routes subnets from other zones
  2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
                   ` (2 preceding siblings ...)
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 3/6] fix #4662 : frr: fix config generation ordering Alexandre Derumier
@ 2023-04-20 21:36 ` Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 5/6] fix #4683 : zones: qinq: fix vlan-protocol with bridge vlan aware Alexandre Derumier
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Derumier @ 2023-04-20 21:36 UTC (permalink / raw)
  To: pve-devel

We don't want to routes subnets betwen differents when same exit
node is used

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/Network/SDN/Controllers/EvpnPlugin.pm     | 15 ++-
 PVE/Network/SDN/Vnets.pm                      |  4 +-
 .../expected_controller_config                | 98 +++++++++++++++++++
 .../exitnodenullroute/expected_sdn_interfaces | 81 +++++++++++++++
 test/zones/evpn/exitnodenullroute/interfaces  |  7 ++
 test/zones/evpn/exitnodenullroute/sdn_config  | 42 ++++++++
 6 files changed, 242 insertions(+), 5 deletions(-)
 create mode 100644 test/zones/evpn/exitnodenullroute/expected_controller_config
 create mode 100644 test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
 create mode 100644 test/zones/evpn/exitnodenullroute/interfaces
 create mode 100644 test/zones/evpn/exitnodenullroute/sdn_config

diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 1944178..b1eb845 100644
--- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -144,10 +144,23 @@ sub generate_controller_zone_config {
     return if !$vrf || !$vrfvxlan || !$asn;
 
     my ($ifaceip, $interface) = PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback);
+    my $is_gateway = $exitnodes->{$local_node};
 
     # vrf
     my @controller_config = ();
     push @controller_config, "vni $vrfvxlan";
+    #avoid to routes between nodes through the exit nodes
+    #null routes subnets of other zones
+    if ($is_gateway) {
+	my $subnets = PVE::Network::SDN::Vnets::get_subnets();
+	foreach my $subnetid (sort keys %{$subnets}) {
+	    my $subnet = $subnets->{$subnetid};
+	    my $cidr = $subnet->{cidr};
+	    my $zone = $subnet->{zone};
+	    push @controller_config, "ip route $cidr null0" if $zone ne $id;
+	}
+    }
+
     push(@{$config->{frr}->{vrf}->{"$vrf"}}, @controller_config);
 
     #main vrf router
@@ -161,8 +174,6 @@ sub generate_controller_zone_config {
 	push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"l2vpn evpn"}}, "route-target export $autortas:$vrfvxlan");
     }
 
-    my $is_gateway = $exitnodes->{$local_node};
-
     if ($is_gateway) {
 
 	if (!$exitnodes_primary || $exitnodes_primary eq $local_node) {
diff --git a/PVE/Network/SDN/Vnets.pm b/PVE/Network/SDN/Vnets.pm
index 0b32c58..1106c9f 100644
--- a/PVE/Network/SDN/Vnets.pm
+++ b/PVE/Network/SDN/Vnets.pm
@@ -70,13 +70,11 @@ sub get_vnet {
 sub get_subnets {
     my ($vnetid) = @_;
 
-    return if !$vnetid;
-
     my $subnets = undef;
     my $subnets_cfg = PVE::Network::SDN::Subnets::config();
     foreach my $subnetid (sort keys %{$subnets_cfg->{ids}}) {
 	my $subnet = PVE::Network::SDN::Subnets::sdn_subnets_config($subnets_cfg, $subnetid);
-	next if !$subnet->{vnet} || $subnet->{vnet} ne $vnetid;
+	next if !$subnet->{vnet} || ($vnetid && $subnet->{vnet} ne $vnetid);
 	$subnets->{$subnetid} = $subnet;
     }
     return $subnets;
diff --git a/test/zones/evpn/exitnodenullroute/expected_controller_config b/test/zones/evpn/exitnodenullroute/expected_controller_config
new file mode 100644
index 0000000..f461f1e
--- /dev/null
+++ b/test/zones/evpn/exitnodenullroute/expected_controller_config
@@ -0,0 +1,98 @@
+frr version 8.2.2
+frr defaults datacenter
+hostname localhost
+log syslog informational
+service integrated-vtysh-config
+!
+!
+vrf vrf_myzone
+ vni 1000
+ ip route 172.16.0.0/24 null0
+ ip route 172.16.1.0/24 null0
+exit-vrf
+!
+vrf vrf_myzone2
+ vni 1001
+ ip route 10.0.0.0/24 null0
+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 ipv4 unicast
+  import vrf vrf_myzone
+  import vrf vrf_myzone2
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  import vrf vrf_myzone
+  import vrf vrf_myzone2
+ exit-address-family
+ !
+ 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
+ !
+ address-family ipv4 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  default-originate ipv4
+  default-originate ipv6
+ exit-address-family
+exit
+!
+router bgp 65000 vrf vrf_myzone2
+ bgp router-id 192.168.0.1
+ !
+ address-family ipv4 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  default-originate ipv4
+  default-originate ipv6
+ exit-address-family
+exit
+!
+route-map MAP_VTEP_IN deny 1
+ match evpn vni 1001
+ match evpn route-type prefix
+exit
+!
+route-map MAP_VTEP_IN deny 2
+ match evpn vni 1000
+ match evpn route-type prefix
+exit
+!
+route-map MAP_VTEP_IN permit 3
+exit
+!
+route-map MAP_VTEP_OUT permit 1
+exit
+!
+line vty
+!
\ No newline at end of file
diff --git a/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces b/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
new file mode 100644
index 0000000..b6d9c13
--- /dev/null
+++ b/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
@@ -0,0 +1,81 @@
+#version:1
+
+auto myvnet
+iface myvnet
+	address 10.0.0.1/24
+	bridge_ports vxlan_myvnet
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	ip-forward on
+	arp-accept on
+	vrf vrf_myzone
+
+auto myvnet2
+iface myvnet2
+	address 172.16.0.1/24
+	bridge_ports vxlan_myvnet2
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	ip-forward on
+	arp-accept on
+	vrf vrf_myzone2
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+
+auto vrf_myzone2
+iface vrf_myzone2
+	vrf-table auto
+	post-up ip route del vrf vrf_myzone2 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 vrfbr_myzone2
+iface vrfbr_myzone2
+	bridge-ports vrfvx_myzone2
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	vrf vrf_myzone2
+
+auto vrfvx_myzone
+iface vrfvx_myzone
+	vxlan-id 1000
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
+
+auto vrfvx_myzone2
+iface vrfvx_myzone2
+	vxlan-id 1001
+	vxlan-local-tunnelip 192.168.0.1
+	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
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
+
+auto vxlan_myvnet2
+iface vxlan_myvnet2
+	vxlan-id 101
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
diff --git a/test/zones/evpn/exitnodenullroute/interfaces b/test/zones/evpn/exitnodenullroute/interfaces
new file mode 100644
index 0000000..66bb826
--- /dev/null
+++ b/test/zones/evpn/exitnodenullroute/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/exitnodenullroute/sdn_config b/test/zones/evpn/exitnodenullroute/sdn_config
new file mode 100644
index 0000000..1060f83
--- /dev/null
+++ b/test/zones/evpn/exitnodenullroute/sdn_config
@@ -0,0 +1,42 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                        myvnet2 => { tag => "101", type => "vnet", zone => "myzone2" },
+                      },
+             },
+
+  zones   => {
+		ids => { 
+			myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, exitnodes => { 'localhost' => 1 } },
+			myzone2 => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1001, exitnodes => { 'localhost' => 1 } },
+		}
+             },
+  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',
+			},
+			'myzone2-172.16.0.0-24' => {
+			    'type' => 'subnet',
+			    'vnet' => 'myvnet2',
+			    'gateway' => '172.16.0.1',
+			},
+			'myzone2-172.16.1.0-24' => {
+			    'type' => 'subnet',
+			    'vnet' => 'myvnet2',
+			    'gateway' => '172.16.0.1',
+			},
+		}
+  }
+
+}
+
+
-- 
2.30.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pve-devel] [PATCH pve-network 5/6] fix #4683 : zones: qinq: fix vlan-protocol with bridge vlan aware
  2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
                   ` (3 preceding siblings ...)
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 4/6] fix #4389 : evpn: exit nodes : null routes subnets from other zones Alexandre Derumier
@ 2023-04-20 21:36 ` Alexandre Derumier
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 6/6] network reload: fix UPID parsing Alexandre Derumier
  2023-06-06  8:42 ` [pve-devel] applied: [PATCH pve-network 0/6] sdn multiples fixes Thomas Lamprecht
  6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Derumier @ 2023-04-20 21:36 UTC (permalink / raw)
  To: pve-devel

The tagged bridge interface need to also have to correct vlan-protocol

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/Network/SDN/Zones/QinQPlugin.pm                       | 8 ++++++--
 .../bridge_vlanaware_vlanprotocol/expected_sdn_interfaces | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm b/PVE/Network/SDN/Zones/QinQPlugin.pm
index f4d12bc..8b9de43 100644
--- a/PVE/Network/SDN/Zones/QinQPlugin.pm
+++ b/PVE/Network/SDN/Zones/QinQPlugin.pm
@@ -98,13 +98,17 @@ sub generate_sdn_config {
     } elsif ($vlan_aware) {
         # VLAN_aware_brige-(tag)----->vlanwarebridge-(tag)----->vnet
 
+	$zone_bridge_ports = "$bridge.$stag";
+
 	if ($vlanprotocol) {
 	    @iface_config = ();
 	    push @iface_config, "bridge-vlan-protocol $vlanprotocol";
 	    push(@{$config->{$bridge}}, @iface_config) if !$config->{$bridge};
-	}
 
-	$zone_bridge_ports = "$bridge.$stag";
+	    @iface_config = ();
+	    push @iface_config, "vlan-protocol $vlanprotocol";
+	    push(@{$config->{$zone_bridge_ports}}, @iface_config) if !$config->{$zone_bridge_ports};
+	}
 
     } else {
 	# eth--->eth.x(svlan)----->vlanwarebridge-(tag)----->vnet---->vnet
diff --git a/test/zones/qinq/bridge_vlanaware_vlanprotocol/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanaware_vlanprotocol/expected_sdn_interfaces
index 0bc301b..b24238f 100644
--- a/test/zones/qinq/bridge_vlanaware_vlanprotocol/expected_sdn_interfaces
+++ b/test/zones/qinq/bridge_vlanaware_vlanprotocol/expected_sdn_interfaces
@@ -20,6 +20,10 @@ auto vmbr0
 iface vmbr0
 	bridge-vlan-protocol 802.1ad
 
+auto vmbr0.10
+iface vmbr0.10
+	vlan-protocol 802.1ad
+
 auto z_myzone
 iface z_myzone
 	bridge-stp off
-- 
2.30.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pve-devel] [PATCH pve-network 6/6] network reload: fix UPID parsing
  2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
                   ` (4 preceding siblings ...)
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 5/6] fix #4683 : zones: qinq: fix vlan-protocol with bridge vlan aware Alexandre Derumier
@ 2023-04-20 21:36 ` Alexandre Derumier
  2023-06-06  8:42 ` [pve-devel] applied: [PATCH pve-network 0/6] sdn multiples fixes Thomas Lamprecht
  6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Derumier @ 2023-04-20 21:36 UTC (permalink / raw)
  To: pve-devel

When warning or error from ifreload are logged,
They are received in 1 line in result of pvesh,

so the UPID is not at the begin, and not correctly parse

and throw a warning:

Use of uninitialized value $upid in pattern match (m//) at /usr/share/perl5/PVE/Tools.pm line 1106.
Use of uninitialized value $upid in concatenation (.) or string at /usr/share/perl5/PVE/Tools.pm line 1120.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/API2/Network/SDN.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Network/SDN.pm b/PVE/API2/Network/SDN.pm
index f129d60..33ecfb7 100644
--- a/PVE/API2/Network/SDN.pm
+++ b/PVE/API2/Network/SDN.pm
@@ -86,9 +86,10 @@ my $create_reload_network_worker = sub {
 
     # FIXME: how to proxy to final node ?
     my $upid;
+    print "$nodename: reloading network config\n";
     run_command(['pvesh', 'set', "/nodes/$nodename/network"], outfunc => sub {
 	my $line = shift;
-	if ($line =~ /^["']?(UPID:[^\s"']+)["']?$/) {
+	if ($line =~ /["']?(UPID:[^\s"']+)["']?$/) {
 	    $upid = $1;
 	}
     });
-- 
2.30.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pve-devel] applied:  [PATCH pve-network 0/6] sdn multiples fixes
  2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
                   ` (5 preceding siblings ...)
  2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 6/6] network reload: fix UPID parsing Alexandre Derumier
@ 2023-06-06  8:42 ` Thomas Lamprecht
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Lamprecht @ 2023-06-06  8:42 UTC (permalink / raw)
  To: Proxmox VE development discussion, Alexandre Derumier

Am 20/04/2023 um 23:36 schrieb Alexandre Derumier:
> This is a resend of the 4 last patches for pve-network
> + 2 new patches
> 
> 
> Alexandre Derumier (6):
>   fix #4657 : evpn: fix exit-node with multiple vrf
>   fix #4425: vxlan|evpn: add vxlan-port option
>   fix #4662 : frr: fix config generation ordering
>   fix #4389 : evpn: exit nodes : null routes subnets from other zones
>   fix #4683 : zones: qinq: fix vlan-protocol with bridge vlan aware
>   network reload: fix UPID parsing
> 
>  PVE/API2/Network/SDN.pm                       |  3 +-
>  PVE/Network/SDN/Controllers/BgpPlugin.pm      |  2 +-
>  PVE/Network/SDN/Controllers/EvpnPlugin.pm     | 83 ++++++++++------
>  PVE/Network/SDN/Vnets.pm                      |  4 +-
>  PVE/Network/SDN/Zones/EvpnPlugin.pm           |  4 +
>  PVE/Network/SDN/Zones/QinQPlugin.pm           |  8 +-
>  PVE/Network/SDN/Zones/VxlanPlugin.pm          |  9 ++
>  .../ebgp_loopback/expected_controller_config  |  3 +-
>  .../evpn/exitnode/expected_controller_config  |  1 +
>  .../expected_controller_config                |  4 +-
>  .../exitnode_snat/expected_controller_config  |  1 +
>  .../expected_controller_config                | 98 +++++++++++++++++++
>  .../exitnodenullroute/expected_sdn_interfaces | 81 +++++++++++++++
>  test/zones/evpn/exitnodenullroute/interfaces  |  7 ++
>  test/zones/evpn/exitnodenullroute/sdn_config  | 42 ++++++++
>  .../multiplezones/expected_controller_config  | 49 ++++++++++
>  .../multiplezones/expected_sdn_interfaces     | 81 +++++++++++++++
>  test/zones/evpn/multiplezones/interfaces      |  7 ++
>  test/zones/evpn/multiplezones/sdn_config      | 37 +++++++
>  .../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 +++++
>  .../expected_sdn_interfaces                   |  4 +
>  .../vxlan/vxlanport/expected_sdn_interfaces   | 16 +++
>  test/zones/vxlan/vxlanport/interfaces         |  7 ++
>  test/zones/vxlan/vxlanport/sdn_config         | 11 +++
>  27 files changed, 640 insertions(+), 40 deletions(-)
>  create mode 100644 test/zones/evpn/exitnodenullroute/expected_controller_config
>  create mode 100644 test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
>  create mode 100644 test/zones/evpn/exitnodenullroute/interfaces
>  create mode 100644 test/zones/evpn/exitnodenullroute/sdn_config
>  create mode 100644 test/zones/evpn/multiplezones/expected_controller_config
>  create mode 100644 test/zones/evpn/multiplezones/expected_sdn_interfaces
>  create mode 100644 test/zones/evpn/multiplezones/interfaces
>  create mode 100644 test/zones/evpn/multiplezones/sdn_config
>  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
> 


applied, with `git am --directory=src <patches>`, as I separated packaging from source
recently, thanks!

ps. would be great to mock the access to CFS for the test system, otherwise building this
in isolated environments like via sbuild is broken (I just disabled tests there for now).




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-06  8:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 21:36 [pve-devel] [PATCH pve-network 0/6] sdn multiples fixes Alexandre Derumier
2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 1/6] fix #4657 : evpn: fix exit-node with multiple vrf Alexandre Derumier
2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 2/6] fix #4425: vxlan|evpn: add vxlan-port option Alexandre Derumier
2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 3/6] fix #4662 : frr: fix config generation ordering Alexandre Derumier
2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 4/6] fix #4389 : evpn: exit nodes : null routes subnets from other zones Alexandre Derumier
2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 5/6] fix #4683 : zones: qinq: fix vlan-protocol with bridge vlan aware Alexandre Derumier
2023-04-20 21:36 ` [pve-devel] [PATCH pve-network 6/6] network reload: fix UPID parsing Alexandre Derumier
2023-06-06  8:42 ` [pve-devel] applied: [PATCH pve-network 0/6] sdn multiples fixes Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal