# SPDX-License-Identifier: BSD-3-Clause
---
- name: Test configuring ethernet devices
  hosts: all
  vars:
    type: veth
    interface: lsr27
  tasks:
    - name: Show inside ethernet tests
      debug:
        msg: Inside ethernet tests

    - name: Show network_provider
      debug:
        var: network_provider

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

    - name: Include the task 'manage_test_interface.yml'
      include_tasks: tasks/manage_test_interface.yml
      vars:
        state: present

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

    - name: Test static interface up
      include_role:
        name: linux-system-roles.network
      vars:
        network_connections:
          - name: "{{ interface }}"
            interface_name: "{{ interface }}"
            state: up
            type: ethernet
            autoconnect: true
            ip:
              address: 192.0.2.1/24

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

    - name: Show network_provider after running role
      debug:
        var: network_provider

    # FIXME: assert profile present
    # FIXME: assert profile/device up + IP address
    - name: Include the tasks '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: Include the task 'assert_profile_absent.yml'
      include_tasks: tasks/assert_profile_absent.yml
      vars:
        profile: "{{ interface }}"
    - name: Include the task 'assert_device_absent.yml'
      include_tasks: tasks/assert_device_absent.yml

    - name: Verify network state restored to default
      include_tasks: tasks/check_network_dns.yml
