]> git.proxmox.com Git - pve-common.git/blobdiff - test/etc_network_interfaces/t.list-interfaces.pl
remove extra space after address && gateway options
[pve-common.git] / test / etc_network_interfaces / t.list-interfaces.pl
index caffe88d6ac075fe3c1d9caa1e38ca2f6abddf95..5925c35878422b04fd821a6f6f436c5c080a34c8 100644 (file)
@@ -1,5 +1,3 @@
-no warnings 'experimental::smartmatch';
-
 # Assuming eth0..3 and eth100
 # eth0 is part of vmbr0, eth100 is part of the OVS bridge vmbr1
 # vmbr0 has ipv4 and ipv6, OVS only ipv4
@@ -18,13 +16,10 @@ eth100:
 /proc/net/dev
 
 my %wanted = (
-    vmbr0 => { address => '192.168.1.2',
-              netmask => '255.255.255.0',
+    vmbr0 => { address => '192.168.1.2/24',
               gateway => '192.168.1.1',
-              address6 => 'fc05::1:1',
-              netmask6 => '112' },
-    vmbr1 => { address => '10.0.0.5',
-              netmask => '255.255.255.0' }
+              address6 => 'fc05::1:1/112'},
+    vmbr1 => { address => '10.0.0.5/24'}
 );
 
 save('interfaces', <<"/etc/network/interfaces");
@@ -42,23 +37,23 @@ iface eth100 inet manual
 
 auto vmbr0
 iface vmbr0 inet static
-       address  $wanted{vmbr0}->{address}
-       netmask  $wanted{vmbr0}->{netmask}
+       address  192.168.1.2
+       netmask  24
        gateway  $wanted{vmbr0}->{gateway}
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
 
 iface vmbr0 inet6 static
-       address  $wanted{vmbr0}->{address6}
-       netmask  $wanted{vmbr0}->{netmask6}
+       address  fc05::1:1
+       netmask  112
 
 source-directory before-ovs.d
 
-auto vmbr1
+allow-ovs vmbr1
 iface vmbr1 inet static
-       address  $wanted{vmbr1}->{address}
-       netmask  $wanted{vmbr1}->{netmask}
+       address  10.0.0.5
+       netmask  255.255.255.0
        ovs_type OVSBridge
        ovs_ports eth100
 
@@ -99,9 +94,11 @@ $ck->('eth100', type => 'OVSPort');
 $ck->('eth100', ovs_type => 'OVSPort');
 $ck->('eth100', ovs_bridge => 'vmbr1');
 
-my $f100 = $ifaces->{vmbr0}->{families};
-die "invalid families defined for vmbr0: @$f100\n" unless [sort(@$f100)] ~~ ['inet', 'inet6'];
+my @f100 = sort @{$ifaces->{vmbr0}->{families}};
 
+die "invalid families defined for vmbr0"
+    if (scalar(@f100) != 2) || ($f100[0] ne 'inet') || ($f100[1] ne 'inet6');
 # idempotency
 r(w());
 expect load('2');