]> git.proxmox.com Git - pve-network.git/commitdiff
add zones && controllers unit tests
authorAlexandre Derumier <aderumier@odiso.com>
Wed, 9 Dec 2020 15:11:19 +0000 (16:11 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Dec 2020 17:02:47 +0000 (18:02 +0100)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
86 files changed:
Makefile
test/Makefile [new file with mode: 0644]
test/debug/documentation.txt [new file with mode: 0644]
test/debug/generateconfig.pl [new file with mode: 0644]
test/debug/statuscheck.pl [new file with mode: 0644]
test/documentation.txt [deleted file]
test/generateconfig.pl [deleted file]
test/run_test_zones.pl [new file with mode: 0755]
test/statuscheck.pl [deleted file]
test/zones/evpn/ebgp/expected_controller_config [new file with mode: 0644]
test/zones/evpn/ebgp/expected_sdn_interfaces [new file with mode: 0644]
test/zones/evpn/ebgp/interfaces [new file with mode: 0644]
test/zones/evpn/ebgp/sdn_config [new file with mode: 0644]
test/zones/evpn/ebgp_loopback/expected_controller_config [new file with mode: 0644]
test/zones/evpn/ebgp_loopback/expected_sdn_interfaces [new file with mode: 0644]
test/zones/evpn/ebgp_loopback/interfaces [new file with mode: 0644]
test/zones/evpn/ebgp_loopback/sdn_config [new file with mode: 0644]
test/zones/evpn/exitnode/expected_controller_config [new file with mode: 0644]
test/zones/evpn/exitnode/expected_sdn_interfaces [new file with mode: 0644]
test/zones/evpn/exitnode/interfaces [new file with mode: 0644]
test/zones/evpn/exitnode/sdn_config [new file with mode: 0644]
test/zones/evpn/exitnode_snat/expected_controller_config [new file with mode: 0644]
test/zones/evpn/exitnode_snat/expected_sdn_interfaces [new file with mode: 0644]
test/zones/evpn/exitnode_snat/interfaces [new file with mode: 0644]
test/zones/evpn/exitnode_snat/sdn_config [new file with mode: 0644]
test/zones/evpn/ipv4/expected_controller_config [new file with mode: 0644]
test/zones/evpn/ipv4/expected_sdn_interfaces [new file with mode: 0644]
test/zones/evpn/ipv4/interfaces [new file with mode: 0644]
test/zones/evpn/ipv4/sdn_config [new file with mode: 0644]
test/zones/qinq/bridge/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/bridge/interfaces [new file with mode: 0644]
test/zones/qinq/bridge/sdn_config [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware/interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware/sdn_config [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware_vlanawarevnet/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware_vlanawarevnet/interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware_vlanawarevnet/sdn_config [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware_vlanprotocol/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware_vlanprotocol/interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanaware_vlanprotocol/sdn_config [new file with mode: 0644]
test/zones/qinq/bridge_vlanawarevnet/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanawarevnet/interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanawarevnet/sdn_config [new file with mode: 0644]
test/zones/qinq/bridge_vlanprotocol/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanprotocol/interfaces [new file with mode: 0644]
test/zones/qinq/bridge_vlanprotocol/sdn_config [new file with mode: 0644]
test/zones/qinq/ovs/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/ovs/interfaces [new file with mode: 0644]
test/zones/qinq/ovs/sdn_config [new file with mode: 0644]
test/zones/qinq/ovs_vlanawarevnet/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/ovs_vlanawarevnet/interfaces [new file with mode: 0644]
test/zones/qinq/ovs_vlanawarevnet/sdn_config [new file with mode: 0644]
test/zones/qinq/ovs_vlanprotocol/expected_sdn_interfaces [new file with mode: 0644]
test/zones/qinq/ovs_vlanprotocol/interfaces [new file with mode: 0644]
test/zones/qinq/ovs_vlanprotocol/sdn_config [new file with mode: 0644]
test/zones/simple/basic/expected_sdn_interfaces [new file with mode: 0644]
test/zones/simple/basic/interfaces [new file with mode: 0644]
test/zones/simple/basic/sdn_config [new file with mode: 0644]
test/zones/simple/ipv4/expected_sdn_interfaces [new file with mode: 0644]
test/zones/simple/ipv4/interfaces [new file with mode: 0644]
test/zones/simple/ipv4/sdn_config [new file with mode: 0644]
test/zones/simple/ipv4snat/expected_sdn_interfaces [new file with mode: 0644]
test/zones/simple/ipv4snat/interfaces [new file with mode: 0644]
test/zones/simple/ipv4snat/sdn_config [new file with mode: 0644]
test/zones/vlan/bridge/expected_sdn_interfaces [new file with mode: 0644]
test/zones/vlan/bridge/interfaces [new file with mode: 0644]
test/zones/vlan/bridge/sdn_config [new file with mode: 0644]
test/zones/vlan/bridge_vlanaware/expected_sdn_interfaces [new file with mode: 0644]
test/zones/vlan/bridge_vlanaware/interfaces [new file with mode: 0644]
test/zones/vlan/bridge_vlanaware/sdn_config [new file with mode: 0644]
test/zones/vlan/bridge_vlanaware_vlanawarevnet/expected_sdn_interfaces [new file with mode: 0644]
test/zones/vlan/bridge_vlanaware_vlanawarevnet/interfaces [new file with mode: 0644]
test/zones/vlan/bridge_vlanaware_vlanawarevnet/sdn_config [new file with mode: 0644]
test/zones/vlan/ovs/expected_sdn_interfaces [new file with mode: 0644]
test/zones/vlan/ovs/interfaces [new file with mode: 0644]
test/zones/vlan/ovs/sdn_config [new file with mode: 0644]
test/zones/vlan/ovs_vlanware_vnet/expected_sdn_interfaces [new file with mode: 0644]
test/zones/vlan/ovs_vlanware_vnet/interfaces [new file with mode: 0644]
test/zones/vlan/ovs_vlanware_vnet/sdn_config [new file with mode: 0644]
test/zones/vxlan/basic/expected_sdn_interfaces [new file with mode: 0644]
test/zones/vxlan/basic/interfaces [new file with mode: 0644]
test/zones/vxlan/basic/sdn_config [new file with mode: 0644]
test/zones/vxlan/vlanawarevnet/expected_sdn_interfaces [new file with mode: 0644]
test/zones/vxlan/vlanawarevnet/interfaces [new file with mode: 0644]
test/zones/vxlan/vlanawarevnet/sdn_config [new file with mode: 0644]

index fb402e580ba10902f98033fd057a64bd5b6d4003..a162c114afd979bb7a1dcd961f9cde3cccde5f4f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,9 +37,9 @@ distclean: clean
 clean:
        rm -rf *~ *.deb *.changes ${PACKAGE}-* *.buildinfo *.dsc *.tar.gz
 
-.PHONY: check
-check:
-       $(MAKE) -C test check
+.PHONY: test
+test:
+       $(MAKE) -C test
 
 .PHONY: install
 install:
diff --git a/test/Makefile b/test/Makefile
new file mode 100644 (file)
index 0000000..b8e5de1
--- /dev/null
@@ -0,0 +1,6 @@
+all: test
+
+test: test_zones
+
+test_zones: run_test_zones.pl
+       ./run_test_zones.pl
diff --git a/test/debug/documentation.txt b/test/debug/documentation.txt
new file mode 100644 (file)
index 0000000..6ee8ee6
--- /dev/null
@@ -0,0 +1,102 @@
+Here a sample of command with pvesh to manage the sdn.
+
+
+#create a vlan transportzone
+pvesh create /cluster/sdn/zones/ --zone vlanzone --type vlan --ipam pve --bridge vmbr0
+#create a vnet on vlanzone
+pvesh create /cluster/sdn/vnets/ --vnet vnet100 --type vnet --zone vlanzone --tag 100
+#create a subnet on vlanzone
+pvesh create /cluster/sdn/vnets/vnet100/subnets/ --type subnet --subnet 192.168.0.0/24 --gateway 192.168.0.1
+
+
+#create a layer2 vxlan unicast transportzone
+pvesh create /cluster/sdn/zones/ --zone vxlanunicastzone --type vxlan --ipam pve --peers 192.168.0.1,192.168.0.2,192.168.0.3
+
+#create an evpn controller
+pvesh create /cluster/sdn/controllers/ --controller evpn1 --type evpn --peers 192.168.0.1,192.168.0.2,192.168.0.3 --asn 1234
+
+#add a ebgp peer
+pvesh create /cluster/sdn/controllers/ --controller bgp1 --type bgp --peers 192.168.0.253,192.168.0.254 --asn 1234 --ebgp --node pxnode1
+
+#create a layer2 vxlan bgpevpn transportzone
+pvesh create /cluster/sdn/zones/ --zone layer2evpnzone --type evpn --ipam pve --controller evpn1
+
+#create a layer3 routable vxlan bgpevpn transportzone + exit-nodes
+pvesh create /cluster/sdn/zones/ --zone layer3evpnzone --type evpn --ipam pve --controller evpn1 --vrf-vxlan 4000 --exit-nodes pxnode1,pxnode2
+
+
+
+#create a vnet in the transportzone
+pvesh create /cluster/sdn/vnets/ --vnet vnet10 --type vnet --zone vlanzone --tag 10
+
+#create a vnet in the transportzone with subnets for evpn routing
+pvesh create /cluster/sdn/vnets/ --vnet vnet11 --type vnet --zone layer3evpnzone --tag 11 --mac c8:1f:66:f8:62:8d
+pvesh create /cluster/sdn/vnets/vnet11/subnets/ --type subnet --subnet 10.0.0.0/24 --gateway 10.0.0.1
+pvesh create /cluster/sdn/vnets/ --vnet vnet12 --type vnet --zone layer3evpnzone --tag 12 --mac c8:1f:66:f8:62:8e
+pvesh create /cluster/sdn/vnets/vnet11/subnets/ --type subnet --subnet 10.0.1.0/24 --gateway 10.0.1.1
+
+#display running configuration
+pvesh get /cluster/sdn/vnets --running
+pvesh get /cluster/sdn/zones --running
+pvesh get /cluster/sdn/controllers --running
+pvesh get /cluster/sdn/vnets/vnetX/subnets --running
+
+
+#display pending configuration
+pvesh get /cluster/sdn/vnets --pending
+pvesh get /cluster/sdn/zones --pending
+pvesh get /cluster/sdn/controllers --pending
+pvesh get /cluster/sdn/vnets/vnetX/subnets --pending
+
+
+#apply changes from /etc/pve/sdn.cfg.new to /etc/pve/sdn.cfg
+pvesh set /cluster/sdn
+
+
+#generate local /etc/network/interfaces.d/sdn  and reload  (need to be called on each node)
+ pvesh set /nodes/<node>/network
+
+
+display transporzone status on all cluster nodes
+#pvesh get /cluster/resources    
+┌────────────────────────────────────┬─────────┬───────┬───────────┬─────────┬───────┬────────┬─────────────┬────────────┬────────────┬───────────────┬──────┬───────────┬──────────────┬────────────────┐
+│ id                                 │ type    │   cpu │ disk      │ hastate │ level │ maxcpu │     maxdisk │     maxmem │ mem        │ node          │ pool │ status    │ storage      │         uptime │
+│ sdn/node1/transportzone10          │ sdn     │       │           │         │       │        │             │            │            │ kvmformation1 │      │ error     │              │                │
+├────────────────────────────────────┼─────────┼───────┼───────────┼─────────┼───────┼────────┼─────────────┼────────────┼────────────┼───────────────┼──────┼───────────┼──────────────┼────────────────┤
+│ sdn/node1/zone1                    │ sdn     │       │           │         │       │        │             │            │            │ node1         │      │ available │              │                │
+├────────────────────────────────────┼─────────┼───────┼───────────┼─────────┼───────┼────────┼─────────────┼────────────┼────────────┼───────────────┼──────┼───────────┼──────────────┼────────────────┤
+│ sdn/node1/zone4                    │ sdn     │       │           │         │       │        │             │            │            │ node1         │      │ available │              │                │
+├────────────────────────────────────┼─────────┼───────┼───────────┼─────────┼───────┼────────┼─────────────┼────────────┼────────────┼───────────────┼──────┼───────────┼──────────────┼────────────────┤
+
+
+
+
+#list all transport zones of a node
+
+pvesh get /nodes/<node>/sdn/zones/
+    ┌─────────────────┬───────────┐
+    │ sdn             │ status    │
+    ├─────────────────┼───────────┤
+    │ transportzone10 │ error     │
+    ├─────────────────┼───────────┤
+    │ zone1           │ available │
+    ├─────────────────┼───────────┤
+    │ zone4           │ available │
+    └─────────────────┴───────────┘
+
+
+#list all vnet status from a node transportzone
+
+pveset get /nodes/<node>/sdn/zones/<transportzone>/content
+    
+    ┌─────────┬────────┐
+    │ vnet    │ status │
+    ├─────────┼────────┤
+    │ vnet100 │ error  │
+    ├─────────┼────────┤
+    │ vnet101 │ error  │
+    └─────────┴────────┘
+
+
+
+
diff --git a/test/debug/generateconfig.pl b/test/debug/generateconfig.pl
new file mode 100644 (file)
index 0000000..250db43
--- /dev/null
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+use File::Copy;
+use PVE::Cluster qw(cfs_read_file);
+
+use PVE::Network::SDN;
+use PVE::Network::SDN::Zones;
+use PVE::Network::SDN::Controllers;
+use Data::Dumper;
+
+PVE::Network::SDN::commit_config();
+my $network_config = PVE::Network::SDN::Zones::generate_etc_network_config();
+
+PVE::Network::SDN::Zones::write_etc_network_config($network_config);
+print "/etc/network/interfaces.d/sdn\n";
+print $network_config;
+print "\n";
+
+my $controller_config = PVE::Network::SDN::Controllers::generate_controller_config();
+
+if ($controller_config) {
+    print Dumper($controller_config);
+    PVE::Network::SDN::Controllers::write_controller_config($controller_config);
+}
diff --git a/test/debug/statuscheck.pl b/test/debug/statuscheck.pl
new file mode 100644 (file)
index 0000000..e43003b
--- /dev/null
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use PVE::Network::SDN;
+use Data::Dumper;
+
+my ($transport_status, $vnet_status) = PVE::Network::SDN::status();
+
+print Dumper($vnet_status);
+print Dumper($transport_status);
diff --git a/test/documentation.txt b/test/documentation.txt
deleted file mode 100644 (file)
index 6ee8ee6..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-Here a sample of command with pvesh to manage the sdn.
-
-
-#create a vlan transportzone
-pvesh create /cluster/sdn/zones/ --zone vlanzone --type vlan --ipam pve --bridge vmbr0
-#create a vnet on vlanzone
-pvesh create /cluster/sdn/vnets/ --vnet vnet100 --type vnet --zone vlanzone --tag 100
-#create a subnet on vlanzone
-pvesh create /cluster/sdn/vnets/vnet100/subnets/ --type subnet --subnet 192.168.0.0/24 --gateway 192.168.0.1
-
-
-#create a layer2 vxlan unicast transportzone
-pvesh create /cluster/sdn/zones/ --zone vxlanunicastzone --type vxlan --ipam pve --peers 192.168.0.1,192.168.0.2,192.168.0.3
-
-#create an evpn controller
-pvesh create /cluster/sdn/controllers/ --controller evpn1 --type evpn --peers 192.168.0.1,192.168.0.2,192.168.0.3 --asn 1234
-
-#add a ebgp peer
-pvesh create /cluster/sdn/controllers/ --controller bgp1 --type bgp --peers 192.168.0.253,192.168.0.254 --asn 1234 --ebgp --node pxnode1
-
-#create a layer2 vxlan bgpevpn transportzone
-pvesh create /cluster/sdn/zones/ --zone layer2evpnzone --type evpn --ipam pve --controller evpn1
-
-#create a layer3 routable vxlan bgpevpn transportzone + exit-nodes
-pvesh create /cluster/sdn/zones/ --zone layer3evpnzone --type evpn --ipam pve --controller evpn1 --vrf-vxlan 4000 --exit-nodes pxnode1,pxnode2
-
-
-
-#create a vnet in the transportzone
-pvesh create /cluster/sdn/vnets/ --vnet vnet10 --type vnet --zone vlanzone --tag 10
-
-#create a vnet in the transportzone with subnets for evpn routing
-pvesh create /cluster/sdn/vnets/ --vnet vnet11 --type vnet --zone layer3evpnzone --tag 11 --mac c8:1f:66:f8:62:8d
-pvesh create /cluster/sdn/vnets/vnet11/subnets/ --type subnet --subnet 10.0.0.0/24 --gateway 10.0.0.1
-pvesh create /cluster/sdn/vnets/ --vnet vnet12 --type vnet --zone layer3evpnzone --tag 12 --mac c8:1f:66:f8:62:8e
-pvesh create /cluster/sdn/vnets/vnet11/subnets/ --type subnet --subnet 10.0.1.0/24 --gateway 10.0.1.1
-
-#display running configuration
-pvesh get /cluster/sdn/vnets --running
-pvesh get /cluster/sdn/zones --running
-pvesh get /cluster/sdn/controllers --running
-pvesh get /cluster/sdn/vnets/vnetX/subnets --running
-
-
-#display pending configuration
-pvesh get /cluster/sdn/vnets --pending
-pvesh get /cluster/sdn/zones --pending
-pvesh get /cluster/sdn/controllers --pending
-pvesh get /cluster/sdn/vnets/vnetX/subnets --pending
-
-
-#apply changes from /etc/pve/sdn.cfg.new to /etc/pve/sdn.cfg
-pvesh set /cluster/sdn
-
-
-#generate local /etc/network/interfaces.d/sdn  and reload  (need to be called on each node)
- pvesh set /nodes/<node>/network
-
-
-display transporzone status on all cluster nodes
-#pvesh get /cluster/resources    
-┌────────────────────────────────────┬─────────┬───────┬───────────┬─────────┬───────┬────────┬─────────────┬────────────┬────────────┬───────────────┬──────┬───────────┬──────────────┬────────────────┐
-│ id                                 │ type    │   cpu │ disk      │ hastate │ level │ maxcpu │     maxdisk │     maxmem │ mem        │ node          │ pool │ status    │ storage      │         uptime │
-│ sdn/node1/transportzone10          │ sdn     │       │           │         │       │        │             │            │            │ kvmformation1 │      │ error     │              │                │
-├────────────────────────────────────┼─────────┼───────┼───────────┼─────────┼───────┼────────┼─────────────┼────────────┼────────────┼───────────────┼──────┼───────────┼──────────────┼────────────────┤
-│ sdn/node1/zone1                    │ sdn     │       │           │         │       │        │             │            │            │ node1         │      │ available │              │                │
-├────────────────────────────────────┼─────────┼───────┼───────────┼─────────┼───────┼────────┼─────────────┼────────────┼────────────┼───────────────┼──────┼───────────┼──────────────┼────────────────┤
-│ sdn/node1/zone4                    │ sdn     │       │           │         │       │        │             │            │            │ node1         │      │ available │              │                │
-├────────────────────────────────────┼─────────┼───────┼───────────┼─────────┼───────┼────────┼─────────────┼────────────┼────────────┼───────────────┼──────┼───────────┼──────────────┼────────────────┤
-
-
-
-
-#list all transport zones of a node
-
-pvesh get /nodes/<node>/sdn/zones/
-    ┌─────────────────┬───────────┐
-    │ sdn             │ status    │
-    ├─────────────────┼───────────┤
-    │ transportzone10 │ error     │
-    ├─────────────────┼───────────┤
-    │ zone1           │ available │
-    ├─────────────────┼───────────┤
-    │ zone4           │ available │
-    └─────────────────┴───────────┘
-
-
-#list all vnet status from a node transportzone
-
-pveset get /nodes/<node>/sdn/zones/<transportzone>/content
-    
-    ┌─────────┬────────┐
-    │ vnet    │ status │
-    ├─────────┼────────┤
-    │ vnet100 │ error  │
-    ├─────────┼────────┤
-    │ vnet101 │ error  │
-    └─────────┴────────┘
-
-
-
-
diff --git a/test/generateconfig.pl b/test/generateconfig.pl
deleted file mode 100644 (file)
index 250db43..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-use strict;
-use warnings;
-use File::Copy;
-use PVE::Cluster qw(cfs_read_file);
-
-use PVE::Network::SDN;
-use PVE::Network::SDN::Zones;
-use PVE::Network::SDN::Controllers;
-use Data::Dumper;
-
-PVE::Network::SDN::commit_config();
-my $network_config = PVE::Network::SDN::Zones::generate_etc_network_config();
-
-PVE::Network::SDN::Zones::write_etc_network_config($network_config);
-print "/etc/network/interfaces.d/sdn\n";
-print $network_config;
-print "\n";
-
-my $controller_config = PVE::Network::SDN::Controllers::generate_controller_config();
-
-if ($controller_config) {
-    print Dumper($controller_config);
-    PVE::Network::SDN::Controllers::write_controller_config($controller_config);
-}
diff --git a/test/run_test_zones.pl b/test/run_test_zones.pl
new file mode 100755 (executable)
index 0000000..71ead61
--- /dev/null
@@ -0,0 +1,124 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use lib qw(..);
+use File::Slurp;
+
+use Test::More;
+use Test::MockModule;
+
+use PVE::Network::SDN;
+use PVE::Network::SDN::Zones;
+use PVE::Network::SDN::Controllers;
+use PVE::INotify;
+
+sub read_sdn_config {
+    my ($file) = @_;
+
+    # Read structure back in again
+    open my $in, '<', $file or die $!;
+    my $sdn_config;
+    {
+       local $/;    # slurp mode
+       $sdn_config = eval <$in>;
+    }
+    close $in;
+
+    return $sdn_config;
+}
+
+
+my @tests = grep { -d } glob './zones/*/*';
+
+foreach my $test (@tests) {
+
+    my $sdn_config = read_sdn_config ("./$test/sdn_config");
+
+    open my $fh1, '<', "./$test/interfaces" or die "can't read interfaces file";
+    my $interfaces_config = PVE::INotify::__read_etc_network_interfaces($fh1, undef, undef);
+    close $fh1;
+
+    my $pve_common_inotify;
+    $pve_common_inotify = Test::MockModule->new('PVE::INotify');
+    $pve_common_inotify->mock(
+       nodename => sub {
+           return 'localhost';
+       },
+       read_file => sub {
+           return $interfaces_config;
+       },
+    );
+
+    my $pve_sdn_subnets;
+    $pve_sdn_subnets = Test::MockModule->new('PVE::Network::SDN::Subnets');
+    $pve_sdn_subnets->mock(
+       config => sub {
+           return $sdn_config->{subnets};
+       },
+    );
+
+    my $pve_sdn_zones_plugin;
+    $pve_sdn_zones_plugin = Test::MockModule->new('PVE::Network::SDN::Zones::Plugin');
+    $pve_sdn_zones_plugin->mock(
+       get_local_route_ip => sub {
+           my $outiface = "vmbr0";
+           my $outip = $interfaces_config->{ifaces}->{$outiface}->{address};
+           return ($outip, $outiface);
+       },
+       is_vlanaware => sub {
+           return $interfaces_config->{ifaces}->{vmbr0}->{'bridge_vlan_aware'};
+       },
+       is_ovs => sub {
+           return 1 if $interfaces_config->{ifaces}->{vmbr0}->{'type'} eq 'OVSBridge';
+       },
+       get_bridge_ifaces => sub {
+           return ('eth0');
+       },
+       find_bridge => sub {
+           return;
+       }
+    );
+
+    my $sdn_module = Test::MockModule->new("PVE::Network::SDN");
+    $sdn_module->mock(
+       config => sub {
+           return $sdn_config;
+       },
+    );
+
+    my $name = $test;
+    my $expected = read_file("./$test/expected_sdn_interfaces");
+
+    my $result = "";
+    eval { 
+       $result = PVE::Network::SDN::Zones::generate_etc_network_config();
+    };
+
+    if (my $err = $@) {
+       fail($name);
+    } else {
+       is ($result, $expected, $name);
+    }
+
+    if ($sdn_config->{controllers}) {
+       my $expected = read_file("./$test/expected_controller_config");
+       my $controller_rawconfig = "";
+
+       eval { 
+           my $config = PVE::Network::SDN::Controllers::generate_controller_config();
+           $controller_rawconfig = PVE::Network::SDN::Controllers::generate_controller_rawconfig($config);
+       };
+
+       if (my $err = $@) {
+           fail($name);
+       } else {
+           is ($controller_rawconfig, $expected, $name);
+       }
+    }
+}
+
+done_testing();
+
+
diff --git a/test/statuscheck.pl b/test/statuscheck.pl
deleted file mode 100644 (file)
index e43003b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-use strict;
-use warnings;
-use PVE::Network::SDN;
-use Data::Dumper;
-
-my ($transport_status, $vnet_status) = PVE::Network::SDN::status();
-
-print Dumper($vnet_status);
-print Dumper($transport_status);
diff --git a/test/zones/evpn/ebgp/expected_controller_config b/test/zones/evpn/ebgp/expected_controller_config
new file mode 100644 (file)
index 0000000..4c42012
--- /dev/null
@@ -0,0 +1,49 @@
+log syslog informational
+ip forwarding
+ipv6 forwarding
+frr defaults datacenter
+service integrated-vtysh-config
+hostname localhost
+!
+!
+vrf vrf_myzone
+ vni 1000
+exit-vrf
+!
+router bgp 65001
+ bgp router-id 192.168.0.1
+ no bgp default ipv4-unicast
+ coalesce-time 1000
+ neighbor VTEP peer-group
+ neighbor VTEP remote-as external
+ neighbor VTEP bfd
+ neighbor 192.168.0.2 peer-group VTEP
+ neighbor 192.168.0.3 peer-group VTEP
+ no bgp ebgp-requires-policy
+ neighbor BGP peer-group
+ neighbor BGP remote-as external
+ neighbor BGP bfd
+ neighbor 192.168.0.252 peer-group BGP
+ neighbor 192.168.0.253 peer-group BGP
+ !
+ address-family ipv4 unicast
+  neighbor BGP activate
+  neighbor BGP soft-reconfiguration inbound
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  neighbor VTEP activate
+  advertise-all-vni
+  autort as 65000
+ exit-address-family
+!
+router bgp 65001 vrf vrf_myzone
+ no bgp ebgp-requires-policy
+ !
+ address-family l2vpn evpn
+  route-target import 65000:1000
+  route-target export 65000:1000
+ exit-address-family
+!
+line vty
+!
\ No newline at end of file
diff --git a/test/zones/evpn/ebgp/expected_sdn_interfaces b/test/zones/evpn/ebgp/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..799dcb7
--- /dev/null
@@ -0,0 +1,38 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       address 10.0.0.1/24
+       bridge_ports vxlan_myvnet
+       bridge_stp off
+       bridge_fd 0
+       mtu 1450
+       vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+       vrf-table auto
+
+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
+       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
diff --git a/test/zones/evpn/ebgp/interfaces b/test/zones/evpn/ebgp/interfaces
new file mode 100644 (file)
index 0000000..66bb826
--- /dev/null
@@ -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/ebgp/sdn_config b/test/zones/evpn/ebgp/sdn_config
new file mode 100644 (file)
index 0000000..379dc14
--- /dev/null
@@ -0,0 +1,29 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                      },
+             },
+
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000 } },
+             },
+  controllers  => {
+               ids => { 
+                       evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" },
+                       localhost => { type => "bgp", 'peers' => '192.168.0.252,192.168.0.253', ebgp => "1", asn => "65001", node => "localhost" },
+                     },
+             },
+
+  subnets => {
+              ids => { 'myzone-10.0.0.0-24' => {
+                                                       'type' => 'subnet',
+                                                       'vnet' => 'myvnet',
+                                                       'gateway' => '10.0.0.1',
+                                                 }
+                    }
+            }
+}
+
+
diff --git a/test/zones/evpn/ebgp_loopback/expected_controller_config b/test/zones/evpn/ebgp_loopback/expected_controller_config
new file mode 100644 (file)
index 0000000..23be7f9
--- /dev/null
@@ -0,0 +1,53 @@
+log syslog informational
+ip forwarding
+ipv6 forwarding
+frr defaults datacenter
+service integrated-vtysh-config
+hostname localhost
+!
+!
+vrf vrf_myzone
+ vni 1000
+exit-vrf
+!
+router bgp 65001
+ bgp router-id 192.168.0.1
+ no bgp default ipv4-unicast
+ coalesce-time 1000
+ neighbor VTEP peer-group
+ neighbor VTEP remote-as external
+ neighbor VTEP bfd
+ neighbor VTEP ebgp-multihop 10
+ neighbor VTEP update-source dummy1
+ neighbor 192.168.0.2 peer-group VTEP
+ neighbor 192.168.0.3 peer-group VTEP
+ no bgp ebgp-requires-policy
+ bgp disable-ebgp-connected-route-check
+ neighbor BGP peer-group
+ neighbor BGP remote-as external
+ neighbor BGP bfd
+ neighbor 172.16.0.254 peer-group BGP
+ neighbor 172.17.0.254 peer-group BGP
+ !
+ address-family ipv4 unicast
+  network 192.168.0.1/32
+  neighbor BGP activate
+  neighbor BGP soft-reconfiguration inbound
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  neighbor VTEP activate
+  advertise-all-vni
+  autort as 65000
+ exit-address-family
+!
+router bgp 65001 vrf vrf_myzone
+ no bgp ebgp-requires-policy
+ !
+ address-family l2vpn evpn
+  route-target import 65000:1000
+  route-target export 65000:1000
+ exit-address-family
+!
+line vty
+!
\ No newline at end of file
diff --git a/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces b/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..799dcb7
--- /dev/null
@@ -0,0 +1,38 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       address 10.0.0.1/24
+       bridge_ports vxlan_myvnet
+       bridge_stp off
+       bridge_fd 0
+       mtu 1450
+       vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+       vrf-table auto
+
+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
+       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
diff --git a/test/zones/evpn/ebgp_loopback/interfaces b/test/zones/evpn/ebgp_loopback/interfaces
new file mode 100644 (file)
index 0000000..f6bc352
--- /dev/null
@@ -0,0 +1,13 @@
+auto eth0
+iface eth0 inet static
+       address 172.16.0.1/24
+
+auto eth1
+iface eth1 inet static
+       address 172.17.0.1/24
+
+auto dummy1
+iface dummy1 inet static
+        address 192.168.0.1/32
+        link-type dummy
+
diff --git a/test/zones/evpn/ebgp_loopback/sdn_config b/test/zones/evpn/ebgp_loopback/sdn_config
new file mode 100644 (file)
index 0000000..c8bc2e0
--- /dev/null
@@ -0,0 +1,29 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                      },
+             },
+
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000 } },
+             },
+  controllers  => {
+               ids => { 
+                       evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" },
+                       localhost => { type => "bgp", 'peers' => '172.16.0.254,172.17.0.254', ebgp => "1", asn => "65001", loopback => 'dummy1', node => "localhost" },
+                     },
+             },
+
+  subnets => {
+              ids => { 'myzone-10.0.0.0-24' => {
+                                                       'type' => 'subnet',
+                                                       'vnet' => 'myvnet',
+                                                       'gateway' => '10.0.0.1',
+                                                 }
+                    }
+            }
+}
+
+
diff --git a/test/zones/evpn/exitnode/expected_controller_config b/test/zones/evpn/exitnode/expected_controller_config
new file mode 100644 (file)
index 0000000..57ff6ff
--- /dev/null
@@ -0,0 +1,52 @@
+log syslog informational
+ip forwarding
+ipv6 forwarding
+frr defaults datacenter
+service integrated-vtysh-config
+hostname localhost
+!
+!
+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 ipv4 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  neighbor VTEP activate
+  advertise-all-vni
+ exit-address-family
+!
+router bgp 65000 vrf vrf_myzone
+ !
+ 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
+!
+line vty
+!
\ No newline at end of file
diff --git a/test/zones/evpn/exitnode/expected_sdn_interfaces b/test/zones/evpn/exitnode/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..799dcb7
--- /dev/null
@@ -0,0 +1,38 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       address 10.0.0.1/24
+       bridge_ports vxlan_myvnet
+       bridge_stp off
+       bridge_fd 0
+       mtu 1450
+       vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+       vrf-table auto
+
+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
+       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
diff --git a/test/zones/evpn/exitnode/interfaces b/test/zones/evpn/exitnode/interfaces
new file mode 100644 (file)
index 0000000..66bb826
--- /dev/null
@@ -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/exitnode/sdn_config b/test/zones/evpn/exitnode/sdn_config
new file mode 100644 (file)
index 0000000..fd81817
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                      },
+             },
+
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, 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',
+                                                 }
+                    }
+            }
+}
+
+
diff --git a/test/zones/evpn/exitnode_snat/expected_controller_config b/test/zones/evpn/exitnode_snat/expected_controller_config
new file mode 100644 (file)
index 0000000..57ff6ff
--- /dev/null
@@ -0,0 +1,52 @@
+log syslog informational
+ip forwarding
+ipv6 forwarding
+frr defaults datacenter
+service integrated-vtysh-config
+hostname localhost
+!
+!
+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 ipv4 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  neighbor VTEP activate
+  advertise-all-vni
+ exit-address-family
+!
+router bgp 65000 vrf vrf_myzone
+ !
+ 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
+!
+line vty
+!
\ No newline at end of file
diff --git a/test/zones/evpn/exitnode_snat/expected_sdn_interfaces b/test/zones/evpn/exitnode_snat/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..b364a58
--- /dev/null
@@ -0,0 +1,42 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       address 10.0.0.1/24
+       post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j SNAT --to-source 192.168.0.1
+       post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j SNAT --to-source 192.168.0.1
+       post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+       post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+       bridge_ports vxlan_myvnet
+       bridge_stp off
+       bridge_fd 0
+       mtu 1450
+       vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+       vrf-table auto
+
+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
+       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
diff --git a/test/zones/evpn/exitnode_snat/interfaces b/test/zones/evpn/exitnode_snat/interfaces
new file mode 100644 (file)
index 0000000..66bb826
--- /dev/null
@@ -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/exitnode_snat/sdn_config b/test/zones/evpn/exitnode_snat/sdn_config
new file mode 100644 (file)
index 0000000..f40e8bd
--- /dev/null
@@ -0,0 +1,27 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                      },
+             },
+
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, 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',
+                                                       'snat' => 1
+                                                 }
+                    }
+            }
+}
+
+
diff --git a/test/zones/evpn/ipv4/expected_controller_config b/test/zones/evpn/ipv4/expected_controller_config
new file mode 100644 (file)
index 0000000..c0ca898
--- /dev/null
@@ -0,0 +1,31 @@
+log syslog informational
+ip forwarding
+ipv6 forwarding
+frr defaults datacenter
+service integrated-vtysh-config
+hostname localhost
+!
+!
+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 activate
+  advertise-all-vni
+ exit-address-family
+!
+router bgp 65000 vrf vrf_myzone
+!
+line vty
+!
\ No newline at end of file
diff --git a/test/zones/evpn/ipv4/expected_sdn_interfaces b/test/zones/evpn/ipv4/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..799dcb7
--- /dev/null
@@ -0,0 +1,38 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       address 10.0.0.1/24
+       bridge_ports vxlan_myvnet
+       bridge_stp off
+       bridge_fd 0
+       mtu 1450
+       vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+       vrf-table auto
+
+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
+       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
diff --git a/test/zones/evpn/ipv4/interfaces b/test/zones/evpn/ipv4/interfaces
new file mode 100644 (file)
index 0000000..66bb826
--- /dev/null
@@ -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/ipv4/sdn_config b/test/zones/evpn/ipv4/sdn_config
new file mode 100644 (file)
index 0000000..4c115a9
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                      },
+             },
+
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000 } },
+             },
+  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/qinq/bridge/expected_sdn_interfaces b/test/zones/qinq/bridge/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..73db5b3
--- /dev/null
@@ -0,0 +1,17 @@
+#version:1
+
+auto cv_myvnet
+iface cv_myvnet
+       vlan-raw-device sv_myvnet
+       vlan-id 100
+
+auto myvnet
+iface myvnet
+       bridge_ports  cv_myvnet
+       bridge_stp off
+       bridge_fd 0
+
+auto sv_myvnet
+iface sv_myvnet
+       vlan-raw-device eth0
+       vlan-id 10
diff --git a/test/zones/qinq/bridge/interfaces b/test/zones/qinq/bridge/interfaces
new file mode 100644 (file)
index 0000000..68b6a88
--- /dev/null
@@ -0,0 +1,5 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
diff --git a/test/zones/qinq/bridge/sdn_config b/test/zones/qinq/bridge/sdn_config
new file mode 100644 (file)
index 0000000..1708d4c
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/bridge_vlanaware/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanaware/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..a9ed991
--- /dev/null
@@ -0,0 +1,15 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports z_myzone.100
+       bridge_stp off
+       bridge_fd 0
+
+auto z_myzone
+iface z_myzone
+       bridge-stp off
+       bridge-ports vmbr0.10
+       bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
diff --git a/test/zones/qinq/bridge_vlanaware/interfaces b/test/zones/qinq/bridge_vlanaware/interfaces
new file mode 100644 (file)
index 0000000..cfdfafe
--- /dev/null
@@ -0,0 +1,7 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
+       bridge-vids 2-4094
+       bridge-vlan-aware 1
diff --git a/test/zones/qinq/bridge_vlanaware/sdn_config b/test/zones/qinq/bridge_vlanaware/sdn_config
new file mode 100644 (file)
index 0000000..1708d4c
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/bridge_vlanaware_vlanawarevnet/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanaware_vlanawarevnet/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..373eff2
--- /dev/null
@@ -0,0 +1,17 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports z_myzone.100
+       bridge_stp off
+       bridge_fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
+
+auto z_myzone
+iface z_myzone
+       bridge-stp off
+       bridge-ports vmbr0.10
+       bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
diff --git a/test/zones/qinq/bridge_vlanaware_vlanawarevnet/interfaces b/test/zones/qinq/bridge_vlanaware_vlanawarevnet/interfaces
new file mode 100644 (file)
index 0000000..cfdfafe
--- /dev/null
@@ -0,0 +1,7 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
+       bridge-vids 2-4094
+       bridge-vlan-aware 1
diff --git a/test/zones/qinq/bridge_vlanaware_vlanawarevnet/sdn_config b/test/zones/qinq/bridge_vlanaware_vlanawarevnet/sdn_config
new file mode 100644 (file)
index 0000000..c013176
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", vlanaware => "1", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/bridge_vlanaware_vlanprotocol/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanaware_vlanprotocol/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..6bf2b12
--- /dev/null
@@ -0,0 +1,19 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports z_myzone.100
+       bridge_stp off
+       bridge_fd 0
+
+auto vmbr0
+iface vmbr0
+       bridge-vlan-protocol 802.1ad
+
+auto z_myzone
+iface z_myzone
+       bridge-stp off
+       bridge-ports vmbr0.10
+       bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
diff --git a/test/zones/qinq/bridge_vlanaware_vlanprotocol/interfaces b/test/zones/qinq/bridge_vlanaware_vlanprotocol/interfaces
new file mode 100644 (file)
index 0000000..cfdfafe
--- /dev/null
@@ -0,0 +1,7 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
+       bridge-vids 2-4094
+       bridge-vlan-aware 1
diff --git a/test/zones/qinq/bridge_vlanaware_vlanprotocol/sdn_config b/test/zones/qinq/bridge_vlanaware_vlanprotocol/sdn_config
new file mode 100644 (file)
index 0000000..20a8a51
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, 'vlan-protocol' => '802.1ad', ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/bridge_vlanawarevnet/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanawarevnet/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..ab7572e
--- /dev/null
@@ -0,0 +1,19 @@
+#version:1
+
+auto cv_myvnet
+iface cv_myvnet
+       vlan-raw-device sv_myvnet
+       vlan-id 100
+
+auto myvnet
+iface myvnet
+       bridge_ports  cv_myvnet
+       bridge_stp off
+       bridge_fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
+
+auto sv_myvnet
+iface sv_myvnet
+       vlan-raw-device eth0
+       vlan-id 10
diff --git a/test/zones/qinq/bridge_vlanawarevnet/interfaces b/test/zones/qinq/bridge_vlanawarevnet/interfaces
new file mode 100644 (file)
index 0000000..68b6a88
--- /dev/null
@@ -0,0 +1,5 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
diff --git a/test/zones/qinq/bridge_vlanawarevnet/sdn_config b/test/zones/qinq/bridge_vlanawarevnet/sdn_config
new file mode 100644 (file)
index 0000000..c013176
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", vlanaware => "1", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/bridge_vlanprotocol/expected_sdn_interfaces b/test/zones/qinq/bridge_vlanprotocol/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..460f1a5
--- /dev/null
@@ -0,0 +1,18 @@
+#version:1
+
+auto cv_myvnet
+iface cv_myvnet
+       vlan-raw-device sv_myvnet
+       vlan-id 100
+
+auto myvnet
+iface myvnet
+       bridge_ports  cv_myvnet
+       bridge_stp off
+       bridge_fd 0
+
+auto sv_myvnet
+iface sv_myvnet
+       vlan-raw-device eth0
+       vlan-id 10
+       vlan-protocol 802.1ad
diff --git a/test/zones/qinq/bridge_vlanprotocol/interfaces b/test/zones/qinq/bridge_vlanprotocol/interfaces
new file mode 100644 (file)
index 0000000..68b6a88
--- /dev/null
@@ -0,0 +1,5 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
diff --git a/test/zones/qinq/bridge_vlanprotocol/sdn_config b/test/zones/qinq/bridge_vlanprotocol/sdn_config
new file mode 100644 (file)
index 0000000..20a8a51
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, 'vlan-protocol' => '802.1ad', ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/ovs/expected_sdn_interfaces b/test/zones/qinq/ovs/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..71c7aa3
--- /dev/null
@@ -0,0 +1,25 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports z_myzone.100
+       bridge_stp off
+       bridge_fd 0
+
+auto sv_myzone
+iface sv_myzone
+       ovs_type OVSIntPort
+       ovs_bridge vmbr0
+       ovs_options vlan_mode=dot1q-tunnel tag=10 other_config:qinq-ethtype=802.1q
+
+auto vmbr0
+iface vmbr0
+       ovs_ports sv_myzone
+
+auto z_myzone
+iface z_myzone
+       bridge-stp off
+       bridge-ports sv_myzone
+       bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
diff --git a/test/zones/qinq/ovs/interfaces b/test/zones/qinq/ovs/interfaces
new file mode 100644 (file)
index 0000000..14d2f1e
--- /dev/null
@@ -0,0 +1,9 @@
+auto eth0
+iface eth0 inet manual
+        ovs_type OVSPort
+        ovs_bridge vmbr0
+
+auto vmbr0
+iface vmbr0 inet manual
+        ovs_type OVSBridge
+        ovs_ports eth0
diff --git a/test/zones/qinq/ovs/sdn_config b/test/zones/qinq/ovs/sdn_config
new file mode 100644 (file)
index 0000000..1708d4c
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/ovs_vlanawarevnet/expected_sdn_interfaces b/test/zones/qinq/ovs_vlanawarevnet/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..cf87ad1
--- /dev/null
@@ -0,0 +1,27 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports z_myzone.100
+       bridge_stp off
+       bridge_fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
+
+auto sv_myzone
+iface sv_myzone
+       ovs_type OVSIntPort
+       ovs_bridge vmbr0
+       ovs_options vlan_mode=dot1q-tunnel tag=10 other_config:qinq-ethtype=802.1q
+
+auto vmbr0
+iface vmbr0
+       ovs_ports sv_myzone
+
+auto z_myzone
+iface z_myzone
+       bridge-stp off
+       bridge-ports sv_myzone
+       bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
diff --git a/test/zones/qinq/ovs_vlanawarevnet/interfaces b/test/zones/qinq/ovs_vlanawarevnet/interfaces
new file mode 100644 (file)
index 0000000..14d2f1e
--- /dev/null
@@ -0,0 +1,9 @@
+auto eth0
+iface eth0 inet manual
+        ovs_type OVSPort
+        ovs_bridge vmbr0
+
+auto vmbr0
+iface vmbr0 inet manual
+        ovs_type OVSBridge
+        ovs_ports eth0
diff --git a/test/zones/qinq/ovs_vlanawarevnet/sdn_config b/test/zones/qinq/ovs_vlanawarevnet/sdn_config
new file mode 100644 (file)
index 0000000..c013176
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", vlanaware => "1", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/qinq/ovs_vlanprotocol/expected_sdn_interfaces b/test/zones/qinq/ovs_vlanprotocol/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..10b59f8
--- /dev/null
@@ -0,0 +1,25 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports z_myzone.100
+       bridge_stp off
+       bridge_fd 0
+
+auto sv_myzone
+iface sv_myzone
+       ovs_type OVSIntPort
+       ovs_bridge vmbr0
+       ovs_options vlan_mode=dot1q-tunnel tag=10 other_config:qinq-ethtype=802.1ad
+
+auto vmbr0
+iface vmbr0
+       ovs_ports sv_myzone
+
+auto z_myzone
+iface z_myzone
+       bridge-stp off
+       bridge-ports sv_myzone
+       bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
diff --git a/test/zones/qinq/ovs_vlanprotocol/interfaces b/test/zones/qinq/ovs_vlanprotocol/interfaces
new file mode 100644 (file)
index 0000000..14d2f1e
--- /dev/null
@@ -0,0 +1,9 @@
+auto eth0
+iface eth0 inet manual
+        ovs_type OVSPort
+        ovs_bridge vmbr0
+
+auto vmbr0
+iface vmbr0 inet manual
+        ovs_type OVSBridge
+        ovs_ports eth0
diff --git a/test/zones/qinq/ovs_vlanprotocol/sdn_config b/test/zones/qinq/ovs_vlanprotocol/sdn_config
new file mode 100644 (file)
index 0000000..20a8a51
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", tag => 10, 'vlan-protocol' => '802.1ad', ipam => "pve", type => "qinq" } },
+             },
+}
diff --git a/test/zones/simple/basic/expected_sdn_interfaces b/test/zones/simple/basic/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..1e0c2c7
--- /dev/null
@@ -0,0 +1,7 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports none
+       bridge_stp off
+       bridge_fd 0
diff --git a/test/zones/simple/basic/interfaces b/test/zones/simple/basic/interfaces
new file mode 100644 (file)
index 0000000..68b6a88
--- /dev/null
@@ -0,0 +1,5 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
diff --git a/test/zones/simple/basic/sdn_config b/test/zones/simple/basic/sdn_config
new file mode 100644 (file)
index 0000000..527dcba
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "simple" } },
+             },
+}
diff --git a/test/zones/simple/ipv4/expected_sdn_interfaces b/test/zones/simple/ipv4/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..d84075d
--- /dev/null
@@ -0,0 +1,8 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       address 192.168.0.1/24
+       bridge_ports none
+       bridge_stp off
+       bridge_fd 0
diff --git a/test/zones/simple/ipv4/interfaces b/test/zones/simple/ipv4/interfaces
new file mode 100644 (file)
index 0000000..68b6a88
--- /dev/null
@@ -0,0 +1,5 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
diff --git a/test/zones/simple/ipv4/sdn_config b/test/zones/simple/ipv4/sdn_config
new file mode 100644 (file)
index 0000000..dd77b75
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "simple" } },
+             },
+
+  subnets => {
+              ids => { 'myzone-192.168.0.0-24' => {
+                                                       'type' => 'subnet',
+                                                       'vnet' => 'myvnet',
+                                                       'gateway' => '192.168.0.1',
+                                                 }
+                    }
+            }
+}
+
+
diff --git a/test/zones/simple/ipv4snat/expected_sdn_interfaces b/test/zones/simple/ipv4snat/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..c822af1
--- /dev/null
@@ -0,0 +1,12 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       address 10.0.0.1/24
+       post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j SNAT --to-source 192.168.0.1
+       post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j SNAT --to-source 192.168.0.1
+       post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+       post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+       bridge_ports none
+       bridge_stp off
+       bridge_fd 0
diff --git a/test/zones/simple/ipv4snat/interfaces b/test/zones/simple/ipv4snat/interfaces
new file mode 100644 (file)
index 0000000..66bb826
--- /dev/null
@@ -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/simple/ipv4snat/sdn_config b/test/zones/simple/ipv4snat/sdn_config
new file mode 100644 (file)
index 0000000..5936d7d
--- /dev/null
@@ -0,0 +1,23 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "simple" } },
+             },
+
+  subnets => {
+              ids => { 'myzone-10.0.0.0-24' => {
+                                                       'type' => 'subnet',
+                                                       'vnet' => 'myvnet',
+                                                       'gateway' => '10.0.0.1',
+                                                       'snat' => 1
+                                                 }
+                    }
+            }
+}
+
+
diff --git a/test/zones/vlan/bridge/expected_sdn_interfaces b/test/zones/vlan/bridge/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..f9e96d1
--- /dev/null
@@ -0,0 +1,23 @@
+#version:1
+
+auto ln_myvnet
+iface ln_myvnet
+       link-type veth
+       veth-peer-name pr_myvnet
+
+auto myvnet
+iface myvnet
+       bridge_ports ln_myvnet
+       bridge_stp off
+       bridge_fd 0
+
+auto pr_myvnet
+iface pr_myvnet
+       link-type veth
+       veth-peer-name ln_myvnet
+
+auto vmbr0v100
+iface vmbr0v100
+       bridge_ports  eth0.100 pr_myvnet
+       bridge_stp off
+       bridge_fd 0
diff --git a/test/zones/vlan/bridge/interfaces b/test/zones/vlan/bridge/interfaces
new file mode 100644 (file)
index 0000000..68b6a88
--- /dev/null
@@ -0,0 +1,5 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
diff --git a/test/zones/vlan/bridge/sdn_config b/test/zones/vlan/bridge/sdn_config
new file mode 100644 (file)
index 0000000..c6cfaaa
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
+             },
+}
diff --git a/test/zones/vlan/bridge_vlanaware/expected_sdn_interfaces b/test/zones/vlan/bridge_vlanaware/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..a318c7a
--- /dev/null
@@ -0,0 +1,7 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports vmbr0.100
+       bridge_stp off
+       bridge_fd 0
diff --git a/test/zones/vlan/bridge_vlanaware/interfaces b/test/zones/vlan/bridge_vlanaware/interfaces
new file mode 100644 (file)
index 0000000..cfdfafe
--- /dev/null
@@ -0,0 +1,7 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
+       bridge-vids 2-4094
+       bridge-vlan-aware 1
diff --git a/test/zones/vlan/bridge_vlanaware/sdn_config b/test/zones/vlan/bridge_vlanaware/sdn_config
new file mode 100644 (file)
index 0000000..c6cfaaa
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
+             },
+}
diff --git a/test/zones/vlan/bridge_vlanaware_vlanawarevnet/expected_sdn_interfaces b/test/zones/vlan/bridge_vlanaware_vlanawarevnet/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..ebf9d2e
--- /dev/null
@@ -0,0 +1,9 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports vmbr0.100
+       bridge_stp off
+       bridge_fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
diff --git a/test/zones/vlan/bridge_vlanaware_vlanawarevnet/interfaces b/test/zones/vlan/bridge_vlanaware_vlanawarevnet/interfaces
new file mode 100644 (file)
index 0000000..64eec9e
--- /dev/null
@@ -0,0 +1,7 @@
+auto vmbr0
+iface vmbr0 inet manual
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4096
diff --git a/test/zones/vlan/bridge_vlanaware_vlanawarevnet/sdn_config b/test/zones/vlan/bridge_vlanaware_vlanawarevnet/sdn_config
new file mode 100644 (file)
index 0000000..67068f9
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", vlanaware => 1, zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
+             },
+}
diff --git a/test/zones/vlan/ovs/expected_sdn_interfaces b/test/zones/vlan/ovs/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..044559e
--- /dev/null
@@ -0,0 +1,17 @@
+#version:1
+
+auto ln_myvnet
+iface ln_myvnet
+       ovs_type OVSIntPort
+       ovs_bridge vmbr0
+       ovs_options tag=100
+
+auto myvnet
+iface myvnet
+       bridge_ports ln_myvnet
+       bridge_stp off
+       bridge_fd 0
+
+auto vmbr0
+iface vmbr0
+       ovs_ports ln_myvnet
diff --git a/test/zones/vlan/ovs/interfaces b/test/zones/vlan/ovs/interfaces
new file mode 100644 (file)
index 0000000..14d2f1e
--- /dev/null
@@ -0,0 +1,9 @@
+auto eth0
+iface eth0 inet manual
+        ovs_type OVSPort
+        ovs_bridge vmbr0
+
+auto vmbr0
+iface vmbr0 inet manual
+        ovs_type OVSBridge
+        ovs_ports eth0
diff --git a/test/zones/vlan/ovs/sdn_config b/test/zones/vlan/ovs/sdn_config
new file mode 100644 (file)
index 0000000..c6cfaaa
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
+             },
+}
diff --git a/test/zones/vlan/ovs_vlanware_vnet/expected_sdn_interfaces b/test/zones/vlan/ovs_vlanware_vnet/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..7bb73b6
--- /dev/null
@@ -0,0 +1,19 @@
+#version:1
+
+auto ln_myvnet
+iface ln_myvnet
+       ovs_type OVSIntPort
+       ovs_bridge vmbr0
+       ovs_options vlan_mode=dot1q-tunnel other_config:qinq-ethtype=802.1q tag=100
+
+auto myvnet
+iface myvnet
+       bridge_ports ln_myvnet
+       bridge_stp off
+       bridge_fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
+
+auto vmbr0
+iface vmbr0
+       ovs_ports ln_myvnet
diff --git a/test/zones/vlan/ovs_vlanware_vnet/interfaces b/test/zones/vlan/ovs_vlanware_vnet/interfaces
new file mode 100644 (file)
index 0000000..14d2f1e
--- /dev/null
@@ -0,0 +1,9 @@
+auto eth0
+iface eth0 inet manual
+        ovs_type OVSPort
+        ovs_bridge vmbr0
+
+auto vmbr0
+iface vmbr0 inet manual
+        ovs_type OVSBridge
+        ovs_ports eth0
diff --git a/test/zones/vlan/ovs_vlanware_vnet/sdn_config b/test/zones/vlan/ovs_vlanware_vnet/sdn_config
new file mode 100644 (file)
index 0000000..9cfdb52
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", vlanaware => "1", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
+             },
+}
diff --git a/test/zones/vxlan/basic/expected_sdn_interfaces b/test/zones/vxlan/basic/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..7b73c3e
--- /dev/null
@@ -0,0 +1,15 @@
+#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
+       mtu 1450
diff --git a/test/zones/vxlan/basic/interfaces b/test/zones/vxlan/basic/interfaces
new file mode 100644 (file)
index 0000000..66bb826
--- /dev/null
@@ -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/basic/sdn_config b/test/zones/vxlan/basic/sdn_config
new file mode 100644 (file)
index 0000000..f929304
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "vxlan", peers => "192.168.0.1,192.168.0.2,192.168.0.3" } },
+             },
+}
diff --git a/test/zones/vxlan/vlanawarevnet/expected_sdn_interfaces b/test/zones/vxlan/vlanawarevnet/expected_sdn_interfaces
new file mode 100644 (file)
index 0000000..55cdf9c
--- /dev/null
@@ -0,0 +1,17 @@
+#version:1
+
+auto myvnet
+iface myvnet
+       bridge_ports vxlan_myvnet
+       bridge_stp off
+       bridge_fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
+       mtu 1450
+
+auto vxlan_myvnet
+iface vxlan_myvnet
+       vxlan-id 100
+       vxlan_remoteip 192.168.0.2
+       vxlan_remoteip 192.168.0.3
+       mtu 1450
diff --git a/test/zones/vxlan/vlanawarevnet/interfaces b/test/zones/vxlan/vlanawarevnet/interfaces
new file mode 100644 (file)
index 0000000..66bb826
--- /dev/null
@@ -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/vlanawarevnet/sdn_config b/test/zones/vxlan/vlanawarevnet/sdn_config
new file mode 100644 (file)
index 0000000..23fb557
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => 100, type => "vnet", vlanaware => "1", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "vxlan", peers => "192.168.0.1,192.168.0.2,192.168.0.3" } },
+             },
+}