summaryrefslogtreecommitdiff
path: root/test/integration/targets/vmware_dvswitch_uplink_pg
diff options
context:
space:
mode:
authorGonéri Le Bouder <goneri@lebouder.net>2019-04-24 13:52:48 -0400
committerGonéri Le Bouder <goneri@lebouder.net>2019-05-02 09:31:03 -0400
commit2307797a764eda80863b3b14b0251e36ccc3b1ea (patch)
tree664eedbae08082853c0b5ce214de97aadab04e61 /test/integration/targets/vmware_dvswitch_uplink_pg
parent636f8cbdab3f09589d04ff064d99d599e112f8e2 (diff)
downloadansible-2307797a764eda80863b3b14b0251e36ccc3b1ea.tar.gz
vmware: refactoring of vmware test roles -- part3
Refactoring of the following roles to make use of the new `prepare_vmware_tests` role. - `vmware_drs_group` - `vmware_drs_group_facts` - `vmware_drs_rule_facts` - `vmware_drs_portgroup` - `vmware_drs_portgroup_facts` - `vmware_dvs_portgroup_facts` - `vmware_dvswitch` - `vmware_dvswitch_pvlans` This patch depends on: https://github.com/ansible/ansible/pull/55719 Original PR: https://github.com/ansible/ansible/pull/54882
Diffstat (limited to 'test/integration/targets/vmware_dvswitch_uplink_pg')
-rw-r--r--test/integration/targets/vmware_dvswitch_uplink_pg/aliases3
-rw-r--r--test/integration/targets/vmware_dvswitch_uplink_pg/tasks/main.yml154
2 files changed, 55 insertions, 102 deletions
diff --git a/test/integration/targets/vmware_dvswitch_uplink_pg/aliases b/test/integration/targets/vmware_dvswitch_uplink_pg/aliases
index 845e8a6dad..3eede2cbf0 100644
--- a/test/integration/targets/vmware_dvswitch_uplink_pg/aliases
+++ b/test/integration/targets/vmware_dvswitch_uplink_pg/aliases
@@ -1,2 +1,3 @@
cloud/vcenter
-unsupported
+shippable/vcenter/group1
+needs/target/prepare_vmware_tests
diff --git a/test/integration/targets/vmware_dvswitch_uplink_pg/tasks/main.yml b/test/integration/targets/vmware_dvswitch_uplink_pg/tasks/main.yml
index f245e25a86..1258c8bacc 100644
--- a/test/integration/targets/vmware_dvswitch_uplink_pg/tasks/main.yml
+++ b/test/integration/targets/vmware_dvswitch_uplink_pg/tasks/main.yml
@@ -2,43 +2,17 @@
# 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)
-- name: Wait for Flask controller to come up online
- wait_for:
- host: "{{ vcsim }}"
- port: 5000
- state: started
-
-- name: kill vcsim
- uri:
- url: http://{{ vcsim }}:5000/killall
-
-- name: start vcsim
- uri:
- url: http://{{ vcsim }}:5000/spawn?cluster=2
- register: vcsim_instance
-
-- name: Wait for vcsim server to come up online
- wait_for:
- host: "{{ vcsim }}"
- port: 443
- state: started
-
-- name: get a list of Datacenter from vcsim
- uri:
- url: http://{{ vcsim }}:5000/govc_find?filter=DC
- register: datacenters
-
-- debug: var=vcsim_instance
-- debug: var=datacenters
+- import_role:
+ name: prepare_vmware_tests
# Testcase 0001: Add Distributed vSwitch
- name: add distributed vSwitch
vmware_dvswitch:
validate_certs: False
- hostname: "{{ vcsim }}"
- username: "{{ vcsim_instance['json']['username'] }}"
- password: "{{ vcsim_instance['json']['password'] }}"
- datacenter_name: "{{ item | basename }}"
+ hostname: "{{ vcenter_hostname }}"
+ username: "{{ vcenter_username }}"
+ password: "{{ vcenter_password }}"
+ datacenter_name: "{{ dc1 }}"
state: present
switch_name: dvswitch_0001
mtu: 9000
@@ -46,77 +20,55 @@
discovery_proto: lldp
discovery_operation: both
register: dvs_result_0001
- with_items:
- - "{{ datacenters['json'] }}"
-
-- name: ensure distributed vswitch is present
- assert:
- that:
- - "{{ dvs_result_0001.changed == true }}"
-
-- name: get a list of distributed vswitch from vcsim after adding
- uri:
- url: http://{{ vcsim }}:5000/govc_find?filter=DVS
- register: new_dvs_0001
- debug:
- msg: "{{ item | basename }}"
- with_items: "{{ new_dvs_0001['json'] }}"
+ var: dvs_result_0001
-- set_fact: new_dvs_name="{% for dvs in new_dvs_0001['json'] %} {{ True if (dvs | basename) == 'dvswitch_0001' else False }}{% endfor %}"
-
-- debug: var=new_dvs_name
-- assert:
- that:
- - "{{ 'True' in new_dvs_name }}"
-
-- name: Configure Uplink portgroup in check mode
- vmware_dvswitch_uplink_pg:
- hostname: "{{ vcsim }}"
- username: "{{ vcsim_instance['json']['username'] }}"
- password: "{{ vcsim_instance['json']['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
-
-- name: ensure uplink portgroup was changed
- assert:
- that:
- - uplink_pg_result_check_mode.changed
-
-- name: Configure Uplink portgroup
- vmware_dvswitch_uplink_pg:
- hostname: "{{ vcsim }}"
- username: "{{ vcsim_instance['json']['username'] }}"
- password: "{{ vcsim_instance['json']['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
-
-- name: ensure uplink portgroup was changed
+- name: ensure distributed vswitch is present
assert:
that:
- - uplink_pg_result.changed
+ - 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
+ check_mode: no
+
+ - debug:
+ var: uplink_pg_result
+
+ - name: ensure uplink portgroup was changed
+ assert:
+ that:
+ - uplink_pg_result is changed