mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-09-19 21:48:10 -07:00
Fix netapp modules (#76)
* Replace missing netapp parts with own copy. * Localize final fragment. * Mark netapps docs fragment as deprecated. * Drop dependency on netapp.ontap. * Remove all netapp_e_* modules. * Remove docs fragment.
This commit is contained in:
parent
50f8477dbc
commit
6172e56b62
125 changed files with 829 additions and 20206 deletions
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 10.113.1.111:8443
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,39 +0,0 @@
|
|||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: NetApp Test ASUP module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars:
|
||||
defaults: &defaults
|
||||
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
state: enabled
|
||||
server: mail.example.com
|
||||
sender: noreply@example.com
|
||||
recipients:
|
||||
- noreply@example.com
|
||||
|
||||
- name: set default vars
|
||||
set_fact:
|
||||
vars: *defaults
|
||||
|
||||
- name: Set the initial alerting settings
|
||||
netapp_e_alerts:
|
||||
<<: *defaults
|
||||
register: result
|
||||
|
||||
- name: Validate the idempotency of the module
|
||||
netapp_e_alerts:
|
||||
<<: *defaults
|
||||
register: result
|
||||
|
||||
- name: Ensure we still have the same settings, but had no change
|
||||
assert:
|
||||
that: not result.changed
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 10.113.1.111:8443
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,233 +0,0 @@
|
|||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: NetApp Test ASUP module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars: &vars
|
||||
credentials: &creds
|
||||
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
|
||||
- name: set credentials
|
||||
set_fact:
|
||||
credentials: *creds
|
||||
|
||||
- name: Show some debug information
|
||||
debug:
|
||||
msg: "Using user={{ credentials.api_username }} on server={{ credentials.api_url }}."
|
||||
|
||||
# ****************************************************
|
||||
# *** Enable auto-support using all default values ***
|
||||
# ****************************************************
|
||||
- name: Enable auto-support using default values
|
||||
netapp_e_asup:
|
||||
<<: *creds
|
||||
verbose: true
|
||||
|
||||
- name: Collect auto-support state information from the array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/device-asup"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- name: Validate auto-support expected default state
|
||||
assert:
|
||||
that: "{{ current.json.asupEnabled and
|
||||
current.json.onDemandEnabled and
|
||||
current.json.remoteDiagsEnabled and
|
||||
current.json.schedule.dailyMinTime == 0 and
|
||||
current.json.schedule.dailyMaxTime == 1439 }}"
|
||||
msg: "Unexpected auto-support state"
|
||||
|
||||
- name: Validate auto-support schedule
|
||||
assert:
|
||||
that: "{{ item in current.json.schedule.daysOfWeek }}"
|
||||
msg: "{{ item }} is missing from the schedule"
|
||||
loop: "{{ lookup('list', ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']) }}"
|
||||
|
||||
# ****************************
|
||||
# *** Disable auto-support ***
|
||||
# ****************************
|
||||
- name: Disable auto-support
|
||||
netapp_e_asup:
|
||||
<<: *creds
|
||||
state: disabled
|
||||
|
||||
- name: Collect auto-support state information from the array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/device-asup"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- name: Validate auto-support is disabled
|
||||
assert:
|
||||
that: "{{ not current.json.asupEnabled }}"
|
||||
msg: "Auto-support failed to be disabled"
|
||||
|
||||
# ****************************************************
|
||||
# *** Enable auto-support using specific values ***
|
||||
# ****************************************************
|
||||
- name: Enable auto-support using specific values
|
||||
netapp_e_asup:
|
||||
<<: *creds
|
||||
state: enabled
|
||||
active: true
|
||||
start: 22
|
||||
end: 24
|
||||
days:
|
||||
- friday
|
||||
- saturday
|
||||
verbose: true
|
||||
|
||||
- name: Collect auto-support state information from the array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/device-asup"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- name: Validate auto-support expected state
|
||||
assert:
|
||||
that: "{{ current.json.asupEnabled and
|
||||
current.json.onDemandEnabled and
|
||||
current.json.remoteDiagsEnabled and
|
||||
current.json.schedule.dailyMinTime == (22 * 60) and
|
||||
current.json.schedule.dailyMaxTime == (24 * 60 - 1) }}"
|
||||
msg: "Unexpected auto-support state"
|
||||
|
||||
- name: Validate auto-support schedule
|
||||
assert:
|
||||
that: "{{ item in current.json.schedule.daysOfWeek }}"
|
||||
msg: "{{ item }} is missing from the schedule"
|
||||
loop: "{{ lookup('list', ['friday', 'saturday']) }}"
|
||||
|
||||
# ***********************************
|
||||
# *** Alter auto-support schedule ***
|
||||
# ***********************************
|
||||
- name: Auto auto-support schedule
|
||||
netapp_e_asup:
|
||||
<<: *creds
|
||||
state: enabled
|
||||
active: true
|
||||
start: 0
|
||||
end: 5
|
||||
days:
|
||||
- monday
|
||||
- thursday
|
||||
- sunday
|
||||
verbose: true
|
||||
|
||||
- name: Collect auto-support state information from the array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/device-asup"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- name: Validate auto-support expected state
|
||||
assert:
|
||||
that: "{{ current.json.asupEnabled and
|
||||
current.json.onDemandEnabled and
|
||||
current.json.remoteDiagsEnabled and
|
||||
current.json.schedule.dailyMinTime == (0 * 60) and
|
||||
current.json.schedule.dailyMaxTime == (5 * 60) }}"
|
||||
msg: "Unexpected auto-support state"
|
||||
|
||||
- name: Validate auto-support schedule
|
||||
assert:
|
||||
that: "{{ item in current.json.schedule.daysOfWeek }}"
|
||||
msg: "{{ item }} is missing from the schedule"
|
||||
loop: "{{ lookup('list', ['monday', 'thursday', 'sunday']) }}"
|
||||
|
||||
# *************************************************************
|
||||
# *** Repeat previous test to verify state remains the same ***
|
||||
# *************************************************************
|
||||
- name: Repeat auto-support schedule change to verify idempotency
|
||||
netapp_e_asup:
|
||||
<<: *creds
|
||||
state: enabled
|
||||
active: true
|
||||
start: 0
|
||||
end: 5
|
||||
days:
|
||||
- monday
|
||||
- thursday
|
||||
- sunday
|
||||
verbose: true
|
||||
register: result
|
||||
|
||||
- name: Collect auto-support state information from the array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/device-asup"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- name: Validate auto-support expected state
|
||||
assert:
|
||||
that: "{{ current.json.asupEnabled and
|
||||
current.json.onDemandEnabled and
|
||||
current.json.remoteDiagsEnabled and
|
||||
current.json.schedule.dailyMinTime == (0 * 60) and
|
||||
current.json.schedule.dailyMaxTime == (5 * 60) }}"
|
||||
msg: "Unexpected auto-support state"
|
||||
|
||||
- name: Validate auto-support schedule
|
||||
assert:
|
||||
that: "{{ item in current.json.schedule.daysOfWeek }}"
|
||||
msg: "{{ item }} is missing from the schedule"
|
||||
loop: "{{ lookup('list', ['monday', 'thursday', 'sunday']) }}"
|
||||
|
||||
- name: Validate change was not detected
|
||||
assert:
|
||||
that: "{{ not result.changed }}"
|
||||
msg: "Invalid change was detected"
|
||||
|
||||
# ***********************************
|
||||
# *** Disable auto-support active ***
|
||||
# ***********************************
|
||||
- name: Auto auto-support schedule
|
||||
netapp_e_asup:
|
||||
<<: *creds
|
||||
state: enabled
|
||||
active: false
|
||||
start: 0
|
||||
end: 5
|
||||
days:
|
||||
- monday
|
||||
- thursday
|
||||
- sunday
|
||||
verbose: true
|
||||
|
||||
- name: Collect auto-support state information from the array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/device-asup"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- name: Validate auto-support expected state
|
||||
assert:
|
||||
that: "{{ current.json.asupEnabled and not current.json.onDemandEnabled and not current.json.remoteDiagsEnabled }}"
|
||||
msg: "Unexpected auto-support state"
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 192.168.1.1000
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,209 +0,0 @@
|
|||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# Existing symbol issue: occasionally symbol will return 422 which causes Ansible to fail; however the drive firmware download will complete.
|
||||
# Work-around: Remove all storage provisioning before commencing test.
|
||||
|
||||
- name: NetApp Test ASUP module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
|
||||
- set_fact:
|
||||
firmware:
|
||||
downgrade:
|
||||
list:
|
||||
- "/home/swartzn/Downloads/drive firmware/D_PX04SVQ160_DOWNGRADE_MS00toMSB6_801.dlp"
|
||||
- "/home/swartzn/Downloads/drive firmware/D_ST1200MM0017_DNGRADE_MS02toMS00_6600_802.dlp"
|
||||
check:
|
||||
- firmware: "D_PX04SVQ160_DOWNGRADE_MS00toMSB6_801.dlp"
|
||||
drive: "PX04SVQ160"
|
||||
version: "MSB6"
|
||||
- firmware: "D_ST1200MM0017_DNGRADE_MS02toMS00_6600_802.dlp"
|
||||
drive: "ST1200MM0017"
|
||||
version: "MS00"
|
||||
upgrade:
|
||||
list:
|
||||
- "/home/swartzn/Downloads/drive firmware/D_PX04SVQ160_30603183_MS00_6600_001.dlp"
|
||||
- "/home/swartzn/Downloads/drive firmware/D_ST1200MM0017_30602214_MS02_5600_002.dlp"
|
||||
check:
|
||||
- firmware: "D_PX04SVQ160_30603183_MS00_6600_001.dlp"
|
||||
drive: "PX04SVQ160"
|
||||
version: "MS00"
|
||||
- firmware: "D_ST1200MM0017_30602214_MS02_5600_002.dlp"
|
||||
drive: "ST1200MM0017"
|
||||
version: "MS02"
|
||||
|
||||
- name: Set drive firmware (baseline, maybe change)
|
||||
netapp_e_drive_firmware:
|
||||
api_url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: false
|
||||
firmware: "{{ firmware['downgrade']['list'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_inaccessible_drives: true
|
||||
upgrade_drives_online: false
|
||||
register: drive_firmware
|
||||
- pause:
|
||||
seconds: 60
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_ssid }}/drives"
|
||||
user: "{{ netapp_e_api_username }}"
|
||||
password: "{{ netapp_e_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_drive_firmware
|
||||
- name: Check if drive firmware is the expected versions
|
||||
assert:
|
||||
that: "{{ (item['productID'].strip() not in [firmware['downgrade']['check'][0]['drive'], firmware['downgrade']['check'][1]['drive']]) or
|
||||
(firmware['downgrade']['check'][0]['drive'] == item['productID'].strip() and
|
||||
firmware['downgrade']['check'][0]['version'] == item['softwareVersion']) or
|
||||
(firmware['downgrade']['check'][1]['drive'] == item['productID'].strip() and
|
||||
firmware['downgrade']['check'][1]['version'] == item['softwareVersion']) }}"
|
||||
msg: "Drive firmware failed to update all drives"
|
||||
loop: "{{ lookup('list', current_drive_firmware['json']) }}"
|
||||
|
||||
- name: Set drive firmware (upgrade, change-checkmode)
|
||||
netapp_e_drive_firmware:
|
||||
api_url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: false
|
||||
firmware: "{{ firmware['upgrade']['list'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_inaccessible_drives: true
|
||||
upgrade_drives_online: false
|
||||
register: drive_firmware
|
||||
check_mode: true
|
||||
- pause:
|
||||
seconds: 60
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_ssid }}/drives"
|
||||
user: "{{ netapp_e_api_username }}"
|
||||
password: "{{ netapp_e_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_drive_firmware
|
||||
- name: Validate change status
|
||||
assert:
|
||||
that: "{{ drive_firmware.changed }}"
|
||||
msg: "Change status is incorrect."
|
||||
- name: Check if drive firmware is the expected versions
|
||||
assert:
|
||||
that: "{{ (item['productID'].strip() not in [firmware['downgrade']['check'][0]['drive'], firmware['downgrade']['check'][1]['drive']]) or
|
||||
(firmware['downgrade']['check'][0]['drive'] == item['productID'].strip() and
|
||||
firmware['downgrade']['check'][0]['version'] == item['softwareVersion']) or
|
||||
(firmware['downgrade']['check'][1]['drive'] == item['productID'].strip() and
|
||||
firmware['downgrade']['check'][1]['version'] == item['softwareVersion']) }}"
|
||||
msg: "Drive firmware failed to update all drives"
|
||||
loop: "{{ lookup('list', current_drive_firmware['json']) }}"
|
||||
|
||||
- name: Set drive firmware (upgrade, change)
|
||||
netapp_e_drive_firmware:
|
||||
api_url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: false
|
||||
firmware: "{{ firmware['upgrade']['list'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_inaccessible_drives: true
|
||||
upgrade_drives_online: false
|
||||
register: drive_firmware
|
||||
- pause:
|
||||
seconds: 60
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_ssid }}/drives"
|
||||
user: "{{ netapp_e_api_username }}"
|
||||
password: "{{ netapp_e_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_drive_firmware
|
||||
- name: Validate change status
|
||||
assert:
|
||||
that: "{{ drive_firmware.changed }}"
|
||||
msg: "Change status is incorrect."
|
||||
- name: Check if drive firmware is the expected versions
|
||||
assert:
|
||||
that: "{{ (item['productID'].strip() not in [firmware['downgrade']['check'][0]['drive'], firmware['downgrade']['check'][1]['drive']]) or
|
||||
(firmware['upgrade']['check'][0]['drive'] == item['productID'].strip() and
|
||||
firmware['upgrade']['check'][0]['version'] == item['softwareVersion']) or
|
||||
(firmware['upgrade']['check'][1]['drive'] == item['productID'].strip() and
|
||||
firmware['upgrade']['check'][1]['version'] == item['softwareVersion']) }}"
|
||||
msg: "Drive firmware failed to update all drives"
|
||||
loop: "{{ lookup('list', current_drive_firmware['json']) }}"
|
||||
|
||||
- name: Set drive firmware (upgrade, no change)
|
||||
netapp_e_drive_firmware:
|
||||
api_url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: false
|
||||
firmware: "{{ firmware['upgrade']['list'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_inaccessible_drives: true
|
||||
upgrade_drives_online: false
|
||||
register: drive_firmware
|
||||
- pause:
|
||||
seconds: 60
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_ssid }}/drives"
|
||||
user: "{{ netapp_e_api_username }}"
|
||||
password: "{{ netapp_e_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_drive_firmware
|
||||
- name: Validate change status
|
||||
assert:
|
||||
that: "{{ not drive_firmware.changed }}"
|
||||
msg: "Change status is incorrect."
|
||||
- name: Check if drive firmware is the expected versions
|
||||
assert:
|
||||
that: "{{ (item['productID'].strip() not in [firmware['downgrade']['check'][0]['drive'], firmware['downgrade']['check'][1]['drive']]) or
|
||||
(firmware['upgrade']['check'][0]['drive'] == item['productID'].strip() and
|
||||
firmware['upgrade']['check'][0]['version'] == item['softwareVersion']) or
|
||||
(firmware['upgrade']['check'][1]['drive'] == item['productID'].strip() and
|
||||
firmware['upgrade']['check'][1]['version'] == item['softwareVersion']) }}"
|
||||
msg: "Drive firmware failed to update all drives"
|
||||
loop: "{{ lookup('list', current_drive_firmware['json']) }}"
|
||||
|
||||
- name: Set drive firmware (downgrade, change)
|
||||
netapp_e_drive_firmware:
|
||||
api_url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: false
|
||||
firmware: "{{ firmware['downgrade']['list'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_inaccessible_drives: true
|
||||
upgrade_drives_online: false
|
||||
register: drive_firmware
|
||||
- pause:
|
||||
seconds: 60
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_ssid }}/drives"
|
||||
user: "{{ netapp_e_api_username }}"
|
||||
password: "{{ netapp_e_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_drive_firmware
|
||||
- name: Validate change status
|
||||
assert:
|
||||
that: "{{ drive_firmware.changed }}"
|
||||
msg: "Change status is incorrect."
|
||||
- name: Check if drive firmware is the expected versions
|
||||
assert:
|
||||
that: "{{ (item['productID'].strip() not in [firmware['downgrade']['check'][0]['drive'], firmware['downgrade']['check'][1]['drive']]) or
|
||||
(firmware['downgrade']['check'][0]['drive'] == item['productID'].strip() and
|
||||
firmware['downgrade']['check'][0]['version'] == item['softwareVersion']) or
|
||||
(firmware['downgrade']['check'][1]['drive'] == item['productID'].strip() and
|
||||
firmware['downgrade']['check'][1]['version'] == item['softwareVersion']) }}"
|
||||
msg: "Drive firmware failed to update all drives"
|
||||
loop: "{{ lookup('list', current_drive_firmware['json']) }}"
|
|
@ -1,15 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
netapp_e_embedded_api_host: 192.168.1.1
|
||||
netapp_e_embedded_api_username: admin
|
||||
netapp_e_embedded_api_password: adminPass
|
||||
netapp_e_embedded_ssid: 1
|
||||
|
||||
netapp_e_proxy_api_host: 192.168.1.100
|
||||
netapp_e_proxy_api_username: admin
|
||||
netapp_e_proxy_api_password: adminPass
|
||||
netapp_e_proxy_ssid: 10
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,348 +0,0 @@
|
|||
# Test code for the netapp_e_firmware module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# TODO: MUST BE DOWNGRADE BEFORE EXECUTING INTEGRATION TO RCB_11.40.3R2_280x_5c7d81b3.dlp and N280X-842834-D02.dlp
|
||||
# loadControllerFirmware_MT swartzn@10.113.1.250 /home/swartzn/Downloads/RCB_11.40.3R2_280x_5c7d81b3.dlp /home/swartzn/Downloads/N280X-842834-D02.dlp
|
||||
|
||||
# This integration test will validate upgrade functionality for firmware-only, firmware-and-nvsram, and check mode.
|
||||
|
||||
- name: NetApp Test ASUP module
|
||||
fail:
|
||||
msg: "Please define netapp_e_embedded_api_host, netapp_e_embedded_api_username, netapp_e_embedded_api_password, netapp_e_embedded_ssid,
|
||||
netapp_e_proxy_api_host, netapp_e_proxy_api_username, netapp_e_proxy_api_password, and netapp_e_proxy_ssid."
|
||||
when: "netapp_e_embedded_api_host is undefined or netapp_e_embedded_api_username is undefined or netapp_e_embedded_api_password is undefined or
|
||||
netapp_e_embedded_ssid is undefined or netapp_e_proxy_api_host is undefined or netapp_e_proxy_api_username is undefined or
|
||||
netapp_e_proxy_api_password is undefined or netapp_e_proxy_ssid is undefined"
|
||||
|
||||
- set_fact:
|
||||
path: "/home/swartzn/Downloads/"
|
||||
upgrades:
|
||||
- firmware: "RCB_11.40.3R2_280x_5c7d81b3.dlp"
|
||||
nvsram: "N280X-842834-D02.dlp"
|
||||
expected_firmware_version: "08.42.30.05"
|
||||
expected_nvsram_version: "N280X-842834-D02"
|
||||
- firmware: "RCB_11.40.5_280x_5ceef00e.dlp"
|
||||
nvsram: "N280X-842834-D02.dlp"
|
||||
expected_firmware_version: "08.42.50.00"
|
||||
expected_nvsram_version: "N280X-842834-D02"
|
||||
- firmware: "RCB_11.50.2_280x_5ce8501f.dlp"
|
||||
nvsram: "N280X-852834-D02.dlp"
|
||||
expected_firmware_version: "08.52.00.00"
|
||||
expected_nvsram_version: "N280X-852834-D02"
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (checkmode-no change, firmware only)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_embedded_ssid }}"
|
||||
api_url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_embedded_api_username }}"
|
||||
api_password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[0]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[0]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
check_mode: true
|
||||
register: netapp_e_firmware
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == False }}"
|
||||
msg: "Failed to return unchanged."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[0]['expected_firmware_version'] }}"
|
||||
msg: "Unexpected firmware version."
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[0]['expected_nvsram_version'] }}"
|
||||
msg: "Unexpected nvsram version."
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (no change, firmware only)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_embedded_ssid }}"
|
||||
api_url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_embedded_api_username }}"
|
||||
api_password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[0]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[0]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
register: netapp_e_firmware
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == False }}"
|
||||
msg: "Failed to return changed."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[0]['expected_firmware_version'] }}"
|
||||
msg: "Unexpected firmware version."
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[0]['expected_nvsram_version'] }}"
|
||||
msg: "Unexpected nvsram version."
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (checkmode-change, firmware)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_embedded_ssid }}"
|
||||
api_url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_embedded_api_username }}"
|
||||
api_password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[1]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[1]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
register: netapp_e_firmware
|
||||
check_mode: true
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == True }}"
|
||||
msg: "Failed to return changed."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[0]['expected_firmware_version'] }}"
|
||||
msg: "Unexpected firmware version."
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[0]['expected_nvsram_version'] }}"
|
||||
msg: "Unexpected nvsram version."
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (change, firmware)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_embedded_ssid }}"
|
||||
api_url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_embedded_api_username }}"
|
||||
api_password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[1]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[1]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
register: netapp_e_firmware
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_embedded_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_embedded_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_embedded_api_username }}"
|
||||
password: "{{ netapp_e_embedded_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == True }}"
|
||||
msg: "Failed to return changed."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[1]['expected_firmware_version'] }}"
|
||||
msg: "Unexpected firmware version. {{ current_firmware['json'][0] }} != {{ upgrades[1]['expected_firmware_version'] }}"
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[1]['expected_nvsram_version'] }}"
|
||||
msg: "Unexpected nvsram version. {{ current_nvsram['json'][0] }} != {{ upgrades[1]['expected_nvsram_version'] }}"
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (changed, firmware)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_proxy_ssid }}"
|
||||
api_url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_proxy_api_username }}"
|
||||
api_password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[0]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[0]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
register: netapp_e_firmware
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == True }}"
|
||||
msg: "Failed to return changed."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[0]['expected_firmware_version'] }}"
|
||||
msg: "Failed to change the firmware version."
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[0]['expected_nvsram_version'] }}"
|
||||
msg: "Failed to change the nvsram version."
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (checkmode-unchanged, firmware)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_proxy_ssid }}"
|
||||
api_url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_proxy_api_username }}"
|
||||
api_password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[0]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[0]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
check_mode: true
|
||||
register: netapp_e_firmware
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == False }}"
|
||||
msg: "Failed to return unchanged."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[0]['expected_firmware_version'] }}"
|
||||
msg: "Failed to change the firmware version."
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[0]['expected_nvsram_version'] }}"
|
||||
msg: "Failed to change the nvsram version."
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (checkmode-change, firmware and nvsram)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_proxy_ssid }}"
|
||||
api_url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_proxy_api_username }}"
|
||||
api_password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[2]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[2]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
check_mode: true
|
||||
register: netapp_e_firmware
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == True }}"
|
||||
msg: "Failed to return changed."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[0]['expected_firmware_version'] }}"
|
||||
msg: "Failed to change the firmware version."
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[0]['expected_nvsram_version'] }}"
|
||||
msg: "Failed to change the nvsram version."
|
||||
|
||||
- name: Perform firmware upgrade using the Web Services REST API (changed, firmware and nvsram)
|
||||
netapp_e_firmware:
|
||||
ssid: "{{ netapp_e_proxy_ssid }}"
|
||||
api_url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_proxy_api_username }}"
|
||||
api_password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
nvsram: "{{ path }}{{ upgrades[2]['nvsram'] }}"
|
||||
firmware: "{{ path }}{{ upgrades[2]['firmware'] }}"
|
||||
wait_for_completion: true
|
||||
ignore_health_check: true
|
||||
register: netapp_e_firmware
|
||||
- name: Retrieve current firmware version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/fwVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_firmware
|
||||
- name: Retrieve current nvsram version
|
||||
uri:
|
||||
url: "https://{{ netapp_e_proxy_api_host }}:8443/devmgr/v2/storage-systems/{{ netapp_e_proxy_ssid }}/graph/xpath-filter?query=/sa/saData/nvsramVersion"
|
||||
user: "{{ netapp_e_proxy_api_username }}"
|
||||
password: "{{ netapp_e_proxy_api_password }}"
|
||||
validate_certs: no
|
||||
register: current_nvsram
|
||||
- name: Verify change status
|
||||
assert:
|
||||
that: "{{ netapp_e_firmware.changed == True }}"
|
||||
msg: "Failed to return changed."
|
||||
- name: Verify current firmware version
|
||||
assert:
|
||||
that: "{{ current_firmware['json'][0] == upgrades[2]['expected_firmware_version'] }}"
|
||||
msg: "Failed to change the firmware version."
|
||||
- name: Verify current nvsram version
|
||||
assert:
|
||||
that: "{{ current_nvsram['json'][0] == upgrades[2]['expected_nvsram_version'] }}"
|
||||
msg: "Failed to change the nvsram version."
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 10.113.1.111:8443
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,51 +0,0 @@
|
|||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: NetApp Test Global Settings module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars: &vars
|
||||
credentials: &creds
|
||||
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
name: TestArray
|
||||
- name: set credentials
|
||||
set_fact:
|
||||
credentials: *creds
|
||||
|
||||
- name: Show some debug information
|
||||
debug:
|
||||
msg: "Using user={{ credentials.api_username }} on server={{ credentials.api_url }}."
|
||||
|
||||
- name: Set the name to the default
|
||||
netapp_e_global:
|
||||
<<: *creds
|
||||
|
||||
- name: Set a few different names
|
||||
netapp_e_global:
|
||||
<<: *creds
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- a
|
||||
- x
|
||||
- "000001111122222333334444455555"
|
||||
|
||||
- name: Set an explicit name
|
||||
netapp_e_global:
|
||||
<<: *creds
|
||||
name: abc
|
||||
register: result
|
||||
|
||||
- name: Validate name
|
||||
assert:
|
||||
that: result.name == "abc"
|
||||
|
||||
- name: Restore the original name
|
||||
netapp_e_global:
|
||||
<<: *creds
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 192.168.1.1
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,276 +0,0 @@
|
|||
---
|
||||
# Test code for the netapp_e_host module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: NetApp Test Host module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined or
|
||||
netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars:
|
||||
gather_facts: yes
|
||||
credentials: &creds
|
||||
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
hosts: &hosts
|
||||
1:
|
||||
host_type: 27
|
||||
update_host_type: 28
|
||||
ports:
|
||||
- type: 'iscsi'
|
||||
label: 'I1_1'
|
||||
port: 'iqn.1996-04.de.suse:01:56f86f9bd1fe-PORT1'
|
||||
- type: 'iscsi'
|
||||
label: 'I1_2'
|
||||
port: 'iqn.1996-04.de.suse:01:56f86f9bd1ff-port1'
|
||||
ports2:
|
||||
- type: 'iscsi'
|
||||
label: 'I1_1'
|
||||
port: 'iqn.1996-04.de.suse:01:56f86f9bd1fe-port2'
|
||||
- type: 'iscsi'
|
||||
label: 'I1_2'
|
||||
port: 'iqn.1996-04.de.suse:01:56f86f9bd1ff-port2'
|
||||
- type: 'iscsi'
|
||||
label: 'I1_3'
|
||||
port: 'iqn.1996-04.redhat:01:56f86f9bd1fe-PORT1'
|
||||
2:
|
||||
host_type: 27
|
||||
update_host_type: 28
|
||||
ports:
|
||||
- type: 'iscsi'
|
||||
label: 'I2_1'
|
||||
port: 'iqn.1996-04.redhat:01:56f86f9bd1fe-port1'
|
||||
- type: 'iscsi'
|
||||
label: 'I2_2'
|
||||
port: 'iqn.1996-04.redhat:01:56f86f9bd1ff-port1'
|
||||
ports2:
|
||||
- type: 'iscsi'
|
||||
label: 'I2_1'
|
||||
port: 'iqn.1996-04.redhat:01:56f86f9bd1fe-port2'
|
||||
- type: 'iscsi'
|
||||
label: 'I2_2'
|
||||
port: 'iqn.1996-04.redhat:01:56f86f9bd1ff-PORT2'
|
||||
|
||||
|
||||
# ********************************************
|
||||
# *** Ensure jmespath package is installed ***
|
||||
# ********************************************
|
||||
# NOTE: jmespath must be installed for the json_query filter
|
||||
- name: Ensure that jmespath is installed
|
||||
pip:
|
||||
name: jmespath
|
||||
state: present
|
||||
register: jmespath
|
||||
- fail:
|
||||
msg: "Restart playbook, the jmespath package was installed and is need for the playbook's execution."
|
||||
when: jmespath.changed
|
||||
|
||||
|
||||
# *****************************************
|
||||
# *** Set credential and host variables ***
|
||||
# *****************************************
|
||||
- name: Set hosts variable
|
||||
set_fact:
|
||||
hosts: *hosts
|
||||
- name: set credentials
|
||||
set_fact:
|
||||
credentials: *creds
|
||||
- name: Show some debug information
|
||||
debug:
|
||||
msg: "Using user={{ credentials.api_username }} on server={{ credentials.api_url }}."
|
||||
|
||||
# *** Remove any existing hosts to set initial state and verify state ***
|
||||
- name: Remove any existing hosts
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: "{{ item.key }}"
|
||||
with_dict: *hosts
|
||||
|
||||
# Retrieve array host definitions
|
||||
- name: HTTP request for all host definitions from array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/hosts"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
|
||||
# Verify that host 1 and 2 host objects do not exist
|
||||
- name: Collect host side port labels
|
||||
set_fact:
|
||||
host_labels: "{{ result | json_query('json[*].label') }}"
|
||||
- name: Assert hosts were removed
|
||||
assert:
|
||||
that: "'{{ item.key }}' not in host_labels"
|
||||
msg: "Host, {{ item.key }}, failed to be removed from the hosts!"
|
||||
loop: "{{ lookup('dict', hosts) }}"
|
||||
|
||||
|
||||
# *****************************************************************
|
||||
# *** Create host definitions and validate host object creation ***
|
||||
# *****************************************************************
|
||||
- name: Define hosts
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: present
|
||||
host_type: "{{ item.value.host_type }}"
|
||||
ports: "{{ item.value.ports }}"
|
||||
name: "{{ item.key }}"
|
||||
with_dict: *hosts
|
||||
|
||||
# Retrieve array host definitions
|
||||
- name: https request to validate host definitions were created
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/hosts"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
|
||||
# Verify hosts were indeed created
|
||||
- name: Collect host label list
|
||||
set_fact:
|
||||
hosts_labels: "{{ result | json_query('json[*].label') }}"
|
||||
- name: Validate hosts were in fact created
|
||||
assert:
|
||||
that: "'{{ item.key }}' in hosts_labels"
|
||||
msg: "host, {{ item.key }}, not define on array!"
|
||||
loop: "{{ lookup('dict', hosts) }}"
|
||||
|
||||
# *** Update with no state changes results in no changes ***
|
||||
- name: Redefine hosts, expecting no changes
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: present
|
||||
host_type: "{{ item.value.host_type }}"
|
||||
ports: "{{ item.value.ports }}"
|
||||
name: "{{ item.key }}"
|
||||
with_dict: *hosts
|
||||
register: result
|
||||
|
||||
# Verify that no changes occurred
|
||||
- name: Ensure no change occurred
|
||||
assert:
|
||||
msg: "A change was not detected!"
|
||||
that: "not result.changed"
|
||||
|
||||
|
||||
# ***********************************************************************************
|
||||
# *** Redefine hosts using ports2 host definitions and validate the updated state ***
|
||||
# ***********************************************************************************
|
||||
- name: Redefine hosts, expecting changes
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: present
|
||||
host_type: "{{ item.value.host_type }}"
|
||||
ports: "{{ item.value.ports2 }}"
|
||||
name: "{{ item.key }}"
|
||||
force_port: yes
|
||||
with_dict: *hosts
|
||||
register: result
|
||||
|
||||
# Request from the array all host definitions
|
||||
- name: HTTP request for port information
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/hosts"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
|
||||
# Compile a list of array host port information for verifying changes
|
||||
- name: Compile array host port information list
|
||||
set_fact:
|
||||
tmp: []
|
||||
|
||||
# Append each loop to the previous extraction. Each loop consists of host definitions and the filters will perform
|
||||
# the following: grab host side port lists; combine to each list a dictionary containing the host name(label);
|
||||
# lastly, convert the zip_longest object into a list
|
||||
- set_fact:
|
||||
tmp: "{{ tmp }} + {{ [item | json_query('hostSidePorts[*]')] |
|
||||
zip_longest([], fillvalue={'host_name': item.label}) | list }}"
|
||||
loop: "{{ result.json }}"
|
||||
|
||||
# Make new list, port_info, by combining each list entry's dictionaries into a single dictionary
|
||||
- name: Create port information list
|
||||
set_fact:
|
||||
port_info: []
|
||||
- set_fact:
|
||||
port_info: "{{ port_info + [item[0] |combine(item[1])] }}"
|
||||
loop: "{{ tmp }}"
|
||||
|
||||
# Compile list of expected host port information for verifying changes
|
||||
- name: Create expected port information list
|
||||
set_fact:
|
||||
tmp: []
|
||||
|
||||
# Append each loop to the previous extraction. Each loop consists of host definitions and the filters will perform
|
||||
# the following: grab host side port lists; combine to each list a dictionary containing the host name(label);
|
||||
# lastly, convert the zip_longest object into a list
|
||||
- set_fact:
|
||||
tmp: "{{ tmp }} + {{ [item | json_query('value.ports2[*]')]|
|
||||
zip_longest([], fillvalue={'host_name': item.key|string}) | list }}"
|
||||
loop: "{{ lookup('dict', hosts) }}"
|
||||
|
||||
# Make new list, expected_port_info, by combining each list entry's dictionaries into a single dictionary
|
||||
- name: Create expected port information list
|
||||
set_fact:
|
||||
expected_port_info: []
|
||||
- set_fact:
|
||||
expected_port_info: "{{ expected_port_info + [ item[0] |combine(item[1]) ] }}"
|
||||
loop: "{{ tmp }}"
|
||||
|
||||
# Verify that each host object has the expected protocol type and address/port
|
||||
- name: Assert hosts information was updated with new port information
|
||||
assert:
|
||||
that: "{{ item[0].host_name != item[1].host_name or
|
||||
item[0].label != item[1].label or
|
||||
(item[0].type == item[1].type and
|
||||
(item[0].address|regex_replace(':','')) == (item[1].port|regex_replace(':',''))) }}"
|
||||
msg: "port failed to be updated!"
|
||||
loop: "{{ query('nested', port_info, expected_port_info) }}"
|
||||
|
||||
|
||||
# ****************************************************
|
||||
# *** Remove any existing hosts and verify changes ***
|
||||
# ****************************************************
|
||||
- name: Remove any existing hosts
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: "{{ item.key }}"
|
||||
with_dict: *hosts
|
||||
|
||||
# Request all host object definitions
|
||||
- name: HTTP request for all host definitions from array
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/hosts"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: results
|
||||
|
||||
# Collect port label information
|
||||
- name: Collect host side port labels
|
||||
set_fact:
|
||||
host_side_port_labels: "{{ results | json_query('json[*].hostSidePorts[*].label') }}"
|
||||
|
||||
- name: Collect removed port labels
|
||||
set_fact:
|
||||
removed_host_side_port_labels: "{{ hosts | json_query('*.ports[*].label') }}"
|
||||
|
||||
# Verify host 1 and 2 objects were removed
|
||||
- name: Assert hosts were removed
|
||||
assert:
|
||||
that: item not in host_side_port_labels
|
||||
msg: "Host {{ item }} failed to be removed from the hosts!"
|
||||
loop: "{{ removed_host_side_port_labels }}"
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 10.113.1.111:8443
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,448 +0,0 @@
|
|||
---
|
||||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
|
||||
# ***********************
|
||||
# *** Local test data ***
|
||||
# ***********************
|
||||
- name: NetApp Test iSCSI Interface module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars:
|
||||
credentials: &creds
|
||||
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
array: &array
|
||||
subnet: 255.255.255.0
|
||||
gateway: 10.10.10.1
|
||||
A:
|
||||
- channel: 1
|
||||
max_frame_size: 1500
|
||||
- channel: 2
|
||||
max_frame_size: 2000
|
||||
- channel: 3
|
||||
max_frame_size: 9000
|
||||
- channel: 4
|
||||
max_frame_size: 1500
|
||||
- channel: 5
|
||||
max_frame_size: 2000
|
||||
- channel: 6
|
||||
max_frame_size: 9000
|
||||
B:
|
||||
- channel: 1
|
||||
max_frame_size: 9000
|
||||
- channel: 2
|
||||
max_frame_size: 1500
|
||||
- channel: 3
|
||||
max_frame_size: 2000
|
||||
- channel: 4
|
||||
max_frame_size: 9000
|
||||
- channel: 5
|
||||
max_frame_size: 1500
|
||||
- channel: 6
|
||||
max_frame_size: 2000
|
||||
|
||||
|
||||
# ***************************************************
|
||||
# *** Ensure python jmespath package is installed ***
|
||||
# ***************************************************
|
||||
- name: Ensure that jmespath is installed
|
||||
pip:
|
||||
name: jmespath
|
||||
state: enabled
|
||||
register: jmespath
|
||||
- fail:
|
||||
msg: "Restart playbook, the jmespath package was installed and is need for the playbook's execution."
|
||||
when: jmespath.changed
|
||||
|
||||
|
||||
# ************************************
|
||||
# *** Set local playbook test data ***
|
||||
# ************************************
|
||||
- name: set credentials
|
||||
set_fact:
|
||||
credentials: *creds
|
||||
- name: set array
|
||||
set_fact:
|
||||
array: *array
|
||||
|
||||
- name: Show some debug information
|
||||
debug:
|
||||
msg: "Using user={{ credentials.api_username }} on server={{ credentials.api_url }}."
|
||||
|
||||
|
||||
# *****************************************
|
||||
# *** Disable all controller A channels ***
|
||||
# *****************************************
|
||||
- name: Disable all controller A ports
|
||||
netapp_e_iscsi_interface:
|
||||
<<: *creds
|
||||
controller: "A"
|
||||
channel: "{{ item.channel }}"
|
||||
state: disabled
|
||||
loop: "{{ lookup('list', array.A) }}"
|
||||
|
||||
# Delay to give time for the asynchronous symbol call has complete
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
# Request all controller's iscsi host interface information
|
||||
- name: Collect iscsi port information
|
||||
uri:
|
||||
url: "{{ xpath_filter_url }}?query=controller/hostInterfaces//iscsi"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
vars:
|
||||
xpath_filter_url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/graph/xpath-filter"
|
||||
|
||||
# Extract controller A's port information from the iscsi host interfaces list
|
||||
# Note: min filter is used because there are only two controller ids and the smaller corresponds with controller A
|
||||
- name: Get controller A's controllerId
|
||||
set_fact:
|
||||
controller_a_id: "{{ result | json_query('json[*].controllerId') | min }}"
|
||||
|
||||
# Collect all port information associated with controller A
|
||||
- name: Get controller A's port information
|
||||
set_fact:
|
||||
controller_a: "{{ result | json_query(controller_a_query) }}"
|
||||
vars:
|
||||
controller_a_query: "json[?controllerId=='{{ controller_a_id }}']"
|
||||
|
||||
# Confirm controller A's ports are disabled
|
||||
- name: Verify all controller A ports are disabled
|
||||
assert:
|
||||
that: "{{ item.ipv4Enabled == false }}"
|
||||
msg: "Controller A, channel {{ item.channel }} is not disabled"
|
||||
loop: "{{ controller_a }}"
|
||||
|
||||
|
||||
# *****************************************
|
||||
# *** Disable all controller B channels ***
|
||||
# *****************************************
|
||||
- name: Disable all controller B ports
|
||||
netapp_e_iscsi_interface:
|
||||
<<: *creds
|
||||
controller: "B"
|
||||
channel: "{{ item.channel }}"
|
||||
state: disabled
|
||||
loop: "{{ lookup('list', array.B) }}"
|
||||
|
||||
# Delay to give time for the asynchronous symbol call has complete
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
# Request all controller's iscsi host interface information
|
||||
- name: Collect iscsi port information
|
||||
uri:
|
||||
url: "{{ xpath_filter_url }}?query=controller/hostInterfaces//iscsi"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
vars:
|
||||
xpath_filter_url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/graph/xpath-filter"
|
||||
|
||||
# Extract controller B's port information from the iscsi host interfaces list
|
||||
# Note: min filter is used because there are only two controller ids and the smaller corresponds with controller B
|
||||
- name: Get controller B's controllerId
|
||||
set_fact:
|
||||
controller_b_id: "{{ result | json_query('json[*].controllerId') | max }}"
|
||||
|
||||
# Collect all port information associated with controller B
|
||||
- name: Get controller B's port information
|
||||
set_fact:
|
||||
controller_b: "{{ result | json_query(controller_b_query) }}"
|
||||
vars:
|
||||
controller_b_query: "json[?controllerId=='{{ controller_b_id }}']"
|
||||
|
||||
# Confirm controller B's ports are disabled
|
||||
- name: Verify all controller B ports are disabled
|
||||
assert:
|
||||
that: "{{ item.ipv4Enabled == false }}"
|
||||
msg: "Controller B, channel {{ item.channel }} is not disabled"
|
||||
loop: "{{ controller_b }}"
|
||||
|
||||
|
||||
# *****************************************************
|
||||
# *** Configure all controller A's ports statically ***
|
||||
# *****************************************************
|
||||
- name: Configure controller A's port to use a static configuration method
|
||||
netapp_e_iscsi_interface:
|
||||
<<: *creds
|
||||
controller: "A"
|
||||
channel: "{{ item.channel }}"
|
||||
state: enabled
|
||||
config_method: static
|
||||
address: "{{ array.gateway.split('.')[:3] | join('.') }}.{{ item.channel }}"
|
||||
subnet_mask: "{{ array.subnet }}"
|
||||
gateway: "{{ array.gateway }}"
|
||||
max_frame_size: "{{ item.max_frame_size }}"
|
||||
loop: "{{ lookup('list', array.A) }}"
|
||||
|
||||
# Delay to give time for the asynchronous symbol call has complete
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
# Request a list of iscsi host interfaces
|
||||
- name: Collect array information
|
||||
uri:
|
||||
url: "{{ xpath_filter }}?query=controller/hostInterfaces//iscsi"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
vars:
|
||||
xpath_filter: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/graph/xpath-filter"
|
||||
|
||||
# Extract controller A's port information from the iscsi host interfaces list
|
||||
# Note: min filter is used because there are only two controller ids and the smaller corresponds with controller A
|
||||
- name: Get controller A's controllerId
|
||||
set_fact:
|
||||
controller_a_id: "{{ result | json_query('json[*].controllerId') | min }}"
|
||||
|
||||
# Compile any iscsi port information associated with controller A
|
||||
- name: Get controller A's port information
|
||||
set_fact:
|
||||
controller_a: "{{ result | json_query(controller_a_query) }}"
|
||||
vars:
|
||||
controller_a_query: "json[?controllerId=='{{ controller_a_id }}']"
|
||||
|
||||
# Confirm that controller A ports are statically defined with the expected MTU, gateway, subnet and ipv4 address
|
||||
- name: Verify expected controller A's port configuration
|
||||
assert:
|
||||
that: "{{ item[0].channel != item[1].channel or
|
||||
( item[0].ipv4Data.ipv4AddressConfigMethod == 'configStatic' and
|
||||
item[0].interfaceData.ethernetData.maximumFramePayloadSize == item[1].max_frame_size and
|
||||
item[0].ipv4Data.ipv4AddressData.ipv4GatewayAddress == array.gateway and
|
||||
item[0].ipv4Data.ipv4AddressData.ipv4SubnetMask == array.subnet and
|
||||
item[0].ipv4Data.ipv4AddressData.ipv4Address == partial_address + item[1].channel | string ) }}"
|
||||
msg: "Failed to configure controller A, channel {{ item[0].channel }}"
|
||||
loop: "{{ query('nested', lookup('list', controller_a), lookup('list', array.A) ) }}"
|
||||
vars:
|
||||
partial_address: "{{ array.gateway.split('.')[:3] | join('.') + '.' }}"
|
||||
|
||||
|
||||
# *******************************************************************************************
|
||||
# *** Configure controller B's channels for dhcp and specific frame maximum payload sizes ***
|
||||
# *******************************************************************************************
|
||||
- name: Configure controller B's ports to use dhcp with different MTU
|
||||
netapp_e_iscsi_interface:
|
||||
<<: *creds
|
||||
controller: "B"
|
||||
channel: "{{ item.channel }}"
|
||||
state: enabled
|
||||
config_method: dhcp
|
||||
max_frame_size: "{{ item.max_frame_size }}"
|
||||
loop: "{{ lookup('list', array.B) }}"
|
||||
|
||||
# Delay to give time for the asynchronous symbol call has complete
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
# request a list of iscsi host interfaces
|
||||
- name: Collect array information
|
||||
uri:
|
||||
url: "{{ xpath_filter_url }}?query=controller/hostInterfaces//iscsi"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
vars:
|
||||
xpath_filter_url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/graph/xpath-filter"
|
||||
|
||||
# Extract controller B's port information from the iscsi host interfaces list
|
||||
# Note: max filter is used because there are only two controller ids and the larger corresponds with controller B
|
||||
- name: Get controller B's controllerId
|
||||
set_fact:
|
||||
controller_b_id: "{{ result | json_query('json[*].controllerId') | max }}"
|
||||
- name: Get controller B port information list
|
||||
set_fact:
|
||||
controller_b: "{{ result | json_query(controller_b_query) }}"
|
||||
vars:
|
||||
controller_b_query: "json[?controllerId=='{{ controller_b_id }}']"
|
||||
|
||||
# Using a nested loop of array information and expected information, verify that each channel has the appropriate max
|
||||
# frame payload size and is configured for dhcp
|
||||
- name: Verify expected controller B's port configuration
|
||||
assert:
|
||||
that: "{{ item[0].channel != item[1].channel or
|
||||
( item[0].ipv4Data.ipv4AddressConfigMethod == 'configDhcp' and
|
||||
item[0].interfaceData.ethernetData.maximumFramePayloadSize == item[1].max_frame_size ) }}"
|
||||
msg: >
|
||||
Failed to configure controller channel {{ item[0].channel }} for dhcp
|
||||
and/or maximum frame size of {{ item[1].max_frame_size }}!
|
||||
loop: "{{ query('nested', lookup('list', controller_b), lookup('list', array.B)) }}"
|
||||
|
||||
|
||||
# *******************************************************************************************
|
||||
# *** Configure controller A's channels for dhcp and specific frame maximum payload sizes ***
|
||||
# *******************************************************************************************
|
||||
- name: Configure controller A's ports to use dhcp with different MTU
|
||||
netapp_e_iscsi_interface:
|
||||
<<: *creds
|
||||
controller: "A"
|
||||
channel: "{{ item.channel }}"
|
||||
state: enabled
|
||||
config_method: dhcp
|
||||
max_frame_size: "{{ item.max_frame_size }}"
|
||||
loop: "{{ lookup('list', array.A) }}"
|
||||
|
||||
# Delay to give time for the asynchronous symbol call has complete
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
# Request a list of iscsi host interfaces
|
||||
- name: Collect array information
|
||||
uri:
|
||||
url: "{{ xpath_filter_url }}?query=controller/hostInterfaces//iscsi"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
vars:
|
||||
xpath_filter_url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/graph/xpath-filter"
|
||||
|
||||
# Extract controller A's port information from the iscsi host interfaces list
|
||||
# Note: min filter is used because there are only two controller ids and the larger corresponds with controller A
|
||||
- name: Get controller A's controllerId
|
||||
set_fact:
|
||||
controller_a_id: "{{ result | json_query('json[*].controllerId') | min }}"
|
||||
- name: Get controller A port information list
|
||||
set_fact:
|
||||
controller_a: "{{ result | json_query(controller_a_query) }}"
|
||||
vars:
|
||||
controller_a_query: "json[?controllerId=='{{ controller_a_id }}']"
|
||||
|
||||
# Using a nested loop of array information and expected information, verify that each channel has the appropriate max
|
||||
# frame payload size and is configured for dhcp
|
||||
- name: Verify expected controller A's port configuration
|
||||
assert:
|
||||
that: "{{ item[0].channel != item[1].channel or
|
||||
( item[0].ipv4Data.ipv4AddressConfigMethod == 'configDhcp' and
|
||||
item[0].interfaceData.ethernetData.maximumFramePayloadSize == item[1].max_frame_size ) }}"
|
||||
msg: >
|
||||
Failed to configure controller channel {{ item[0].channel }} for dhcp
|
||||
and/or maximum frame size of {{ item[1].max_frame_size }}!
|
||||
loop: "{{ query('nested', lookup('list', controller_a), lookup('list', array.A)) }}"
|
||||
|
||||
|
||||
# *****************************************************
|
||||
# *** Configure all controller B's ports statically ***
|
||||
# *****************************************************
|
||||
- name: Configure controller B's ports to use a static configuration method
|
||||
netapp_e_iscsi_interface:
|
||||
<<: *creds
|
||||
controller: "B"
|
||||
channel: "{{ item.channel }}"
|
||||
state: enabled
|
||||
config_method: static
|
||||
address: "{{ array.gateway.split('.')[:3] | join('.') }}.{{ item.channel }}"
|
||||
subnet_mask: "{{ array.subnet }}"
|
||||
gateway: "{{ array.gateway }}"
|
||||
max_frame_size: "{{ item.max_frame_size }}"
|
||||
loop: "{{ lookup('list', array.B) }}"
|
||||
|
||||
# Delay to give time for the asynchronous symbol call has complete
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
# request a list of iscsi host interfaces
|
||||
- name: Collect array information
|
||||
uri:
|
||||
url: "{{ xpath_filter }}?query=controller/hostInterfaces//iscsi"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
vars:
|
||||
xpath_filter: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/graph/xpath-filter"
|
||||
|
||||
# Extract controller B's port information from the iscsi host interfaces list
|
||||
# Note: min filter is used because there are only two controller ids and the smaller corresponds with controller B
|
||||
- name: Get controller B's controllerId
|
||||
set_fact:
|
||||
controller_b_id: "{{ result | json_query('json[*].controllerId') | max }}"
|
||||
|
||||
# Compile any iscsi port information associated with controller B
|
||||
- name: Get controller B's port information
|
||||
set_fact:
|
||||
controller_b: "{{ result | json_query(controller_b_query) }}"
|
||||
vars:
|
||||
controller_b_query: "json[?controllerId=='{{ controller_b_id }}']"
|
||||
|
||||
# Confirm that controller B ports are statically defined with the expected MTU, gateway, subnet and ipv4 address
|
||||
- name: Verify expected controller B's port configuration
|
||||
assert:
|
||||
that: "{{ item[0].channel != item[1].channel or
|
||||
( item[0].ipv4Data.ipv4AddressConfigMethod == 'configStatic' and
|
||||
item[0].interfaceData.ethernetData.maximumFramePayloadSize == item[1].max_frame_size and
|
||||
item[0].ipv4Data.ipv4AddressData.ipv4GatewayAddress == array.gateway and
|
||||
item[0].ipv4Data.ipv4AddressData.ipv4SubnetMask == array.subnet and
|
||||
item[0].ipv4Data.ipv4AddressData.ipv4Address == partial_address + item[1].channel | string ) }}"
|
||||
msg: "Failed to configure controller B, channel {{ item[0].channel }}"
|
||||
loop: "{{ query('nested', lookup('list', controller_b), lookup('list', array.B) ) }}"
|
||||
vars:
|
||||
partial_address: "{{ array.gateway.split('.')[:3] | join('.') + '.' }}"
|
||||
|
||||
|
||||
# **************************************
|
||||
# *** Disable all controller B ports ***
|
||||
# **************************************
|
||||
- name: Disable all controller B's ports
|
||||
netapp_e_iscsi_interface:
|
||||
<<: *creds
|
||||
controller: "B"
|
||||
channel: "{{ item.channel }}"
|
||||
state: disabled
|
||||
loop: "{{ lookup('list', array.B) }}"
|
||||
|
||||
# Delay to give time for the asynchronous symbol call has complete
|
||||
- pause:
|
||||
seconds: 30
|
||||
|
||||
# Request controller iscsi host interface information
|
||||
- name: Collect iscsi port information
|
||||
uri:
|
||||
url: "{{ xpath_filter_url }}?query=controller/hostInterfaces//iscsi"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: result
|
||||
vars:
|
||||
xpath_filter_url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/graph/xpath-filter"
|
||||
|
||||
# Extract controller A's port information from the iscsi host interfaces list
|
||||
# Note: min filter is used because there are only two controller ids and the smaller corresponds with controller B
|
||||
- name: Get controller B's controllerId
|
||||
set_fact:
|
||||
controller_b_id: "{{ result | json_query('json[*].controllerId') | max }}"
|
||||
|
||||
# Compile any iscsi port information associated with controller B
|
||||
- name: Get controller B's port information
|
||||
set_fact:
|
||||
controller_b: "{{ result | json_query(controller_b_query) }}"
|
||||
vars:
|
||||
controller_b_query: "json[?controllerId=='{{ controller_b_id }}']"
|
||||
|
||||
# Confirm that all of controller B's ports are disabled
|
||||
- name: Verify all controller B ports are disabled
|
||||
assert:
|
||||
that: "{{ item.ipv4Enabled == false }}"
|
||||
msg: "Controller B, channel {{ item.channel }} is not disabled"
|
||||
loop: "{{ controller_b }}"
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 10.113.1.111:8443
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,68 +0,0 @@
|
|||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: NetApp Test iSCSI Target module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars: &vars
|
||||
credentials: &creds
|
||||
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
secrets: &secrets
|
||||
# 12 characters
|
||||
- 012345678912
|
||||
# 16 characters
|
||||
- 0123456789123456
|
||||
|
||||
- name: set credentials
|
||||
set_fact:
|
||||
credentials: *creds
|
||||
|
||||
- name: Show some debug information
|
||||
debug:
|
||||
msg: "Using user={{ credentials.api_username }} on server={{ credentials.api_url }}."
|
||||
|
||||
- name: Ensure we can set the chap secret
|
||||
netapp_e_iscsi_target:
|
||||
<<: *creds
|
||||
name: myTarget
|
||||
chap_secret: "{{ item }}"
|
||||
loop: *secrets
|
||||
|
||||
- name: Turn off all of the options
|
||||
netapp_e_iscsi_target:
|
||||
<<: *creds
|
||||
name: abc
|
||||
ping: no
|
||||
unnamed_discovery: no
|
||||
|
||||
- name: Ensure we can set the ping option
|
||||
netapp_e_iscsi_target:
|
||||
<<: *creds
|
||||
name: myTarget
|
||||
ping: yes
|
||||
unnamed_discovery: yes
|
||||
register: result
|
||||
|
||||
- name: Ensure we received a change
|
||||
assert:
|
||||
that: result.changed
|
||||
|
||||
- name: Run the ping change in check-mode
|
||||
netapp_e_iscsi_target:
|
||||
<<: *creds
|
||||
name: myTarget
|
||||
ping: yes
|
||||
unnamed_discovery: yes
|
||||
check_mode: yes
|
||||
register: result
|
||||
|
||||
- name: Ensure no change resulted
|
||||
assert:
|
||||
that: not result.changed
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 192.168.1.100
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,326 +0,0 @@
|
|||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: NetApp Test ASUP module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars:
|
||||
credentials: &creds
|
||||
api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
|
||||
- name: set credentials
|
||||
set_fact:
|
||||
credentials: *creds
|
||||
# ****************************************************
|
||||
# *** Setup test hosts, storage pools, and volumes ***
|
||||
# ****************************************************
|
||||
- name: Create host for host mapping
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: test_host_mapping_host
|
||||
host_type: 27
|
||||
- netapp_e_host:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: test_host1
|
||||
host_type: 27
|
||||
- netapp_e_host:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: test_host2
|
||||
host_type: 27
|
||||
- name: Create storage pool for host mapping
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: test_host_mapping_storage_pool
|
||||
raid_level: raid0
|
||||
criteria_min_usable_capacity: 1
|
||||
- name: Create volume for host mapping
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: test_host_mapping_volume
|
||||
storage_pool_name: test_host_mapping_storage_pool
|
||||
size: 1
|
||||
- name: Create volume for host mapping
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: test_host_mapping_volume2
|
||||
storage_pool_name: test_host_mapping_storage_pool
|
||||
size: 1
|
||||
|
||||
# **********************************************
|
||||
# *** Create new lun between host and volume ***
|
||||
# **********************************************
|
||||
- name: Create netapp_e_lun_mapping
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: present
|
||||
target: test_host_mapping_host
|
||||
volume: test_host_mapping_volume
|
||||
register: result
|
||||
|
||||
- name: Verify lun mapping
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ netapp_e_ssid }}/graph/xpath-filter?query=//volume[name='test_host_mapping_volume']"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- assert:
|
||||
that: "{{ item['mapped'] }}"
|
||||
msg: "Lun failed to be created."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
# QUICK VERIFICATION OF MISMATCHING TARGET/TARGET_TYPE - GOOD
|
||||
#- name: Create netapp_e_lun_mapping
|
||||
# netapp_e_lun_mapping:
|
||||
# <<: *creds
|
||||
# state: present
|
||||
# target: test_host_mapping_host
|
||||
# volume: test_host_mapping_volume
|
||||
# lun: 100
|
||||
# target_type: group
|
||||
# register: result
|
||||
#
|
||||
#- pause: seconds=30
|
||||
# **************************************************************
|
||||
# *** Repeat previous lun creation play and verify unchanged ***
|
||||
# **************************************************************
|
||||
- name: Repeat lun creation
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: present
|
||||
target: test_host_mapping_host
|
||||
volume: test_host_mapping_volume
|
||||
register: result
|
||||
|
||||
- name: Verify lun mapping
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ netapp_e_ssid }}/graph/xpath-filter?query=//volume[name='test_host_mapping_volume']"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- assert:
|
||||
that: "{{ item['mapped'] and result.changed==False }}"
|
||||
msg: "Lun failed to be unchanged."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
# ****************************************************************
|
||||
# *** Move existing lun to default target and verify unchanged ***
|
||||
# ****************************************************************
|
||||
- name: Move lun to default target
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: present
|
||||
volume: test_host_mapping_volume
|
||||
register: result
|
||||
|
||||
- name: Verify lun mapping
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ netapp_e_ssid }}/graph/xpath-filter?query=//volume[name='test_host_mapping_volume']"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- assert:
|
||||
that: "{{ item['mapped'] }}"
|
||||
msg: "Lun failed to be created."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
# *****************************************************************
|
||||
# *** Move existing lun to specific target and verify unchanged ***
|
||||
# *****************************************************************
|
||||
- name: Move lun to default target
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: present
|
||||
target: test_host_mapping_host
|
||||
volume: test_host_mapping_volume
|
||||
register: result
|
||||
|
||||
- name: Verify lun mapping
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ netapp_e_ssid }}/graph/xpath-filter?query=//volume[name='test_host_mapping_volume']"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- assert:
|
||||
that: "{{ item['mapped'] }}"
|
||||
msg: "Lun failed to be created."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
# *******************************************
|
||||
# *** Modify a volume mapping's lun value ***
|
||||
# *******************************************
|
||||
- name: Change volume mapping's lun value
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: present
|
||||
target: test_host_mapping_host
|
||||
volume: test_host_mapping_volume
|
||||
lun: 100
|
||||
register: result
|
||||
|
||||
- pause: seconds=15
|
||||
|
||||
- name: Verify lun mapping
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ netapp_e_ssid }}/graph/xpath-filter?query=//volume[name='test_host_mapping_volume']"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- assert:
|
||||
that: "{{ result.changed }}"
|
||||
msg: "Lun failed to be unchanged."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
- name: Verify mapping fails when lun already in use on existing host object
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: present
|
||||
target: test_host_mapping_host
|
||||
volume: test_host_mapping_volume2
|
||||
lun: 100
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- pause: seconds=15
|
||||
|
||||
- assert:
|
||||
that: "{{ not result.changed }}"
|
||||
msg: "Lun succeeded when it should have failed."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
- name: Verify mapping succeeds when the same lun is used on multiple host objects.
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: present
|
||||
target: test_host1
|
||||
volume: test_host_mapping_volume2
|
||||
lun: 100
|
||||
register: result
|
||||
|
||||
- pause: seconds=15
|
||||
|
||||
- assert:
|
||||
that: "{{ result.changed }}"
|
||||
msg: "Lun failed to be unchanged."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
# *************************************************************************************************
|
||||
# *** Verify that exact mapping details but different lun results in an unchanged configuration ***
|
||||
# *************************************************************************************************
|
||||
- name: Verify that exact mapping details but different lun results in an unchanged configuration
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: absent
|
||||
target: test_host_mapping_host
|
||||
volume: test_host_mapping_volume
|
||||
lun: 99
|
||||
register: result
|
||||
|
||||
- name: Verify lun mapping
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ netapp_e_ssid }}/graph/xpath-filter?query=//volume[name='test_host_mapping_volume']"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- assert:
|
||||
that: "{{ item['mapped'] and not result.changed }}"
|
||||
msg: "Lun failed to be unchanged."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
# ********************************
|
||||
# *** Delete newly created lun ***
|
||||
# ********************************
|
||||
- name: Delete lun creation
|
||||
netapp_e_lun_mapping:
|
||||
<<: *creds
|
||||
state: absent
|
||||
target: test_host_mapping_host
|
||||
volume: test_host_mapping_volume
|
||||
register: result
|
||||
|
||||
- name: Verify lun mapping
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ netapp_e_ssid }}/graph/xpath-filter?query=//volume[name='test_host_mapping_volume']"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
body_format: json
|
||||
validate_certs: no
|
||||
register: current
|
||||
|
||||
- assert:
|
||||
that: "{{ not item['mapped'] }}"
|
||||
msg: "Lun failed to be created."
|
||||
loop: "{{ lookup('list', current.json)}}"
|
||||
|
||||
# ********************************************************
|
||||
# *** Tear down test hosts, storage pools, and volumes ***
|
||||
# ********************************************************
|
||||
- name: Delete volume for host mapping
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: test_host_mapping_volume
|
||||
storage_pool_name: test_host_mapping_storage_pool
|
||||
size: 1
|
||||
- name: Delete volume for host mapping
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: test_host_mapping_volume2
|
||||
storage_pool_name: test_host_mapping_storage_pool
|
||||
size: 1
|
||||
- name: Delete storage pool for host mapping
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: test_host_mapping_storage_pool
|
||||
raid_level: raid0
|
||||
criteria_min_usable_capacity: 1
|
||||
- name: Delete host for host mapping
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: test_host_mapping_host
|
||||
host_type_index: 27
|
||||
- name: Delete host for host mapping
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: test_host2
|
||||
host_type_index: 27
|
||||
- name: Delete host for host mapping
|
||||
netapp_e_host:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: test_host1
|
||||
host_type_index: 27
|
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 10.113.1.111:8443
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
File diff suppressed because it is too large
Load diff
|
@ -1,10 +0,0 @@
|
|||
# This test is not enabled by default, but can be utilized by defining required variables in integration_config.yml
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
#netapp_e_api_host: 192.168.1.1
|
||||
#netapp_e_api_username: admin
|
||||
#netapp_e_api_password: myPass
|
||||
#netapp_e_ssid: 1
|
||||
|
||||
unsupported
|
||||
netapp/eseries
|
|
@ -1 +0,0 @@
|
|||
- include_tasks: run.yml
|
|
@ -1,776 +0,0 @@
|
|||
# Test code for the netapp_e_iscsi_interface module
|
||||
# (c) 2018, NetApp, Inc
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: NetApp Test ASUP module
|
||||
fail:
|
||||
msg: 'Please define netapp_e_api_username, netapp_e_api_password, netapp_e_api_host, and netapp_e_ssid.'
|
||||
when: netapp_e_api_username is undefined or netapp_e_api_password is undefined
|
||||
or netapp_e_api_host is undefined or netapp_e_ssid is undefined
|
||||
vars:
|
||||
credentials: &creds
|
||||
api_url: "https://{{ netapp_e_api_host }}:8443/devmgr/v2"
|
||||
api_username: "{{ netapp_e_api_username }}"
|
||||
api_password: "{{ netapp_e_api_password }}"
|
||||
ssid: "{{ netapp_e_ssid }}"
|
||||
validate_certs: no
|
||||
|
||||
- set_fact:
|
||||
credentials: *creds
|
||||
|
||||
# test setup
|
||||
- name: Delete raid 0 storage pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- storage_pool
|
||||
- storage_pool2
|
||||
- storage_pool3
|
||||
|
||||
# Thick volume testing: create, delete, expand, change properties (read/write cache), expand and change properties,
|
||||
- name: Create raid 0 storage pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: storage_pool
|
||||
criteria_min_usable_capacity: 5
|
||||
criteria_size_unit: tb
|
||||
erase_secured_drives: yes
|
||||
raid_level: raid0
|
||||
|
||||
- name: Delete volume in raid 0 storage pool
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: volume
|
||||
|
||||
- name: Create volume in raid 0 storage pool
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 100
|
||||
size_unit: gb
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '107374182400' and item.segmentSize == 131072}}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
- name: Re-execute volume creation in raid 0 storage pool
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 100
|
||||
size_unit: gb
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ not results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '107374182400' and item.segmentSize == 131072}}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
- name: Update volume size
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 200
|
||||
size_unit: gb
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '214748364800' and item.segmentSize == 131072}}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
- pause: seconds=15
|
||||
|
||||
- name: Update volume properties
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 200
|
||||
size_unit: gb
|
||||
write_cache_enable: true
|
||||
read_cache_enable: false
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '214748364800' and item.segmentSize == 131072 and
|
||||
not item.cacheSettings.readCacheEnable and item.cacheSettings.writeCacheEnable}}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
- name: Update volume properties and expand storage capabilities
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 300
|
||||
size_unit: gb
|
||||
write_cache_enable: false
|
||||
read_cache_enable: true
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '322122547200' and item.segmentSize == 131072 and
|
||||
item.cacheSettings.readCacheEnable and not item.cacheSettings.writeCacheEnable}}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
# Workload tagging testing: create, utilize existing (name only, name with same attributes), modify attributes
|
||||
- name: Add workload tag (change, new workload tag)
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 300
|
||||
size_unit: gb
|
||||
write_cache_enable: false
|
||||
read_cache_enable: true
|
||||
workload_name: volume_tag
|
||||
metadata:
|
||||
volume_tag_key: volume_tag_value
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- name: Validate volume workload changes
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '322122547200' and item.segmentSize == 131072 and
|
||||
item.cacheSettings.readCacheEnable and not item.cacheSettings.writeCacheEnable and
|
||||
{'key': 'volumeTypeId', 'value': 'volume'} in item.metadata }}"
|
||||
msg: "Failed to modify volume metadata!"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/workloads"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: workload_tags
|
||||
- assert:
|
||||
that: "{{ item.name == 'volume_tag' and
|
||||
{'key': 'volume_tag_key', 'value': 'volume_tag_value'} in item.workloadAttributes }}"
|
||||
msg: "Workload tag failed to be created!"
|
||||
loop: "{{ lookup('list', volume_tag_id, wantList=True) }}"
|
||||
vars:
|
||||
volume_tag_id: "{{ workload_tags | json_query('json[?name==`volume_tag`]') }}"
|
||||
|
||||
- name: Repeat add workload tag (no change)
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 300
|
||||
size_unit: gb
|
||||
write_cache_enable: false
|
||||
read_cache_enable: true
|
||||
workload_name: volume_tag
|
||||
metadata:
|
||||
volume_tag_key: volume_tag_value
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- name: Validate volume workload changes
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ not results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '322122547200' and item.segmentSize == 131072 and
|
||||
item.cacheSettings.readCacheEnable and not item.cacheSettings.writeCacheEnable and
|
||||
{'key': 'volumeTypeId', 'value': 'volume'} in item.metadata }}"
|
||||
msg: "Failed to not modify volume metadata!"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/workloads"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: workload_tags
|
||||
- assert:
|
||||
that: "{{ item.name == 'volume_tag' and
|
||||
{'key': 'volume_tag_key', 'value': 'volume_tag_value'} in item.workloadAttributes }}"
|
||||
msg: "Workload tag failed not to be changed"
|
||||
loop: "{{ lookup('list', volume_tag_id, wantList=True) }}"
|
||||
vars:
|
||||
volume_tag_id: "{{ workload_tags | json_query('json[?name==`volume_tag`]') }}"
|
||||
|
||||
- name: Workload tag (no change, just using workload_name)
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 300
|
||||
size_unit: gb
|
||||
write_cache_enable: false
|
||||
read_cache_enable: true
|
||||
workload_name: volume_tag
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- name: Validate volume workload changes
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ not results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '322122547200' and item.segmentSize == 131072 and
|
||||
item.cacheSettings.readCacheEnable and not item.cacheSettings.writeCacheEnable and
|
||||
{'key': 'volumeTypeId', 'value': 'volume'} in item.metadata }}"
|
||||
msg: "Failed to not modify volume metadata!"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/workloads"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: workload_tags
|
||||
- assert:
|
||||
that: "{{ item.name == 'volume_tag' and
|
||||
{'key': 'volume_tag_key', 'value': 'volume_tag_value'} in item.workloadAttributes }}"
|
||||
msg: "Workload tag failed to not be modified!"
|
||||
loop: "{{ lookup('list', volume_tag_id, wantList=True) }}"
|
||||
vars:
|
||||
volume_tag_id: "{{ workload_tags | json_query('json[?name==`volume_tag`]') }}"
|
||||
|
||||
- name: Add workload tag (change, new attributes)
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 300
|
||||
size_unit: gb
|
||||
write_cache_enable: false
|
||||
read_cache_enable: true
|
||||
workload_name: volume_tag
|
||||
metadata:
|
||||
volume_tag_key2: volume_tag_value2
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- name: Validate volume workload changes
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '322122547200' and item.segmentSize == 131072 and
|
||||
item.cacheSettings.readCacheEnable and not item.cacheSettings.writeCacheEnable and
|
||||
{'key': 'volumeTypeId', 'value': 'volume'} in item.metadata }}"
|
||||
msg: "Failed to not modify volume metadata!"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/workloads"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: workload_tags
|
||||
- assert:
|
||||
that: "{{ item.name == 'volume_tag' and
|
||||
{'key': 'volume_tag_key2', 'value': 'volume_tag_value2'} in item.workloadAttributes }}"
|
||||
msg: "Workload tag failed to be updated!"
|
||||
loop: "{{ lookup('list', volume_tag_id, wantList=True) }}"
|
||||
vars:
|
||||
volume_tag_id: "{{ workload_tags | json_query('json[?name==`volume_tag`]') }}"
|
||||
|
||||
- name: Remove workload tag from volume (change)
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 300
|
||||
size_unit: gb
|
||||
write_cache_enable: false
|
||||
read_cache_enable: true
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- name: Validate volume workload changes
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '322122547200' and item.segmentSize == 131072 and
|
||||
item.cacheSettings.readCacheEnable and not item.cacheSettings.writeCacheEnable and
|
||||
item.metadata == []}}"
|
||||
msg: "Failed to not modify volume metadata!"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/workloads"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: workload_tags
|
||||
- assert:
|
||||
that: "{{ item.name == 'volume_tag' and
|
||||
{'key': 'volume_tag_key2', 'value': 'volume_tag_value2'} in item.workloadAttributes }}"
|
||||
msg: "Workload tag failed to be updated!"
|
||||
loop: "{{ lookup('list', volume_tag_id, wantList=True) }}"
|
||||
vars:
|
||||
volume_tag_id: "{{ workload_tags | json_query('json[?name==`volume_tag`]') }}"
|
||||
|
||||
- name: Delete workload tag
|
||||
uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/workloads"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: workload_tags
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/workloads/{{ item }}"
|
||||
method: DELETE
|
||||
status_code: 204
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
loop: "{{ lookup('list', volume_tag_id, wantList=True) }}"
|
||||
vars:
|
||||
volume_tag_id: "{{ workload_tags | json_query('json[?name==`volume_tag`].id') }}"
|
||||
|
||||
- name: Delete raid 0 storage pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: storage_pool
|
||||
|
||||
|
||||
# *** Thin volume testing (May not work with simulator) ***
|
||||
- name: Create dynamic disk pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: storage_pool
|
||||
criteria_min_usable_capacity: 2
|
||||
criteria_size_unit: tb
|
||||
|
||||
- name: Create thin volume
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: thin_volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 131072
|
||||
size_unit: gb
|
||||
thin_provision: true
|
||||
thin_volume_repo_size: 32
|
||||
thin_volume_max_repo_size: 1024
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/thin-volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'thin_volume' and item.thinProvisioned and
|
||||
item.capacity == '140737488355328' and item.initialProvisionedCapacity == '34359738368' and
|
||||
item.provisionedCapacityQuota == '1099511627776' and item.expansionPolicy == 'automatic' }}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`thin_volume`]') }}"
|
||||
|
||||
- name: (Rerun) Create thin volume
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: thin_volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 131072
|
||||
size_unit: gb
|
||||
thin_provision: true
|
||||
thin_volume_repo_size: 32
|
||||
thin_volume_max_repo_size: 1024
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/thin-volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ not results.changed and item.name == 'thin_volume' and item.thinProvisioned and
|
||||
item.capacity == '140737488355328' and item.initialProvisionedCapacity == '34359738368' and
|
||||
item.provisionedCapacityQuota == '1099511627776' and item.expansionPolicy == 'automatic' }}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`thin_volume`]') }}"
|
||||
|
||||
|
||||
- name: Expand thin volume's virtual size
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: thin_volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 262144
|
||||
size_unit: gb
|
||||
thin_provision: true
|
||||
thin_volume_repo_size: 32
|
||||
thin_volume_max_repo_size: 1024
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/thin-volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'thin_volume' and item.thinProvisioned and
|
||||
item.capacity == '281474976710656' and item.initialProvisionedCapacity == '34359738368' and
|
||||
item.provisionedCapacityQuota == '1099511627776' and item.expansionPolicy == 'automatic' }}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`thin_volume`]') }}"
|
||||
|
||||
|
||||
- name: Expand thin volume's maximum repository size
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: thin_volume
|
||||
storage_pool_name: storage_pool
|
||||
size: 262144
|
||||
size_unit: gb
|
||||
thin_provision: true
|
||||
thin_volume_repo_size: 32
|
||||
thin_volume_max_repo_size: 2048
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/thin-volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'thin_volume' and item.thinProvisioned and
|
||||
item.capacity == '281474976710656' and item.initialProvisionedCapacity == '34359738368' and
|
||||
item.provisionedCapacityQuota == '2199023255552' and item.expansionPolicy == 'automatic' }}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`thin_volume`]') }}"
|
||||
|
||||
- name: Create dynamic disk pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: storage_pool2
|
||||
criteria_min_usable_capacity: 2
|
||||
criteria_size_unit: tb
|
||||
- pause: seconds=15
|
||||
|
||||
- name: Create second thin volume with manual expansion policy
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: thin_volume2
|
||||
storage_pool_name: storage_pool2
|
||||
size_unit: gb
|
||||
size: 131072
|
||||
thin_provision: true
|
||||
thin_volume_repo_size: 32
|
||||
thin_volume_max_repo_size: 32
|
||||
thin_volume_expansion_policy: manual
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/thin-volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'thin_volume2' and item.thinProvisioned and
|
||||
item.capacity == '140737488355328' and item.initialProvisionedCapacity == '34359738368' and
|
||||
item.currentProvisionedCapacity == '34359738368' and item.expansionPolicy == 'manual' }}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`thin_volume2`]') }}"
|
||||
|
||||
|
||||
- name: Create second thin volume with manual expansion policy
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: thin_volume2
|
||||
storage_pool_name: storage_pool2
|
||||
size_unit: gb
|
||||
size: 131072
|
||||
thin_provision: true
|
||||
thin_volume_repo_size: 288
|
||||
thin_volume_max_repo_size: 288
|
||||
thin_volume_expansion_policy: manual
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/thin-volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'thin_volume2' and item.thinProvisioned and
|
||||
item.capacity == '140737488355328' and item.initialProvisionedCapacity == '34359738368' and
|
||||
item.currentProvisionedCapacity == '309237645312' and item.expansionPolicy == 'manual' }}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`thin_volume2`]') }}"
|
||||
|
||||
- name: Modify second thin volume to use automatic expansion policy
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: thin_volume2
|
||||
storage_pool_name: storage_pool2
|
||||
size_unit: gb
|
||||
size: 131072
|
||||
thin_provision: true
|
||||
thin_volume_repo_size: 288
|
||||
thin_volume_max_repo_size: 288
|
||||
thin_volume_expansion_policy: automatic
|
||||
register: results
|
||||
- pause: seconds=15
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/thin-volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'thin_volume2' and item.thinProvisioned and
|
||||
item.capacity == '140737488355328' and item.initialProvisionedCapacity == '34359738368' and
|
||||
item.currentProvisionedCapacity == '309237645312' and item.expansionPolicy == 'automatic' }}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`thin_volume2`]') }}"
|
||||
|
||||
- name: Delete raid 0 storage pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- storage_pool
|
||||
- storage_pool2
|
||||
|
||||
- name: Create raid 0 storage pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: storage_pool
|
||||
criteria_min_usable_capacity: 5
|
||||
criteria_size_unit: tb
|
||||
erase_secured_drives: yes
|
||||
raid_level: raid0
|
||||
|
||||
# Thick volume expansion testing: wait and don't wait for operation to complete
|
||||
- name: Create raid 6 storage pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: storage_pool3
|
||||
criteria_min_usable_capacity: 5
|
||||
criteria_size_unit: tb
|
||||
erase_secured_drives: yes
|
||||
raid_level: raid6
|
||||
|
||||
- name: Delete volume in raid 6 storage pool
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: volume
|
||||
|
||||
- name: Create volume in raid 0 storage pool for expansion testing
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool3
|
||||
size: 1
|
||||
size_unit: gb
|
||||
register: results
|
||||
- pause: seconds=10
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '1073741824' and item.segmentSize == 131072}}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
- name: Modify volume in raid 0 storage pool and wait for expansion testing
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool3
|
||||
size: 10
|
||||
size_unit: gb
|
||||
wait_for_initialization: True
|
||||
register: results
|
||||
- pause: seconds=10
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes/{{ volume[0]['id'] }}/expand"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: expansion_state
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '10737418240' and item.segmentSize == 131072 and
|
||||
expansion_state['json']['action'] == 'none'}}"
|
||||
msg: "Volume expansion test failed."
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
- name: Modify volume in raid 0 storage pool and don't wait for expansion testing
|
||||
netapp_e_volume:
|
||||
<<: *creds
|
||||
state: present
|
||||
name: volume
|
||||
storage_pool_name: storage_pool3
|
||||
size: 100
|
||||
size_unit: gb
|
||||
wait_for_initialization: False
|
||||
register: results
|
||||
- pause: seconds=10
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: current
|
||||
- uri:
|
||||
url: "{{ credentials.api_url }}/storage-systems/{{ credentials.ssid }}/volumes/{{ volume[0]['id'] }}/expand"
|
||||
user: "{{ credentials.api_username }}"
|
||||
password: "{{ credentials.api_password }}"
|
||||
validate_certs: no
|
||||
register: expansion_state
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
- assert:
|
||||
that: "{{ results.changed and item.name == 'volume' and not item.thinProvisioned and
|
||||
item.capacity == '107374182400' and item.segmentSize == 131072 and expansion_state['json']['action'] != 'none'}}"
|
||||
msg: "Failed to create volume"
|
||||
loop: "{{ lookup('list', volume, wantList=True) }}"
|
||||
vars:
|
||||
volume: "{{ current | json_query('json[?name==`volume`]') }}"
|
||||
|
||||
- name: Delete raid 0 storage pool
|
||||
netapp_e_storagepool:
|
||||
<<: *creds
|
||||
state: absent
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- storage_pool3
|
Loading…
Add table
Add a link
Reference in a new issue