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,27 +204,32 @@ class DVSPortgroupFactsManager(PyVmomi):
|
|||
mac_changes=dvs_pg.config.defaultPortConfig.securityPolicy.macChanges.value
|
||||
)
|
||||
if self.module.params['show_teaming_policy']:
|
||||
teaming_policy = dict(
|
||||
policy=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.policy.value,
|
||||
inbound_policy=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.reversePolicy.value,
|
||||
notify_switches=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.notifySwitches.value,
|
||||
rolling_order=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.rollingOrder.value,
|
||||
)
|
||||
# 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,
|
||||
notify_switches=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.notifySwitches.value,
|
||||
rolling_order=dvs_pg.config.defaultPortConfig.uplinkTeamingPolicy.rollingOrder.value,
|
||||
)
|
||||
|
||||
if self.params['show_port_policy']:
|
||||
port_policy = dict(
|
||||
block_override=dvs_pg.config.policy.blockOverrideAllowed,
|
||||
ipfix_override=dvs_pg.config.policy.ipfixOverrideAllowed,
|
||||
live_port_move=dvs_pg.config.policy.livePortMovingAllowed,
|
||||
network_rp_override=dvs_pg.config.policy.networkResourcePoolOverrideAllowed,
|
||||
port_config_reset_at_disconnect=dvs_pg.config.policy.portConfigResetAtDisconnect,
|
||||
security_override=dvs_pg.config.policy.securityPolicyOverrideAllowed,
|
||||
shaping_override=dvs_pg.config.policy.shapingOverrideAllowed,
|
||||
traffic_filter_override=dvs_pg.config.policy.trafficFilterOverrideAllowed,
|
||||
uplink_teaming_override=dvs_pg.config.policy.uplinkTeamingOverrideAllowed,
|
||||
vendor_config_override=dvs_pg.config.policy.vendorConfigOverrideAllowed,
|
||||
vlan_override=dvs_pg.config.policy.vlanOverrideAllowed
|
||||
)
|
||||
# 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,
|
||||
live_port_move=dvs_pg.config.policy.livePortMovingAllowed,
|
||||
network_rp_override=dvs_pg.config.policy.networkResourcePoolOverrideAllowed,
|
||||
port_config_reset_at_disconnect=dvs_pg.config.policy.portConfigResetAtDisconnect,
|
||||
security_override=dvs_pg.config.policy.securityPolicyOverrideAllowed,
|
||||
shaping_override=dvs_pg.config.policy.shapingOverrideAllowed,
|
||||
traffic_filter_override=dvs_pg.config.policy.trafficFilterOverrideAllowed,
|
||||
uplink_teaming_override=dvs_pg.config.policy.uplinkTeamingOverrideAllowed,
|
||||
vendor_config_override=dvs_pg.config.policy.vendorConfigOverrideAllowed,
|
||||
vlan_override=dvs_pg.config.policy.vlanOverrideAllowed
|
||||
)
|
||||
|
||||
if self.params['show_vlan_info']:
|
||||
vlan_info = self.get_vlan_info(dvs_pg.config.defaultPortConfig.vlan)
|
||||
|
|
|
@ -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