Add Makefile target: lldp/snmp docker images (#74)

* Add sonic-dbsyncd submodule

* Add sonic-py-swsssdk submodule

* Add lldpd submodule

* Add sonic-snmpagent submodule

* Add Makefile target: lldp/snmp docker images

* Fix docker-snmp-sv2.gz dependency

* Add lldp/snmp sources to the top level targets
This commit is contained in:
Qi Luo 2016-11-23 16:18:35 -08:00 committed by GitHub
parent f45e781782
commit f83460bdb7
8 changed files with 114 additions and 10 deletions

12
.gitmodules vendored
View File

@ -29,3 +29,15 @@
path = src/sonic-quagga
url = https://github.com/Azure/sonic-quagga
branch = debian/0.99.24.1
[submodule "sonic-dbsyncd"]
path = src/sonic-dbsyncd
url = https://github.com/Azure/sonic-dbsyncd
[submodule "src/sonic-py-swsssdk"]
path = src/sonic-py-swsssdk
url = https://github.com/Azure/sonic-py-swsssdk.git
[submodule "src/lldpd"]
path = src/lldpd
url = https://github.com/vincentbernat/lldpd.git
[submodule "src/sonic-snmpagent"]
path = src/sonic-snmpagent
url = https://github.com/Azure/sonic-snmpagent

View File

@ -16,6 +16,7 @@ BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb))
CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb))
LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-3-dev_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-genl-3-dev_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-route-3-dev_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb libnl-nf-3-dev_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-cli-3-dev_3.2.27-1_amd64.deb
LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb
## Function: build_docker, image_name save_file
@ -37,6 +38,18 @@ src/%:
LIBTEAM-DEBS="$(LIBTEAM-DEBS)" \
-C src $(subst src/,,$@)
## Rules: docker-snmp-sv2
dockers/docker-snmp-sv2/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-snmp-sv2/deps/python3/%.whl: src/%.whl
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-lldp-sv2
dockers/docker-lldp-sv2/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-lldp-sv2/deps/%.whl: src/%.whl
mkdir -p `dirname $@` && cp $< $(dir $@)
## Rules: docker-fpm
dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd
mkdir -p `dirname $@` && cp $< $(dir $@)
@ -107,6 +120,14 @@ dockers/docker-sonic-p4/deps/%.deb: src/%.deb
target/docker-base.gz:
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-snmp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-snmp-sv2/deps/,python3/sswsdk-2.0.1-py3-none-any.whl python3/asyncsnmp-2.1.0-py3-none-any.whl libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb snmpd_5.7.3+dfsg-1.5_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-lldp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-lldp-sv2/deps/,sswsdk-2.0.1-py2-none-any.whl sonic_d-2.0.0-py2-none-any.whl lldpd_0.9.5-0_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS))
## TODO: remove placeholders for the dependencies
touch dockers/docker-syncd/deps/{dsserve,bcmcmd}
@ -161,12 +182,12 @@ target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_am
./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz)
brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz)
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz)
mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz)
## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd
cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz)
cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz)
p4-all: $(addprefix target/,docker-sonic-p4.gz)

View File

