]> git.puffer.fish Git - mirror/frr.git/commitdiff
mgmtd: add option to specify netns as the vrf backend
authorIgor Ryzhov <iryzhov@nfware.com>
Sun, 14 Jan 2024 14:55:46 +0000 (16:55 +0200)
committerIgor Ryzhov <iryzhov@nfware.com>
Sun, 14 Jan 2024 18:00:22 +0000 (20:00 +0200)
mgmtd has to know if netns is used as the vrf backend to correctly
process interface names in northbound.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
doc/user/zebra.rst
mgmtd/mgmt_main.c
tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py
tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
tests/topotests/bgp_vrf_netns/test_bgp_vrf_netns_topo.py
tests/topotests/ospf_netns_vrf/test_ospf_netns_vrf.py

index 2b737c1a2f673dbab28d95fad9a0522d8d8af6e9..71201b42781da32b61efaf02047813d1d7f9a84e 100644 (file)
@@ -50,7 +50,8 @@ Besides the common invocation options (:ref:`common-invocation-options`), the
    When *Zebra* starts with this option, the VRF backend is based on Linux
    network namespaces. That implies that all network namespaces discovered by
    ZEBRA will create an associated VRF. The other daemons will operate on the VRF
-   VRF defined by *Zebra*, as usual.
+   VRF defined by *Zebra*, as usual. If this option is specified when running
+   *Zebra*, one must also specify the same option for *mgmtd*.
 
    .. seealso:: :ref:`zebra-vrf`
 
index 72bb353b2095b2b41d1d8783d1045d1824130d10..0f2bdacdc56bf81444fa2ada70057b2c0a115cc3 100644 (file)
@@ -22,6 +22,7 @@ static const struct option longopts[] = {
        {"skip_runas", no_argument, NULL, 'S'},
        {"no_zebra", no_argument, NULL, 'Z'},
        {"socket_size", required_argument, NULL, 's'},
+       {"vrfwnetns", no_argument, NULL, 'n'},
        {0}};
 
 static void mgmt_exit(int);
@@ -237,6 +238,9 @@ int main(int argc, char **argv)
                case 's':
                        buffer_size = atoi(optarg);
                        break;
+               case 'n':
+                       vrf_configure_backend(VRF_BACKEND_NETNS);
+                       break;
                default:
                        frr_help_exit(1);
                        break;
index a532f3a2d7f377ab820ad478279700d3cbb98130..9e5a68f0a3138f1abc702dba174be08de7669591 100644 (file)
@@ -84,6 +84,7 @@ def setup_module(mod):
             router.net.set_intf_netns(rname + "-eth2", ns, up=True)
 
     for rname, router in router_list.items():
+        router.load_config(TopoRouter.RD_MGMTD, None, "--vrfwnetns")
         router.load_config(
             TopoRouter.RD_ZEBRA,
             os.path.join(CWD, "{}/zebra.conf".format(rname)),
index 7e4bcc8adaeac12b58e29257384c2948354b6c72..d9177b4d25d16099316a98cdfda339892cbbdb45 100644 (file)
@@ -132,6 +132,7 @@ def setup_module(mod):
 
     for rname, router in router_list.items():
         if rname == "r1":
+            router.load_config(TopoRouter.RD_MGMTD, None, "--vrfwnetns")
             router.load_config(
                 TopoRouter.RD_ZEBRA,
                 os.path.join(CWD, "{}/zebra.conf".format(rname)),
index 8457b752afafad9ab177b1092f9cf63e527f2459..028bc353586b4ea575fc6b40d46970ffb08afe31 100644 (file)
@@ -94,6 +94,7 @@ def setup_module(module):
     router.net.set_intf_netns("r1-eth0", ns, up=True)
 
     # run daemons
+    router.load_config(TopoRouter.RD_MGMTD, None, "--vrfwnetns")
     router.load_config(
         TopoRouter.RD_ZEBRA,
         os.path.join(CWD, "{}/zebra.conf".format("r1")),
@@ -205,7 +206,6 @@ def test_bgp_vrf_netns():
 
 
 if __name__ == "__main__":
-
     args = ["-s"] + sys.argv[1:]
     ret = pytest.main(args)
 
index 2716f63348c802e5cd9d0e42a2a8a773200caf78..23eef8f5a6337d8f9cccc890c93948d277829e85 100644 (file)
@@ -87,6 +87,7 @@ def setup_module(mod):
         router.net.set_intf_netns(rname + "-eth0", ns, up=True)
         router.net.set_intf_netns(rname + "-eth1", ns, up=True)
 
+        router.load_config(TopoRouter.RD_MGMTD, None, "--vrfwnetns")
         router.load_config(
             TopoRouter.RD_ZEBRA,
             os.path.join(CWD, "{}/zebra.conf".format(rname)),