lib: Create VRF if needed

When creating a control plane protocol through NB, create the vrf
if needed instead of only looking up and asserting if it doesn't
exist yet.
Fixes 18429.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
This commit is contained in:
Nathan Bahr 2025-03-19 16:07:37 +00:00
parent d5b864ebee
commit b6ae01f907

View file

@ -47,7 +47,7 @@ int routing_control_plane_protocols_control_plane_protocol_create(
*/ */
if (nb_node_has_dependency(args->dnode->schema->priv)) { if (nb_node_has_dependency(args->dnode->schema->priv)) {
vrfname = yang_dnode_get_string(args->dnode, "vrf"); vrfname = yang_dnode_get_string(args->dnode, "vrf");
vrf = vrf_lookup_by_name(vrfname); vrf = vrf_get(VRF_UNKNOWN, vrfname);
assert(vrf); assert(vrf);
nb_running_set_entry(args->dnode, vrf); nb_running_set_entry(args->dnode, vrf);
} }