@ -44,10 +44,34 @@ define build_project
popd
endef
## Function: build_project_py2, directory
## Build the project and save the .deb target in the same directory
define build_project_py2
pushd $(1)
python2 setup.py bdist_wheel
popd
endef
## Function: build_project_py3, directory
## Build the project and save the .deb target in the same directory
define build_project_py3
pushd $(1)
python3 setup.py bdist_wheel
popd
endef
## Function: install_deb, debfile
install_deb = \
[ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1;
## Function: install_py2, whlfile
install_py2 = \
sudo pip install $(1)
## Function: install_py3, whlfile
install_py3 = \
sudo pip3 install $(1)
## Rules
$(LIBNL-DEBS):
pushd libnl3; ./build.sh; popd
@ -65,7 +89,7 @@ $(PYTHON3_5-DEBS): $(MPDECIMAL-DEBS)
redis-sentinel_$(REDIS_VERSION).deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb:
pushd redis; ./build.sh; popd
libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd hiredis; ./build.sh; popd
@ -90,13 +114,37 @@ python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb python-p4-
python-tenjin_1.1.1-1_all.deb:
pushd tenjin; ./build.sh; popd
p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-tenjin_1.1.1-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb
snmpd_5.7.3+dfsg-1.5_amd64.deb snmptrapd_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb libsnmp30-dbg_5.7.3+dfsg-1.5_amd64.deb libsnmp-dev_5.7.3+dfsg-1.5_amd64.deb libsnmp-perl_5.7.3+dfsg-1.5_amd64.deb python-netsnmp_5.7.3+dfsg-1.5_amd64.deb tkmib_5.7.3+dfsg-1.5_all.deb:
pushd snmpd; ./build.sh; popd
sswsdk-2.0.1-py2-none-any.whl:
$(call build_project_py2, sonic-py-swsssdk)
cp sonic-py-swsssdk/dist/$@ .
sswsdk-2.0.1-py3-none-any.whl:
$(call build_project_py3, sonic-py-swsssdk)
cp sonic-py-swsssdk/dist/$@ .
sonic_d-2.0.0-py2-none-any.whl: sswsdk-2.0.1-py2-none-any.whl
$(foreach dep, $^, $(call install_py2, $(dep)))
$(call build_project_py2, sonic-dbsyncd)
cp sonic-dbsyncd/dist/$@ .
asyncsnmp-2.1.0-py3-none-any.whl: sswsdk-2.0.1-py3-none-any.whl
$(foreach dep, $^, $(call install_py3, $(dep)))
$(call build_project_py3, sonic-snmpagent)
cp sonic-snmpagent/dist/$@ .
p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-tenjin_1.1.1-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
pushd p4-switch; ./build.sh; popd
lldpd_0.9.5-0_amd64.deb liblldpctl-dev_0.9.5-0_amd64.deb:
$(call build_project, lldpd)
quagga_0.99.24.1-2.1_amd64.deb:
$(call build_project, sonic-quagga)
libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(LIBNL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss-common)
@ -106,7 +154,7 @@ brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev
$(call build_project, sonic-sairedis)
mkdir -p brcm
cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb brcm/
mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/*.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-sairedis)
@ -118,7 +166,7 @@ cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev
$(call build_project, sonic-sairedis)
mkdir -p cavm
cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb cavm/
p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb p4-bmv2_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-sairedis)
@ -148,7 +196,7 @@ cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd
cp swss_1.0.0_amd64.deb cavm/
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
cp sonic-swss/debian/swss/usr/bin/teamsyncd .
p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS)
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss)

1
src/lldpd Submodule

@ -0,0 +1 @@
Subproject commit 396961a038a38675d46f96eaa7b430b2a1f8701b

19
src/snmpd/build.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# Install build dependency for snmpd
sudo apt-get -y build-dep snmpd
# download debian net-snmp 5.7.3
wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg-1.5.dsc
wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg.orig.tar.xz
wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg-1.5.debian.tar.xz
dpkg-source -x net-snmp_5.7.3+dfsg-1.5.dsc
pushd net-snmp-5.7.3+dfsg
fakeroot debian/rules binary
popd
cp *.deb ../

1
src/sonic-dbsyncd Submodule

@ -0,0 +1 @@
Subproject commit 3d30cfc9318d03652df01c0871090f5ef6c8ccb2

1
src/sonic-py-swsssdk Submodule

@ -0,0 +1 @@
Subproject commit 7bbe8419f719f577fdf923c8eadd0d462a9ce72a

1
src/sonic-snmpagent Submodule

@ -0,0 +1 @@
Subproject commit 2e7fe1b2a9c3fafdc49d0063d1fb9e5396fd3649