zebra: remove one unnecessary check for l3vni nb

The parent node of "vrf"  MUST be non-NULL, so the check is unnecessary and
misleading. Otherwise, there will be a branch of NULL parent node, it makes
no sense, remove it.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
This commit is contained in:
anlan_cs 2022-05-18 21:55:33 -04:00
parent d37879b7a2
commit c331ef1665

View File

@ -1163,22 +1163,20 @@ int lib_vrf_zebra_l3vni_id_modify(struct nb_cb_modify_args *args)
* if zebra vrf already mapped to different vni id. * if zebra vrf already mapped to different vni id.
*/ */
pn_dnode = yang_dnode_get_parent(args->dnode, "vrf"); pn_dnode = yang_dnode_get_parent(args->dnode, "vrf");
if (pn_dnode) { vrfname = yang_dnode_get_string(pn_dnode, "./name");
vrfname = yang_dnode_get_string(pn_dnode, "./name"); zvrf = zebra_vrf_lookup_by_name(vrfname);
zvrf = zebra_vrf_lookup_by_name(vrfname); if (!zvrf) {
if (!zvrf) { snprintf(args->errmsg, args->errmsg_len,
snprintf(args->errmsg, args->errmsg_len, "zebra vrf info not found for vrf:%s.",
"zebra vrf info not found for vrf:%s.", vrfname);
vrfname); return NB_ERR_VALIDATION;
return NB_ERR_VALIDATION; }
} if (zvrf->l3vni && zvrf->l3vni != vni) {
if (zvrf->l3vni && zvrf->l3vni != vni) { snprintf(
snprintf( args->errmsg, args->errmsg_len,
args->errmsg, args->errmsg_len, "vni %u cannot be configured as vni %u is already configured under the vrf",
"vni %u cannot be configured as vni %u is already configured under the vrf", vni, zvrf->l3vni);
vni, zvrf->l3vni); return NB_ERR_VALIDATION;
return NB_ERR_VALIDATION;
}
} }
/* Check if this VNI is already present in the system */ /* Check if this VNI is already present in the system */