-
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.
ZTP infrastructure changes to support DHCP discovery provisioning data (
#3298) * ZTP infrastructure changes to support DHCP discovery provisioning data - Dynamically generate DHCP client configuration based on current ZTP state - Added support to request and process hostname when using DHCPv6 - Do not process graphservice url dhcp option if ZTP is enabled, ZTP service will process it - Generate /e/n/i file with all active interfaces seeking address assignment via DHCP. Only interfaces that are created in Linux will be added to /e/n/i. Also DHCP is started only on linked up in-band interfaces. Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
- Loading branch information
1 parent
335514b
commit fec8029
Showing
11 changed files
with
172 additions
and
42 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
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