diff options
author | CaptTrews <capttrews@gmail.com> | 2020-01-16 15:50:24 +0000 |
---|---|---|
committer | CaptTrews <capttrews@gmail.com> | 2020-01-16 15:50:24 +0000 |
commit | 6b6166151faa3d811ae0ec3010a89e518a26287b (patch) | |
tree | 9cf59872c2ddc7e99595db4f47c72a7ce08b6c10 /tests/integration/targets/vyos_vlan | |
parent | d31b74ba6c74a6e3cdebd80b9eb5272aeb9b0fb4 (diff) | |
download | vyos-ansible-old-6b6166151faa3d811ae0ec3010a89e518a26287b.tar.gz vyos-ansible-old-6b6166151faa3d811ae0ec3010a89e518a26287b.zip |
Updated from network content collector
Signed-off-by: CaptTrews <capttrews@gmail.com>
Diffstat (limited to 'tests/integration/targets/vyos_vlan')
6 files changed, 59 insertions, 51 deletions
diff --git a/tests/integration/targets/vyos_vlan/defaults/main.yaml b/tests/integration/targets/vyos_vlan/defaults/main.yaml index 9ef5ba5..a845c24 100644 --- a/tests/integration/targets/vyos_vlan/defaults/main.yaml +++ b/tests/integration/targets/vyos_vlan/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: "*" +testcase: '*' test_items: [] diff --git a/tests/integration/targets/vyos_vlan/tasks/cli.yaml b/tests/integration/targets/vyos_vlan/tasks/cli.yaml index 890d3ac..90f265f 100644 --- a/tests/integration/targets/vyos_vlan/tasks/cli.yaml +++ b/tests/integration/targets/vyos_vlan/tasks/cli.yaml @@ -1,22 +1,22 @@ --- - name: collect all cli test cases find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' register: test_cases delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' loop_control: loop_var: test_case_to_run - name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_vlan/tasks/main.yaml b/tests/integration/targets/vyos_vlan/tasks/main.yaml index d4cf26f..a3db933 100644 --- a/tests/integration/targets/vyos_vlan/tasks/main.yaml +++ b/tests/integration/targets/vyos_vlan/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- {include: cli.yaml, tags: ['cli']} +- include: cli.yaml + tags: + - cli diff --git a/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml b/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml index cb0f348..eade5a4 100644 --- a/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml +++ b/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml @@ -11,86 +11,92 @@ - delete interfaces ethernet eth1 vif 201 - name: set vlan with name - vyos.vyos.vyos_vlan: &name + register: result + vyos.vyos.vyos_vlan: &id001 vlan_id: 100 name: vlan-100 interfaces: eth1 - register: result - assert: that: - - "result.changed == true" + - result.changed == true - "'set interfaces ethernet eth1 vif 100 description vlan-100' in result.commands" - name: set vlan with name(idempotence) - vyos.vyos.vyos_vlan: *name register: result + vyos.vyos.vyos_vlan: *id001 - assert: that: - - "result.changed == false" + - result.changed == false - name: set vlan with address - vyos.vyos.vyos_vlan: &address + register: result + vyos.vyos.vyos_vlan: &id002 vlan_id: 5 address: 192.168.5.12/24 interfaces: eth0 - register: result - assert: that: - - "result.changed == true" + - result.changed == true - "'set interfaces ethernet eth0 vif 5 address 192.168.5.12/24' in result.commands" - name: set vlan with address(idempotence) - vyos.vyos.vyos_vlan: *address register: result + vyos.vyos.vyos_vlan: *id002 - assert: that: - - "result.changed == false" + - result.changed == false - name: delete - vyos.vyos.vyos_vlan: &delete + register: result + vyos.vyos.vyos_vlan: &id003 vlan_id: 100 interfaces: eth1 state: absent - register: result - assert: that: - - "result.changed == true" + - result.changed == true - "'delete interfaces ethernet eth1 vif 100' in result.commands" - name: delete(idempotence) - vyos.vyos.vyos_vlan: *delete register: result + vyos.vyos.vyos_vlan: *id003 - assert: that: - - "result.changed == false" + - result.changed == false - name: Create VLANs using aggregate - vyos.vyos.vyos_vlan: &agg_vlan + register: result + vyos.vyos.vyos_vlan: &id004 aggregate: - - {vlan_id: 101, name: voice, interfaces: "eth0"} - - {vlan_id: 201, name: mgm, interfaces: "eth1"} + + - vlan_id: 101 + name: voice + interfaces: eth0 + + - vlan_id: 201 + name: mgm + interfaces: eth1 state: present - register: result - assert: that: - - "result.changed == true" + - result.changed == true - "'set interfaces ethernet eth0 vif 101 description voice' in result.commands" - "'set interfaces ethernet eth1 vif 201 description mgm' in result.commands" - name: Create VLANs using aggregate (idempotent) - vyos.vyos.vyos_vlan: *agg_vlan register: result + vyos.vyos.vyos_vlan: *id004 - assert: that: - - "result.changed == false" + - result.changed == false - name: teardown vyos.vyos.vyos_config: diff --git a/tests/integration/targets/vyos_vlan/tests/cli/intent.yaml b/tests/integration/targets/vyos_vlan/tests/cli/intent.yaml index 4a12317..f180d17 100644 --- a/tests/integration/targets/vyos_vlan/tests/cli/intent.yaml +++ b/tests/integration/targets/vyos_vlan/tests/cli/intent.yaml @@ -2,58 +2,58 @@ - debug: msg="START cli/intent.yaml on connection={{ ansible_connection }}" - name: setup - remove vlan used in test - vyos.vyos.vyos_config: &delete + vyos.vyos.vyos_config: lines: - delete interfaces ethernet eth1 vif 100 - delete interfaces ethernet eth0 vif 100 - name: set vlan with name + register: result vyos.vyos.vyos_vlan: vlan_id: 100 name: vlan-100 interfaces: eth1 - register: result - assert: that: - - "result.changed == true" + - result.changed == true - "'set interfaces ethernet eth1 vif 100 description vlan-100' in result.commands" - name: check vlan interface intent + register: result vyos.vyos.vyos_vlan: vlan_id: 100 name: vlan-100 associated_interfaces: eth1 - register: result - assert: that: - - "result.failed == false" + - result.failed == false - name: vlan interface config + intent + register: result vyos.vyos.vyos_vlan: vlan_id: 100 interfaces: eth0 associated_interfaces: - eth0 - eth1 - register: result - assert: that: - - "result.failed == false" + - result.failed == false - name: vlan intent fail + register: result + ignore_errors: true vyos.vyos.vyos_vlan: vlan_id: 100 associated_interfaces: - eth3 - eth4 - register: result - ignore_errors: true - assert: that: - - "result.failed == True" + - result.failed == True - debug: msg="End cli/intent.yaml on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/vyos_vlan/tests/cli/multiple.yaml b/tests/integration/targets/vyos_vlan/tests/cli/multiple.yaml index 53e93fd..2059a43 100644 --- a/tests/integration/targets/vyos_vlan/tests/cli/multiple.yaml +++ b/tests/integration/targets/vyos_vlan/tests/cli/multiple.yaml @@ -9,49 +9,49 @@ - delete interfaces ethernet eth1 vif 100 - name: Add multiple interfaces to vlan - vyos.vyos.vyos_vlan: &multiple + register: result + vyos.vyos.vyos_vlan: &id001 vlan_id: 100 interfaces: - eth0 - eth1 - register: result - assert: that: - - "result.changed == true" + - result.changed == true - "'set interfaces ethernet eth0 vif 100' in result.commands" - "'set interfaces ethernet eth1 vif 100' in result.commands" - name: Add multiple interfaces to vlan(idempotence) - vyos.vyos.vyos_vlan: *multiple register: result + vyos.vyos.vyos_vlan: *id001 - assert: that: - - "result.changed == false" + - result.changed == false - name: delete vlan with multiple interfaces - vyos.vyos.vyos_vlan: &delete_multiple + register: result + vyos.vyos.vyos_vlan: &id002 vlan_id: 100 interfaces: - eth0 - eth1 state: absent - register: result - assert: that: - - "result.changed == true" + - result.changed == true - "'delete interfaces ethernet eth0 vif 100' in result.commands" - "'delete interfaces ethernet eth1 vif 100' in result.commands" - name: delete vlan with multiple interfaces(idempotence) - vyos.vyos.vyos_vlan: *delete_multiple register: result + vyos.vyos.vyos_vlan: *id002 - assert: that: - - "result.changed == false" + - result.changed == false - name: teardown vyos.vyos.vyos_config: |