write real files
[pve-firewall.git] / fwtest.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use lib qw(.);
5 use PVE::Firewall;
6 use File::Path;
7
8 my $vmdata = {
9 qemu => {
10 100 => {
11 net0 => 'rtl8139=9A:42:2D:0C:01:FF,bridge=vmbr0',
12 },
13 101 => {
14 net0 => 'rtl8139=0E:9D:ED:CC:9B:ED,bridge=vmbr0',
15 },
16 102 => {
17 zone => 'z1',
18 net0 => 'rtl8139=0E:9D:ED:CC:AA:ED,bridge=vmbr0',
19 net1 => 'rtl8139=0E:9D:ED:CC:CC:ED,bridge=vmbr1',
20 },
21 103 => {
22 zone => 'z1',
23 net0 => 'rtl8139=0E:9D:ED:CC:BC:ED,bridge=vmbr0',
24 net1 => 'rtl8139=0E:9D:ED:CC:BC:AA,tag=5,bridge=vmbr0',
25 },
26 },
27 };
28
29 my $testdir = "./testdir";
30 rmtree($testdir);
31 mkdir $testdir;
32
33 PVE::Firewall::compile($testdir, $vmdata);
34
35 PVE::Tools::run_command(['shorewall', 'check', $testdir]);
36
37 exit(0);