diff --git a/plugins/modules/dcnm_vrf.py b/plugins/modules/dcnm_vrf.py index 73f17b132..5a9ea2070 100644 --- a/plugins/modules/dcnm_vrf.py +++ b/plugins/modules/dcnm_vrf.py @@ -1851,6 +1851,7 @@ def get_want(self): if vrf.get("vlan_id"): vlan_id = vrf.get("vlan_id") else: + # Todo: When DCNM 11.x support is ended, change the default vlan_id to "" vlan_id = 0 want_create.append(self.update_create_params(vrf, vlan_id)) @@ -2176,6 +2177,9 @@ def get_next_vrf_id(self, fabric) -> int: msg += f"{self.dcnm_version}" self.module.fail_json(msg) + if vrf_id is not None: + break + if vrf_id is None: msg = f"{self.class_name}.{method_name}: " msg += "Unable to retrieve vrf_id " @@ -2273,7 +2277,13 @@ def diff_merge_create(self, replace=False): } if self.dcnm_version > 11: - template_conf.update(isRPAbsent=json_to_dict.get("isRPAbsent")) + vrf_vlan_id = "" if template_conf["vrfVlanId"] in [0, None] else template_conf["vrfVlanId"] + template_conf.update( + vrfVlanId=vrf_vlan_id + ) + template_conf.update( + isRPAbsent=json_to_dict.get("isRPAbsent") + ) template_conf.update( ENABLE_NETFLOW=json_to_dict.get("ENABLE_NETFLOW") )