- name: cleanup a network ipv4
  nios_network:
    network: 192.168.10.0/24
    comment: this is a test comment
    state: absent
    provider: "{{ nios_provider }}"

- name: configure a network ipv4
  nios_network:
    network: 192.168.10.0/24
    comment: this is a test comment
    state: present
    provider: "{{ nios_provider }}"
  register: nios_ipv4_create1

- name: configure a network ipv4
  nios_network:
    network: 192.168.10.0/24
    comment: this is a test comment
    state: present
    provider: "{{ nios_provider }}"
  register: nios_ipv4_create2

#- assert:
#    that:
#      - "nios_ipv4_create1.changed"
#      - "not nios_ipv4_create2.changed"

- name: set dhcp options for a network ipv4
  nios_network:
    network: 192.168.10.0/24
    comment: this is a test comment
    options:
      - name: domain-name
        value: ansible.com
    state: present
    provider: "{{ nios_provider }}"
  register: nios_ipv4_update1

- name: set dhcp options for a network ipv4
  nios_network:
    network: 192.168.10.0/24
    comment: this is a test comment
    options:
      - name: domain-name
        value: ansible.com
    state: present
    provider: "{{ nios_provider }}"
  register: nios_ipv4_update2

- name: remove a network ipv4
  nios_network:
    network: 192.168.10.0/24
    state: absent
    provider: "{{ nios_provider }}"
  register: nios_ipv4_remove1

- name: remove a network ipv4
  nios_network:
    network: 192.168.10.0/24
    state: absent
    provider: "{{ nios_provider }}"
  register: nios_ipv4_remove2

- name: configure a network ipv6
  nios_network:
    network: fe80::/64
    comment: this is a test comment
    state: present
    provider: "{{ nios_provider }}"
  register: nios_ipv6_create1

- assert:
    that:
      - "nios_ipv4_create1.changed"
      - "not nios_ipv4_create2.changed"
      - "nios_ipv4_update1.changed"
      - "not nios_ipv4_update2.changed"
      - "nios_ipv4_remove1.changed"
      - "not nios_ipv4_remove2.changed"
