mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07:00
Module renamed to ucs_mac_pool to match naming convention for other ucs modules. (#34826)
Documentation updated to match UCS Manager online help. Coding style updated to match other ucs modules.
This commit is contained in:
parent
6648964afa
commit
b7906f9c27
5 changed files with 315 additions and 287 deletions
6
test/integration/targets/ucs_mac_pool/aliases
Normal file
6
test/integration/targets/ucs_mac_pool/aliases
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware.
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
# ucs_hostname: 172.16.143.136
|
||||
# ucs_username: admin
|
||||
# ucs_password: password
|
129
test/integration/targets/ucs_mac_pool/tasks/main.yml
Normal file
129
test/integration/targets/ucs_mac_pool/tasks/main.yml
Normal file
|
@ -0,0 +1,129 @@
|
|||
# Test code for the UCS modules
|
||||
# Copyright 2017, David Soper (@dsoper2)
|
||||
|
||||
- name: Test that we have a UCS host, UCS username, and UCS password
|
||||
fail:
|
||||
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
|
||||
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
|
||||
vars:
|
||||
login_info: &login_info
|
||||
hostname: "{{ ucs_hostname }}"
|
||||
username: "{{ ucs_username }}"
|
||||
password: "{{ ucs_password }}"
|
||||
|
||||
|
||||
# Setup (clean environment)
|
||||
- name: MAC pools absent
|
||||
ucs_mac_pool: &mac_pools_absent
|
||||
<<: *login_info
|
||||
name: mac-A
|
||||
state: absent
|
||||
|
||||
|
||||
# Test present (check_mode)
|
||||
- name: MAC pools present (check_mode)
|
||||
ucs_mac_pool: &mac_pools_present
|
||||
<<: *login_info
|
||||
name: mac-A
|
||||
first_addr: 00:25:B5:00:66:00
|
||||
last_addr: 00:25:B5:00:67:F3
|
||||
order: sequential
|
||||
check_mode: yes
|
||||
register: cm_mac_pools_present
|
||||
|
||||
|
||||
# Present (normal mode)
|
||||
- name: MAC pools present (normal mode)
|
||||
ucs_mac_pool: *mac_pools_present
|
||||
register: nm_mac_pools_present
|
||||
|
||||
|
||||
# Test present again (idempotent)
|
||||
- name: MAC pools present again (check_mode)
|
||||
ucs_mac_pool: *mac_pools_present
|
||||
check_mode: yes
|
||||
register: cm_mac_pools_present_again
|
||||
|
||||
|
||||
# Present again (normal mode)
|
||||
- name: MAC pools present again (normal mode)
|
||||
ucs_mac_pool: *mac_pools_present
|
||||
register: nm_mac_pools_present_again
|
||||
|
||||
|
||||
# Verfiy present
|
||||
- name: Verify MAC present results
|
||||
assert:
|
||||
that:
|
||||
- cm_mac_pools_present.changed == nm_mac_pools_present.changed == true
|
||||
- cm_mac_pools_present_again.changed == nm_mac_pools_present_again.changed == false
|
||||
|
||||
|
||||
# Test change (check_mode)
|
||||
- name: MAC pools description change (check_mode)
|
||||
ucs_mac_pool: &mac_pools_change
|
||||
<<: *mac_pools_present
|
||||
descr: Testing Ansible
|
||||
check_mode: yes
|
||||
register: cm_mac_pools_descr_change
|
||||
|
||||
|
||||
# Change (normal mode)
|
||||
- name: MAC pools description change (normal mode)
|
||||
ucs_mac_pool: *mac_pools_change
|
||||
register: nm_mac_pools_descr_change
|
||||
|
||||
|
||||
# Test change again (idempotent)
|
||||
- name: MAC pools description again (check_mode)
|
||||
ucs_mac_pool: *mac_pools_change
|
||||
check_mode: yes
|
||||
register: cm_mac_pools_descr_change_again
|
||||
|
||||
|
||||
# Change again (normal mode)
|
||||
- name: MAC pools description change again (normal mode)
|
||||
ucs_mac_pool: *mac_pools_change
|
||||
register: nm_mac_pools_descr_change_again
|
||||
|
||||
|
||||
# Verfiy change
|
||||
- name: Verify MAC change results
|
||||
assert:
|
||||
that:
|
||||
- cm_mac_pools_descr_change.changed == nm_mac_pools_descr_change.changed == true
|
||||
- cm_mac_pools_descr_change_again.changed == nm_mac_pools_descr_change_again.changed == false
|
||||
|
||||
|
||||
# Teardown (clean environment)
|
||||
- name: MAC pools absent (check_mode)
|
||||
ucs_mac_pool: *mac_pools_absent
|
||||
check_mode: yes
|
||||
register: cm_mac_pools_absent
|
||||
|
||||
|
||||
# Absent (normal mode)
|
||||
- name: MAC pools absent (normal mode)
|
||||
ucs_mac_pool: *mac_pools_absent
|
||||
register: nm_mac_pools_absent
|
||||
|
||||
|
||||
# Test absent again (idempotent)
|
||||
- name: MAC pools absent again (check_mode)
|
||||
ucs_mac_pool: *mac_pools_absent
|
||||
check_mode: yes
|
||||
register: cm_mac_pools_absent_again
|
||||
|
||||
|
||||
# Absent again (normal mode)
|
||||
- name: MAC pools absent again (normal mode)
|
||||
ucs_mac_pool: *mac_pools_absent
|
||||
register: nm_mac_pools_absent_again
|
||||
|
||||
|
||||
# Verfiy absent
|
||||
- name: Verify MAC absent results
|
||||
assert:
|
||||
that:
|
||||
- cm_mac_pools_absent.changed == nm_mac_pools_absent.changed == true
|
||||
- cm_mac_pools_absent_again.changed == nm_mac_pools_absent_again.changed == false
|
Loading…
Add table
Add a link
Reference in a new issue