diff --git a/.github/run_test.sh b/.github/run_test.sh index 7ea72bb..a04c4a8 100755 --- a/.github/run_test.sh +++ b/.github/run_test.sh @@ -11,11 +11,13 @@ PODMAN_OPTS="--systemd=true --privileged" # exclude bond tests since missing the bonding kernel module # exclude tests/tests_wireless_nm.yml since failing to load mac80211_hwsim kernel # module to mock a wifi network +# exclude tests/tests_infiniband_nm.yml since missing the infiniband device EXCLUDE_TESTS_C7=' -e tests/tests_auto_gateway_initscripts.yml -e tests/tests_bond_deprecated_initscripts.yml -e tests/tests_bond_initscripts.yml -e tests/tests_bond_removal_initscripts.yml +-e tests/tests_infiniband_nm.yml -e tests/tests_team_nm.yml -e tests/tests_unit.yml -e tests/tests_wireless_nm.yml @@ -24,11 +26,13 @@ EXCLUDE_TESTS_C7=' # exclude bond tests since missing the bonding kernel module # exclude tests/tests_wireless_wpa3_owe_nm.yml and tests/tests_wireless_wpa3_sae_nm.yml # since failing to install mac80211_hwsim kernel module +# exclude tests/tests_infiniband_nm.yml since missing the infiniband device EXCLUDE_TESTS_C8S=' -e tests/tests_auto_gateway_initscripts.yml -e tests/tests_bond_deprecated_initscripts.yml -e tests/tests_bond_initscripts.yml -e tests/tests_bond_removal_initscripts.yml +-e tests/tests_infiniband_nm.yml -e tests/tests_integration_pytest.yml -e tests/tests_team_nm.yml -e tests/tests_unit.yml @@ -40,7 +44,9 @@ EXCLUDE_TESTS_C8S=' # network-scripts available # exclude tests/tests_wireless_wpa3_owe_nm.yml and tests/tests_wireless_wpa3_sae_nm.yml # since failing to install mac80211_hwsim kernel module +# exclude tests/tests_infiniband_nm.yml since missing the infiniband device EXCLUDE_TESTS_C9S=' +-e tests/tests_infiniband_nm.yml -e tests/tests_provider_nm.yml -e tests/tests_regression_nm.yml -e tests/tests_team_nm.yml diff --git a/tests/ensure_provider_tests.py b/tests/ensure_provider_tests.py index 38adae2..a6c014c 100755 --- a/tests/ensure_provider_tests.py +++ b/tests/ensure_provider_tests.py @@ -70,6 +70,7 @@ ibution_major_version | int < 9", "playbooks/tests_bond_options.yml": {}, "playbooks/tests_eth_dns_support.yml": {}, "playbooks/tests_dummy.yml": {}, + "playbooks/tests_infiniband.yml": {}, "playbooks/tests_ipv6_disabled.yml": {}, "playbooks/tests_ipv6_dns_search.yml": {}, "playbooks/tests_provider.yml": { diff --git a/tests/playbooks/tests_infiniband.yml b/tests/playbooks/tests_infiniband.yml new file mode 100644 index 0000000..96646ba --- /dev/null +++ b/tests/playbooks/tests_infiniband.yml @@ -0,0 +1,81 @@ +# SPDX-License-Identifier: BSD-3-Clause +--- +- hosts: all + tasks: + - block: + - name: TEST Configuring infiniband devices + debug: + msg: "##################################################" + - name: Setup the IP over the infiniband device + import_role: + name: linux-system-roles.network + vars: + network_connections: + - name: ib0 + type: infiniband + interface_name: ib0 + + - name: ib0-10 + type: infiniband + autoconnect: yes + infiniband: + p_key: 10 + transport_mode: datagram + parent: ib0 + state: up + ip: + dhcp4: no + auto6: no + address: + - 198.51.100.133/30 + - 2001:db8::2/32 + + - name: Get the details for the virtual device ib0.000a + command: ip -d a s ib0.000a + register: virtual_device_setting + ignore_errors: yes + changed_when: false + + - name: Assert that the settings in the virtual device + ib0.000a match the specified settings + assert: + that: + - virtual_device_setting.stdout is search("ipoib pkey 0x800a mode + datagram") + msg: the settings in the virtual device ib0.000a + match the specified settings + + - command: ip -4 a s ib0.000a + name: "** TEST check IPv4" + register: result + until: "'198.51.100.133/30' in result.stdout" + retries: 20 + delay: 2 + + - command: ip -6 a s ib0.000a + name: "** TEST check IPv6" + register: result + until: "'2001:db8::2/32' in result.stdout" + retries: 20 + delay: 2 + + always: + - block: + - name: Import network role + import_role: + name: linux-system-roles.network + vars: + network_connections: + - name: ib0 + persistent_state: absent + state: down + - name: ib0-10 + persistent_state: absent + state: down + ignore_errors: true + - command: ip link del ib0.000a + ignore_errors: true + tags: + - "tests::cleanup" + tags: + - "tests::infiniband" diff --git a/tests/tests_infiniband_nm.yml b/tests/tests_infiniband_nm.yml new file mode 100644 index 0000000..b99b72d --- /dev/null +++ b/tests/tests_infiniband_nm.yml @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: BSD-3-Clause +# This file was generated by ensure_provider_tests.py +--- +# set network provider and gather facts +- hosts: all + name: Run playbook 'playbooks/tests_infiniband.yml' with nm as provider + tasks: + - include_tasks: tasks/el_repo_setup.yml + - name: Set network provider to 'nm' + set_fact: + network_provider: nm + tags: + - always + + +# The test requires or should run with NetworkManager, therefore it cannot run +# on RHEL/CentOS 6 +- import_playbook: playbooks/tests_infiniband.yml + when: + - ansible_distribution_major_version != '6'