-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
/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");
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
$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');