-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5737c22
commit e30d559
Showing
10 changed files
with
361 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[group:isc-dhcp-relay] | ||
programs= | ||
{%- set add_preceding_comma = { 'flag': False } %} | ||
{% for vlan_name in VLAN_INTERFACE %} | ||
{# Append DHCPv4 agents #} | ||
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %} | ||
{% if add_preceding_comma.flag %},{% endif %} | ||
{% set _dummy = add_preceding_comma.update({'flag': True}) %} | ||
isc-dhcpv4-relay-{{ vlan_name }} | ||
{%- endif %} | ||
{# Append DHCPv6 agents #} | ||
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %} | ||
{% if add_preceding_comma.flag %},{% endif %} | ||
{% set _dummy = add_preceding_comma.update({'flag': True}) %} | ||
isc-dhcpv6-relay-{{ vlan_name }} | ||
{%- endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{# Append DHCPv4 agents #} | ||
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %} | ||
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} | ||
{% if dhcp_server | ipv4 %} | ||
{% set _dummy = relay_for_ipv4.update({'flag': True}) %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if relay_for_ipv4.flag %} | ||
{% set _dummy = relay_for_ipv4.update({'flag': False}) %} | ||
[program:isc-dhcpv4-relay-{{ vlan_name }}] | ||
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #} | ||
command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id {{ vlan_name }} | ||
{#- Dual ToR Option #} | ||
{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} -U Loopback0 -dt{% endif -%} | ||
{#- si option to use intf addr in relay #} | ||
{% if DEVICE_METADATA['localhost']['deployment_id'] == '8' %} -si{% endif -%} | ||
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #} | ||
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %} | ||
{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%} | ||
{% endfor %} | ||
{% for (name, prefix) in INTERFACE|pfx_filter %} | ||
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%} | ||
{% endfor %} | ||
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %} | ||
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%} | ||
{% endfor %} | ||
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} | ||
{%- if dhcp_server | ipv4 %} {{ dhcp_server }}{% endif -%} | ||
{% endfor %} | ||
|
||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=start:exited | ||
|
||
{% endif %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{# Append DHCPv6 agents #} | ||
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %} | ||
{% for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %} | ||
{% if dhcpv6_server | ipv6 %} | ||
{% set _dummy = relay_for_ipv6.update({'flag': True}) %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if relay_for_ipv6.flag %} | ||
{% set _dummy = relay_for_ipv6.update({'flag': False}) %} | ||
[program:isc-dhcpv6-relay-{{ vlan_name }}] | ||
{# We treat this VLAN as a downstream interface (-l), as we only want to listen for requests #} | ||
command=/usr/sbin/dhcrelay -d -6 --name-alias-map-file /tmp/port-name-alias-map.txt -l {{ vlan_name }} | ||
{#- We treat all other interfaces as upstream interfaces (-u), as we only want to listen for replies #} | ||
{%- for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %} | ||
{%- if dhcpv6_server | ipv6 %} | ||
{%- for (name, prefix) in VLAN_INTERFACE|pfx_filter %} | ||
{%- if prefix | ipv6 and name != vlan_name %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%} | ||
{% endfor %} | ||
{% for (name, prefix) in INTERFACE|pfx_filter %} | ||
{% if prefix | ipv6 %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%} | ||
{% endfor %} | ||
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %} | ||
{% if prefix | ipv6 %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%} | ||
{% endfor %} | ||
{% endif -%} | ||
{% endfor %} | ||
|
||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=start:exited | ||
|
||
{% endif %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[group:dhcpmon] | ||
programs= | ||
{%- set add_preceding_comma = { 'flag': False } %} | ||
{% set monitor_instance = { 'flag': False } %} | ||
{% for vlan_name in VLAN_INTERFACE %} | ||
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %} | ||
{% set _dummy = monitor_instance.update({'flag': True}) %} | ||
{%- endif %} | ||
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %} | ||
{% set _dummy = monitor_instance.update({'flag': True}) %} | ||
{%- endif %} | ||
{% if monitor_instance.flag %} | ||
{% if add_preceding_comma.flag %},{% endif %} | ||
{% set _dummy = add_preceding_comma.update({'flag': True}) %} | ||
dhcpmon-{{ vlan_name }} | ||
{%- set _dummy = monitor_instance.update({'flag': False}) %} | ||
{%- endif %} | ||
{% endfor %} | ||
|
||
|
||
{# Create a program entry for each DHCP MONitor instance #} | ||
{% set relay_for_ipv4 = { 'flag': False } %} | ||
{% set relay_for_ipv6 = { 'flag': False } %} | ||
{% for vlan_name in VLAN_INTERFACE %} | ||
{# Check DHCPv4 agents #} | ||
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %} | ||
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} | ||
{% if dhcp_server | ipv4 %} | ||
{% set _dummy = relay_for_ipv4.update({'flag': True}) %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{# Check DHCPv6 agents #} | ||
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %} | ||
{% for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %} | ||
{% if dhcpv6_server | ipv6 %} | ||
{% set _dummy = relay_for_ipv6.update({'flag': True}) %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% if relay_for_ipv4.flag or relay_for_ipv6.flag %} | ||
[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 }} | ||
{#- Dual ToR Option #} | ||
{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} -u Loopback0{% endif -%} | ||
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #} | ||
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %} | ||
{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%} | ||
{% endfor %} | ||
{% for (name, prefix) in INTERFACE|pfx_filter %} | ||
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%} | ||
{% endfor %} | ||
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %} | ||
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%} | ||
{% endfor %} | ||
{% if MGMT_INTERFACE %} | ||
{% for (name, prefix) in MGMT_INTERFACE|pfx_filter %} | ||
{% if prefix | ipv4 %} -im {{ name }}{% endif -%} | ||
{% endfor %} | ||
{% endif %} | ||
{% if relay_for_ipv4.flag %} -4{% endif %} | ||
{% if relay_for_ipv6.flag %} -6{% endif %} | ||
|
||
priority=4 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for= | ||
{%- if relay_for_ipv4.flag %}isc-dhcpv4-relay-{{ vlan_name }}:running {% endif %} | ||
{% if relay_for_ipv6.flag %}isc-dhcpv6-relay-{{ vlan_name }}:running{% endif %} | ||
|
||
|
||
{% set _dummy = relay_for_ipv4.update({'flag': False}) %} | ||
{% set _dummy = relay_for_ipv6.update({'flag': False}) %} | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.