diff options
author | Kevin Breit <kevin.breit@kevinbreit.net> | 2018-06-20 02:44:50 -0500 |
---|---|---|
committer | Dag Wieers <dag@wieers.com> | 2018-06-20 09:44:50 +0200 |
commit | 7c888b86ba82c4e49ee16130d9cb9c068b95c805 (patch) | |
tree | ab484cc57bc67b98f5affc8f0fd32a77c0e7ec5e /test/integration/targets | |
parent | 564fe87b29b7fff47652065f0f8b35fe508466db (diff) | |
download | ansible-7c888b86ba82c4e49ee16130d9cb9c068b95c805.tar.gz |
New module - meraki_device (#41631)
* Initial commit for meraki_device module
- Allow claiming, removal, updating, and querying of devices
- Integration tests are included
- Integration tests are not complete because physical gear is required
- Integration tests also require Meraki subscriptions
* Added support for serial number query without network
* Added support for net_id and net_name
* Changes recommended by ansible-test for PEP8 and documentation
* Remove duplicate state in example
* Fix typo
Diffstat (limited to 'test/integration/targets')
-rw-r--r-- | test/integration/targets/meraki_device/aliases | 1 | ||||
-rw-r--r-- | test/integration/targets/meraki_device/tasks/main.yml | 202 |
2 files changed, 203 insertions, 0 deletions
diff --git a/test/integration/targets/meraki_device/aliases b/test/integration/targets/meraki_device/aliases new file mode 100644 index 0000000000..89aea537d1 --- /dev/null +++ b/test/integration/targets/meraki_device/aliases @@ -0,0 +1 @@ +unsupported
\ No newline at end of file diff --git a/test/integration/targets/meraki_device/tasks/main.yml b/test/integration/targets/meraki_device/tasks/main.yml new file mode 100644 index 0000000000..2368162509 --- /dev/null +++ b/test/integration/targets/meraki_device/tasks/main.yml @@ -0,0 +1,202 @@ +--- +- name: Claim a device + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + serial: '{{serial}}' + state: present + delegate_to: localhost + register: claim_device + +- debug: + msg: '{{claim_device}}' + +- assert: + that: + - claim_device.changed == true + +- name: Query all devices + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + state: query + delegate_to: localhost + register: query_all + +- debug: + msg: '{{query_all}}' + +- assert: + that: + - query_all.changed == False + +- name: Query all devices in one network by network ID + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_id: '{{test_net_id}}' + state: query + delegate_to: localhost + register: query_one_net_id + +- debug: + msg: '{{query_one_net_id}}' + +- name: Query all devices in one network + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + state: query + delegate_to: localhost + register: query_one_net + +- debug: + msg: '{{query_one_net}}' + +- name: Query device by serial + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + serial: '{{serial}}' + state: query + delegate_to: localhost + register: query_serial_no_net + +- debug: + msg: '{{query_serial_no_net}}' + +- name: Query device by serial + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + serial: '{{serial}}' + state: query + delegate_to: localhost + register: query_serial + +- debug: + msg: '{{query_serial}}' + +- assert: + that: + - query_serial.changed == False + +- name: Query uplink information for a device + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + serial_uplink: '{{serial}}' + state: query + delegate_to: localhost + register: query_serial_uplink + +- debug: + msg: '{{query_serial_uplink}}' + +- name: Query LLDP/CDP information about a device + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + serial_lldp_cdp: '{{serial}}' + lldp_cdp_timespan: 6000 + state: query + delegate_to: localhost + register: query_serial_lldp_cdp + +- debug: + msg: '{{query_serial_lldp_cdp}}' + +- name: Query a device by hostname + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + hostname: test-hostname + state: query + delegate_to: localhost + register: query_hostname + +- debug: + msg: '{{query_hostname}}' + +- name: Query a device by model + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + model: MR26 + state: query + delegate_to: localhost + register: query_model + +- debug: + msg: '{{query_model}}' + +- name: Update a device + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + serial: '{{serial}}' + name: mr26 + address: 1060 W. Addison St., Chicago, IL + lat: 41.948038 + lng: -87.65568 + tags: recently-added + state: present + move_map_marker: True + delegate_to: localhost + register: update_device + +- debug: + msg: '{{update_device}}' + +# - assert: +# that: +# - update_device.changed == true +# - '"1060 W. Addison St., Chicago, IL" in update_device.data.0.address' + +- name: Update a device with idempotency + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + serial: '{{serial}}' + name: mr26 + address: 1060 W. Addison St., Chicago, IL + lat: 41.948038 + lng: -87.65568 + tags: recently-added + state: present + move_map_marker: True + delegate_to: localhost + register: update_device_idempotent + +- debug: + msg: '{{update_device_idempotent}}' + +- assert: + that: + - update_device_idempotent.changed == False + +- name: Remove a device + meraki_device: + auth_key: '{{auth_key}}' + org_name: '{{test_org_name}}' + net_name: '{{test_net_name}}' + serial: '{{serial}}' + state: absent + delegate_to: localhost + register: delete_device + +- debug: + msg: '{{delete_device}}' + +- assert: + that: + - delete_device.changed == true
\ No newline at end of file |