Skip to content

Commit

Permalink
nmstate: add a new test after previous mod
Browse files Browse the repository at this point in the history
  • Loading branch information
jouvin committed Oct 21, 2024
1 parent 7e962e1 commit 0a71bff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion ncm-network/src/main/perl/nmstate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ use constant BOND_MASTER_STARTS_SLAVES => 0;
sub iface_filename
{
my ($self, $iface) = @_;
return $self->IFCFG_DIR . "/$iface.yml";
my $filename = $self->IFCFG_DIR . "/$iface.yml";
$self->verbose("Interface $iface configuration file: $filename");
return $filename;
}

# Determine if this is a valid interface for ncm-network to manage,
Expand Down
4 changes: 3 additions & 1 deletion ncm-network/src/test/perl/nmstate_advance.t
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ is($vlanyml, $VLAN_YML, "Exact eth0.123 vlan yml config");
my $vlanyml2 = get_file_contents("/etc/nmstate/vlan0.yml");
is($vlanyml2, $VLAN0_YML, "Exact vlan0 yml config");

my $vlanyml3 = get_file_contents("/etc/nmstate/vlan.0.yml");
is($vlanyml3, $VLAN0_YML, "Exact vlan.0 yml config");

my $ibyml = get_file_contents("/etc/nmstate/ib0.yml");
is($ibyml, $IB_YML, "Exact ib0 yml config");

Expand Down Expand Up @@ -335,5 +338,4 @@ ok(command_history_ok([
'/usr/bin/nmstatectl apply /etc/nmstate/bond0.yml',
], []));


done_testing();
12 changes: 10 additions & 2 deletions ncm-network/src/test/resources/nmstate_advance.pan
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ prefix "/system/network/interfaces/eth0.123";
"physdev" = "eth0";
"route/0" = dict("address", "1.2.3.4");

# test vlan interface route on vlan for backward compatibily with network.pm
# test vlan interface route on vlan0 for backward compatibily with network.pm
"/system/network/interfaces/vlan0" = create("defaultinterface");
prefix "/system/network/interfaces/vlan0";
"device" = "eth0.123";
Expand Down Expand Up @@ -72,4 +72,12 @@ prefix "/system/network/interfaces/eth4";
"aliases/dba/broadcast" = "4.3.2.255";
"aliases/dba/fqdn" = "host-alias1.quattor.com";
"aliases/dba/ip" = "4.3.2.12";
"aliases/dba/netmask" = "255.255.255.0";
"aliases/dba/netmask" = "255.255.255.0";
"route/0" = dict("address", "1.2.3.4");

# test vlan interface route on vlan.0 for backward compatibily with network.pm
"/system/network/interfaces/vlan.0" = create("defaultinterface");
prefix "/system/network/interfaces/vlan.0";
"device" = "eth0.123";
"physdev" = "eth0";
"route/0" = dict("address", "1.2.3.4");

0 comments on commit 0a71bff

Please sign in to comment.