vyos: Make vyos related yaml file passing yamllint (#65449)

pull/65467/head
Yanis Guenane 5 years ago committed by Paul Belanger
parent ae4363f6d1
commit c19949706f

@ -10,4 +10,4 @@
set interfaces ethernet eth1 set interfaces ethernet eth1
set interfaces ethernet eth2 set interfaces ethernet eth2
delete interfaces loopback lo delete interfaces loopback lo
ignore_errors: yes ignore_errors: true

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -9,7 +9,7 @@
wait_for: wait_for:
- result[0] is 'VyOS' - result[0] is 'VyOS'
register: result register: result
ignore_errors: yes ignore_errors: true
- assert: - assert:
that: that:

@ -3,39 +3,39 @@
msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}" msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"
- block: - block:
- name: get output for single command - name: get output for single command
cli_command: cli_command:
command: show version command: show version
register: result register: result
- assert: - assert:
that: that:
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- name: send invalid command - name: send invalid command
cli_command: cli_command:
command: 'show foo' command: 'show foo'
register: result register: result
ignore_errors: yes ignore_errors: true
- assert: - assert:
that: that:
- "result.failed == true" - "result.failed == true"
- "result.msg is defined" - "result.msg is defined"
when: "ansible_connection == 'network_cli'" when: "ansible_connection == 'network_cli'"
- block: - block:
- name: test failure for local connection - name: test failure for local connection
cli_command: cli_command:
command: show version command: show version
register: result register: result
ignore_errors: yes ignore_errors: true
- assert: - assert:
that: that:
- 'result.failed == true' - 'result.failed == true'
- "'Connection type local is not valid for this module' in result.msg" - "'Connection type local is not valid for this module' in result.msg"
when: "ansible_connection == 'local'" when: "ansible_connection == 'local'"
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"

@ -5,9 +5,9 @@
vyos_command: vyos_command:
commands: show foo commands: show foo
register: result register: result
ignore_errors: yes ignore_errors: true
- assert: { that: result.failed } - assert: {that: result.failed}
- name: run commands that include invalid command - name: run commands that include invalid command
vyos_command: vyos_command:
@ -15,8 +15,8 @@
- show version - show version
- show foo - show foo
register: result register: result
ignore_errors: yes ignore_errors: true
- assert: { that: result.failed } - assert: {that: result.failed}
- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}"

@ -28,8 +28,8 @@
- name: Get output for multiple commands that call less explicitly - name: Get output for multiple commands that call less explicitly
vyos_command: vyos_command:
commands: commands:
# NOTE: We only test show commands that will output <ANSIBLE_VYOS_TERMINAL_LENGTH # NOTE: We only test show commands that will output <ANSIBLE_VYOS_TERMINAL_LENGTH
# Otherwise you will get ": "command timeout triggered" # Otherwise you will get ": "command timeout triggered"
- show hardware cpu detail - show hardware cpu detail
- show hardware mem - show hardware mem
- show license - show license

@ -8,7 +8,7 @@
wait_for: wait_for:
- result[0] contains bad_value_string - result[0] contains bad_value_string
register: result register: result
ignore_errors: yes ignore_errors: true
- assert: - assert:
that: that:

@ -1,3 +1,3 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}
- { include: cli_config.yaml, tags: ['cli_config'] } - {include: cli_config.yaml, tags: ['cli_config']}

@ -16,7 +16,7 @@
- name: take configure backup - name: take configure backup
vyos_config: vyos_config:
backup: yes backup: true
register: result register: result
- assert: - assert:
@ -44,11 +44,11 @@
- name: take configuration backup in custom filename and directory path - name: take configuration backup in custom filename and directory path
vyos_config: vyos_config:
backup: yes backup: true
backup_options: backup_options:
filename: backup.cfg filename: backup.cfg
dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}"
become: yes become: true
register: result register: result
- assert: - assert:
@ -67,10 +67,10 @@
- name: take configuration backup in custom filename - name: take configuration backup in custom filename
vyos_config: vyos_config:
backup: yes backup: true
backup_options: backup_options:
filename: backup.cfg filename: backup.cfg
become: yes become: true
register: result register: result
- assert: - assert:
@ -89,10 +89,10 @@
- name: take configuration backup in custom path and default filename - name: take configuration backup in custom path and default filename
vyos_config: vyos_config:
backup: yes backup: true
backup_options: backup_options:
dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}"
become: yes become: true
register: result register: result
- assert: - assert:

@ -49,11 +49,11 @@
- name: check multiple line config filter is working - name: check multiple line config filter is working
vyos_config: vyos_config:
lines: lines:
- set system login user esa level admin - set system login user esa level admin
- set system login user esa authentication encrypted-password '!abc!' - set system login user esa authentication encrypted-password '!abc!'
- set system login user vyos level admin - set system login user vyos level admin
- set system login user vyos authentication encrypted-password 'abc' - set system login user vyos authentication encrypted-password 'abc'
register: result register: result
- assert: - assert:

