Skip to content

Commit

Permalink
Add Makefile target: lldp/snmp docker images (#74)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
qiluo-msft authored Nov 24, 2016
1 parent f45e781 commit f83460b
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 10 deletions.
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 24 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 $@)
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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)
62 changes: 55 additions & 7 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/lldpd
Submodule lldpd added at 396961
19 changes: 19 additions & 0 deletions src/snmpd/build.sh
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions src/sonic-dbsyncd
Submodule sonic-dbsyncd added at 3d30cf
1 change: 1 addition & 0 deletions src/sonic-py-swsssdk
Submodule sonic-py-swsssdk added at 7bbe84
1 change: 1 addition & 0 deletions src/sonic-snmpagent
Submodule sonic-snmpagent added at 2e7fe1

0 comments on commit f83460b

Please sign in to comment.