diff --git a/dockers/docker-dhcp-relay/dhcp-relay.programs.j2 b/dockers/docker-dhcp-relay/dhcp-relay.programs.j2 index 8b2207c81e..61ddaf3e09 100644 --- a/dockers/docker-dhcp-relay/dhcp-relay.programs.j2 +++ b/dockers/docker-dhcp-relay/dhcp-relay.programs.j2 @@ -8,7 +8,7 @@ programs= isc-dhcpv4-relay-{{ vlan_name }} {%- endif %} {# Append DHCPv6 agents #} -{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %} +{% if DHCP_RELAY and vlan_name in DHCP_RELAY and 'dhcpv6_servers' in DHCP_RELAY[vlan_name] %} {% if add_preceding_comma.flag %},{% endif %} {% set _dummy = add_preceding_comma.update({'flag': True}) %} dhcp6relay diff --git a/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 b/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 index 511f6e77c3..1f92175847 100644 --- a/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 +++ b/dockers/docker-dhcp-relay/dhcpv6-relay.agents.j2 @@ -1,8 +1,8 @@ {# Append DHCPv6 agents #} {# Create a program entry for each DHCPv6 relay agent instance #} {% for vlan_name in vlan_list %} -{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %} -{% for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %} +{% if DHCP_RELAY and vlan_name in DHCP_RELAY and 'dhcpv6_servers' in DHCP_RELAY[vlan_name] %} +{% for dhcpv6_server in DHCP_RELAY[vlan_name]['dhcpv6_servers'] %} {% if dhcpv6_server | ipv6 %} {% set _dummy = relay_for_ipv6.update({'flag': True}) %} {% endif %} diff --git a/dockers/docker-dhcp-relay/dhcpv6-relay.monitors.j2 b/dockers/docker-dhcp-relay/dhcpv6-relay.monitors.j2 index b374215aeb..dd25f58fa4 100644 --- a/dockers/docker-dhcp-relay/dhcpv6-relay.monitors.j2 +++ b/dockers/docker-dhcp-relay/dhcpv6-relay.monitors.j2 @@ -6,7 +6,7 @@ programs= {% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %} {% set _dummy = monitor_instance.update({'flag': True}) %} {%- endif %} -{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %} +{% if DHCP_RELAY and vlan_name in DHCP_RELAY and 'dhcpv6_servers' in DHCP_RELAY[vlan_name] %} {% set _dummy = monitor_instance.update({'flag': True}) %} {% endif %} {% if monitor_instance.flag %} @@ -31,17 +31,13 @@ dhcpmon-{{ vlan_name }} {% endfor %} {% endif %} {# Check DHCPv6 agents #} -{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %} -{% for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %} +{% if DHCP_RELAY and vlan_name in DHCP_RELAY and 'dhcpv6_servers' in DHCP_RELAY[vlan_name] %} +{% for dhcpv6_server in DHCP_RELAY[vlan_name]['dhcpv6_servers'] %} {% if dhcpv6_server | ipv6 %} {% set _dummy = relay_for_ipv6.update({'flag': True}) %} {% endif %} {% endfor %} {% endif %} -{% if relay_for_ipv4.flag %} -{% set _dummy = relay_for_ipv4.update({'flag': False}) %} -{% if relay_for_ipv6.flag %} -{% set _dummy = relay_for_ipv6.update({'flag': False}) %} [program:dhcpmon-{{ vlan_name }}] {# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #} command=/usr/sbin/dhcpmon -id {{ vlan_name }} @@ -62,6 +58,10 @@ command=/usr/sbin/dhcpmon -id {{ vlan_name }} {% endif %} {% if relay_for_ipv4.flag %} -4{% endif %} {% if relay_for_ipv6.flag %} -6{% endif %} +{% if relay_for_ipv4.flag %} +{% set _dummy = relay_for_ipv4.update({'flag': False}) %} +{% if relay_for_ipv6.flag %} +{% set _dummy = relay_for_ipv6.update({'flag': False}) %} priority=4 autostart=false diff --git a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 index 8dc0631c0a..63f4da50ab 100644 --- a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 +++ b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 @@ -37,7 +37,7 @@ stderr_logfile=syslog {% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %} {% set _dummy = ipv4_num_relays.update({'count': ipv4_num_relays.count + 1}) %} {% endif %} -{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %} +{% if DHCP_RELAY and vlan_name in DHCP_RELAY and 'dhcpv6_servers' in DHCP_RELAY[vlan_name] %} {% set _dummy = ipv6_num_relays.update({'count': ipv6_num_relays.count + 1}) %} {% endif %} {% endfor %} diff --git a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf index 0ac7d8f5cb..b9b6141918 100644 --- a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf @@ -44,7 +44,7 @@ stderr_logfile=syslog programs=dhcpmon-Vlan1000 [program:dhcpmon-Vlan1000] -command=/usr/sbin/dhcpmon -id Vlan1000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -im eth0 +command=/usr/sbin/dhcpmon -id Vlan1000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -im eth0 -4 -6 priority=4 autostart=false autorestart=false