@ -1,3 +1,4 @@
---
- debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}" - debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}"
- name: delete configurable backup file path - name: delete configurable backup file path
@ -23,8 +24,8 @@
- name: take config backup - name: take config backup
cli_config: cli_config:
backup: yes backup: true
become: yes become: true
register: result register: result
- assert: - assert:
@ -44,11 +45,11 @@
- name: take configuration backup in custom filename and directory path - name: take configuration backup in custom filename and directory path
cli_config: cli_config:
backup: yes backup: true
backup_options: backup_options:
filename: backup.cfg filename: backup.cfg
dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}"
become: yes become: true
register: result register: result
- assert: - assert:
@ -67,10 +68,10 @@
- name: take configuration backup in custom filename - name: take configuration backup in custom filename
cli_config: cli_config:
backup: yes backup: true
backup_options: backup_options:
filename: backup.cfg filename: backup.cfg
become: yes become: true
register: result register: result
- assert: - assert:
@ -89,10 +90,10 @@
- name: take configuration backup in custom path and default filename - name: take configuration backup in custom path and default filename
cli_config: cli_config:
backup: yes backup: true
backup_options: backup_options:
dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}"
become: yes become: true
register: result register: result
- assert: - assert:

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -1,3 +1,4 @@
---
- name: get host name - name: get host name
vyos_command: vyos_command:
commands: commands:

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -84,7 +84,7 @@
- name: Disable interface - name: Disable interface
vyos_interface: vyos_interface:
name: eth1 name: eth1
enabled: False enabled: false
register: result register: result
- assert: - assert:
@ -95,7 +95,7 @@
- name: Enable interface - name: Enable interface
vyos_interface: vyos_interface:
name: eth1 name: eth1
enabled: True enabled: true
register: result register: result
- assert: - assert:
@ -133,8 +133,8 @@
- name: Set interface on aggregate - name: Set interface on aggregate
vyos_interface: vyos_interface:
aggregate: aggregate:
- { name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512} - {name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512}
- { name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256} - {name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256}
register: result register: result
when: "'virtio_net' not in lsmod_out.stdout[0]" when: "'virtio_net' not in lsmod_out.stdout[0]"
@ -154,8 +154,8 @@
- name: Set interface on aggregate (idempotent) - name: Set interface on aggregate (idempotent)
vyos_interface: vyos_interface:
aggregate: aggregate:
- { name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512} - {name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512}
- { name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256} - {name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256}
register: result register: result
when: "'virtio_net' not in lsmod_out.stdout[0]" when: "'virtio_net' not in lsmod_out.stdout[0]"
@ -170,7 +170,7 @@
- name: eth1 - name: eth1
- name: eth2 - name: eth2
description: test-interface description: test-interface
enabled: False enabled: false
register: result register: result
- assert: - assert:
@ -184,7 +184,7 @@
aggregate: aggregate:
- name: eth1 - name: eth1
- name: eth2 - name: eth2
enabled: True enabled: true
register: result register: result
- assert: - assert:

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/intent.yaml on connection={{ ansible_connection }}" #" - debug: msg="START cli/intent.yaml on connection={{ ansible_connection }}"
# To be able to run the lldp test we need to have a neighbor configured to talk to # To be able to run the lldp test we need to have a neighbor configured to talk to
# In DCI & Zuul we (currently) only spin up a single network VM, so we can't configure a neighbor # In DCI & Zuul we (currently) only spin up a single network VM, so we can't configure a neighbor
@ -30,7 +30,7 @@
- name: Setup (interface is up) - name: Setup (interface is up)
vyos_interface: vyos_interface:
name: eth1 name: eth1
enabled: True enabled: true
state: present state: present
register: result register: result
@ -48,7 +48,7 @@
vyos_interface: vyos_interface:
name: eth0 name: eth0
neighbors: neighbors:
- port: eth0 - port: eth0
when: run_lldp_tests when: run_lldp_tests
register: result register: result
@ -61,7 +61,7 @@
vyos_interface: vyos_interface:
name: eth1 name: eth1
state: down state: down
ignore_errors: yes ignore_errors: true
register: result register: result
- assert: - assert:
@ -73,9 +73,9 @@
vyos_interface: vyos_interface:
name: eth0 name: eth0
neighbors: neighbors:
- port: dummy_port - port: dummy_port
host: dummy_host host: dummy_host
ignore_errors: yes ignore_errors: true
when: run_lldp_tests when: run_lldp_tests
register: result register: result
@ -89,7 +89,7 @@
- name: Config + intent - name: Config + intent
vyos_interface: vyos_interface:
name: eth1 name: eth1
enabled: False enabled: false
state: down state: down
register: result register: result
@ -100,9 +100,9 @@
- name: Config + intent (fail) - name: Config + intent (fail)
vyos_interface: vyos_interface:
name: eth1 name: eth1
enabled: False enabled: false
state: up state: up
ignore_errors: yes ignore_errors: true
register: result register: result
- assert: - assert:
@ -113,10 +113,10 @@
- name: Aggregate config + intent (pass) - name: Aggregate config + intent (pass)
vyos_interface: vyos_interface:
aggregate: aggregate:
- name: eth1 - name: eth1
enabled: True enabled: true
state: up state: up
ignore_errors: yes ignore_errors: true
register: result register: result
- assert: - assert:
@ -126,9 +126,9 @@
- name: Check lldp neighbors intent aggregate arguments - name: Check lldp neighbors intent aggregate arguments
vyos_interface: vyos_interface:
aggregate: aggregate:
- name: eth0 - name: eth0
neighbors: neighbors:
- port: eth0 - port: eth0
when: run_lldp_tests when: run_lldp_tests
register: result register: result
@ -140,12 +140,12 @@
- name: Check lldp neighbors intent aggregate arguments (failed) - name: Check lldp neighbors intent aggregate arguments (failed)
vyos_interface: vyos_interface:
aggregate: aggregate:
- name: eth0 - name: eth0
neighbors: neighbors:
- port: eth0 - port: eth0
- port: dummy_port - port: dummy_port
host: dummy_host host: dummy_host
ignore_errors: yes ignore_errors: true
when: run_lldp_tests when: run_lldp_tests
register: result register: result

@ -1,2 +1,3 @@
---
dependencies: dependencies:
- prepare_vyos_tests - prepare_vyos_tests

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -14,4 +14,4 @@
- eth1 - eth1
- eth2 - eth2
loop_control: loop_control:
loop_var: intf loop_var: intf

@ -14,4 +14,4 @@
- eth1 - eth1
- eth2 - eth2
loop_control: loop_control:
loop_var: intf loop_var: intf

@ -4,7 +4,7 @@
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Delete attributes of given interfaces - name: Delete attributes of given interfaces
vyos_interfaces: &deleted vyos_interfaces: &deleted
config: config:

@ -1,13 +1,13 @@
--- ---
- debug: - debug:
msg: "START vyos_interfaces empty_config integration tests on connection={{ ansible_connection }}" msg: "START vyos_interfaces empty_config integration tests on connection={{ ansible_connection }}"
- name: Merged with empty config should give appropriate error message - name: Merged with empty config should give appropriate error message
vyos_interfaces: vyos_interfaces:
config: config:
state: merged state: merged
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -18,7 +18,7 @@
config: config:
state: replaced state: replaced
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -29,7 +29,7 @@
config: config:
state: overridden state: overridden
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:

