Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .sanity-ansible-ignore-2.18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins/modules/network_connections.py validate-modules:missing-gplv3-license
plugins/modules/network_state.py validate-modules:missing-gplv3-license
tests/network/ensure_provider_tests.py shebang!skip
3 changes: 3 additions & 0 deletions .sanity-ansible-ignore-2.19.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins/modules/network_connections.py validate-modules:missing-gplv3-license
plugins/modules/network_state.py validate-modules:missing-gplv3-license
tests/network/ensure_provider_tests.py shebang!skip
1 change: 0 additions & 1 deletion examples/down_profile.yml

This file was deleted.

8 changes: 4 additions & 4 deletions examples/network_state_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@
network_state:
routes:
config:
- destination: ::/0
next-hop-interface: eth1
next-hop-address: fe80::1
- destination: ::/0
next-hop-interface: eth1
next-hop-address: fe80::1
ansible.builtin.include_role:
name: linux-system-roles.network

- name: Configure the ethernet device eth1 with dhcp4 configured
- name: Configure the ethernet device eth1 with dhcp4 configured again
vars:
network_state:
interfaces:
Expand Down
11 changes: 0 additions & 11 deletions examples/remove+down_profile.yml

This file was deleted.

1 change: 0 additions & 1 deletion examples/remove_profile.yml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/get_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
hidden: true
register: files_to_delete

- name: Remove old data
- name: Remove old data from files_to_delete
file:
path: "{{ item.path }}"
state: absent
Expand Down
9 changes: 0 additions & 9 deletions tests/playbooks/down_profile+delete_interface.yml

This file was deleted.

10 changes: 0 additions & 10 deletions tests/playbooks/remove_profile.yml

This file was deleted.

24 changes: 12 additions & 12 deletions tests/playbooks/tests_auto_gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# not take precedence over other routes or not ignore other
# routes
route_metric4: 65535
- name: Include the task 'assert_device_present.yml'
- name: Include the task 'assert_device_present.yml' again
include_tasks: tasks/assert_device_present.yml
- name: Include the task 'assert_profile_present.yml'
include_tasks: tasks/assert_profile_present.yml
Expand Down Expand Up @@ -67,7 +67,7 @@
- name: "TEARDOWN: remove profiles."
debug:
msg: "##################################################"
- name: Import network role
- name: Import network role to remove interface
import_role:
name: linux-system-roles.network
vars:
Expand All @@ -76,19 +76,19 @@
persistent_state: absent
state: down
ignore_errors: true # noqa ignore-errors
- name: Include the task 'manage_test_interface.yml'
- name: Include the task 'manage_test_interface.yml' to remove interface
include_tasks: tasks/manage_test_interface.yml
vars:
state: absent
- name: >-
TEST: I can configure an interface with auto_gateway disabled
debug:
msg: "##################################################"
- name: Include the task 'manage_test_interface.yml'
- name: Include the task 'manage_test_interface.yml' to disable auto_gateway
include_tasks: tasks/manage_test_interface.yml
vars:
state: present
- name: Import network role
- name: Import network role to disable auto_gateway
import_role:
name: linux-system-roles.network
vars:
Expand All @@ -105,13 +105,13 @@
- "203.0.113.2/24"
gateway6: "2001:db8::1"
gateway4: "203.0.113.1"
- name: Include the task 'assert_device_present.yml'
- name: Include the task 'assert_device_present.yml' - 3
include_tasks: tasks/assert_device_present.yml
- name: Include the task 'assert_profile_present.yml'
- name: Include the task 'assert_profile_present.yml' again
include_tasks: tasks/assert_profile_present.yml
vars:
profile: "{{ interface }}"
- name: "Show ipv4 routes"
- name: "Show ipv4 routes again"
command: "ip route"
register: ipv4_routes
changed_when: false
Expand All @@ -120,7 +120,7 @@
that: __test_str not in ipv4_routes.stdout
vars:
__test_str: default via 203.0.113.1 dev {{ interface }}
- name: "Get ipv6 routes"
- name: "Get ipv6 routes again"
command: "ip -6 route"
register: ipv6_route
changed_when: false
Expand All @@ -130,10 +130,10 @@
vars:
__test_str: default via 2001:db8::1 dev {{ interface }}
when: network_provider == "nm"
- name: "TEARDOWN: remove profiles."
- name: "TEARDOWN: remove profiles. again"
debug:
msg: "##################################################"
- name: Import network role
- name: Import network role to remove interface again
import_role:
name: linux-system-roles.network
vars:
Expand All @@ -142,7 +142,7 @@
persistent_state: absent
state: down
ignore_errors: true # noqa ignore-errors
- name: Include the task 'manage_test_interface.yml'
- name: Include the task 'manage_test_interface.yml' to remove interface again
include_tasks: tasks/manage_test_interface.yml
vars:
state: absent
Expand Down
93 changes: 40 additions & 53 deletions tests/playbooks/tests_bridge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,52 @@
hosts: all
vars:
interface: LSR-TST-br31

