diff --git a/changelogs/fragments/warnings-meraki_ms_l3_interface.yml b/changelogs/fragments/warnings-meraki_ms_l3_interface.yml new file mode 100644 index 00000000..e9077d5f --- /dev/null +++ b/changelogs/fragments/warnings-meraki_ms_l3_interface.yml @@ -0,0 +1,2 @@ +trivial: + - Resolved ansible-lint warnings in tests for module-meraki_ms_l3_interface diff --git a/tests/integration/targets/meraki_ms_l3_interface/tasks/main.yml b/tests/integration/targets/meraki_ms_l3_interface/tasks/main.yml index b32135cd..1b05c295 100644 --- a/tests/integration/targets/meraki_ms_l3_interface/tasks/main.yml +++ b/tests/integration/targets/meraki_ms_l3_interface/tasks/main.yml @@ -3,234 +3,244 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) --- -- block: - - name: Create network with type switch - 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: Claim a device into a network - meraki_device: - auth_key: '{{auth_key}}' - org_name: '{{test_org_name}}' - net_name: IntTestNetworkSwitch - serial: '{{ serial_switch_l3 }}' - state: present - delegate_to: localhost - - - name: Query all l3 interfaces - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: query - serial: '{{ serial_switch_l3 }}' - delegate_to: localhost - register: query_all - - - set_fact: - interface_id_1: '{{query_all.data.1.interface_id}}' - ignore_errors: true - - - assert: - that: - - query_all.data is defined - - query_all.data | length > 0 - - - name: Query one l3 interface - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: query - serial: '{{ serial_switch_l3 }}' - name: Test L3 interface - delegate_to: localhost - register: query_one - - - assert: - that: - - query_one.data is defined - - - name: Create l3 interface in check mode - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: present - serial: '{{ serial_switch_l3 }}' - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - # default_gateway: "192.168.2.1" - ospf_settings: - area: 0 - cost: 1 - is_passive_enabled: true - delegate_to: localhost - check_mode: true - register: create_check - - - assert: - that: - - create_check.data is defined - - create_check is changed - - - name: Create l3 interface - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: present - serial: '{{ serial_switch_l3 }}' - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - # default_gateway: "192.168.2.1" - ospf_settings: - area: 0 - cost: 1 - is_passive_enabled: true - delegate_to: localhost - register: create - - - set_fact: - interface_id_1: '{{create.data.interface_id}}' - - - assert: - that: - - create.data is defined - - create is changed - - - name: Update l3 interface with check mode - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: present - serial: '{{ serial_switch_l3 }}' - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - ospf_settings: - area: 0 - cost: 2 - is_passive_enabled: false - delegate_to: localhost - register: update_check - check_mode: true - - - assert: - that: - - update_check.data is defined - - update_check is changed - - - name: Update l3 interface - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: present - serial: '{{ serial_switch_l3 }}' - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - ospf_settings: - area: 0 - cost: 2 - is_passive_enabled: false - delegate_to: localhost - register: update - - - assert: - that: - - update.data is defined - - update is changed - - - name: Update l3 interface idempotent - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: present - serial: '{{ serial_switch_l3 }}' - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - ospf_settings: - area: 0 - cost: 2 - is_passive_enabled: false - delegate_to: localhost - register: update_idempotent - - - assert: - that: - update_idempotent is not changed - - - name: Update l3 interface idempotent with check mode - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: present - serial: '{{ serial_switch_l3 }}' - name: "Test L3 interface 2" - subnet: "192.168.3.0/24" - interface_ip: "192.168.3.2" - multicast_routing: disabled - vlan_id: 11 - ospf_settings: - area: 0 - cost: 2 - is_passive_enabled: false - delegate_to: localhost - register: update_idempotent_check - check_mode: true - - - assert: - that: - update_idempotent_check is not changed - - -############################################################################# -# Tear down starts here -############################################################################# +- 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: Claim a device into a network + cisco.meraki.meraki_device: + auth_key: "{{ auth_key }}" + org_name: "{{ test_org_name }}" + net_name: IntTestNetworkSwitch + serial: "{{ serial_switch_l3 }}" + state: present + delegate_to: localhost + + - name: Create l3 interface in check mode + cisco.meraki.meraki_ms_l3_interface: + auth_key: "{{ auth_key }}" + state: present + serial: "{{ serial_switch_l3 }}" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + # default_gateway: "192.168.2.1" + ospf_settings: + area: 0 + cost: 1 + is_passive_enabled: true + delegate_to: localhost + check_mode: true + register: create_check + + - 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_l3_interface: + auth_key: "{{ auth_key }}" + state: present + serial: "{{ serial_switch_l3 }}" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + # default_gateway: "192.168.2.1" + ospf_settings: + area: 0 + cost: 1 + is_passive_enabled: true + delegate_to: localhost + register: create + + - name: Set fact interface_id_1 + ansible.builtin.set_fact: + interface_id_1: "{{ create.data.interface_id }}" + + - name: Assert create + ansible.builtin.assert: + that: + - create.data is defined + - create is changed + + - name: Query all l3 interfaces + cisco.meraki.meraki_ms_l3_interface: + auth_key: "{{ auth_key }}" + state: query + serial: "{{ serial_switch_l3 }}" + delegate_to: localhost + register: query_all + + - name: Set fact interface_id_1 + ansible.builtin.set_fact: + interface_id_1: "{{query_all.data.1.interface_id}}" + ignore_errors: true + + - name: Assert query_all + ansible.builtin.assert: + that: + - query_all.data is defined + - query_all.data | length > 0 + + - name: Query one l3 interface + cisco.meraki.meraki_ms_l3_interface: + auth_key: "{{ auth_key }}" + state: query + serial: "{{ serial_switch_l3 }}" + name: Test L3 interface + delegate_to: localhost + register: query_one + + - name: Assert query_one + ansible.builtin.assert: + that: + - query_one.data is defined + + - name: Update l3 interface with check mode + cisco.meraki.meraki_ms_l3_interface: + auth_key: "{{ auth_key }}" + state: present + serial: "{{ serial_switch_l3 }}" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + ospf_settings: + area: 0 + cost: 2 + is_passive_enabled: false + 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_l3_interface: + auth_key: "{{ auth_key }}" + state: present + serial: "{{ serial_switch_l3 }}" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + ospf_settings: + area: 0 + cost: 2 + is_passive_enabled: false + 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_l3_interface: + auth_key: "{{ auth_key }}" + state: present + serial: "{{ serial_switch_l3 }}" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + ospf_settings: + area: 0 + cost: 2 + is_passive_enabled: false + 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_l3_interface: + auth_key: "{{ auth_key }}" + state: present + serial: "{{ serial_switch_l3 }}" + name: "Test L3 interface 2" + subnet: "192.168.3.0/24" + interface_ip: "192.168.3.2" + multicast_routing: disabled + vlan_id: 11 + ospf_settings: + area: 0 + cost: 2 + is_passive_enabled: false + 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 + + ############################################################################# + # Tear down starts here + ############################################################################# always: - - name: Delete l3 interface with check mode - meraki_ms_l3_interface: - auth_key: '{{ auth_key }}' - state: absent - serial: '{{ serial_switch_l3 }}' - 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_l3_interface: - auth_key: '{{ auth_key }}' - state: absent - serial: '{{ serial_switch_l3 }}' - interface_id: '{{ interface_id_1 }}' - delegate_to: localhost - register: delete - - - assert: - that: - - delete is changed + - name: Delete l3 interface with check mode + cisco.meraki.meraki_ms_l3_interface: + auth_key: "{{ auth_key }}" + state: absent + serial: "{{ serial_switch_l3 }}" + 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_l3_interface: + auth_key: "{{ auth_key }}" + state: absent + serial: "{{ serial_switch_l3 }}" + interface_id: "{{ interface_id_1 }}" + delegate_to: localhost + register: delete + + - name: Assert delete + ansible.builtin.assert: + that: + - delete is changed # - name: Delete network # meraki_network: # auth_key: '{{ auth_key }}' # state: absent - # org_name: '{{test_org_name}}' + # org_name: '{{ test_org_name }}' # net_name: IntTestNetworkSwitch # delegate_to: localhost