5d1ed1fc25
* Fix platform agnostic network test cases * Fix vyos_interface CI failure
223 lines
5.7 KiB
YAML
223 lines
5.7 KiB
YAML
---
|
|
- debug: msg="START net_interface vyos/basic.yaml"
|
|
|
|
- name: Run vyos lsmod command
|
|
vyos_command:
|
|
commands:
|
|
- lsmod
|
|
register: lsmod_out
|
|
|
|
- name: Set up - delete interface
|
|
net_interface:
|
|
name: eth1
|
|
state: absent
|
|
|
|
- name: Set up - Create interface
|
|
net_interface:
|
|
name: eth1
|
|
state: present
|
|
description: test-interface
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set interfaces ethernet eth1" in result.commands'
|
|
- '"set interfaces ethernet eth1 description test-interface" in result.commands'
|
|
|
|
- name: Configure interface params
|
|
net_interface:
|
|
name: eth1
|
|
state: present
|
|
description: test-interface-1
|
|
speed: 100
|
|
duplex: half
|
|
mtu: 256
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set interfaces ethernet eth1 description test-interface-1" in result.commands'
|
|
- '"set interfaces ethernet eth1 speed 100" in result.commands'
|
|
- '"set interfaces ethernet eth1 duplex half" in result.commands'
|
|
- '"set interfaces ethernet eth1 mtu 256" in result.commands'
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- name: Configure interface params (idempotent)
|
|
net_interface:
|
|
name: eth1
|
|
state: present
|
|
description: test-interface-1
|
|
speed: 100
|
|
duplex: half
|
|
mtu: 256
|
|
register: result
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
when: "'virtio' not in lsmod_out.stdout[0]"
|
|
|
|
- name: Change interface params
|
|
net_interface:
|
|
name: eth1
|
|
state: present
|
|
description: test-interface-2
|
|
speed: 1000
|
|
duplex: full
|
|
mtu: 512
|
|
register: result
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set interfaces ethernet eth1 description test-interface-2" in result.commands'
|
|
- '"set interfaces ethernet eth1 speed 1000" in result.commands'
|
|
- '"set interfaces ethernet eth1 duplex full" in result.commands'
|
|
- '"set interfaces ethernet eth1 mtu 512" in result.commands'
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- name: Disable interface
|
|
net_interface:
|
|
name: eth1
|
|
enabled: False
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set interfaces ethernet eth1 disable" in result.commands'
|
|
|
|
- name: Enable interface
|
|
net_interface:
|
|
name: eth1
|
|
enabled: True
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"delete interfaces ethernet eth1 disable" in result.commands'
|
|
|
|
- name: Delete interface
|
|
net_interface:
|
|
name: eth1
|
|
state: absent
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"delete interfaces ethernet eth1" in result.commands'
|
|
|
|
- name: Delete interface (idempotent)
|
|
net_interface:
|
|
name: eth1
|
|
state: absent
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
|
|
- name: Aggregate setup- delete interface
|
|
net_interface:
|
|
name: eth2
|
|
state: absent
|
|
register: result
|
|
|
|
- name: Set interface on aggregate
|
|
net_interface:
|
|
aggregate:
|
|
- { name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512}
|
|
- { name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256}
|
|
register: result
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set interfaces ethernet eth1 description test-interface-1" in result.commands'
|
|
- '"set interfaces ethernet eth1 speed 100" in result.commands'
|
|
- '"set interfaces ethernet eth1 duplex half" in result.commands'
|
|
- '"set interfaces ethernet eth1 mtu 512" in result.commands'
|
|
- '"set interfaces ethernet eth2 description test-interface-2" in result.commands'
|
|
- '"set interfaces ethernet eth2 speed 1000" in result.commands'
|
|
- '"set interfaces ethernet eth2 duplex full" in result.commands'
|
|
- '"set interfaces ethernet eth2 mtu 256" in result.commands'
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- name: Set interface on aggregate (idempotent)
|
|
net_interface:
|
|
aggregate:
|
|
- { name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512}
|
|
- { name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256}
|
|
register: result
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
when: "'virtio_net' not in lsmod_out.stdout[0]"
|
|
|
|
- name: Disable interface on aggregate
|
|
net_interface:
|
|
aggregate:
|
|
- name: eth1
|
|
- name: eth2
|
|
description: test-interface
|
|
enabled: False
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set interfaces ethernet eth1 disable" in result.commands'
|
|
- '"set interfaces ethernet eth2 disable" in result.commands'
|
|
|
|
- name: Enable interface on aggregate
|
|
net_interface:
|
|
aggregate:
|
|
- name: eth1
|
|
- name: eth2
|
|
enabled: True
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"delete interfaces ethernet eth1 disable" in result.commands'
|
|
- '"delete interfaces ethernet eth2 disable" in result.commands'
|
|
|
|
- name: Delete interface aggregate
|
|
net_interface:
|
|
aggregate:
|
|
- name: eth1
|
|
- name: eth2
|
|
state: absent
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"delete interfaces ethernet eth1" in result.commands'
|
|
- '"delete interfaces ethernet eth2" in result.commands'
|
|
|
|
- name: Delete interface aggregate (idempotent)
|
|
net_interface:
|
|
aggregate:
|
|
- name: eth1
|
|
- name: eth2
|
|
state: absent
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
|
|
|
|
- debug: msg="END net_interface vyos/basic.yaml"
|