@ -1,6 +1,6 @@
--- ---
- debug: - debug:
msg: "START vyos_interfaces merged integration tests on connection={{ ansible_connection }}" msg: "START vyos_interfaces merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
@ -56,4 +56,4 @@
that: that:
- "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,6 +1,6 @@
--- ---
- debug: - debug:
msg: "START vyos_interfaces overridden integration tests on connection={{ ansible_connection }}" msg: "START vyos_interfaces overridden integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
@ -22,7 +22,7 @@
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that correct commands were generated - name: Assert that correct commands were generated
assert: assert:
@ -47,6 +47,6 @@
assert: assert:
that: that:
- "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,6 +1,6 @@
--- ---
- debug: - debug:
msg: "START vyos_interfaces replaced integration tests on connection={{ ansible_connection }}" msg: "START vyos_interfaces replaced integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
@ -13,8 +13,8 @@
- name: eth1 - name: eth1
description: "Replaced by Ansible" description: "Replaced by Ansible"
vifs: vifs:
- vlan_id: 100 - vlan_id: 100
description: "VIF 100 - Replaced by Ansible" description: "VIF 100 - Replaced by Ansible"
- name: eth2 - name: eth2
mtu: 1400 mtu: 1400
@ -24,8 +24,8 @@
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that before dicts are correctly generated - name: Assert that before dicts are correctly generated
assert: assert:
@ -43,13 +43,13 @@
- name: Assert that task was idempotent - name: Assert that task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dict is correctly generated - name: Assert that before dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -73,6 +73,6 @@
- name: Assert that config was reverted - name: Assert that config was reverted
assert: assert:
that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -147,9 +147,9 @@
- name: Set IP addresses on aggregate - name: Set IP addresses on aggregate
vyos_l3_interface: vyos_l3_interface:
aggregate: aggregate:
- { name: eth1, ipv4: 192.168.2.10/24 } - {name: eth1, ipv4: 192.168.2.10/24}
- { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } - {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"}
- { name: eth2, ipv4: 192.168.4.10/24 } - {name: eth2, ipv4: 192.168.4.10/24}
register: result register: result
- assert: - assert:
@ -163,9 +163,9 @@
- name: Set IP addresses on aggregate (idempotent) - name: Set IP addresses on aggregate (idempotent)
vyos_l3_interface: vyos_l3_interface:
aggregate: aggregate:
- { name: eth1, ipv4: 192.168.2.10/24 } - {name: eth1, ipv4: 192.168.2.10/24}
- { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } - {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"}
- { name: eth2, ipv4: 192.168.4.10/24 } - {name: eth2, ipv4: 192.168.4.10/24}
register: result register: result
- assert: - assert:
@ -175,9 +175,9 @@
- name: Remove IP addresses on aggregate - name: Remove IP addresses on aggregate
vyos_l3_interface: vyos_l3_interface:
aggregate: aggregate:
- { name: eth1, ipv4: 192.168.2.10/24 } - {name: eth1, ipv4: 192.168.2.10/24}
- { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } - {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"}
- { name: eth2, ipv4: 192.168.4.10/24 } - {name: eth2, ipv4: 192.168.4.10/24}
state: absent state: absent
register: result register: result
@ -192,9 +192,9 @@
- name: Remove IP addresses on aggregate (idempotent) - name: Remove IP addresses on aggregate (idempotent)
vyos_l3_interface: vyos_l3_interface:
aggregate: aggregate:
- { name: eth1, ipv4: 192.168.2.10/24 } - {name: eth1, ipv4: 192.168.2.10/24}
- { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } - {name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64"}
- { name: eth2, ipv4: 192.168.4.10/24 } - {name: eth2, ipv4: 192.168.4.10/24}
state: absent state: absent
register: result register: result

@ -1,2 +1,3 @@
---
dependencies: dependencies:
- prepare_vyos_tests - prepare_vyos_tests

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -8,4 +8,4 @@
set interfaces ethernet eth2 address '192.0.2.10/24' set interfaces ethernet eth2 address '192.0.2.10/24'
set interfaces ethernet eth2 address '192.0.2.11/24' set interfaces ethernet eth2 address '192.0.2.11/24'
set interfaces ethernet eth2 address '2001:db8::10/32' set interfaces ethernet eth2 address '2001:db8::10/32'
set interfaces ethernet eth2 address '2001:db8::12/32' set interfaces ethernet eth2 address '2001:db8::12/32'

@ -5,44 +5,44 @@
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- block: - block:
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- name: Delete attributes of given interfaces - name: Delete attributes of given interfaces
vyos_l3_interfaces: &deleted vyos_l3_interfaces: &deleted
config: config:
- name: eth1 - name: eth1
- name: eth2 - name: eth2
state: deleted state: deleted
register: result register: result
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that the correct set of commands were generated - name: Assert that the correct set of commands were generated
assert: assert:
that: that:
- "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that the after dicts were correctly generated - name: Assert that the after dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Delete attributes of given interfaces (IDEMPOTENT) - name: Delete attributes of given interfaces (IDEMPOTENT)
vyos_l3_interfaces: *deleted vyos_l3_interfaces: *deleted
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result.changed == false" - "result.changed == false"
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,13 +1,13 @@
--- ---
- debug: - debug:
msg: "START vyos_l3_interfaces empty_config integration tests on connection={{ ansible_connection }}" msg: "START vyos_l3_interfaces empty_config integration tests on connection={{ ansible_connection }}"
- name: Merged with empty config should give appropriate error message - name: Merged with empty config should give appropriate error message
vyos_l3_interfaces: vyos_l3_interfaces:
config: config:
state: merged state: merged
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -18,7 +18,7 @@
config: config:
state: replaced state: replaced
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -29,7 +29,7 @@
config: config:
state: overridden state: overridden
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:

@ -5,54 +5,54 @@
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- block: - block:
- name: Merge the provided configuration with the exisiting running configuration - name: Merge the provided configuration with the exisiting running configuration
vyos_l3_interfaces: &merged vyos_l3_interfaces: &merged
config: config:
- name: eth1 - name: eth1
ipv4: ipv4:
- address: 192.0.2.10/24 - address: 192.0.2.10/24
ipv6: ipv6:
- address: 2001:db8::10/32 - address: 2001:db8::10/32
- name: eth2 - name: eth2
ipv4: ipv4:
- address: 198.51.100.10/24 - address: 198.51.100.10/24
vifs: vifs:
- vlan_id: 101 - vlan_id: 101
ipv4: ipv4:
- address: 198.51.100.130/25 - address: 198.51.100.130/25
ipv6: ipv6:
- address: 2001:db8::20/32 - address: 2001:db8::20/32
state: merged state: merged
register: result register: result
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that after dicts was correctly generated - name: Assert that after dicts was correctly generated
assert: assert:
that: that:
- "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
vyos_l3_interfaces: *merged vyos_l3_interfaces: *merged
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -5,48 +5,48 @@
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- block: - block:
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- name: Overrides all device configuration with provided configuration - name: Overrides all device configuration with provided configuration
vyos_l3_interfaces: &overridden vyos_l3_interfaces: &overridden
config: config:
- name: eth0 - name: eth0
ipv4: ipv4:
- address: dhcp - address: dhcp
- name: eth1 - name: eth1
ipv4: ipv4:
- address: "192.0.2.15/24" - address: "192.0.2.15/24"
state: overridden state: overridden
register: result register: result
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that correct commands were generated - name: Assert that correct commands were generated
assert: assert:
that: that:
- "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that after dicts were correctly generated - name: Assert that after dicts were correctly generated
assert: assert:
that: that:
- "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Overrides all device configuration with provided configurations (IDEMPOTENT) - name: Overrides all device configuration with provided configurations (IDEMPOTENT)
vyos_l3_interfaces: *overridden vyos_l3_interfaces: *overridden
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -5,48 +5,48 @@
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- block: - block:
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- name: Replace device configurations of listed interfaces with provided configurations - name: Replace device configurations of listed interfaces with provided configurations
vyos_l3_interfaces: &replaced vyos_l3_interfaces: &replaced
config: config:
- name: eth1 - name: eth1
ipv4: ipv4:
- address: 192.0.2.19/24 - address: 192.0.2.19/24
- name: eth2 - name: eth2
ipv6: ipv6:
- address: 2001:db8::11/32 - address: 2001:db8::11/32
state: replaced state: replaced
register: result register: result
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that before dicts are correctly generated - name: Assert that before dicts are correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that after dict is correctly generated - name: Assert that after dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT)
vyos_l3_interfaces: *replaced vyos_l3_interfaces: *replaced
register: result register: result
- name: Assert that task was idempotent - name: Assert that task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dict is correctly generated - name: Assert that before dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -20,7 +20,7 @@ merged:
- name: "eth0" - name: "eth0"
ipv4: ipv4:
- address: "dhcp" - address: "dhcp"
- name: "eth1" - name: "eth1"
ipv4: ipv4:
- address: "192.0.2.10/24" - address: "192.0.2.10/24"

@ -1,2 +1,3 @@
---
dependencies: dependencies:
- prepare_vyos_tests - prepare_vyos_tests

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -4,5 +4,5 @@
config: "{{ lines }}" config: "{{ lines }}"
vars: vars:
lines: | lines: |
set interfaces bonding bond0 set interfaces bonding bond0
set interfaces bonding bond1 set interfaces bonding bond1

@ -4,5 +4,5 @@
config: "{{ lines }}" config: "{{ lines }}"
vars: vars:
lines: | lines: |
delete interfaces bonding bond0 delete interfaces bonding bond0
delete interfaces bonding bond1 delete interfaces bonding bond1

@ -5,42 +5,42 @@
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Delete attributes of given LAG interfaces. - name: Delete attributes of given LAG interfaces.
vyos_lag_interfaces: &deleted vyos_lag_interfaces: &deleted
config: config:
- name: bond0 - name: bond0
- name: bond1 - name: bond1
state: deleted state: deleted
register: result register: result
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that the correct set of commands were generated - name: Assert that the correct set of commands were generated
assert: assert:
that: that:
- "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that the after dicts were correctly generated - name: Assert that the after dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Delete attributes of given interfaces (IDEMPOTENT) - name: Delete attributes of given interfaces (IDEMPOTENT)
vyos_lag_interfaces: *deleted vyos_lag_interfaces: *deleted
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result.changed == false" - "result.changed == false"
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,13 +1,13 @@
--- ---
- debug: - debug:
msg: "START vyos_lag_interfaces empty_config integration tests on connection={{ ansible_connection }}" msg: "START vyos_lag_interfaces empty_config integration tests on connection={{ ansible_connection }}"
- name: Merged with empty config should give appropriate error message - name: Merged with empty config should give appropriate error message
vyos_lag_interfaces: vyos_lag_interfaces:
config: config:
state: merged state: merged
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -18,7 +18,7 @@
config: config:
state: replaced state: replaced
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -29,7 +29,7 @@
config: config:
state: overridden state: overridden
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:

@ -1,6 +1,6 @@
--- ---
- debug: - debug:
msg: "START vyos_lag_interfaces merged integration tests on connection={{ ansible_connection }}" msg: "START vyos_lag_interfaces merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
@ -9,52 +9,52 @@
- include_tasks: _add_bond.yaml - include_tasks: _add_bond.yaml
- block: - block:
- name: Merge the provided configuration with the exisiting running configuration - name: Merge the provided configuration with the exisiting running configuration
vyos_lag_interfaces: &merged vyos_lag_interfaces: &merged
config: config:
- name: bond0 - name: bond0
hash_policy: "layer2" hash_policy: "layer2"
mode: "active-backup" mode: "active-backup"
members: members:
- member: eth1 - member: eth1
primary: eth1 primary: eth1
- name: bond1 - name: bond1
hash_policy: "layer2+3" hash_policy: "layer2+3"
mode: "active-backup" mode: "active-backup"
members: members:
- member: eth2 - member: eth2
primary: eth2 primary: eth2
state: merged state: merged
register: result register: result
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that after dicts was correctly generated - name: Assert that after dicts was correctly generated
assert: assert:
that: that:
- "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
vyos_lag_interfaces: *merged vyos_lag_interfaces: *merged
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,6 +1,6 @@
--- ---
- debug: - debug:
msg: "START vyos_lag_interfaces overridden integration tests on connection={{ ansible_connection }}" msg: "START vyos_lag_interfaces overridden integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
@ -9,46 +9,46 @@
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Overrides all device configuration with provided configuration - name: Overrides all device configuration with provided configuration
vyos_lag_interfaces: &overridden vyos_lag_interfaces: &overridden
config: config:
- name: bond1 - name: bond1
mode: "active-backup" mode: "active-backup"
members: members:
- member: eth2 - member: eth2
primary: eth2 primary: eth2
hash_policy: layer2 hash_policy: layer2
state: overridden state: overridden
register: result register: result
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that correct commands were generated - name: Assert that correct commands were generated
assert: assert:
that: that:
- "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that after dicts were correctly generated - name: Assert that after dicts were correctly generated
assert: assert:
that: that:
- "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Overrides all device configuration with provided configurations (IDEMPOTENT) - name: Overrides all device configuration with provided configurations (IDEMPOTENT)
vyos_lag_interfaces: *overridden vyos_lag_interfaces: *overridden
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,51 +1,51 @@
--- ---
- debug: - debug:
msg: "START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }}" msg: "START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Replace device configurations of listed LAG interfaces with provided configurations - name: Replace device configurations of listed LAG interfaces with provided configurations
vyos_lag_interfaces: &replaced vyos_lag_interfaces: &replaced
config: config:
- name: bond1 - name: bond1
mode: "802.3ad" mode: "802.3ad"
hash_policy: "layer2" hash_policy: "layer2"
members: members:
- member: eth2 - member: eth2
state: replaced state: replaced
register: result register: result
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that before dicts are correctly generated - name: Assert that before dicts are correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that after dict is correctly generated - name: Assert that after dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Replace device configurations of listed LAG interfaces with provided configurarions (IDEMPOTENT) - name: Replace device configurations of listed LAG interfaces with provided configurarions (IDEMPOTENT)
vyos_lag_interfaces: *replaced vyos_lag_interfaces: *replaced
register: result register: result
- name: Assert that task was idempotent - name: Assert that task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dict is correctly generated - name: Assert that before dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -7,63 +7,63 @@
- include_tasks: _remove_bond.yaml - include_tasks: _remove_bond.yaml
- block: - block:
- name: Apply the provided configuration (base config) - name: Apply the provided configuration (base config)
vyos_lag_interfaces: vyos_lag_interfaces:
config: config:
- name: bond0 - name: bond0
hash_policy: "layer2" hash_policy: "layer2"
mode: "active-backup" mode: "active-backup"
members: members:
- member: eth1 - member: eth1
primary: eth1 primary: eth1
- name: bond1 - name: bond1
hash_policy: "layer2+3" hash_policy: "layer2+3"
mode: "active-backup" mode: "active-backup"
members: members:
- member: eth2 - member: eth2
primary: eth2 primary: eth2
state: merged state: merged
register: base_config register: base_config
- name: Gather lag_interfaces facts - name: Gather lag_interfaces facts
vyos_facts: vyos_facts:
gather_subset: gather_subset:
- default - default
gather_network_resources: gather_network_resources:
- lag_interfaces - lag_interfaces
- name: Apply the provided configuration (config to be reverted) - name: Apply the provided configuration (config to be reverted)
vyos_lag_interfaces: vyos_lag_interfaces:
config: config:
- name: bond0 - name: bond0
hash_policy: "layer2+3" hash_policy: "layer2+3"
mode: "802.3ad" mode: "802.3ad"
members: members:
- member: eth1 - member: eth1
- name: bond1 - name: bond1
hash_policy: "layer2" hash_policy: "layer2"
mode: "xor-hash" mode: "xor-hash"
members: members:
- member: eth2 - member: eth2
state: merged state: merged
register: result register: result
- name: Assert that changes were applied - name: Assert that changes were applied
assert: assert:
that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Revert back to base config using facts round trip - name: Revert back to base config using facts round trip
vyos_lag_interfaces: vyos_lag_interfaces:
config: "{{ ansible_facts['network_resources']['lag_interfaces'] }}" config: "{{ ansible_facts['network_resources']['lag_interfaces'] }}"
state: overridden state: overridden
register: revert register: revert
- name: Assert that config was reverted - name: Assert that config was reverted
assert: assert:
that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -130,8 +130,8 @@
- name: Create collection of linkagg definitions - name: Create collection of linkagg definitions
vyos_linkagg: vyos_linkagg:
aggregate: aggregate:
- { name: bond0, members: [eth1] } - {name: bond0, members: [eth1]}
- { name: bond1, members: [eth2] } - {name: bond1, members: [eth2]}
state: present state: present
register: result register: result
@ -146,8 +146,8 @@
- name: Create collection of linkagg definitions again (idempotent) - name: Create collection of linkagg definitions again (idempotent)
vyos_linkagg: vyos_linkagg:
aggregate: aggregate:
- { name: bond0, members: [eth1] } - {name: bond0, members: [eth1]}
- { name: bond1, members: [eth2] } - {name: bond1, members: [eth2]}
state: present state: present
register: result register: result

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -5,40 +5,40 @@
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Delete attributes of LLDP service. - name: Delete attributes of LLDP service.
vyos_lldp_global: &deleted vyos_lldp_global: &deleted
config: config:
state: deleted state: deleted
register: result register: result
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate == result['before']}}" - "{{ populate == result['before']}}"
- name: Assert that the correct set of commands were generated - name: Assert that the correct set of commands were generated
assert: assert:
that: that:
- "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that the after dicts were correctly generated - name: Assert that the after dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] == result['after']}}" - "{{ deleted['after'] == result['after']}}"
- name: Delete attributes of given interfaces (IDEMPOTENT) - name: Delete attributes of given interfaces (IDEMPOTENT)
vyos_lldp_global: *deleted vyos_lldp_global: *deleted
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result.changed == false" - "result.changed == false"
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] == result['before'] }}" - "{{ deleted['after'] == result['before'] }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,13 +1,13 @@
--- ---
- debug: - debug:
msg: "START vyos_lldp_global empty_config integration tests on connection={{ ansible_connection }}" msg: "START vyos_lldp_global empty_config integration tests on connection={{ ansible_connection }}"
- name: Merged with empty config should give appropriate error message - name: Merged with empty config should give appropriate error message
vyos_lldp_global: vyos_lldp_global:
config: config:
state: merged state: merged
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -18,7 +18,7 @@
config: config:
state: replaced state: replaced
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:

@ -1,49 +1,49 @@
--- ---
- debug: - debug:
msg: "START vyos_lldp_global merged integration tests on connection={{ ansible_connection }}" msg: "START vyos_lldp_global merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Merge the provided configuration with the exisiting running configuration - name: Merge the provided configuration with the exisiting running configuration
vyos_lldp_global: &merged vyos_lldp_global: &merged
config: config:
legacy_protocols: legacy_protocols:
- 'fdp' - 'fdp'
- 'cdp' - 'cdp'
address: 192.0.2.11 address: 192.0.2.11
state: merged state: merged
register: result register: result
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: "{{ merged['before'] == result['before'] }}" that: "{{ merged['before'] == result['before'] }}"
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that after dicts was correctly generated - name: Assert that after dicts was correctly generated
assert: assert:
that: that:
- "{{ merged['after'] == result['after'] }}" - "{{ merged['after'] == result['after'] }}"
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
vyos_lldp_global: *merged vyos_lldp_global: *merged
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ merged['after'] == result['before'] }}" - "{{ merged['after'] == result['before'] }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,51 +1,51 @@
--- ---
- debug: - debug:
msg: "START vyos_lldp_global replaced integration tests on connection={{ ansible_connection }}" msg: "START vyos_lldp_global replaced integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Replace device configurations of LLDP service with provided configurations - name: Replace device configurations of LLDP service with provided configurations
vyos_lldp_global: &replaced vyos_lldp_global: &replaced
config: config:
legacy_protocols: legacy_protocols:
- 'edp' - 'edp'
- 'sonmp' - 'sonmp'
- 'cdp' - 'cdp'
address: 192.0.2.14 address: 192.0.2.14
state: replaced state: replaced
register: result register: result
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that before dicts are correctly generated - name: Assert that before dicts are correctly generated
assert: assert:
that: that:
- "{{ populate == result['before'] }}" - "{{ populate == result['before'] }}"
- name: Assert that after dict is correctly generated - name: Assert that after dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] == result['after'] }}" - "{{ replaced['after'] == result['after'] }}"
- name: Replace device configurations of LLDP service with provided configurarions (IDEMPOTENT) - name: Replace device configurations of LLDP service with provided configurarions (IDEMPOTENT)
vyos_lldp_global: *replaced vyos_lldp_global: *replaced
register: result register: result
- name: Assert that task was idempotent - name: Assert that task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dict is correctly generated - name: Assert that before dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] == result['before'] }}" - "{{ replaced['after'] == result['before'] }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -5,47 +5,47 @@
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- block: - block:
- name: Apply the provided configuration (base config) - name: Apply the provided configuration (base config)
vyos_lldp_global: vyos_lldp_global:
config: config:
legacy_protocols: legacy_protocols:
- 'fdp' - 'fdp'
- 'cdp' - 'cdp'
address: 192.0.2.11 address: 192.0.2.11
state: merged state: merged
register: base_config register: base_config
- name: Gather vyos_lldp_global facts - name: Gather vyos_lldp_global facts
vyos_facts: vyos_facts:
gather_subset: gather_subset:
- default - default
gather_network_resources: gather_network_resources:
- lldp_global - lldp_global
- name: Apply the provided configuration (config to be reverted) - name: Apply the provided configuration (config to be reverted)
vyos_lldp_global: vyos_lldp_global:
config: config:
legacy_protocols: legacy_protocols:
- 'edp' - 'edp'
- 'sonmp' - 'sonmp'
- 'cdp' - 'cdp'
address: 192.0.2.14 address: 192.0.2.14
state: merged state: merged
register: result register: result
- name: Assert that changes were applied - name: Assert that changes were applied
assert: assert:
that: "{{ round_trip['after'] == result['after'] }}" that: "{{ round_trip['after'] == result['after'] }}"
- name: Revert back to base config using facts round trip - name: Revert back to base config using facts round trip
vyos_lldp_global: vyos_lldp_global:
config: "{{ ansible_facts['network_resources']['lldp_global'] }}" config: "{{ ansible_facts['network_resources']['lldp_global'] }}"
state: replaced state: replaced
register: revert register: revert
- name: Assert that config was reverted - name: Assert that config was reverted
assert: assert:
that: "{{ base_config['after'] == revert['after'] }}" that: "{{ base_config['after'] == revert['after'] }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -4,7 +4,7 @@ merged:
address: '192.0.2.17' address: '192.0.2.17'
enable: true enable: true
legacy_protocols: legacy_protocols:
- 'cdp' - 'cdp'
commands: commands:
- "set service lldp management-address '192.0.2.11'" - "set service lldp management-address '192.0.2.11'"

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -92,8 +92,8 @@
- name: Create aggregate of LLDP interface configurations - name: Create aggregate of LLDP interface configurations
vyos_lldp_interface: vyos_lldp_interface:
aggregate: aggregate:
- name: eth1 - name: eth1
- name: eth2 - name: eth2
state: present state: present
register: result register: result
@ -106,8 +106,8 @@
- name: Create aggregate of LLDP interface configurations again (idempotent) - name: Create aggregate of LLDP interface configurations again (idempotent)
vyos_lldp_interface: vyos_lldp_interface:
aggregate: aggregate:
- name: eth1 - name: eth1
- name: eth2 - name: eth2
state: present state: present
register: result register: result
@ -118,8 +118,8 @@
- name: Override LLDP interface configuration on aggregate - name: Override LLDP interface configuration on aggregate
vyos_lldp_interface: vyos_lldp_interface:
aggregate: aggregate:
- name: eth1 - name: eth1
- { name: eth2, state: disabled } - {name: eth2, state: disabled}
state: present state: present
register: result register: result
@ -131,8 +131,8 @@
- name: Override LLDP interface configuration on aggregate again (idempotent) - name: Override LLDP interface configuration on aggregate again (idempotent)
vyos_lldp_interface: vyos_lldp_interface:
aggregate: aggregate:
- name: eth1 - name: eth1
- { name: eth2, state: disabled } - {name: eth2, state: disabled}
state: present state: present
register: result register: result
@ -143,8 +143,8 @@
- name: Delete aggregate of LLDP interface configurations - name: Delete aggregate of LLDP interface configurations
vyos_lldp_interface: vyos_lldp_interface:
aggregate: aggregate:
- name: eth1 - name: eth1
- name: eth2 - name: eth2
state: absent state: absent
register: result register: result
@ -157,8 +157,8 @@
- name: Delete aggregate of LLDP interface configurations (idempotent) - name: Delete aggregate of LLDP interface configurations (idempotent)
vyos_lldp_interface: vyos_lldp_interface:
aggregate: aggregate:
- name: eth1 - name: eth1
- name: eth2 - name: eth2
state: absent state: absent
register: result register: result

@ -1,2 +1,3 @@
---
dependencies: dependencies:
- prepare_vyos_tests - prepare_vyos_tests

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -5,4 +5,4 @@
vars: vars:
lines: | lines: |
delete service lldp interface delete service lldp interface
delete service lldp delete service lldp

@ -5,42 +5,42 @@
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Delete attributes of given LLDP interfaces. - name: Delete attributes of given LLDP interfaces.
vyos_lldp_interfaces: &deleted vyos_lldp_interfaces: &deleted
config: config:
- name: 'eth1' - name: 'eth1'
- name: 'eth2' - name: 'eth2'
state: deleted state: deleted
register: result register: result
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that the correct set of commands were generated - name: Assert that the correct set of commands were generated
assert: assert:
that: that:
- "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that the after dicts were correctly generated - name: Assert that the after dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Delete attributes of given interfaces (IDEMPOTENT) - name: Delete attributes of given interfaces (IDEMPOTENT)
vyos_lldp_interfaces: *deleted vyos_lldp_interfaces: *deleted
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result.changed == false" - "result.changed == false"
- "result.commands|length == 0" - "result.commands|length == 0"
- name: Assert that the before dicts were correctly generated - name: Assert that the before dicts were correctly generated
assert: assert:
that: that:
- "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,13 +1,13 @@
--- ---
- debug: - debug:
msg: "START vyos_lldp_interfaces empty_config integration tests on connection={{ ansible_connection }}" msg: "START vyos_lldp_interfaces empty_config integration tests on connection={{ ansible_connection }}"
- name: Merged with empty config should give appropriate error message - name: Merged with empty config should give appropriate error message
vyos_lldp_interfaces: vyos_lldp_interfaces:
config: config:
state: merged state: merged
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -18,7 +18,7 @@
config: config:
state: replaced state: replaced
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:
@ -29,7 +29,7 @@
config: config:
state: overridden state: overridden
register: result register: result
ignore_errors: True ignore_errors: true
- assert: - assert:
that: that:

@ -1,58 +1,58 @@
--- ---
- debug: - debug:
msg: "START vyos_lldp_interfaces merged integration tests on connection={{ ansible_connection }}" msg: "START vyos_lldp_interfaces merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- block: - block:
- name: Merge the provided configuration with the exisiting running configuration - name: Merge the provided configuration with the exisiting running configuration
vyos_lldp_interfaces: &merged vyos_lldp_interfaces: &merged
config: config:
- name: 'eth1' - name: 'eth1'
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
- name: 'eth2' - name: 'eth2'
location: location:
coordinate_based: coordinate_based:
altitude: 2200 altitude: 2200
datum: 'WGS84' datum: 'WGS84'
longitude: '222.267255W' longitude: '222.267255W'
latitude: '33.524449N' latitude: '33.524449N'
state: merged state: merged
register: result register: result
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that after dicts was correctly generated - name: Assert that after dicts was correctly generated
assert: assert:
that: that:
- "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
vyos_lldp_interfaces: *merged vyos_lldp_interfaces: *merged
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,49 +1,49 @@
--- ---
- debug: - debug:
msg: "START vyos_lldp_interfaces overridden integration tests on connection={{ ansible_connection }}" msg: "START vyos_lldp_interfaces overridden integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- include_tasks: _populate_intf.yaml - include_tasks: _populate_intf.yaml
- block: - block:
- name: Overrides all device configuration with provided configuration - name: Overrides all device configuration with provided configuration
vyos_lldp_interfaces: &overridden vyos_lldp_interfaces: &overridden
config: config:
- name: 'eth2' - name: 'eth2'
location: location:
elin: '0000000911' elin: '0000000911'
state: overridden state: overridden
register: result register: result
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ populate_intf | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate_intf | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that correct commands were generated - name: Assert that correct commands were generated
assert: assert:
that: that:
- "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that after dicts were correctly generated - name: Assert that after dicts were correctly generated
assert: assert:
that: that:
- "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Overrides all device configuration with provided configurations (IDEMPOTENT) - name: Overrides all device configuration with provided configurations (IDEMPOTENT)
vyos_lldp_interfaces: *overridden vyos_lldp_interfaces: *overridden
register: result register: result
- name: Assert that the previous task was idempotent - name: Assert that the previous task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dicts were correctly generated - name: Assert that before dicts were correctly generated
assert: assert:
that: that:
- "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -1,63 +1,63 @@
--- ---
- debug: - debug:
msg: "START vyos_lldp_interfaces replaced integration tests on connection={{ ansible_connection }}" msg: "START vyos_lldp_interfaces replaced integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- include_tasks: _populate.yaml - include_tasks: _populate.yaml
- block: - block:
- name: Replace device configurations of listed LLDP interfaces with provided configurations - name: Replace device configurations of listed LLDP interfaces with provided configurations
vyos_lldp_interfaces: &replaced vyos_lldp_interfaces: &replaced
config: config:
- name: 'eth2' - name: 'eth2'
enable: false enable: false
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
- name: 'eth1' - name: 'eth1'
enable: false enable: false
location: location:
coordinate_based: coordinate_based:
altitude: 2200 altitude: 2200
datum: 'WGS84' datum: 'WGS84'
longitude: '222.267255W' longitude: '222.267255W'
latitude: '33.524449N' latitude: '33.524449N'
state: replaced state: replaced
register: result register: result
- name: Assert that correct set of commands were generated - name: Assert that correct set of commands were generated
assert: assert:
that: that:
- "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
- name: Assert that before dicts are correctly generated - name: Assert that before dicts are correctly generated
assert: assert:
that: that:
- "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
- name: Assert that after dict is correctly generated - name: Assert that after dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Replace device configurations of listed LLDP interfaces with provided configurarions (IDEMPOTENT) - name: Replace device configurations of listed LLDP interfaces with provided configurarions (IDEMPOTENT)
vyos_lldp_interfaces: *replaced vyos_lldp_interfaces: *replaced
register: result register: result
- name: Assert that task was idempotent - name: Assert that task was idempotent
assert: assert:
that: that:
- "result['changed'] == false" - "result['changed'] == false"
- name: Assert that before dict is correctly generated - name: Assert that before dict is correctly generated
assert: assert:
that: that:
- "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -5,53 +5,53 @@
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml
- block: - block:
- name: Apply the provided configuration (base config) - name: Apply the provided configuration (base config)
vyos_lldp_interfaces: vyos_lldp_interfaces:
config: config:
- name: 'eth1' - name: 'eth1'
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
state: merged state: merged
register: base_config register: base_config
- name: Gather lldp_interfaces facts - name: Gather lldp_interfaces facts
vyos_facts: vyos_facts:
gather_subset: gather_subset:
- default - default
gather_network_resources: gather_network_resources:
- lldp_interfaces - lldp_interfaces
- name: Apply the provided configuration (config to be reverted) - name: Apply the provided configuration (config to be reverted)
vyos_lldp_interfaces: vyos_lldp_interfaces:
config: config:
- name: 'eth2' - name: 'eth2'
location: location:
coordinate_based: coordinate_based:
altitude: 2200 altitude: 2200
datum: 'WGS84' datum: 'WGS84'
longitude: '222.267255W' longitude: '222.267255W'
latitude: '33.524449N' latitude: '33.524449N'
state: merged state: merged
register: result register: result
- name: Assert that changes were applied - name: Assert that changes were applied
assert: assert:
that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}"
- name: Revert back to base config using facts round trip - name: Revert back to base config using facts round trip
vyos_lldp_interfaces: vyos_lldp_interfaces:
config: "{{ ansible_facts['network_resources']['lldp_interfaces'] }}" config: "{{ ansible_facts['network_resources']['lldp_interfaces'] }}"
state: overridden state: overridden
register: revert register: revert
- name: Assert that config was reverted - name: Assert that config was reverted
assert: assert:
that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}"
always: always:
- include_tasks: _remove_config.yaml - include_tasks: _remove_config.yaml

