VMware: Add testcase for vmware_dvs_portgroup_facts (#59088)
* Tests for choosing specific DVS while gathering facts Signed-off-by: dx0xm <52723266+dx0xm@users.noreply.github.com> Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
ce907c8b90
commit
b8eba8e1f0
2 changed files with 42 additions and 19 deletions
|
@ -204,6 +204,9 @@ class DVSPortgroupFactsManager(PyVmomi):
|
|||
mac_changes=dvs_pg.config.defaultPortConfig.securityPolicy.macChanges.value
|
||||
)
|
||||
if self.module.params['show_teaming_policy']:
|
||||
# govcsim does not have uplinkTeamingPolicy, remove this check once
|
||||
# PR https://github.com/vmware/govmomi/pull/1524 merged.
|
||||
if dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy:
|
||||
teaming_policy = dict(
|
||||
policy=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.policy.value,
|
||||
inbound_policy=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.reversePolicy.value,
|
||||
|
@ -212,6 +215,8 @@ class DVSPortgroupFactsManager(PyVmomi):
|
|||
)
|
||||
|
||||
if self.params['show_port_policy']:
|
||||
# govcsim does not have port policy
|
||||
if dvs_pg.config.policy:
|
||||
port_policy = dict(
|
||||
block_override=dvs_pg.config.policy.blockOverrideAllowed,
|
||||
ipfix_override=dvs_pg.config.policy.ipfixOverrideAllowed,
|
||||
|
|
|
@ -34,3 +34,21 @@
|
|||
- assert:
|
||||
that:
|
||||
- dvs_results.dvs_portgroup_facts is defined
|
||||
|
||||
# Testcase 0002: Get portgroup facts for a given dvswitch
|
||||
- name: get facts for a given dvswitch
|
||||
vmware_dvs_portgroup_facts:
|
||||
validate_certs: False
|
||||
hostname: "{{ vcenter_hostname }}"
|
||||
username: "{{ vcenter_username }}"
|
||||
password: "{{ vcenter_password }}"
|
||||
datacenter: "{{ dc1 }}"
|
||||
dvswitch: "{{ dvswitch1 }}"
|
||||
register: dvs_results_0002
|
||||
|
||||
- debug:
|
||||
msg: "{{ dvs_results_0002 }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "dvs_results_0002['dvs_portgroup_facts']['DVS0'] is defined"
|
||||
|
|
Loading…
Reference in a new issue