Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test bonding two network interfaces on ALP #18251

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions schedule/alp/bonding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
description: 'Network bonding test suite for ALP'
name: 'alp_bonding@x86_64'
schedule:
- microos/disk_boot
- microos/network_bonding
48 changes: 48 additions & 0 deletions tests/microos/network_bonding.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# SUSE's openQA tests
#
# Copyright 2016-2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Test network bonding capability and connectivity
# Maintainer: QE Core <qe-core@suse.de>

use base "consoletest";
use strict;
use warnings;
use testapi;
use power_action_utils "power_action";

sub test_failover {
my $device = shift;
# disable one child eth, other should keep bond0 alive
assert_script_run "ip link set dev $device down";
script_run 'ip a';
# networking should be still good
assert_script_run 'ping -c1 -I bond0 conncheck.opensuse.org';
# bring back up device
assert_script_run "ip link set dev $device up";
}

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;
# 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};
# bring up bond interface
assert_script_run "nmcli con up bond0";
# reboot to ensure connection properly comes up at start
power_action('reboot', textmode => 1);
$self->wait_boot;
select_console 'root-console';
# first connectivity check
assert_script_run 'ping -c1 -I bond0 conncheck.opensuse.org';
# check device failover
test_failover $_ for qw{eth0 eth1};
}

1;