Skip to content

Commit 1edb696

Browse files
rajendra-dendukuriabdosi
authored andcommitted
[sonic-ztp]: Build sonic-ztp package (#3299)
* Build sonic-ztp package - Add changes in make rules to conditionally include sonic-ztp package Signed-off-by: Rajendra Dendukuri <[email protected]>
1 parent 1aac153 commit 1edb696

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

Makefile.work

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# * BUILD_NUMBER: Desired version-number to pass to the building-system.
88
# * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files
99
# through http.
10+
# * ENABLE_ZTP: Enables zero touch provisioning.
1011
# * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart.
1112
# * ENABLE_PFCWD_ON_START: Enable PFC Watchdog (PFCWD) on server-facing ports
1213
# * by default for TOR switch.
@@ -162,6 +163,7 @@ SONIC_BUILD_INSTRUCTION := make \
162163
BUILD_NUMBER=$(BUILD_NUMBER) \
163164
BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) \
164165
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
166+
ENABLE_ZTP=$(ENABLE_ZTP) \
165167
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
166168
SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \
167169
SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \

files/build_templates/sonic_debian_extension.j2

+6
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install tabulat
147147
sudo dpkg --root=$FILESYSTEM_ROOT -i $python_debs_path/python-sonic-utilities_*.deb || \
148148
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
149149

150+
{% if enable_ztp == "y" %}
151+
# Install ZTP (and its dependencies via 'apt-get -y install -f')
152+
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-ztp_*.deb || \
153+
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
154+
{% endif %}
155+
150156
# SONiC utilities installs bash-completion as a dependency. However, it is disabled by default
151157
# in bash.bashrc, so we copy a version of the file with it enabled here.
152158
sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/

rules/config

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ DEFAULT_PASSWORD = YourPaSsWoRd
4444
# If not set (default behavior) the default minigraph built into the image will be used.
4545
# ENABLE_DHCP_GRAPH_SERVICE = y
4646

47+
# ENABLE_ZTP - installs Zero Touch Provisioning support.
48+
# ENABLE_ZTP = y
49+
4750
# SHUTDOWN_BGP_ON_START - if set to y all bgp sessions will be in admin down state when
4851
# bgp service starts.
4952
# SHUTDOWN_BGP_ON_START = y

rules/sonic-ztp.mk

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SONiC ztp package
2+
#
3+
4+
ifeq ($(ENABLE_ZTP), y)
5+
6+
SONIC_ZTP_VERSION = 1.0.0
7+
8+
SONIC_ZTP = sonic-ztp_$(SONIC_ZTP_VERSION)_all.deb
9+
$(SONIC_ZTP)_SRC_PATH = $(SRC_PATH)/sonic-ztp
10+
SONIC_DPKG_DEBS += $(SONIC_ZTP)
11+
SONIC_STRETCH_DEBS += $(SONIC_ZTP)
12+
13+
export SONIC_ZTP_VERSION
14+
export SONIC_ZTP
15+
16+
endif
17+

slave.mk

+1
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
632632
$(MONIT)) \
633633
$$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \
634634
$$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \
635+
$(if $(findstring y,$(ENABLE_ZTP)),$(addprefix $(DEBS_PATH)/,$(SONIC_ZTP))) \
635636
$(addprefix $(STRETCH_FILES_PATH)/, $(if $(filter $(CONFIGURED_ARCH),amd64), $(IXGBE_DRIVER))) \
636637
$(addprefix $(PYTHON_DEBS_PATH)/,$(SONIC_UTILS)) \
637638
$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \

0 commit comments

Comments
 (0)