tasks:
- name: "Set interface={{ interface }}"
set_fact:
interface: "{{ interface }}"
- name: Include the task 'show_interfaces.yml'
include_tasks: tasks/show_interfaces.yml

- name: Include the task 'assert_device_absent.yml'
include_tasks: tasks/assert_device_absent.yml

- name: Add test bridge
hosts: all
vars:
network_connections:
- name: "{{ interface }}"
interface_name: "{{ interface }}"
state: up
type: bridge
ip:
dhcp4: false
auto6: true
roles:
- linux-system-roles.network

- name: Import the playbook 'run_tasks.yml'
import_playbook: run_tasks.yml
vars:
task: tasks/assert_device_present.yml

- name: Import the playbook 'run_tasks.yml'
import_playbook: run_tasks.yml
vars:
profile: "{{ interface }}"
task: tasks/assert_profile_present.yml

- name: Import the playbook 'down_profile+delete_interface.yml'
import_playbook: down_profile+delete_interface.yml
vars:
profile: "{{ interface }}"
# FIXME: assert profile/device down

- name: Import the playbook 'remove_profile.yml'
import_playbook: remove_profile.yml
vars:
profile: "{{ interface }}"

- name: Import the playbook 'run_tasks.yml'
import_playbook: run_tasks.yml
vars:
profile: "{{ interface }}"
task: tasks/assert_profile_absent.yml

- name: Import the playbook 'run_tasks.yml'
import_playbook: run_tasks.yml
vars:
task: tasks/assert_device_absent.yml
- name: Add test bridge
include_role:
name: linux-system-roles.network
vars:
network_connections:
- name: "{{ interface }}"
interface_name: "{{ interface }}"
state: up
type: bridge
ip:
dhcp4: false
auto6: true

- name: Assert device present
include_tasks: tasks/assert_device_present.yml

- name: Assert profile present
include_tasks: tasks/assert_profile_present.yml
vars:
profile: "{{ interface }}"

- name: Include the task 'down_profile+delete_interface.yml'
include_tasks: tasks/down_profile+delete_interface.yml
vars:
profile: "{{ interface }}"
# FIXME: assert profile/device down

- name: Include the task 'remove_profile.yml'
include_tasks: tasks/remove_profile.yml
vars:
profile: "{{ interface }}"

- name: Assert profile absent
include_tasks: tasks/assert_profile_absent.yml
vars:
profile: "{{ interface }}"

- name: Assert device absent
include_tasks: tasks/assert_device_absent.yml

- name: Verify that cleanup restored state to default
hosts: all
tasks:
- name: Verify network state restored to default
include_tasks: tasks/check_network_dns.yml
54 changes: 24 additions & 30 deletions tests/playbooks/tests_bridge_cloned_mac.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Test configuring bridges
hosts: all
tasks:
- name: Define vars
set_fact:
interface: "LSR-TST-br31"
cloned_mac: "12:23:34:45:56:70"

- name: Add test bridge
hosts: all
vars:
network_connections:
- name: "{{ interface }}"
interface_name: "{{ interface }}"
state: up
type: bridge
ip:
dhcp4: false
auto6: true
cloned_mac: "{{ cloned_mac }}"
roles:
- linux-system-roles.network
interface: "LSR-TST-br31"
cloned_mac: "12:23:34:45:56:70"
tasks:
- name: Add test bridge
include_role:
name: linux-system-roles.network
vars:
network_connections:
- name: "{{ interface }}"
interface_name: "{{ interface }}"
state: up
type: bridge
ip:
dhcp4: false
auto6: true
cloned_mac: "{{ cloned_mac }}"

- name: Verify ifcfg MACADDR entry
command: >-
grep ^MACADDR= /etc/sysconfig/network-scripts/ifcfg-{{ interface }}
Expand Down Expand Up @@ -51,18 +48,15 @@
cloned_mac_address_nm.stdout.find(cloned_mac) != -1
msg: "cloned-mac-address is configured incorrectly"

- name: Import the playbook 'down_profile+delete_interface.yml'
import_playbook: down_profile+delete_interface.yml
vars:
profile: "{{ interface }}"
- name: Include the tasks 'down_profile+delete_interface.yml'
include_tasks: tasks/down_profile+delete_interface.yml
vars:
profile: "{{ interface }}"

- name: Import the playbook 'remove_profile.yml'
import_playbook: remove_profile.yml
vars:
profile: "{{ interface }}"
- name: Include the task 'remove_profile.yml'
include_tasks: tasks/remove_profile.yml
vars:
profile: "{{ interface }}"

- name: Verify that cleanup restored state to default
hosts: all
tasks:
- name: Verify network state restored to default
include_tasks: tasks/check_network_dns.yml
Loading
Loading