Skip to content

Commit

Permalink
Read network device names from Network Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmanzo committed Dec 11, 2023
1 parent f69e77d commit bc472ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/microos/network_bonding.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ sub run {
my ($self) = @_;
select_console 'root-console';
# remove existing NM-managed connections (except loopback)
my @interfaces = grep { !/^lo/ } split('\n', script_output 'nmcli -t -f NAME con');
assert_script_run "nmcli con delete '$_'" for @interfaces;
my @connections_info = grep { !/^lo/ } split('\n', script_output 'nmcli -t -f DEVICE,UUID conn show --active');
my @devices = map { (split /:/)[0] } @connections_info;
my @connection_ids = map { (split /:/)[1] } @connections_info;
# can fail due to same ID pointing to different connections
script_run "nmcli con delete '$_'" for @connection_ids;
# create a new bonding interface and connect the two ethernet
assert_script_run "nmcli con add type bond ifname bond0 con-name bond0";
assert_script_run "nmcli con add type ethernet ifname $_ master bond0" for qw{eth0 eth1};
assert_script_run "nmcli con add type ethernet ifname $_ master bond0" for @devices;
# bring up bond interface
assert_script_run "nmcli con up bond0";
# reboot to ensure connection properly comes up at start
Expand All @@ -41,7 +44,7 @@ sub run {
# first connectivity check
assert_script_run 'ping -c1 -I bond0 conncheck.opensuse.org';
# check device failover
test_failover $_ for qw{eth0 eth1};
test_failover $_ for @devices;
}

1;
Expand Down

0 comments on commit bc472ef

Please sign in to comment.