ansible/test/integration/targets/vmware_dvswitch_uplink_pg/tasks/main.yml
Gonéri Le Bouder 6bb21c3db0 vmware: test-refactoring
- In order to keep the integration with `ansible-test`, we prefer to avoid any
  interaction with the Ansible inventory file.
- split up the prepare_vmware_tests/defaults/main.yml in two
  configuration files: one for vcsim and one for a real environment
- remove all the access to hostvars
- directly interact with the ESXi to mount/umount the datastore
  https://github.com/ansible/ansible/pull/56516
- record the virtual machine folder in the environment configuration
- vmware_guest_move: Use https://github.com/ansible/ansible/pull/55237
2019-05-23 17:40:19 -04:00

75 lines
2 KiB
YAML

# Test code for the vmware_dvswitch_uplink_pg module.
# Copyright: (c) 2018, Christian Kotte <christian.kotte@gmx.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- import_role:
name: prepare_vmware_tests
# Testcase 0001: Add Distributed vSwitch
- name: add distributed vSwitch
vmware_dvswitch:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter_name: "{{ dc1 }}"
state: present
switch_name: dvswitch_0001
mtu: 9000
uplink_quantity: 2
discovery_proto: lldp
discovery_operation: both
register: dvs_result_0001
- debug:
var: dvs_result_0001
- name: ensure distributed vswitch is present
assert:
that:
- dvs_result_0001 is changed
- when: vcsim is not defined
block:
- &uplink_data
name: Configure Uplink portgroup in check mode
vmware_dvswitch_uplink_pg:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
switch: dvswitch_0001
name: dvswitch_0001-DVUplinks
advanced:
port_config_reset_at_disconnect: False
block_override: False
vendor_config_override: False
vlan_override: False
netflow_override: False
traffic_filter_override: False
vlan_trunk_range: [ 2-3967, 4049-4092 ]
netflow_enabled: True
block_all_ports: False
validate_certs: no
register: uplink_pg_result_check_mode
check_mode: yes
- debug:
var: uplink_pg_result_check_mode
- name: ensure uplink portgroup was changed
assert:
that:
- uplink_pg_result_check_mode is changed
- <<: *uplink_data
name: Configure Uplink portgroup
register: uplink_pg_result
check_mode: no
- debug:
var: uplink_pg_result
- name: ensure uplink portgroup was changed
assert:
that:
- uplink_pg_result is changed