diff --git a/dockers/docker-fpm-frr/docker_init.sh b/dockers/docker-fpm-frr/docker_init.sh index 416306e8bac7..2170ca699283 100755 --- a/dockers/docker-fpm-frr/docker_init.sh +++ b/dockers/docker-fpm-frr/docker_init.sh @@ -8,11 +8,11 @@ CFGGEN_PARAMS=" \ -y /etc/sonic/constants.yml \ -t /usr/share/sonic/templates/frr_vars.j2 \ -t /usr/share/sonic/templates/supervisord/supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf \ - -t /usr/share/sonic/templates/gen_bgpd.conf.j2,/etc/frr/bgpd.conf \ + -t /usr/share/sonic/templates/bgpd/gen_bgpd.conf.j2,/etc/frr/bgpd.conf \ -t /usr/share/sonic/templates/supervisord/critical_processes.j2,/etc/supervisor/critical_processes \ -t /usr/share/sonic/templates/zebra/zebra.conf.j2,/etc/frr/zebra.conf \ - -t /usr/share/sonic/templates/gen_staticd.conf.j2,/etc/frr/staticd.conf \ - -t /usr/share/sonic/templates/frr.conf.j2,/etc/frr/frr.conf \ + -t /usr/share/sonic/templates/staticd/gen_staticd.conf.j2,/etc/frr/staticd.conf \ + -t /usr/share/sonic/templates/gen_frr.conf.j2,/etc/frr/frr.conf \ -t /usr/share/sonic/templates/isolate.j2,/usr/sbin/bgp-isolate \ -t /usr/share/sonic/templates/unisolate.j2,/usr/sbin/bgp-unisolate \ -t /usr/local/sonic/frr/bfdd.conf.j2,/etc/frr/bfdd.conf \ diff --git a/dockers/docker-fpm-frr/frr/gen_bgpd.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/gen_bgpd.conf.j2 similarity index 100% rename from dockers/docker-fpm-frr/frr/gen_bgpd.conf.j2 rename to dockers/docker-fpm-frr/frr/bgpd/gen_bgpd.conf.j2 diff --git a/dockers/docker-fpm-frr/frr/frr.conf.j2 b/dockers/docker-fpm-frr/frr/frr.conf.j2 index be8169a11636..99900790366c 100644 --- a/dockers/docker-fpm-frr/frr/frr.conf.j2 +++ b/dockers/docker-fpm-frr/frr/frr.conf.j2 @@ -13,27 +13,9 @@ agentx ! {% include "zebra/zebra.interfaces.conf.j2" %} ! -{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %} -{% if MGMT_VRF_CONFIG %} -{% if MGMT_VRF_CONFIG['vrf_global']['mgmtVrfEnabled'] == 'false' %} -{% include "staticd.default_route.conf.j2" %} -{% endif %} -{% else %} -{% include "staticd.default_route.conf.j2" %} -{% endif %} -! -{% include "staticd.db.conf.j2" %} -! -{% include "bgpd.conf.db.j2" %} -! -{% include "ospfd.conf.j2" %} -! -{% include "bfdd.conf.j2" %} -{% else %} {% include "staticd/staticd.default_route.conf.j2" %} ! {% include "staticd/staticd.loopback_route.conf.j2" %} ! {% include "bgpd/bgpd.main.conf.j2" %} -{% endif %} ! diff --git a/dockers/docker-fpm-frr/frr/gen_frr.conf.j2 b/dockers/docker-fpm-frr/frr/gen_frr.conf.j2 new file mode 100644 index 000000000000..055658f8b515 --- /dev/null +++ b/dockers/docker-fpm-frr/frr/gen_frr.conf.j2 @@ -0,0 +1,5 @@ +{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %} + {% include "/usr/local/sonic/frr/frr.conf.j2" %} +{% else %} + {% include "/usr/share/sonic/templates/frr.conf.j2" %} +{% endif %} diff --git a/dockers/docker-fpm-frr/frr/gen_staticd.conf.j2 b/dockers/docker-fpm-frr/frr/staticd/gen_staticd.conf.j2 similarity index 100% rename from dockers/docker-fpm-frr/frr/gen_staticd.conf.j2 rename to dockers/docker-fpm-frr/frr/staticd/gen_staticd.conf.j2 diff --git a/src/sonic-frr-mgmt-framework/setup.py b/src/sonic-frr-mgmt-framework/setup.py index 571862873828..c9bff63d8c73 100755 --- a/src/sonic-frr-mgmt-framework/setup.py +++ b/src/sonic-frr-mgmt-framework/setup.py @@ -44,6 +44,8 @@ 'templates/ospfd/ospfd.conf.db.policyrange.j2', 'templates/ospfd/ospfd.conf.db.vlink.j2', 'templates/staticd/staticd.conf.j2', - 'templates/staticd/staticd.db.conf.j2']) + 'templates/staticd/staticd.db.conf.j2', + 'templates/staticd/staticd.db.default_route.conf.j2', + 'templates/frr/frr.conf.j2']) ] ) diff --git a/src/sonic-frr-mgmt-framework/templates/frr/frr.conf.j2 b/src/sonic-frr-mgmt-framework/templates/frr/frr.conf.j2 new file mode 100644 index 000000000000..f1f015a6e7a6 --- /dev/null +++ b/src/sonic-frr-mgmt-framework/templates/frr/frr.conf.j2 @@ -0,0 +1,30 @@ +! +{% block banner %} +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/frr.conf.j2 with config DB data +! file: frr.conf +! +{% endblock banner %} +! +{% include "common/daemons.common.conf.j2" %} +! +agentx +! +{% include "zebra/zebra.interfaces.conf.j2" %} +! +{% if MGMT_VRF_CONFIG %} +{% if MGMT_VRF_CONFIG['vrf_global']['mgmtVrfEnabled'] == 'false' %} +{% include "staticd.db.default_route.conf.j2" %} +{% endif %} +{% else %} +{% include "staticd.db.default_route.conf.j2" %} +{% endif %} +! +{% include "staticd.db.conf.j2" %} +! +{% include "bgpd.conf.db.j2" %} +! +{% include "ospfd.conf.j2" %} +! +{% include "bfdd.conf.j2" %} +! diff --git a/src/sonic-frr-mgmt-framework/templates/staticd/staticd.conf.j2 b/src/sonic-frr-mgmt-framework/templates/staticd/staticd.conf.j2 index a3b638431eeb..0ab193f4a1f8 100644 --- a/src/sonic-frr-mgmt-framework/templates/staticd/staticd.conf.j2 +++ b/src/sonic-frr-mgmt-framework/templates/staticd/staticd.conf.j2 @@ -12,10 +12,10 @@ ! {% if MGMT_VRF_CONFIG %} {% if MGMT_VRF_CONFIG['vrf_global']['mgmtVrfEnabled'] == 'false' %} -{% include "staticd.default_route.conf.j2" %} +{% include "staticd.db.default_route.conf.j2" %} {% endif %} {% else %} -{% include "staticd.default_route.conf.j2" %} +{% include "staticd.db.default_route.conf.j2" %} {% endif %} ! {% include "staticd.db.conf.j2" %} diff --git a/src/sonic-frr-mgmt-framework/templates/staticd/staticd.db.default_route.conf.j2 b/src/sonic-frr-mgmt-framework/templates/staticd/staticd.db.default_route.conf.j2 new file mode 100644 index 000000000000..63d532203aaa --- /dev/null +++ b/src/sonic-frr-mgmt-framework/templates/staticd/staticd.db.default_route.conf.j2 @@ -0,0 +1,9 @@ +! +{% block default_route %} +! set static default route to mgmt gateway as a backup to learned default +{% if MGMT_INTERFACE %} +{% for (name, prefix) in MGMT_INTERFACE|pfx_filter %} +{% endfor %} +{% endif %} +{% endblock default_route %} +!