From 2a237c57e6fa29a495d69ac1ff7b9484fb58e262 Mon Sep 17 00:00:00 2001 From: bsun-sudo <56011247+bsun-sudo@users.noreply.github.com> Date: Fri, 13 Mar 2020 11:01:16 -0700 Subject: [PATCH] [mgmt-vrf]: mgmt vrf related change for Buster (#53) Co-authored-by: Bing Sun --- files/image_config/interfaces/interfaces.j2 | 10 ---------- .../tests/sample_output/mvrf_interfaces | 6 ------ 2 files changed, 16 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 0e852a1150fb..dbedd5e9418a 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -76,10 +76,6 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static up ip {{ '-4' if prefix | ipv4 else '-6' }} route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table {{ vrf_table }} metric 201 up ip {{ '-4' if prefix | ipv4 else '-6' }} route add {{ prefix | network }}/{{ prefix | prefixlen }} dev eth0 table {{ vrf_table }} up ip {{ '-4' if prefix | ipv4 else '-6' }} rule add from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table {{ vrf_table }} -{% if (MGMT_VRF_CONFIG) and (MGMT_VRF_CONFIG['vrf_global']['mgmtVrfEnabled'] == "true") %} - up cgcreate -g l3mdev:mgmt - up cgset -r l3mdev.master-device=mgmt mgmt -{% endif %} {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} up ip rule add to {{ route }} table {{ vrf_table }} {% endfor %} @@ -87,9 +83,6 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static pre-down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table {{ vrf_table }} pre-down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete {{ prefix | network }}/{{ prefix | prefixlen }} dev eth0 table {{ vrf_table }} pre-down ip {{ '-4' if prefix | ipv4 else '-6' }} rule delete from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table {{ vrf_table }} -{% if (MGMT_VRF_CONFIG) and (MGMT_VRF_CONFIG['vrf_global']['mgmtVrfEnabled'] == "true") %} - down cgdelete -g l3mdev:mgmt -{% endif %} {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} pre-down ip rule delete to {{ route }} table {{ vrf_table }} {% endfor %} @@ -100,9 +93,6 @@ iface eth0 inet dhcp metric 202 {% if (MGMT_VRF_CONFIG) and (MGMT_VRF_CONFIG['vrf_global']['mgmtVrfEnabled'] == "true") %} vrf mgmt - up cgcreate -g l3mdev:mgmt - up cgset -r l3mdev.master-device=mgmt mgmt - down cgdelete -g l3mdev:mgmt {% endif %} iface eth0 inet6 dhcp up sysctl net.ipv6.conf.eth0.accept_ra=1 diff --git a/src/sonic-config-engine/tests/sample_output/mvrf_interfaces b/src/sonic-config-engine/tests/sample_output/mvrf_interfaces index 633d8aa4498d..085f5111c3f5 100644 --- a/src/sonic-config-engine/tests/sample_output/mvrf_interfaces +++ b/src/sonic-config-engine/tests/sample_output/mvrf_interfaces @@ -29,13 +29,10 @@ iface eth0 inet static up ip -4 route add default via 10.0.0.1 dev eth0 table 5000 metric 201 up ip -4 route add 10.0.0.0/24 dev eth0 table 5000 up ip -4 rule add from 10.0.0.100/32 table 5000 - up cgcreate -g l3mdev:mgmt - up cgset -r l3mdev.master-device=mgmt mgmt # management port down rules pre-down ip -4 route delete default via 10.0.0.1 dev eth0 table 5000 pre-down ip -4 route delete 10.0.0.0/24 dev eth0 table 5000 pre-down ip -4 rule delete from 10.0.0.100/32 table 5000 - down cgdelete -g l3mdev:mgmt iface eth0 inet6 static address 2603:10e2:0:2902::8 netmask 64 @@ -47,13 +44,10 @@ iface eth0 inet6 static up ip -6 route add default via 2603:10e2:0:2902::1 dev eth0 table 5000 metric 201 up ip -6 route add 2603:10e2:0:2902::/64 dev eth0 table 5000 up ip -6 rule add from 2603:10e2:0:2902::8/128 table 5000 - up cgcreate -g l3mdev:mgmt - up cgset -r l3mdev.master-device=mgmt mgmt # management port down rules pre-down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table 5000 pre-down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table 5000 pre-down ip -6 rule delete from 2603:10e2:0:2902::8/128 table 5000 - down cgdelete -g l3mdev:mgmt # source /etc/network/interfaces.d/* #