@ -20,36 +20,36 @@ merged:
after: after:
- name: 'eth1' - name: 'eth1'
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
- name: 'eth2' - name: 'eth2'
location: location:
coordinate_based: coordinate_based:
altitude: 2200 altitude: 2200
datum: 'WGS84' datum: 'WGS84'
longitude: '222.267255W' longitude: '222.267255W'
latitude: '33.524449N' latitude: '33.524449N'
populate: populate:
- name: 'eth1' - name: 'eth1'
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
- name: 'eth2' - name: 'eth2'
location: location:
coordinate_based: coordinate_based:
altitude: 2200 altitude: 2200
datum: 'WGS84' datum: 'WGS84'
longitude: '222.267255W' longitude: '222.267255W'
latitude: '33.524449N' latitude: '33.524449N'
replaced: replaced:
commands: commands:
@ -68,35 +68,35 @@ replaced:
- name: 'eth2' - name: 'eth2'
enable: false enable: false
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
- name: 'eth1' - name: 'eth1'
enable: false enable: false
location: location:
coordinate_based: coordinate_based:
altitude: 2200 altitude: 2200
datum: 'WGS84' datum: 'WGS84'
longitude: '222.267255W' longitude: '222.267255W'
latitude: '33.524449N' latitude: '33.524449N'
populate_intf: populate_intf:
- name: 'eth2' - name: 'eth2'
enable: false enable: false
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
overridden: overridden:
commands: commands:
- "delete service lldp interface eth2 location" - "delete service lldp interface eth2 location"
- "delete service lldp interface eth2 'disable'" - "delete service lldp interface eth2 'disable'"
- "set service lldp interface eth2 location elin '0000000911'" - "set service lldp interface eth2 location elin '0000000911'"
after: after:
@ -115,16 +115,16 @@ round_trip:
after: after:
- name: 'eth1' - name: 'eth1'
location: location:
civic_based: civic_based:
country_code: 'US' country_code: 'US'
ca_info: ca_info:
- ca_type: 0 - ca_type: 0
ca_value: 'ENGLISH' ca_value: 'ENGLISH'
- name: 'eth2' - name: 'eth2'
location: location:
coordinate_based: coordinate_based:
altitude: 2200 altitude: 2200
datum: 'WGS84' datum: 'WGS84'
longitude: '222.267255W' longitude: '222.267255W'
latitude: '33.524449N' latitude: '33.524449N'

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -83,8 +83,8 @@
- name: Add logging collections - name: Add logging collections
vyos_logging: vyos_logging:
aggregate: aggregate:
- { dest: file, name: test1, facility: all, level: info } - {dest: file, name: test1, facility: all, level: info}
- { dest: file, name: test2, facility: news, level: debug } - {dest: file, name: test2, facility: news, level: debug}
state: present state: present
register: result register: result
@ -97,9 +97,9 @@
- name: Add and remove logging collections with overrides - name: Add and remove logging collections with overrides
vyos_logging: vyos_logging:
aggregate: aggregate:
- { dest: console, facility: all, level: info } - {dest: console, facility: all, level: info}
- { dest: file, name: test1, facility: all, level: info, state: absent } - {dest: file, name: test1, facility: all, level: info, state: absent}
- { dest: console, facility: daemon, level: warning } - {dest: console, facility: daemon, level: warning}
state: present state: present
register: result register: result
@ -112,9 +112,9 @@
- name: Remove logging collections - name: Remove logging collections
vyos_logging: vyos_logging:
aggregate: aggregate:
- { dest: console, facility: all, level: info } - {dest: console, facility: all, level: info}
- { dest: console, facility: daemon, level: warning } - {dest: console, facility: daemon, level: warning}
- { dest: file, name: test2, facility: news, level: debug } - {dest: file, name: test2, facility: news, level: debug}
state: absent state: absent
register: result register: result

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -1,3 +1,4 @@
---
# vyos.py in plugins and module_utils/network covered by these as well # vyos.py in plugins and module_utils/network covered by these as well
# hit NetworkConfig # hit NetworkConfig
- name: configure simple config command - name: configure simple config command

