verify than parent interface exist
verify than parent interface type is eth,bond,bridge
verify than parent bridge is vlan aware if type bridge
}
}
+ # check vlan
+ foreach my $iface (keys %$ifaces) {
+ my $d = $ifaces->{$iface};
+ if ($d->{type} eq 'vlan' && $iface =~ m/^(\S+)\.\d+$/) {
+ my $p = $1;
+ my $n = $ifaces->{$p};
+
+ die "vlan '$iface' - unable to find parent '$p'\n"
+ if $n->{exists} eq 0;
+
+ if ($n->{type} eq 'bridge' && !$n->{bridge_vlan_aware}) {
+ die "vlan '$iface' - bridge vlan aware is not enabled on parent '$p'\n";
+ } elsif ($n->{type} ne 'eth' && $n->{type} ne 'bridge' && $n->{type} ne 'bond') {
+ die "vlan '$iface' - wrong interface type on parent '$p' " .
+ "('$n->{type}' != 'eth|bond|bridge' )\n";
+ }
+ }
+ }
+
# check bridgeport option
my $bridgeports = {};
my $bridges = {};
autostart => 1
};
-
$config->{ifaces}->{vmbr2} = {
type => 'bridge',
method => 'manual',
autostart => 1
};
+$config->{ifaces}->{'vmbr1.100'} = {
+ type => 'vlan',
+ method => 'manual',
+ families => ['inet'],
+ autostart => 1
+};
+
+$config->{ifaces}->{'bond0.100'} = {
+ type => 'vlan',
+ method => 'manual',
+ families => ['inet'],
+ autostart => 1
+};
+
+$config->{ifaces}->{'eth1.100'} = {
+ type => 'vlan',
+ method => 'manual',
+ families => ['inet'],
+ autostart => 1
+};
expect load('loopback') . <<"CHECK";
source-directory interfaces.d
auto eth3
iface eth3 inet manual
+auto eth1.100
+iface eth1.100 inet manual
+
auto bond0
iface bond0 inet manual
bond-slaves eth2 eth3
bond-mode 802.3ad
bond-xmit-hash-policy layer3+4
+auto bond0.100
+iface bond0.100 inet manual
+
auto vmbr0
iface vmbr0 inet static
address 10.0.0.2
bridge-vlan-aware yes
bridge-vids 2-10
+auto vmbr1.100
+iface vmbr1.100 inet manual
+
auto vxlan1
iface vxlan1 inet manual
vxlan-id 1