diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index aa5e21ac279a..05e633b7602f 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -1,6 +1,28 @@ SERVERS="{{ dhcp_servers | join(' ') }}" -INTERFACES="{{ minigraph_vlan_interfaces[0]['attachto'] }}" +INTERFACES=" +{%- set add_preceding_space = { 'flag': False } %} +{%- for interface in minigraph_interfaces %} +{%- if interface['addr'] | ipv4 %} +{%- if add_preceding_space.flag %} {% endif %} +{{ interface['attachto'] }} +{%- set _dummy = add_preceding_space.update({'flag': True}) %} +{%- endif %} +{%- endfor %} +{%- for vlan_interface in minigraph_vlan_interfaces %} +{%- if vlan_interface['addr'] | ipv4 %} +{%- if add_preceding_space.flag %} {% endif %} +{{ vlan_interface['attachto'] }} +{%- set _dummy = add_preceding_space.update({'flag': True}) %} +{%- endif %} +{%- endfor %} +{%- for pc_interface in minigraph_portchannel_interfaces %} +{%- if pc_interface['addr'] | ipv4 %} +{%- if add_preceding_space.flag %} {% endif %} +{{ pc_interface['attachto'] }} +{%- set _dummy = add_preceding_space.update({'flag': True}) %} +{%- endif %} +{%- endfor %}" # '-a' option provides option 82 circuit id information OPTIONS="-a" diff --git a/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay b/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay new file mode 100644 index 000000000000..4a851af34eb9 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay @@ -0,0 +1,7 @@ +SERVERS="192.0.0.1 192.0.0.2 192.0.0.3 192.0.0.4 192.0.0.5 192.0.0.6 192.0.0.7 192.0.0.8 192.0.0.9 192.0.0.10 192.0.0.11 192.0.0.12 192.0.0.13 192.0.0.14 192.0.0.15 192.0.0.16 192.0.0.17 192.0.0.18 192.0.0.19 192.0.0.20 192.0.0.21 192.0.0.22 192.0.0.23 192.0.0.24 192.0.0.25 192.0.0.26 192.0.0.27 192.0.0.28 192.0.0.29 192.0.0.30 192.0.0.31 192.0.0.32 192.0.0.33 192.0.0.34 192.0.0.35 192.0.0.36 192.0.0.37 192.0.0.38 192.0.0.39 192.0.0.40 192.0.0.41 192.0.0.42 192.0.0.43 192.0.0.44 192.0.0.45 192.0.0.46 192.0.0.47 192.0.0.48" + +INTERFACES="Vlan1000 PortChannel01 PortChannel02 PortChannel03 PortChannel04" + +# '-a' option provides option 82 circuit id information +OPTIONS="-a" +