@ -1,3 +1,4 @@
---
# vyos.py in plugins and module_utils/network covered by these as well # vyos.py in plugins and module_utils/network covered by these as well
# remove_default_spec() hit by multiple plays # remove_default_spec() hit by multiple plays
@ -20,7 +21,7 @@
- name: enable eth1 - name: enable eth1
vyos_interface: vyos_interface:
name: eth1 name: eth1
enabled: True enabled: true
state: present state: present
register: result register: result
@ -34,7 +35,7 @@
vyos_interface: vyos_interface:
name: eth1 name: eth1
state: down state: down
ignore_errors: yes ignore_errors: true
register: result register: result
- assert: - assert:
@ -45,5 +46,5 @@
- name: Config + intent - name: Config + intent
vyos_interface: vyos_interface:
name: eth1 name: eth1
enabled: False enabled: false
state: down state: down

@ -1,8 +1,9 @@
---
# hit check conditional in module_utils.network.vyos -> load_config() # hit check conditional in module_utils.network.vyos -> load_config()
- name: configure simple config command - name: configure simple config command
vyos_config: vyos_config:
lines: set system host-name check-test lines: set system host-name check-test
check_mode: yes check_mode: true
- name: get host name - name: get host name
vyos_command: vyos_command:

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -79,8 +79,8 @@
- name: Add static route collections - name: Add static route collections
vyos_static_route: vyos_static_route:
aggregate: aggregate:
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 } - {prefix: 172.24.1.0/24, next_hop: 192.168.42.64}
- { prefix: 172.24.2.0, mask: 24, next_hop: 192.168.42.64 } - {prefix: 172.24.2.0, mask: 24, next_hop: 192.168.42.64}
state: present state: present
register: result register: result
@ -93,9 +93,9 @@
- name: Add and remove static route collections with overrides - name: Add and remove static route collections with overrides
vyos_static_route: vyos_static_route:
aggregate: aggregate:
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 } - {prefix: 172.24.1.0/24, next_hop: 192.168.42.64}
- { prefix: 172.24.2.0/24, next_hop: 192.168.42.64, state: absent } - {prefix: 172.24.2.0/24, next_hop: 192.168.42.64, state: absent}
- { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 } - {prefix: 172.24.3.0/24, next_hop: 192.168.42.64}
state: present state: present
register: result register: result
@ -108,8 +108,8 @@
- name: Remove static route collections - name: Remove static route collections
vyos_static_route: vyos_static_route:
aggregate: aggregate:
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 } - {prefix: 172.24.1.0/24, next_hop: 192.168.42.64}
- { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 } - {prefix: 172.24.3.0/24, next_hop: 192.168.42.64}
state: absent state: absent
register: result register: result

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -18,7 +18,7 @@
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper show version'" command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper show version'"
responses: responses:
(?i)password: "badpass" (?i)password: "badpass"
ignore_errors: yes ignore_errors: true
register: results register: results
- name: check that attempt failed - name: check that attempt failed
@ -27,8 +27,8 @@
- results.failed - results.failed
always: always:
- name: delete user - name: delete user
vyos_user: vyos_user:
name: auth_user name: auth_user
state: absent state: absent
register: result register: result

