add zones && controllers unit tests

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier 2020-12-09 16:11:19 +01:00 committed by Thomas Lamprecht
parent 9cef13e929
commit 82f6b09f93
83 changed files with 1421 additions and 3 deletions

View File

@ -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:

6
test/Makefile Normal file
View File

@ -0,0 +1,6 @@
all: test
test: test_zones
test_zones: run_test_zones.pl
./run_test_zones.pl

124
test/run_test_zones.pl Executable file
View File

@ -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();

View File

@ -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
!

View File

@ -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

View File

@ -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

View File

@ -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',
}
}
}
}

View File

@ -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
!

View File

@ -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

View File

@ -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

View File

@ -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',
}
}
}
}

View File

@ -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
!

View File

@ -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

View File

@ -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

View File

@ -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',
}
}
}
}

View File

@ -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
!

View File

@ -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

View File

@ -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

View File

@ -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
}
}
}
}

View File

@ -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
!

View File

@ -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

View File

@ -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

View File

@ -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',
}
}
}
}

View File

@ -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

View File

@ -0,0 +1,5 @@
auto vmbr0
iface vmbr0 inet manual
bridge-ports eth0
bridge-stp off
bridge-fd 0

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -0,0 +1,5 @@
auto vmbr0
iface vmbr0 inet manual
bridge-ports eth0
bridge-stp off
bridge-fd 0

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -0,0 +1,5 @@
auto vmbr0
iface vmbr0 inet manual
bridge-ports eth0
bridge-stp off
bridge-fd 0

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -0,0 +1,7 @@
#version:1
auto myvnet
iface myvnet
bridge_ports none
bridge_stp off
bridge_fd 0

View File

@ -0,0 +1,5 @@
auto vmbr0
iface vmbr0 inet manual
bridge-ports eth0
bridge-stp off
bridge-fd 0

View File

@ -0,0 +1,11 @@
{
version => 1,
vnets => {
ids => {
myvnet => { type => "vnet", zone => "myzone" },
},
},
zones => {
ids => { myzone => { ipam => "pve", type => "simple" } },
},
}

View File

@ -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

View File

@ -0,0 +1,5 @@
auto vmbr0
iface vmbr0 inet manual
bridge-ports eth0
bridge-stp off
bridge-fd 0

View File

@ -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',
}
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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
}
}
}
}

View File

@ -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

View File

@ -0,0 +1,5 @@
auto vmbr0
iface vmbr0 inet manual
bridge-ports eth0
bridge-stp off
bridge-fd 0

View File

@ -0,0 +1,11 @@
{
version => 1,
vnets => {
ids => {
myvnet => { tag => 100, type => "vnet", zone => "myzone" },
},
},
zones => {
ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
},
}

View File

@ -0,0 +1,7 @@
#version:1
auto myvnet
iface myvnet
bridge_ports vmbr0.100
bridge_stp off
bridge_fd 0

View File

@ -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

View File

@ -0,0 +1,11 @@
{
version => 1,
vnets => {
ids => {
myvnet => { tag => 100, type => "vnet", zone => "myzone" },
},
},
zones => {
ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,11 @@
{
version => 1,
vnets => {
ids => {
myvnet => { tag => 100, type => "vnet", zone => "myzone" },
},
},
zones => {
ids => { myzone => { bridge => "vmbr0", ipam => "pve", type => "vlan" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}

View File

@ -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

View File

@ -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

View File

@ -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" } },
},
}