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

Fix s390x cc_net_case test #20843

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 108 additions & 26 deletions schedule/security/cc_netfilter_netfilebt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,111 @@ conditional_schedule:
s390x:
- security/cc/disable_root_ssh
test_data:
server:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:11:00
ipv4: 192.168.0.1/24
ipv6: fd00::1
route: fd00::2
second_interface:
netcard: 1
mac_addr: 00:11:11:11:11:01
ipv4: 192.168.1.1/24
ipv6: fd00:1::1
route: fd00:1::2
client:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:11:10
ipv4: 192.168.0.2/24
ipv6: fd00::2
route: fd00::1
second_interface:
netcard: 1
mac_addr: 00:11:11:11:11:11
ipv4: 192.168.1.2/24
ipv6: fd00:1::2
route: fd00:1::1
15-SP4:
server:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:11:00
ipv4: 192.168.0.1/24
ipv6: fd00::1
route: fd00::2
second_interface:
netcard: 1
mac_addr: 00:11:11:11:11:01
ipv4: 192.168.1.1/24
ipv6: fd00:1::1
route: fd00:1::2
client:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:11:10
ipv4: 192.168.0.2/24
ipv6: fd00::2
route: fd00::1
second_interface:
netcard: 1
mac_addr: 00:11:11:11:11:11
ipv4: 192.168.1.2/24
ipv6: fd00:1::2
route: fd00:1::1
15-SP5:
server:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:22:00
ipv4: 192.168.10.1/24
ipv6: fd10::1
route: fd10::2
second_interface:
netcard: 1
mac_addr: 00:11:11:11:22:01
ipv4: 192.168.11.1/24
ipv6: fd10:1::1
route: fd10:1::2
client:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:22:10
ipv4: 192.168.10.2/24
ipv6: fd10::2
route: fd10::1
second_interface:
netcard: 1
mac_addr: 00:11:11:11:22:11
ipv4: 192.168.11.2/24
ipv6: fd10:1::2
route: fd10:1::1
15-SP6:
server:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:33:00
ipv4: 192.168.20.1/24
ipv6: fd20::1
route: fd20::2
second_interface:
netcard: 1
mac_addr: 00:11:11:11:33:01
ipv4: 192.168.21.1/24
ipv6: fd20:1::1
route: fd20:1::2
client:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:33:10
ipv4: 192.168.20.2/24
ipv6: fd20::2
route: fd20::1
second_interface:
netcard: 1
mac_addr: 00:11:11:11:33:11
ipv4: 192.168.21.2/24
ipv6: fd20:1::2
route: fd20:1::1
15-SP7:
server:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:44:00
ipv4: 192.168.30.1/24
ipv6: fd30::1
route: fd30::2
second_interface:
netcard: 1
mac_addr: 00:11:11:11:44:01
ipv4: 192.168.31.1/24
ipv6: fd30:1::1
route: fd30:1::2
client:
first_interface:
netcard: 0
mac_addr: 00:11:11:11:44:10
ipv4: 192.168.30.2/24
ipv6: fd30::2
route: fd30::1
second_interface:
netcard: 1
mac_addr: 00:11:11:11:44:11
ipv4: 192.168.31.2/24
ipv6: fd30:1::2
route: fd30:1::1
2 changes: 1 addition & 1 deletion tests/security/cc/run_net_case.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sub run {
my $case_name = $run_args->{case_name};
my $result = 'ok';
assert_script_run("cd $audit_test::test_dir/audit-test/$case_name/");
my $output = script_output('./run.bash --list');
my $output = script_output('./run.bash --list', timeout => 300);
my @lines = split(/\n/, $output);

# Start lblnet_tst_server
Expand Down
24 changes: 15 additions & 9 deletions tests/security/cc/setup_net_test_env.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,22 @@ sub run {

# Get netdev
my $netdev = 'eth0';
if (is_s390x) {
$netdev = 'eth1';
assert_script_run('ip link set eth1 up');
script_run('ip a');
}

# Configure the network
my $version = get_required_var('VERSION');
my $data = get_test_suite_data();

my $role = get_required_var('ROLE');
foreach my $key (keys %{$data->{$role}}) {
my $n = $data->{$role}->{$key};

foreach my $key (keys %{$data->{$version}->{$role}}) {
my $n = $data->{$version}->{$role}->{$key};
my $netcard = $netdev . '.' . $n->{netcard};
my $dev = $netcard;

assert_script_run("ip link add link $netdev address $n->{mac_addr} $netcard type macvlan");

# Network Bridge setting for Target of Evaluation(TOE)
Expand All @@ -65,15 +72,14 @@ sub run {
if ($role eq 'server') {
mutex_create('NETFILTER_SERVER_READY');
wait_for_children;
}
else {
} else {
mutex_wait('NETFILTER_SERVER_READY');

# Export the variables
my $client_first = $data->{client}->{first_interface};
my $client_second = $data->{client}->{second_interface};
my $server_first = $data->{server}->{first_interface};
my $server_second = $data->{server}->{second_interface};
my $client_first = $data->{$version}->{client}->{first_interface};
my $client_second = $data->{$version}->{client}->{second_interface};
my $server_first = $data->{$version}->{server}->{first_interface};
my $server_second = $data->{$version}->{server}->{second_interface};

# Deal with ipv4 address: change 192.168.0.1/24 to 192.168.0.1
$client_first->{ipv4} =~ s/\/.*//g;
Expand Down
Loading