forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build pensando-sw artifacts for sonic (sonic-net#3)
Signed-off-by: Rishikesh Naik <rishikesh@pensando.io>
- Loading branch information
Showing
19 changed files
with
335 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
FROM docker-config-engine-buster | ||
|
||
ARG docker_container_name | ||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y g++ python3-dev libxml2 libcurl3-gnutls libcjson-dev libltdl-dev | ||
|
||
RUN pip3 install connexion==2.7.0 \ | ||
setuptools==21.0.0 \ | ||
grpcio-tools==1.20.0 \ | ||
certifi==2017.4.17 \ | ||
python-dateutil==2.6.0 \ | ||
six==1.11.0 \ | ||
urllib3==1.21.1 | ||
|
||
COPY \ | ||
{% for deb in docker_pensando_sw_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor -%} | ||
debs/ | ||
|
||
RUN dpkg -i \ | ||
{% for deb in docker_pensando_sw_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor %} | ||
|
||
|
||
COPY template_nmd.json /tmp/ | ||
|
||
COPY template_fru.json /tmp/ | ||
|
||
|
||
COPY netagentcfg.sh /usr/bin/ | ||
COPY netagenthal.sh /usr/bin/ | ||
COPY nmd.sh /usr/bin/ | ||
|
||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
|
||
RUN mkdir -p /pensando/hostdir &&\ | ||
rm -rf /nic/tools | ||
env NAPLES_PIPELINE apollo | ||
env PDS_HOST 0.0.0.0 | ||
env HOST_NAME vnaples1 | ||
env CONTROLLER 0.0.0.0 | ||
env MAC_ADDR 00:00:00:00:00:00 | ||
env SERIAL_NUM REPLACE_ME | ||
env SONIC_MODE 1 | ||
env EVENTS_DIR /pensando/events | ||
|
||
RUN apt-get remove -y g++ python3-dev | ||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
RUN rm -rf /debs | ||
|
||
## TODO: symbolic links will be removed when AAA improvements get merged | ||
RUN ln -sf /host_etc/passwd /etc/passwd | ||
RUN ln -sf /host_etc/group /etc/group | ||
|
||
|
||
ENTRYPOINT ["/usr/local/bin/supervisord"] |
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,11 @@ | ||
#!/bin/bash | ||
|
||
echo "starting NetAgent cfg" | ||
|
||
export SONIC_MODE=1 | ||
|
||
echo $PDS_HOST | ||
echo $SONIC_MODE | ||
|
||
exec /usr/bin/netagentcfg > /tmp/netagentcfg_out.log 2> /tmp/netagentcfg_err.log | ||
|
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,10 @@ | ||
#!/bin/bash | ||
|
||
echo "starting NetAgent HAL" | ||
export SONIC_MODE=1 | ||
|
||
echo $PDS_HOST | ||
echo $SONIC_MODE | ||
|
||
exec /usr/bin/netagenthal > /tmp/netagenthal_out.log 2> /tmp/netagenthal_err.log | ||
|
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,23 @@ | ||
#!/bin/bash | ||
|
||
echo CONTROLLER: $CONTROLLER | ||
echo SERIAL_NUM: $SERIAL_NUM | ||
echo MAC_ADDR: $MAC_ADDR | ||
|
||
sed -i s/CONTROLLER/${CONTROLLER}/ /tmp/template_nmd.json | ||
sed -i s/MAC_ADDR/${MAC_ADDR}/ /tmp/template_nmd.json | ||
sed -i s/HOST_NAME/${HOST_NAME}/ /tmp/template_nmd.json | ||
mv /tmp/template_nmd.json /tmp/nmd.json | ||
|
||
sed -i s/SERIAL_NUM/${SERIAL_NUM}/ /tmp/template_fru.json | ||
sed -i s/MAC_ADDR/${MAC_ADDR}/ /tmp/template_fru.json | ||
mv /tmp/template_fru.json /tmp/fru.json | ||
|
||
echo "Starting NMD" | ||
NAPLES_PIPELINE=apollo SONIC_MODE=1 /usr/bin/nmd > /tmp/nmd_out.log 2> /tmp/nmd_err.log & | ||
sleep 30 | ||
curl -X POST -H "Content-Type: application/json" -k -d @/tmp/nmd.json https://localhost:8888/api/v1/naples/ | ||
sleep 20 | ||
curl 127.0.0.1:9007/api/mode/ | ||
|
||
while :; do sleep 1; done |
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,55 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[eventlistener:dependent-startup] | ||
command=python3 -m supervisord_dependent_startup | ||
autostart=true | ||
autorestart=unexpected | ||
startretries=0 | ||
exitcodes=0,3 | ||
events=PROCESS_STATE | ||
buffer_size=1024 | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n -iNONE | ||
priority=1 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
|
||
[program:netagent-cfg] | ||
command=/usr/bin/netagentcfg.sh | ||
priority=2 | ||
autostart=true | ||
autorestart=false | ||
startsecs=0 | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=rsyslogd:running | ||
|
||
[program:netagent-hal] | ||
command=/usr/bin/netagenthal.sh | ||
priority=3 | ||
autostart=true | ||
autorestart=false | ||
startsecs=0 | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=rsyslogd:running | ||
|
||
|
||
[program:nmd] | ||
command=/usr/bin/nmd.sh | ||
priority=4 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=rsyslogd:running |
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 @@ | ||
{ | ||
"manufacturing-date": "1568246400", | ||
"manufacturer": "PENSANDO SYSTEMS INC.", | ||
"product-name": "NAPLES 25", | ||
"serial-number": "SERIAL_NUM", | ||
"part-number": "SMART_SERVICE_SKU", | ||
"frufileid": "", | ||
"board-id": "2", | ||
"engineering-change-level": "0", | ||
"num-mac-address": "24", | ||
"mac-address": "MAC_ADDR" | ||
} |
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,20 @@ | ||
{ | ||
"TypeMeta": { | ||
"Kind": "DistributedServiceCard" | ||
}, | ||
"ObjectMeta": { | ||
"Name": "DistributedServiceCardConfig", | ||
"tenant": "default" | ||
}, | ||
"spec": { | ||
"primary-mac": "MAC_ADDR", | ||
"id": "HOST_NAME", | ||
"mode": "NETWORK", | ||
"network-mode": "OOB", | ||
"dsc-profile": "FEATURE_PROFILE_BASE", | ||
"controllers": [ | ||
"CONTROLLER" | ||
] | ||
} | ||
} | ||
|
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,13 @@ | ||
[Unit] | ||
Description=Pensando SW container | ||
Requires=database.service | ||
After=database.service swss.service syncd.service | ||
BindsTo=sonic.target | ||
After=sonic.target | ||
Before=ntp-config.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh wait | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop |
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,11 @@ | ||
[Unit] | ||
Description=Delays pensando sw container until SONiC has started | ||
PartOf=pensando-sw.service | ||
|
||
[Timer] | ||
OnUnitActiveSec=0 sec | ||
OnBootSec=3min 30 sec | ||
Unit=pensando-sw.service | ||
|
||
[Install] | ||
WantedBy=timers.target sonic.target sonic-delayed.target |
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,11 @@ | ||
|
||
DPATH := $($(DOCKER_PENSANDO_SW)_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-pensando-sw.mk rules/docker-pensando-sw.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
DEP_FILES += $(shell git ls-files $(DPATH)) | ||
|
||
$(DOCKER_PENSANDO_SW)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(DOCKER_PENSANDO_SW)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(DOCKER_PENSANDO_SW)_DEP_FILES := $(DEP_FILES) | ||
|
||
#$(eval $(call add_dbg_docker,$(DOCKER_PENSANDO_SW),$(DOCKER_PENSANDO_SW_DBG))) |
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,37 @@ | ||
# docker image for pensando-sw | ||
|
||
DOCKER_PENSANDO_SW_STEM = docker-pensando-sw | ||
DOCKER_PENSANDO_SW = $(DOCKER_PENSANDO_SW_STEM).gz | ||
#DOCKER_PENSANDO_SW_DBG = $(DOCKER_PENSANDO_SW_STEM)-$(DBG_IMAGE_MARK).gz | ||
|
||
$(DOCKER_PENSANDO_SW)_PATH = $(DOCKERS_PATH)/$(DOCKER_PENSANDO_SW_STEM) | ||
|
||
$(DOCKER_PENSANDO_SW)_DEPENDS += $(PENSANDO_SW) | ||
#$(DOCKER_PENSANDO_SW)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) | ||
#$(DOCKER_PENSANDO_SW)_DBG_DEPENDS += $(PENSANDO_SW_DBG) | ||
|
||
SONIC_DOCKER_IMAGES += $(DOCKER_PENSANDO_SW) | ||
$(DOCKER_PENSANDO_SW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) | ||
|
||
$(DOCKER_PENSANDO_SW)_VERSION = 1.0.0 | ||
$(DOCKER_PENSANDO_SW)_PACKAGE_NAME = pensando-sw | ||
|
||
#$(DOCKER_PENSANDO_SW)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) | ||
|
||
#ifeq ($(INCLUDE_MGMT_FRAMEWORK), y) | ||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PENSANDO_SW) | ||
#endif | ||
|
||
#SONIC_DOCKER_DBG_IMAGES += $(DOCKER_PENSANDO_SW_DBG) | ||
#ifeq ($(INCLUDE_MGMT_FRAMEWORK), y) | ||
#SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_PENSANDO_SW_DBG) | ||
#endif | ||
|
||
$(DOCKER_PENSANDO_SW)_CONTAINER_NAME = pensando-sw | ||
$(DOCKER_PENSANDO_SW)_RUN_OPT += --privileged -t | ||
$(DOCKER_PENSANDO_SW)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro | ||
$(DOCKER_PENSANDO_SW)_RUN_OPT += -v /etc:/host_etc:ro | ||
$(DOCKER_PENSANDO_SW)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw | ||
$(DOCKER_PENSANDO_SW)_RUN_OPT += --mount type=bind,source="/var/platform/",target="/mnt/platform/" | ||
|
||
#$(DOCKER_PENSANDO_SW)_BASE_IMAGE_FILES += sonic-cli:/usr/bin/sonic-cli |
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 @@ | ||
|
||
SPATH := $($(PENSANDO_SW)_SRC_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/pensando-sw.mk rules/pensando-sw.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) | ||
|
||
$(PENSANDO_SW)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(PENSANDO_SW)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(PENSANDO_SW)_DEP_FILES := $(DEP_FILES) | ||
$(PENSANDO_SW)_SMDEP_FILES := $(SMDEP_FILES) | ||
$(PENSANDO_SW)_SMDEP_PATHS := $(SPATH) | ||
|
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,15 @@ | ||
# pensando sw package | ||
|
||
PENSANDO_SW = pensando-sw_1.0.0-1_$(CONFIGURED_ARCH).deb | ||
$(PENSANDO_SW)_SRC_PATH = $(SRC_PATH)/pensando | ||
#$(PENSANDO_SW)_DEPENDS = | ||
#$(PENSANDO_SW)_RDEPENDS = | ||
SONIC_MAKE_DEBS += $(PENSANDO_SW) | ||
|
||
#PENSANDO_SW_DBG = pensando-sw-dbgsym_1.0.0-1_$(CONFIGURED_ARCH).deb | ||
#$(PENSANDO_SW_DBG)_DEPENDS += $(PENSANDO_SW) | ||
#$(PENSANDO_SW_DBG)_RDEPENDS += $(PENSANDO_SW) | ||
#$(eval $(call add_extra_package,$(PENSANDO_SW),$(PENSANDO_SW_DBG))) | ||
|
||
export PENSANDO_SW | ||
#export PENSANDO_SW_DBG |
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,20 @@ | ||
.ONESHELL: | ||
SHELL = /bin/bash | ||
.SHELLFLAGS += -e | ||
|
||
$(info executing pensando makefile [${DEST}]...) | ||
MAIN_TARGET = $(PENSANDO_SW) | ||
#DERIVED_TARGET = $(PENSANDO_SW_DBG) | ||
|
||
#unexport DEST | ||
|
||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : | ||
pushd sw | ||
# Build package | ||
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) | ||
|
||
popd | ||
mv $* $(DEST)/ | ||
#mv $(DERIVED_TARGET) $* $(DEST)/ | ||
|
||
#$(addprefix $(DEST)/, $(DERIVED_TARGET)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) |