From efed7f993bc1c8aa225a7a6c5950fe65006b4c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Fri, 30 Dec 2022 23:03:49 +0100 Subject: [PATCH 1/4] Resolved warnings in meraki_ms_stack_l3_interface --- .../tasks/main.yml | 254 ++++++++++-------- 1 file changed, 135 insertions(+), 119 deletions(-) diff --git a/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml b/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml index 04bdaf01..a28a5bd6 100644 --- a/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml +++ b/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml @@ -3,44 +3,47 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) --- -- block: +- name: Block of tests + block: - name: Create network with type switch - meraki_network: + cisco.meraki.meraki_network: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' + org_name: '{{ test_org_name }}' net_name: IntTestNetworkSwitch type: switch timezone: America/Chicago delegate_to: localhost register: create_net_switch - - set_fact: - net_id: '{{create_net_switch.data.id}}' + - name: Set fact create_net_switch + ansible.builtin.set_fact: + net_id: '{{ create_net_switch.data.id }}' - name: Create new stack - meraki_switch_stack: - auth_key: '{{auth_key}}' + cisco.meraki.meraki_ms_stack: + auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' name: Test stack serials: - - "QBSB-BPR6-PRER" - - "QBSB-VLNE-E299" - - "QBSB-D75G-PXCG" + - "QBSB-BPR6-PRER" + - "QBSB-VLNE-E299" + - "QBSB-D75G-PXCG" register: stack - - set_fact: - stack_id: '{{stack.data.id}}' + - name: Set fact stack + ansible.builtin.set_fact: + stack_id: '{{ stack.data.id }}' - name: Create l3 interface with check mode - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' default_gateway: "192.168.3.1" name: "Test L3 interface 2" subnet: "192.168.3.0/24" @@ -51,18 +54,19 @@ register: create_check check_mode: true - - assert: + - name: Assert create_check + ansible.builtin.assert: that: - create_check.data is defined - create_check is changed - name: Create l3 interface - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' default_gateway: "192.168.3.1" name: "Test L3 interface 2" subnet: "192.168.3.0/24" @@ -72,88 +76,93 @@ delegate_to: localhost register: create - - assert: + - name: Assert create + ansible.builtin.assert: that: - create.data is defined - create is changed - name: Query all l3 interfaces - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' state: query stack_id: '{{ stack_id }}' delegate_to: localhost register: query_l3 - - set_fact: - interface_id_1: '{{create.data.interface_id}}' + - name: Set interface_id_1 + ansible.builtin.set_fact: + interface_id_1: '{{ create.data.interface_id }}' - name: Query one l3 interface - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' state: query stack_id: '{{ stack_id }}' - interface_id: '{{interface_id_1}}' + interface_id: '{{ interface_id_1 }}' delegate_to: localhost register: query_one - - debug: + - name: Debug query_one + ansible.builtin.debug: var: query_one - name: Update l3 interface with check mode - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' name: "Test L3 interface 3" subnet: "192.168.3.0/24" interface_ip: "192.168.3.2" - interface_id: '{{interface_id_1}}' + interface_id: '{{ interface_id_1 }}' multicast_routing: disabled vlan_id: 11 delegate_to: localhost register: update_check check_mode: true - - assert: + - name: Assert update_check + ansible.builtin.assert: that: - update_check.data is defined - update_check is changed - name: Update l3 interface - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' name: "Test L3 interface 3" subnet: "192.168.3.0/24" interface_ip: "192.168.3.2" - interface_id: '{{interface_id_1}}' + interface_id: '{{ interface_id_1 }}' multicast_routing: disabled vlan_id: 11 delegate_to: localhost register: update - - assert: + - name: Assert update + ansible.builtin.assert: that: - update.data is defined - update is changed - name: Update l3 interface idempotent - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' name: "Test L3 interface 3" subnet: "192.168.3.0/24" interface_ip: "192.168.3.2" @@ -162,17 +171,18 @@ delegate_to: localhost register: update_idempotent - - assert: + - name: Assert update_idempotent + ansible.builtin.assert: that: update_idempotent is not changed - name: Update l3 interface idempotent with check mode - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' name: "Test L3 interface 3" subnet: "192.168.3.0/24" interface_ip: "192.168.3.2" @@ -182,100 +192,106 @@ register: update_idempotent_check check_mode: true - - assert: + - name: Assert update_idempotent_check + ansible.builtin.assert: that: update_idempotent_check is not changed - - name: Query all l3 interfaces - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' state: query stack_id: '{{ stack_id }}' delegate_to: localhost register: query_l3 - - debug: + - name: Debug query_l3 + ansible.builtin.debug: var: query_l3 - - set_fact: - interface_id_1: '{{query_l3.data[0].interface_id}}' - ignore_errors: true + - name: Set fact query_l3 + ansible.builtin.set_fact: + interface_id_1: '{{ query_l3.data[0].interface_id }}' + failed_when: false + changed_when: false - - assert: + - name: Assert query_l3 + ansible.builtin.assert: that: - query_l3.data is defined - query_l3.data | length > 0 - name: Query one l3 interface - meraki_ms_stack_l3_interface: + cisco.meraki.meraki_ms_stack_l3_interface: auth_key: '{{ auth_key }}' state: query - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' stack_id: '{{ stack_id }}' name: Test L3 interface delegate_to: localhost register: query_one - - assert: + - name: Assert query_one + ansible.builtin.assert: that: - query_one.data is defined - ############################################################################# # Tear down starts here ############################################################################# always: - - name: Delete l3 interface with check mode - meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: absent - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' - interface_id: '{{ item }}' - delegate_to: localhost - check_mode: true - register: delete_check - loop: - - '{{interface_id_1}}' - - - assert: - that: - - delete_check is changed - - - name: Delete l3 interface - meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: absent - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - stack_id: '{{stack_id}}' - interface_id: '{{ interface_id_1 }}' - delegate_to: localhost - register: delete - - - assert: - that: - - delete is changed - - - name: Remove switches from stack - meraki_switch_stack: - auth_key: '{{auth_key}}' - state: absent - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - name: Test stack - register: stack - - # - name: Delete network - # meraki_network: - # auth_key: '{{ auth_key }}' - # state: absent - # org_name: '{{test_org_name}}' - # net_name: IntTestNetworkSwitch - # delegate_to: localhost + - name: Delete l3 interface with check mode + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: '{{ auth_key }}' + state: absent + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' + interface_id: '{{ item }}' + delegate_to: localhost + check_mode: true + register: delete_check + loop: + - '{{ interface_id_1 }}' + + - name: Assert delete_check + ansible.builtin.assert: + that: + - delete_check is changed + + - name: Delete l3 interface + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: '{{ auth_key }}' + state: absent + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + stack_id: '{{ stack_id }}' + interface_id: '{{ interface_id_1 }}' + delegate_to: localhost + register: delete + + - name: Assert delete + ansible.builtin.assert: + that: + - delete is changed + + - name: Remove switches from stack + cisco.meraki.meraki_ms_stack: + auth_key: '{{ auth_key }}' + state: absent + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + name: Test stack + register: stack + + # - name: Delete network + # meraki_network: + # auth_key: '{{ auth_key }}' + # state: absent + # org_name: '{{ test_org_name }}' + # net_name: IntTestNetworkSwitch + # delegate_to: localhost From 0a94dbee67c3695041a7d5d9b30b1bf13a9d398e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Fri, 30 Dec 2022 23:03:50 +0100 Subject: [PATCH 2/4] Added the changelog --- changelogs/fragments/warnings-meraki_ms_stack_l3_interface.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/warnings-meraki_ms_stack_l3_interface.yml diff --git a/changelogs/fragments/warnings-meraki_ms_stack_l3_interface.yml b/changelogs/fragments/warnings-meraki_ms_stack_l3_interface.yml new file mode 100644 index 00000000..9ec3f5d2 --- /dev/null +++ b/changelogs/fragments/warnings-meraki_ms_stack_l3_interface.yml @@ -0,0 +1,2 @@ +trivial: + - Resolved ansible-lint warnings in tests for module-meraki_ms_stack_l3_interface From 70f769fd7cc21f1e305062eb7650159de0211afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Sat, 4 Feb 2023 20:52:30 +0100 Subject: [PATCH 3/4] Changed the indentation due to error --- .../tasks/main.yml | 500 +++++++++--------- 1 file changed, 249 insertions(+), 251 deletions(-) diff --git a/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml b/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml index a28a5bd6..d5cda3e4 100644 --- a/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml +++ b/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml @@ -5,258 +5,256 @@ --- - name: Block of tests block: - - name: Create network with type switch - cisco.meraki.meraki_network: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_name: IntTestNetworkSwitch - type: switch - timezone: America/Chicago - delegate_to: localhost - register: create_net_switch - - - name: Set fact create_net_switch - ansible.builtin.set_fact: - net_id: '{{ create_net_switch.data.id }}' - - - name: Create new stack - cisco.meraki.meraki_ms_stack: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - name: Test stack - serials: - - "QBSB-BPR6-PRER" - - "QBSB-VLNE-E299" - - "QBSB-D75G-PXCG" - register: stack - - - name: Set fact stack - ansible.builtin.set_fact: - stack_id: '{{ stack.data.id }}' - - - name: Create l3 interface with check mode - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - default_gateway: "192.168.3.1" - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - delegate_to: localhost - register: create_check - check_mode: true - - - name: Assert create_check - ansible.builtin.assert: - that: - - create_check.data is defined - - create_check is changed - - - name: Create l3 interface - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - default_gateway: "192.168.3.1" - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - delegate_to: localhost - register: create - - - name: Assert create - ansible.builtin.assert: - that: - - create.data is defined - - create is changed - - - name: Query all l3 interfaces - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - state: query - stack_id: '{{ stack_id }}' - delegate_to: localhost - register: query_l3 - - - name: Set interface_id_1 - ansible.builtin.set_fact: - interface_id_1: '{{ create.data.interface_id }}' - - - name: Query one l3 interface - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - state: query - stack_id: '{{ stack_id }}' - interface_id: '{{ interface_id_1 }}' - delegate_to: localhost - register: query_one - - - name: Debug query_one - ansible.builtin.debug: - var: query_one - - - name: Update l3 interface with check mode - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - name: "Test L3 interface 3" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - interface_id: '{{ interface_id_1 }}' - multicast_routing: disabled - vlan_id: 11 - delegate_to: localhost - register: update_check - check_mode: true - - - name: Assert update_check - ansible.builtin.assert: - that: - - update_check.data is defined - - update_check is changed - - - name: Update l3 interface - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - name: "Test L3 interface 3" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - interface_id: '{{ interface_id_1 }}' - multicast_routing: disabled - vlan_id: 11 - delegate_to: localhost - register: update - - - name: Assert update - ansible.builtin.assert: - that: - - update.data is defined - - update is changed - - - name: Update l3 interface idempotent - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - name: "Test L3 interface 3" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - delegate_to: localhost - register: update_idempotent - - - name: Assert update_idempotent - ansible.builtin.assert: - that: - update_idempotent is not changed - - - name: Update l3 interface idempotent with check mode - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: present - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - name: "Test L3 interface 3" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - delegate_to: localhost - register: update_idempotent_check - check_mode: true - - - name: Assert update_idempotent_check - ansible.builtin.assert: - that: - update_idempotent_check is not changed - - - name: Query all l3 interfaces - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - state: query - stack_id: '{{ stack_id }}' - delegate_to: localhost - register: query_l3 - - - name: Debug query_l3 - ansible.builtin.debug: - var: query_l3 - - - name: Set fact query_l3 - ansible.builtin.set_fact: - interface_id_1: '{{ query_l3.data[0].interface_id }}' - failed_when: false - changed_when: false - - - name: Assert query_l3 - ansible.builtin.assert: - that: - - query_l3.data is defined - - query_l3.data | length > 0 - - - name: Query one l3 interface - cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' - state: query - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - name: Test L3 interface - delegate_to: localhost - register: query_one - - - name: Assert query_one - ansible.builtin.assert: - that: - - query_one.data is defined - -############################################################################# -# Tear down starts here -############################################################################# + - name: Create network with type switch + cisco.meraki.meraki_network: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + type: switch + timezone: America/Chicago + delegate_to: localhost + register: create_net_switch + + - name: Set fact create_net_switch + ansible.builtin.set_fact: + net_id: "{{ create_net_switch.data.id }}" + + - name: Create new stack + cisco.meraki.meraki_ms_stack: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + name: Test stack + serials: + - "QBSB-BPR6-PRER" + - "QBSB-VLNE-E299" + - "QBSB-D75G-PXCG" + register: stack + + - name: Set fact stack + ansible.builtin.set_fact: + stack_id: "{{ stack.data.id }}" + + - name: Create l3 interface with check mode + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + default_gateway: "192.168.3.1" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + delegate_to: localhost + register: create_check + check_mode: true + + - name: Assert create_check + ansible.builtin.assert: + that: + - create_check.data is defined + - create_check is changed + + - name: Create l3 interface + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + default_gateway: "192.168.3.1" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + delegate_to: localhost + register: create + + - name: Assert create + ansible.builtin.assert: + that: + - create.data is defined + - create is changed + + - name: Query all l3 interfaces + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + state: query + stack_id: "{{ stack_id }}" + delegate_to: localhost + register: query_l3 + + - name: Set interface_id_1 + ansible.builtin.set_fact: + interface_id_1: "{{ create.data.interface_id }}" + + - name: Query one l3 interface + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + state: query + stack_id: "{{ stack_id }}" + interface_id: "{{ interface_id_1 }}" + delegate_to: localhost + register: query_one + + - name: Debug query_one + ansible.builtin.debug: + var: query_one + + - name: Update l3 interface with check mode + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + name: "Test L3 interface 3" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + interface_id: "{{ interface_id_1 }}" + multicast_routing: disabled + vlan_id: 11 + delegate_to: localhost + register: update_check + check_mode: true + + - name: Assert update_check + ansible.builtin.assert: + that: + - update_check.data is defined + - update_check is changed + + - name: Update l3 interface + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + name: "Test L3 interface 3" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + interface_id: "{{ interface_id_1 }}" + multicast_routing: disabled + vlan_id: 11 + delegate_to: localhost + register: update + + - name: Assert update + ansible.builtin.assert: + that: + - update.data is defined + - update is changed + + - name: Update l3 interface idempotent + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + name: "Test L3 interface 3" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + delegate_to: localhost + register: update_idempotent + + - name: Assert update_idempotent + ansible.builtin.assert: + that: update_idempotent is not changed + + - name: Update l3 interface idempotent with check mode + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + state: present + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + name: "Test L3 interface 3" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + delegate_to: localhost + register: update_idempotent_check + check_mode: true + + - name: Assert update_idempotent_check + ansible.builtin.assert: + that: update_idempotent_check is not changed + + - name: Query all l3 interfaces + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + state: query + stack_id: "{{ stack_id }}" + delegate_to: localhost + register: query_l3 + + - name: Debug query_l3 + ansible.builtin.debug: + var: query_l3 + + - name: Set fact query_l3 + ansible.builtin.set_fact: + interface_id_1: "{{ query_l3.data[0].interface_id }}" + failed_when: false + changed_when: false + + - name: Assert query_l3 + ansible.builtin.assert: + that: + - query_l3.data is defined + - query_l3.data | length > 0 + + - name: Query one l3 interface + cisco.meraki.meraki_ms_stack_l3_interface: + auth_key: "{{ auth_key }}" + state: query + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + name: Test L3 interface + delegate_to: localhost + register: query_one + + - name: Assert query_one + ansible.builtin.assert: + that: + - query_one.data is defined + + ############################################################################# + # Tear down starts here + ############################################################################# always: - name: Delete l3 interface with check mode cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' + auth_key: "{{ auth_key }}" state: absent - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - interface_id: '{{ item }}' + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + interface_id: "{{ item }}" delegate_to: localhost check_mode: true register: delete_check loop: - - '{{ interface_id_1 }}' + - "{{ interface_id_1 }}" - name: Assert delete_check ansible.builtin.assert: @@ -265,12 +263,12 @@ - name: Delete l3 interface cisco.meraki.meraki_ms_stack_l3_interface: - auth_key: '{{ auth_key }}' + auth_key: "{{ auth_key }}" state: absent - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' - stack_id: '{{ stack_id }}' - interface_id: '{{ interface_id_1 }}' + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" + stack_id: "{{ stack_id }}" + interface_id: "{{ interface_id_1 }}" delegate_to: localhost register: delete @@ -281,10 +279,10 @@ - name: Remove switches from stack cisco.meraki.meraki_ms_stack: - auth_key: '{{ auth_key }}' + auth_key: "{{ auth_key }}" state: absent - org_name: '{{ test_org_name }}' - net_id: '{{ net_id }}' + org_name: "{{ test_org_name }}" + net_id: "{{ net_id }}" name: Test stack register: stack From 40184dd9599a28ef828bdccefac0819fc7356f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Sat, 4 Feb 2023 20:57:47 +0100 Subject: [PATCH 4/4] Changed the `net_id` to `test_net_id` --- .../tasks/main.yml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml b/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml index d5cda3e4..1406eedf 100644 --- a/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml +++ b/tests/integration/targets/meraki_ms_stack_l3_interface/tasks/main.yml @@ -10,7 +10,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" type: switch timezone: America/Chicago delegate_to: localhost @@ -25,7 +25,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" name: Test stack serials: - "QBSB-BPR6-PRER" @@ -42,7 +42,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" default_gateway: "192.168.3.1" name: "Test L3 interface 2" @@ -65,7 +65,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" default_gateway: "192.168.3.1" name: "Test L3 interface 2" @@ -86,7 +86,7 @@ cisco.meraki.meraki_ms_stack_l3_interface: auth_key: "{{ auth_key }}" org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" state: query stack_id: "{{ stack_id }}" delegate_to: localhost @@ -100,7 +100,7 @@ cisco.meraki.meraki_ms_stack_l3_interface: auth_key: "{{ auth_key }}" org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" state: query stack_id: "{{ stack_id }}" interface_id: "{{ interface_id_1 }}" @@ -116,7 +116,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" name: "Test L3 interface 3" subnet: "192.168.3.0/24" @@ -139,7 +139,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" name: "Test L3 interface 3" subnet: "192.168.3.0/24" @@ -161,7 +161,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" name: "Test L3 interface 3" subnet: "192.168.3.0/24" @@ -180,7 +180,7 @@ auth_key: "{{ auth_key }}" state: present org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" name: "Test L3 interface 3" subnet: "192.168.3.0/24" @@ -199,7 +199,7 @@ cisco.meraki.meraki_ms_stack_l3_interface: auth_key: "{{ auth_key }}" org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" state: query stack_id: "{{ stack_id }}" delegate_to: localhost @@ -226,7 +226,7 @@ auth_key: "{{ auth_key }}" state: query org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" name: Test L3 interface delegate_to: localhost @@ -247,7 +247,7 @@ auth_key: "{{ auth_key }}" state: absent org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" interface_id: "{{ item }}" delegate_to: localhost @@ -266,7 +266,7 @@ auth_key: "{{ auth_key }}" state: absent org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" stack_id: "{{ stack_id }}" interface_id: "{{ interface_id_1 }}" delegate_to: localhost @@ -282,7 +282,7 @@ auth_key: "{{ auth_key }}" state: absent org_name: "{{ test_org_name }}" - net_id: "{{ net_id }}" + net_id: "{{ test_net_id }}" name: Test stack register: stack