Skip to content

Commit

Permalink
[mgmt-vrf]: mgmt vrf related change for Buster (sonic-net#53)
Browse files Browse the repository at this point in the history
Co-authored-by: Bing Sun <Bing_Sun@dell.com>
  • Loading branch information
2 people authored and lguohan committed Apr 17, 2020
1 parent 452fc3d commit 2a237c5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
10 changes: 0 additions & 10 deletions files/image_config/interfaces/interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,13 @@ 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 %}
# management port down rules
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 %}
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/sonic-config-engine/tests/sample_output/mvrf_interfaces
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/*
#
Expand Down

0 comments on commit 2a237c5

Please sign in to comment.