@ -1,2 +1,2 @@
--- ---
- { include: cli.yaml, tags: ['cli'] } - {include: cli.yaml, tags: ['cli']}

@ -73,8 +73,8 @@
- name: Create VLANs using aggregate - name: Create VLANs using aggregate
vyos_vlan: &agg_vlan vyos_vlan: &agg_vlan
aggregate: aggregate:
- { vlan_id: 101, name: voice, interfaces: "eth0" } - {vlan_id: 101, name: voice, interfaces: "eth0"}
- { vlan_id: 201, name: mgm, interfaces: "eth1" } - {vlan_id: 201, name: mgm, interfaces: "eth1"}
state: present state: present
register: result register: result

@ -35,8 +35,8 @@
vlan_id: 100 vlan_id: 100
interfaces: eth0 interfaces: eth0
associated_interfaces: associated_interfaces:
- eth0 - eth0
- eth1 - eth1
register: result register: result
- assert: - assert:
@ -47,10 +47,10 @@
vyos_vlan: vyos_vlan:
vlan_id: 100 vlan_id: 100
associated_interfaces: associated_interfaces:
- eth3 - eth3
- eth4 - eth4
register: result register: result
ignore_errors: yes ignore_errors: true
- assert: - assert:
that: that:

Loading…
Cancel
Save