-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZTP infrastructure changes to support DHCP discovery provisioning data #3298
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e6cda8a
ZTP infrastructure changes to support DHCP discovery provisioning data
rajendra-dendukuri 421e6ce
Added exit code check for redis-dump command. Fixed code indenation t…
rajendra-dendukuri 364dd31
Allow router advertisements to be accepted by eth0 when DHCPv6
rajendra-dendukuri 7d7b5a4
Assign IPv6 address to OOB using DHCPv6 if static address is not defi…
rajendra-dendukuri 7447899
Merge branch 'master' into ztp_infra
rajendra-dendukuri dfecb07
Merge branch 'master' into ztp_infra
rajendra-dendukuri fa71ce3
Remove interface exists in kernel check.
rajendra-dendukuri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,7 @@ | ||
{% if MGMT_INTERFACE %} | ||
net.ipv6.conf.eth0.accept_ra_defrtr = 0 | ||
net.ipv6.conf.eth0.accept_ra = 0 | ||
{% else %} | ||
net.ipv6.conf.eth0.accept_ra_defrtr = 1 | ||
net.ipv6.conf.eth0.accept_ra = 1 | ||
{% endif %} |
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
{% block banner %} | ||
# =============== Managed by SONiC Config Engine DO NOT EDIT! =============== | ||
# generated from /usr/share/sonic/templates/dhclient.conf.j2 using sonic-cfggen | ||
# file: /etc/dhcp/dhclient.conf | ||
# | ||
{% endblock banner %} | ||
# Configuration file for /sbin/dhclient, which is included in Debian's | ||
# dhcp3-client package. | ||
# | ||
# This is a sample configuration file for dhclient. See dhclient.conf's | ||
# man page for more information about the syntax of this file | ||
# and a more comprehensive list of the parameters understood by | ||
# dhclient. | ||
# | ||
# Normally, if the DHCP server provides reasonable information and does | ||
# not leave anything out (like the domain name, for example), then | ||
# few changes must be made to this file, if any. | ||
# | ||
|
||
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; | ||
option snmp-community code 224 = text; | ||
option minigraph-url code 225 = text; | ||
option acl-url code 226 = text; | ||
option tftp-server-name code 66 = text; | ||
option bootfile-name code 67 = text; | ||
option user-class code 77 = text; | ||
option provisioning-script-url code 239 = text; | ||
option dhcp6.user-class code 15 = text; | ||
option dhcp6.provisioning-script-url code 239 = text; | ||
option dhcp6.boot-file-url code 59 = text; | ||
|
||
send host-name = gethostname(); | ||
request subnet-mask, broadcast-address, time-offset, routers, | ||
domain-name, domain-name-servers, domain-search, host-name, | ||
dhcp6.name-servers, dhcp6.domain-search, interface-mtu, dhcp6.fqdn, | ||
rfc3442-classless-static-routes, ntp-servers, log-servers, | ||
{%- if ZTP is defined and ZTP_DHCP_DISABLED is not defined -%}bootfile-name, provisioning-script-url, tftp-server-name, | ||
dhcp6.provisioning-script-url, dhcp6.boot-file-url,{%- endif -%} | ||
snmp-community, minigraph-url, acl-url; | ||
{% if ZTP is defined and ZTP_DHCP_DISABLED is not defined %} | ||
send user-class "SONiC-ZTP"; | ||
send dhcp6.user-class "SONiC-ZTP"; | ||
send dhcp-client-identifier "SONiC##{{ ZTP['mode']['product-name'] }}##{{ ZTP['mode']['serial-no'] }}"; | ||
retry 60; | ||
{% 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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
case $reason in | ||
BOUND|RENEW|REBIND|REBOOT) | ||
if [ -n "$new_minigraph_url" ]; then | ||
echo $new_minigraph_url > /tmp/dhcp_graph_url | ||
else | ||
echo "N/A" > /tmp/dhcp_graph_url | ||
fi | ||
if [ -n "$new_acl_url" ]; then | ||
echo $new_acl_url > /tmp/dhcp_acl_url | ||
fi | ||
;; | ||
esac | ||
if [ ! -e /usr/bin/ztp ] || [ "$(ztp status -c)" = "0:DISABLED" ]; then | ||
case $reason in | ||
BOUND|RENEW|REBIND|REBOOT) | ||
if [ -n "$new_minigraph_url" ]; then | ||
echo $new_minigraph_url > /tmp/dhcp_graph_url | ||
else | ||
echo "N/A" > /tmp/dhcp_graph_url | ||
fi | ||
if [ -n "$new_acl_url" ]; then | ||
echo $new_acl_url > /tmp/dhcp_acl_url | ||
fi | ||
;; | ||
esac | ||
fi |
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,12 @@ | ||
{ | ||
"dhcp" : { | ||
"defaults" : { | ||
"dhcp-wait" : "no" | ||
}, | ||
"iface_defaults" : { | ||
"eth0" : { | ||
"dhcp6-duid" : "LL" | ||
} | ||
} | ||
} | ||
} |
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,14 @@ | ||
case $reason in | ||
BOUND6|RENEW6|REBIND6|REBOOT) | ||
current_dhcp6_fqdn=`hostname` | ||
if [ "$current_dhcp6_fqdn" != "$new_dhcp6_fqdn" ] && [ -n "$new_dhcp6_fqdn" ] | ||
then | ||
echo $new_dhcp6_fqdn > /etc/hostname | ||
hostname -F /etc/hostname | ||
sed -i "/\s$current_dhcp6_fqdn$/d" /etc/hosts | ||
sed -i "/\s$new_dhcp6_fqdn$/d" /etc/hosts | ||
echo "127.0.0.1 $new_dhcp6_fqdn" >> /etc/hosts | ||
echo ":: $new_dhcp6_fqdn" >> /etc/hosts | ||
fi | ||
;; | ||
esac |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i prefer to keep it as it is. if you need dhcp, then you can enable it. I saw you have this in you interfaces.j2 file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have it in /etc/sysctl.conf, there can be a case where the setting done by interface.j2 is overwritten when sysctl files are re-read by a different service. I moved setting of accept_ra to a new file "files/dhcp/90-dhcp6-systcl.conf.j2". This will decide whether accept_ra is 1/0. For DHCPv6 on eth0 to work, accept_ra must be 1.
The changes done as part of this PR enable DHCPv6 on eth0 by default just like how DHCP is enabled on eth0. This allows access to the switch using an IPv6 address. It has dual purpose to be used for ZTP over IPv6 as well as using it for management of SONiC switch using DHCPv6 assigned IPv6 address.
If we set accept_ra to 0 by default, the access to the switch using DHCPv6 is not possible.
Following are some options for us to consider: