[dhcp_relay] Change dhcp_relay docker files to parse DHCP_RELAY table for dhcpv6 status (#9080)

Why I did it
DHCPv6 Relay information will be stored in DHCP_RELAY table instead of VLAN table in the future.

How I did it
Change dhcp_relay docker files to parse through DHCP_RELAY to check for dhcpv6 status

How to verify it
Build dhcp_relay docker and check all dhcp_relay and dhcpmon are running properly

Which release branch to backport (provide reason below if selected)
This commit is contained in:
kellyyeh 2021-10-27 13:44:38 -07:00 committed by GitHub
parent 2a41e0f96b
commit aa323e435e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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