]> git.proxmox.com Git - mirror_frr.git/commit - lib/vrf.c
lib, yang: remove vrf from the interface list key
authorIgor Ryzhov <iryzhov@nfware.com>
Mon, 8 Nov 2021 10:33:03 +0000 (13:33 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 23 Nov 2021 09:57:52 +0000 (12:57 +0300)
commit574445ecafdee7a4acfdcfbc725ccb280b6f5d4d
tree179dba1d6892fd0fcc9ea29655d254fe714b74fb
parent0ecdbedbf95125e358298fd9cc502560a74c0c4a
lib, yang: remove vrf from the interface list key

This is needed for the following two reasons:

1. To be able to remove the northbound HACK in if_update_to_new_vrf. It
   is totally wrong to rewrite the configuration datastore when some
   operational state changes. It is a hard blocker for storing a
   configuration data in a management daemon which knows nothing about
   the operational state.
2. To allow changing the VRF of the interface using FRR CLI or any other
   frontend in the future. If the VRF is a part of the key, it can't be
   changed. If the VRF is a simple leaf, it becomes possible to change
   it and thus move the interface between VRFs. For now I mark the leaf
   as a "config false" as it's not yet possible to control it from FRR.

But we can't simply remove the VRF from the key, because it is needed to
distinguish interfaces when using netns based VRFs, as it is possible to
have multiple interfaces with the same name in different namespaces. To
handle this, I came up with an idea to store both VRF and an interface
name in the "name" leaf using the pattern "vrfname:ifname". For example,
if there's an interface "eth0" in VRF "red" then its "name" leaf will be
"red:eth0".

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/if.c
lib/vrf.c
yang/frr-interface.yang
yang/ietf/frr-ietf-translator.json