Skip to content

Commit 139a58b

Browse files
kellyyehyxieca
authored andcommitted
[201811] Add DHCPv6 minigraph parsing support (#8970)
* Add DHCPv6 minigraph parsing support Co-authored-by: shlomibitton <[email protected]> Logrotate for wtmp and btmp files to fix size getting too large. (#8744) Signed-off-by: Abhishek Dosi <[email protected]> [201811][utilities][swss][snmpagent] advance sub module head snmpagent * 187aa10 2021-09-16 | [201811][RFC1213]: Initialize lag oid map in reinit_data (#233) (github/201811) [SuvarnaMeenakshi] swss: * 3503705 2021-09-05 | [201811][Cherry-pick] [acl mirror action] Mirror session ref count fix at acl rule attachment (#1898) (HEAD -> 201811, github/201811) [bingwang-ms] utilities: * f3f8667 2021-10-15 | [201811] disk_check.py: Allow remote user access when disk is read-only (#1873) (HEAD -> 201811, github/201811) [Renuka Manavalan] * 6b351c9 2021-10-14 | [201811] Remove exec from platform_reboot_plugin call to handle any hang issue. (#1880) [Sujin Kang] * d8d0461 2021-07-29 | [minigraph][port_config] Consume port_config.json while reloading minigraph (#1726) [Blueve] Signed-off-by: Ying Xie <[email protected]> [201811] Invoke disk check periodically (#8951) * Invoke disk check periodically. (#7374) Why I did it Helps with periodic scan of disk for RO state. If found, this script makes transient fix and raise error message. Save DB dump after warm/fast reboot (#8913) Back porting the master branch change - #8803 Save the redis DB dump after warm reboot. [201811][swss] advance swss submodule head (#9049) * e0b115a 2021-10-22 | [copp] add dhcpv6 copp rules (#1979) (HEAD -> 201811, github/201811) [Ying Xie] Signed-off-by: Ying Xie <[email protected]> [swssconfig] load dhcpv6 copp rules by default (#9047) Why I did it Need to enable DHCPv6 copp rule How I did it Add a separate DHCPv6 copp rule config file and load it during cold reboot. How to verify it cold reboot, and verify config being loaded and dhcpv6 rules got installed. Signed-off-by: Ying Xie [email protected] [warmboot finalizer] load dhcpv6 copp rules when missing (#9048) Why I did it Need to enable DHCPv6 COPP rules. How I did it Load the separate DHCPv6 COPP rules after warm reboot if the rules are missing. How to verify it Warm reboot from an image doesn't have DHCPv6 COPP rules installed. Warm reboot from an image have DHCPv6 COPP rules already installed. In either case, the script did the right thing and only install the COPP rules if it is missing. Signed-off-by: Ying Xie [email protected]
1 parent e30d559 commit 139a58b

File tree

9 files changed

+58
-241
lines changed

9 files changed

+58
-241
lines changed

dockers/docker-dhcp-relay/Dockerfile.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ RUN rm -rf /debs
2828
COPY ["docker_init.sh", "start.sh", "/usr/bin/"]
2929
COPY ["docker-dhcp-relay.supervisord.conf.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"]
3030
COPY ["dhcp-relay.programs.j2", "dhcpv4-relay.agents.j2", "dhcpv6-relay.agents.j2", "dhcpv6-relay.monitors.j2", "/usr/share/sonic/templates/"]
31-
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
31+
COPY ["critical_processes", "/etc/supervisor"]
3232

3333
ENTRYPOINT ["/usr/bin/docker_init.sh"]

dockers/docker-dhcp-relay/dhcp-relay.programs.j2

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
[group:isc-dhcp-relay]
22
programs=
33
{%- set add_preceding_comma = { 'flag': False } %}
4-
{% for vlan_name in VLAN_INTERFACE %}
5-
{# Append DHCPv4 agents #}
6-
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %}
4+
{% for vlan_name in vlan_list %}
5+
{% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %}
76
{% if add_preceding_comma.flag %},{% endif %}
87
{% set _dummy = add_preceding_comma.update({'flag': True}) %}
9-
isc-dhcpv4-relay-{{ vlan_name }}
8+
isc-dhcp-relayv4-{{ vlan_name }}
109
{%- endif %}
1110
{# Append DHCPv6 agents #}
12-
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %}
11+
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %}
1312
{% if add_preceding_comma.flag %},{% endif %}
1413
{% set _dummy = add_preceding_comma.update({'flag': True}) %}
1514
isc-dhcpv6-relay-{{ vlan_name }}
Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,27 @@
11
{# Append DHCPv4 agents #}
2-
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %}
3-
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %}
4-
{% if dhcp_server | ipv4 %}
5-
{% set _dummy = relay_for_ipv4.update({'flag': True}) %}
6-
{% endif %}
7-
{% endfor %}
8-
{% if relay_for_ipv4.flag %}
9-
{% set _dummy = relay_for_ipv4.update({'flag': False}) %}
2+
{# Create a program entry for each DHCP relay agent instance #}
3+
{% for vlan_name in vlan_list %}
4+
{% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %}
105
[program:isc-dhcpv4-relay-{{ vlan_name }}]
116
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #}
127
command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id {{ vlan_name }}
13-
{#- Dual ToR Option #}
14-
{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} -U Loopback0 -dt{% endif -%}
15-
{#- si option to use intf addr in relay #}
16-
{% if DEVICE_METADATA['localhost']['deployment_id'] == '8' %} -si{% endif -%}
178
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #}
18-
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
9+
{% for (name, prefix) in VLAN_INTERFACE %}
1910
{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%}
2011
{% endfor %}
21-
{% for (name, prefix) in INTERFACE|pfx_filter %}
12+
{% for (name, prefix) in INTERFACE %}
2213
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
2314
{% endfor %}
24-
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
15+
{% for (name, prefix) in PORTCHANNEL_INTERFACE %}
2516
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
2617
{% endfor %}
27-
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %}
28-
{%- if dhcp_server | ipv4 %} {{ dhcp_server }}{% endif -%}
29-
{% endfor %}
18+
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} {{ dhcp_server }}{% endfor %}
3019

3120
priority=3
3221
autostart=false
3322
autorestart=false
3423
stdout_logfile=syslog
3524
stderr_logfile=syslog
36-
dependent_startup=true
37-
dependent_startup_wait_for=start:exited
3825

3926
{% endif %}
40-
{% endif %}
27+
{% endfor %}
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
11
{# Append DHCPv6 agents #}
2-
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %}
3-
{% for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %}
2+
{# Create a program entry for each DHCPv6 relay agent instance #}
3+
{% for vlan_name in vlan_list %}
4+
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %}
45
{% if dhcpv6_server | ipv6 %}
56
{% set _dummy = relay_for_ipv6.update({'flag': True}) %}
67
{% endif %}
7-
{% endfor %}
88
{% if relay_for_ipv6.flag %}
99
{% set _dummy = relay_for_ipv6.update({'flag': False}) %}
10+
{% endif %}
1011
[program:isc-dhcpv6-relay-{{ vlan_name }}]
11-
{# We treat this VLAN as a downstream interface (-l), as we only want to listen for requests #}
12+
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #}
1213
command=/usr/sbin/dhcrelay -d -6 --name-alias-map-file /tmp/port-name-alias-map.txt -l {{ vlan_name }}
13-
{#- We treat all other interfaces as upstream interfaces (-u), as we only want to listen for replies #}
14-
{%- for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %}
15-
{%- if dhcpv6_server | ipv6 %}
16-
{%- for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
17-
{%- if prefix | ipv6 and name != vlan_name %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%}
18-
{% endfor %}
19-
{% for (name, prefix) in INTERFACE|pfx_filter %}
20-
{% if prefix | ipv6 %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%}
14+
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #}
15+
{% for (name, prefix) in VLAN_INTERFACE %}
16+
{% if prefix | ipv6 and name != vlan_name %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%}
2117
{% endfor %}
22-
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
23-
{% if prefix | ipv6 %} -u {{ dhcpv6_server }}%%{{ name }} {% endif -%}
18+
{% for (name, prefix) in INTERFACE %}
19+
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
2420
{% endfor %}
25-
{% endif -%}
21+
{% for (name, prefix) in PORTCHANNEL_INTERFACE %}
22+
{% if prefix | ipv4 %} -iu {{ name }} {% endif -%}
2623
{% endfor %}
2724

2825
priority=3
2926
autostart=false
3027
autorestart=false
3128
stdout_logfile=syslog
3229
stderr_logfile=syslog
33-
dependent_startup=true
34-
dependent_startup_wait_for=start:exited
3530

3631
{% endif %}
37-
{% endif %}
32+
{% endfor %}
Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,54 @@
11
[group:dhcpmon]
22
programs=
33
{%- set add_preceding_comma = { 'flag': False } %}
4-
{% set monitor_instance = { 'flag': False } %}
5-
{% for vlan_name in VLAN_INTERFACE %}
6-
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %}
7-
{% set _dummy = monitor_instance.update({'flag': True}) %}
8-
{%- endif %}
9-
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %}
10-
{% set _dummy = monitor_instance.update({'flag': True}) %}
11-
{%- endif %}
12-
{% if monitor_instance.flag %}
4+
{% for vlan_name in vlan_list %}
5+
{% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %}
136
{% if add_preceding_comma.flag %},{% endif %}
147
{% set _dummy = add_preceding_comma.update({'flag': True}) %}
158
dhcpmon-{{ vlan_name }}
16-
{%- set _dummy = monitor_instance.update({'flag': False}) %}
179
{%- endif %}
1810
{% endfor %}
1911

2012

2113
{# Create a program entry for each DHCP MONitor instance #}
2214
{% set relay_for_ipv4 = { 'flag': False } %}
2315
{% set relay_for_ipv6 = { 'flag': False } %}
24-
{% for vlan_name in VLAN_INTERFACE %}
16+
{% for vlan_name in vlan_list %}
2517
{# Check DHCPv4 agents #}
26-
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %}
18+
{% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %}
2719
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %}
2820
{% if dhcp_server | ipv4 %}
2921
{% set _dummy = relay_for_ipv4.update({'flag': True}) %}
3022
{% endif %}
3123
{% endfor %}
3224
{% endif %}
3325
{# Check DHCPv6 agents #}
34-
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %}
26+
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] %}
3527
{% for dhcpv6_server in VLAN[vlan_name]['dhcpv6_servers'] %}
3628
{% if dhcpv6_server | ipv6 %}
3729
{% set _dummy = relay_for_ipv6.update({'flag': True}) %}
3830
{% endif %}
3931
{% endfor %}
4032
{% endif %}
41-
{% if relay_for_ipv4.flag or relay_for_ipv6.flag %}
33+
{% if relay_for_ipv4.flag %}
34+
{% set _dummy = relay_for_ipv4.update({'flag': False}) %}
35+
{% if relay_for_ipv6.flag %}
36+
{% set _dummy = relay_for_ipv6.update({'flag': False}) %}
4237
[program:dhcpmon-{{ vlan_name }}]
4338
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #}
4439
command=/usr/sbin/dhcpmon -id {{ vlan_name }}
45-
{#- Dual ToR Option #}
46-
{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} -u Loopback0{% endif -%}
4740
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #}
48-
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
41+
{% for (name, prefix) in VLAN_INTERFACE %}
4942
{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%}
5043
{% endfor %}
51-
{% for (name, prefix) in INTERFACE|pfx_filter %}
44+
{% for (name, prefix) in INTERFACE %}
5245
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
5346
{% endfor %}
54-
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
47+
{% for (name, prefix) in PORTCHANNEL_INTERFACE %}
5548
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
5649
{% endfor %}
5750
{% if MGMT_INTERFACE %}
58-
{% for (name, prefix) in MGMT_INTERFACE|pfx_filter %}
51+
{% for (name, prefix) in MGMT_INTERFACE %}
5952
{% if prefix | ipv4 %} -im {{ name }}{% endif -%}
6053
{% endfor %}
6154
{% endif %}
@@ -67,13 +60,12 @@ autostart=false
6760
autorestart=false
6861
stdout_logfile=syslog
6962
stderr_logfile=syslog
70-
dependent_startup=true
71-
dependent_startup_wait_for=
7263
{%- if relay_for_ipv4.flag %}isc-dhcpv4-relay-{{ vlan_name }}:running {% endif %}
7364
{% if relay_for_ipv6.flag %}isc-dhcpv6-relay-{{ vlan_name }}:running{% endif %}
7465

7566

7667
{% set _dummy = relay_for_ipv4.update({'flag': False}) %}
7768
{% set _dummy = relay_for_ipv6.update({'flag': False}) %}
7869
{% endif %}
79-
{% endfor %}
70+
{% endif %}
71+
{% endfor %}

dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,24 @@ stderr_logfile=syslog
2929
{% endfor %}
3030
{% set vlan_list = d.vlan_list %}
3131
{# Count how many VLANs require a DHCP relay agent... #}
32-
{% set ipv4_num_relays = { 'count': 0 } %}
33-
{% set ipv6_num_relays = { 'count': 0 } %}
34-
{% for vlan_name in VLAN_INTERFACE %}
35-
{% if VLAN and vlan_name in VLAN and 'dhcp_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcp_servers']|length > 0 %}
36-
{% set _dummy = ipv4_num_relays.update({'count': ipv4_num_relays.count + 1}) %}
37-
{% endif %}
38-
{% if VLAN and vlan_name in VLAN and 'dhcpv6_servers' in VLAN[vlan_name] and VLAN[vlan_name]['dhcpv6_servers']|length > 0 %}
39-
{% set _dummy = ipv6_num_relays.update({'count': ipv6_num_relays.count + 1}) %}
32+
{% set num_relays = { 'count': 0 } %}
33+
{% for vlan_name in vlan_list %}
34+
{% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %}
35+
{% set _dummy = num_relays.update({'count': num_relays.count + 1}) %}
4036
{% endif %}
4137
{% endfor %}
4238
{# If one or more of the VLANs require a DHCP relay agent... #}
43-
{% if ipv4_num_relays.count > 0 or ipv6_num_relays.count > 0 %}
39+
{% if num_relays.count > 0 %}
4440
{% include 'dhcp-relay.programs.j2' %}
4541

46-
47-
{# Create a program entry for each DHCP relay agent instance #}
4842
{% set relay_for_ipv4 = { 'flag': False } %}
4943
{% set relay_for_ipv6 = { 'flag': False } %}
44+
5045
{% for vlan_name in VLAN_INTERFACE %}
5146
{% include 'dhcpv4-relay.agents.j2' %}
5247
{% include 'dhcpv6-relay.agents.j2' %}
5348
{% endfor %}
5449

5550
{% include 'dhcpv6-relay.monitors.j2' %}
5651
{% endif %}
57-
{% endif %}
52+
{% endif %}

src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,24 @@ stdout_logfile=syslog
2020
stderr_logfile=syslog
2121

2222
[group:isc-dhcp-relay]
23-
programs=isc-dhcp-relay-Vlan1000
23+
programs=isc-dhcp-relayv4-Vlan1000,isc-dhcpv6-relay-Vlan1000
2424

25-
[program:isc-dhcp-relay-Vlan1000]
25+
[program:isc-dhcpv4-relay-Vlan1000]
2626
command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id Vlan1000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 192.0.0.1 192.0.0.2
2727
priority=3
2828
autostart=false
2929
autorestart=false
3030
stdout_logfile=syslog
3131
stderr_logfile=syslog
3232

33+
[program:isc-dhcpv6-relay-Vlan1000]
34+
command=/usr/sbin/dhcrelay -d -6 --name-alias-map-file /tmp/port-name-alias-map.txt -l Vlan1000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04
35+
priority=3
36+
autostart=false
37+
autorestart=false
38+
stdout_logfile=syslog
39+
stderr_logfile=syslog
40+
3341

3442
[group:dhcpmon]
3543
programs=dhcpmon-Vlan1000
@@ -43,4 +51,3 @@ stdout_logfile=syslog
4351
stderr_logfile=syslog
4452

4553

46-

src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)