Update roles
This commit is contained in:
@@ -2,23 +2,31 @@
|
||||
---
|
||||
- hosts: all
|
||||
vars:
|
||||
interface: lsrfeat1
|
||||
interface: testnic1
|
||||
type: veth
|
||||
tasks:
|
||||
- debug:
|
||||
msg: "this is: playbooks/tests_ethtool_features.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: "INIT: Ethtool feeatures tests"
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- include_tasks: tasks/show-interfaces.yml
|
||||
- include_tasks: tasks/manage-test-interface.yml
|
||||
- include_tasks: tasks/show_interfaces.yml
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: present
|
||||
- include_tasks: tasks/assert-device_present.yml
|
||||
- include_tasks: tasks/assert_device_present.yml
|
||||
- name: Install ethtool (test dependency)
|
||||
package:
|
||||
name: ethtool
|
||||
state: present
|
||||
|
||||
|
||||
- block:
|
||||
- name: "TEST: I can create a profile without changing the ethtool features."
|
||||
- name: >-
|
||||
TEST: I can create a profile without changing the ethtool features.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- name: Get current device features
|
||||
@@ -41,7 +49,10 @@
|
||||
assert:
|
||||
that:
|
||||
- original_ethtool_features.stdout == ethtool_features.stdout
|
||||
- name: "TEST: I can disable gro and tx-tcp-segmentation and enable gso."
|
||||
|
||||
|
||||
- name: >-
|
||||
TEST: I can disable gro and tx-tcp-segmentation and enable gso.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
@@ -68,9 +79,87 @@
|
||||
- name: Assert device features
|
||||
assert:
|
||||
that:
|
||||
- "'generic-receive-offload: off' in ethtool_features.stdout_lines"
|
||||
- "'generic-segmentation-offload: on' in ethtool_features.stdout_lines"
|
||||
- "'tx-tcp-segmentation: off' in ethtool_features.stdout_lines | map('trim')"
|
||||
- >-
|
||||
'generic-receive-offload: off' in
|
||||
ethtool_features.stdout_lines
|
||||
- >-
|
||||
'generic-segmentation-offload: on' in
|
||||
ethtool_features.stdout_lines
|
||||
- >-
|
||||
'tx-tcp-segmentation: off' in
|
||||
ethtool_features.stdout_lines | map('trim')
|
||||
|
||||
|
||||
- name: >-
|
||||
TEST: I can enable tx_tcp_segmentation (using underscores).
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: "{{ interface }}"
|
||||
state: up
|
||||
type: ethernet
|
||||
ip:
|
||||
dhcp4: "no"
|
||||
auto6: "no"
|
||||
ethtool:
|
||||
features:
|
||||
tx_tcp_segmentation: "yes"
|
||||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: ethtool_features
|
||||
- name:
|
||||
debug:
|
||||
var: ethtool_features.stdout_lines
|
||||
- name: Assert device features
|
||||
assert:
|
||||
that:
|
||||
- >-
|
||||
'tx-tcp-segmentation: on' in
|
||||
ethtool_features.stdout_lines | map('trim')
|
||||
|
||||
|
||||
- name: I cannot change tx_tcp_segmentation and tx-tcp-segmentation at
|
||||
the same time.
|
||||
block:
|
||||
- name: >-
|
||||
TEST: Change feature with both underscores and dashes.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- network_connections:
|
||||
provider: "{{ network_provider | mandatory }}"
|
||||
connections:
|
||||
- name: "{{ interface }}"
|
||||
state: up
|
||||
type: ethernet
|
||||
ip:
|
||||
dhcp4: "no"
|
||||
auto6: "no"
|
||||
ethtool:
|
||||
features:
|
||||
tx_tcp_segmentation: "no"
|
||||
tx-tcp-segmentation: "no"
|
||||
register: __network_connections_result
|
||||
rescue:
|
||||
- name: Show network_connections result
|
||||
debug:
|
||||
var: __network_connections_result
|
||||
- assert:
|
||||
that:
|
||||
- '{{ "fatal error: configuration error:
|
||||
connections[0].ethtool.features: duplicate key
|
||||
''tx_tcp_segmentation''" in
|
||||
__network_connections_result.msg }}'
|
||||
always:
|
||||
- name: Check failure
|
||||
debug:
|
||||
var: __network_connections_result
|
||||
- assert:
|
||||
that: "{{ __network_connections_result.failed == true }}"
|
||||
|
||||
|
||||
- name: "TEST: I can reset features to their original value."
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
@@ -104,7 +193,7 @@
|
||||
persistent_state: absent
|
||||
state: down
|
||||
ignore_errors: true
|
||||
- include_tasks: tasks/manage-test-interface.yml
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: absent
|
||||
tags:
|
||||
|
||||
@@ -4,46 +4,134 @@
|
||||
vars:
|
||||
interface: statebr
|
||||
profile: "{{ interface }}"
|
||||
network_provider: nm
|
||||
lsr_fail_debug:
|
||||
- __network_connections_result
|
||||
tasks:
|
||||
- debug:
|
||||
msg: Inside states tests
|
||||
- include_tasks: tasks/show-interfaces.yml
|
||||
- include_tasks: tasks/assert-device_absent.yml
|
||||
msg: "this is: playbooks/tests_states.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
# create test profile
|
||||
- include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: statebr
|
||||
state: up
|
||||
type: bridge
|
||||
ip:
|
||||
dhcp4: false
|
||||
auto6: false
|
||||
- include_tasks: tasks/assert-device_present.yml
|
||||
- include_tasks: tasks/assert-profile_present.yml
|
||||
|
||||
# test case (remove profile but keep it up)
|
||||
# I can remove a profile but keep the configuration active.
|
||||
- include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: statebr
|
||||
persistent_state: absent
|
||||
- include_tasks: tasks/assert-device_present.yml
|
||||
- include_tasks: tasks/assert-profile_absent.yml
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can create a profile
|
||||
lsr_setup:
|
||||
- tasks/delete_interface.yml
|
||||
- tasks/assert_device_absent.yml
|
||||
lsr_test:
|
||||
- tasks/create_bridge_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_profile_present.yml
|
||||
lsr_assert_when:
|
||||
# Device should be present because of autoconnect: true by
|
||||
# default for NM (this might be considered a bug)
|
||||
- what: tasks/assert_device_present.yml
|
||||
when: "{{ network_provider == 'nm' }}"
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:create
|
||||
|
||||
# test case
|
||||
# I can set a profile down that is up and absent.
|
||||
- name: Set down
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: statebr
|
||||
state: down
|
||||
- include_tasks: tasks/assert-device_absent.yml
|
||||
- include_tasks: tasks/assert-profile_absent.yml
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can create a profile without autoconnect
|
||||
lsr_setup:
|
||||
- tasks/delete_interface.yml
|
||||
- tasks/assert_device_absent.yml
|
||||
lsr_test:
|
||||
- tasks/create_bridge_profile_no_autoconnect.yml
|
||||
lsr_assert:
|
||||
# Device should be absent because of autoconnect: false
|
||||
- tasks/assert_device_absent.yml
|
||||
- tasks/assert_profile_present.yml
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:create_without_autoconnect
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can activate an existing profile
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
lsr_test:
|
||||
- tasks/activate_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_device_present.yml
|
||||
- tasks/assert_profile_present.yml
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:activate
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can remove an existing profile without taking it
|
||||
down
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
- tasks/activate_profile.yml
|
||||
lsr_test:
|
||||
- tasks/remove_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_device_present.yml
|
||||
- tasks/assert_profile_absent.yml
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:remove_up
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I can take a profile down that is absent
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
- tasks/activate_profile.yml
|
||||
- tasks/remove_profile.yml
|
||||
lsr_test:
|
||||
- tasks/remove+down_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_profile_absent.yml
|
||||
lsr_assert_when:
|
||||
- what: tasks/assert_device_absent.yml
|
||||
when: "{{ network_provider == 'nm' }}"
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:remove_down
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: I will not get an error when I try to
|
||||
remove an absent profile
|
||||
lsr_setup:
|
||||
- tasks/create_bridge_profile.yml
|
||||
- tasks/activate_profile.yml
|
||||
- tasks/remove+down_profile.yml
|
||||
lsr_test:
|
||||
- tasks/remove+down_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_profile_absent.yml
|
||||
# FIXME: This needs to be included before lsr_assert_when but
|
||||
# after the role ran to ensure that NetworkManager is actually
|
||||
# installed but it is not an assert.
|
||||
- tasks/get_NetworkManager_NVR.yml
|
||||
lsr_assert_when:
|
||||
- what: tasks/assert_device_absent.yml
|
||||
# NetworkManager 1.18.4 from CentOS does not seem to remove the
|
||||
# virtual interface in this case but it seems to work with
|
||||
# 1:NetworkManager-1.27.0-26129.d0a2eb8f05.el7
|
||||
when: "{{ network_provider == 'nm' and
|
||||
NetworkManager_NVR != 'NetworkManager-1.18.4-3.el7'
|
||||
}}"
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::states:remove_down_twice
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
interface: lsr101
|
||||
vlan_interface: lsr101.90
|
||||
tasks:
|
||||
- include_tasks: tasks/show-interfaces.yml
|
||||
- include_tasks: tasks/manage-test-interface.yml
|
||||
- include_tasks: tasks/show_interfaces.yml
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: present
|
||||
- include_tasks: tasks/assert-device_present.yml
|
||||
- name: "TEST: I can configure the MTU for a vlan interface without autoconnect."
|
||||
- include_tasks: tasks/assert_device_present.yml
|
||||
- name: >-
|
||||
TEST: I can configure the MTU for a vlan interface without autoconnect.
|
||||
debug:
|
||||
msg: "##################################################"
|
||||
- import_role:
|
||||
@@ -37,15 +38,15 @@
|
||||
ip:
|
||||
dhcp4: false
|
||||
auto6: false
|
||||
- include_tasks: tasks/assert-device_present.yml
|
||||
- include_tasks: tasks/assert_device_present.yml
|
||||
vars:
|
||||
interface: "{{ vlan_interface }}"
|
||||
- include_tasks: tasks/assert-profile_present.yml
|
||||
- include_tasks: tasks/assert_profile_present.yml
|
||||
vars:
|
||||
profile: "{{ item }}"
|
||||
loop:
|
||||
- "{{ interface }}"
|
||||
- "{{ vlan_interface }}"
|
||||
- "{{ interface }}"
|
||||
- "{{ vlan_interface }}"
|
||||
|
||||
- name: "TEARDOWN: remove profiles."
|
||||
debug:
|
||||
@@ -61,6 +62,6 @@
|
||||
persistent_state: absent
|
||||
state: down
|
||||
ignore_errors: true
|
||||
- include_tasks: tasks/manage-test-interface.yml
|
||||
- include_tasks: tasks/manage_test_interface.yml
|
||||
vars:
|
||||
state: absent
|
||||
|
||||
Reference in New Issue
Block a user