summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dockerfile23
-rw-r--r--Makefile39
-rwxr-xr-xbuild-root/scripts/de_build.sh30
-rwxr-xr-xbuild-root/scripts/docker.sh45
-rw-r--r--src/Docker/Build/Dockerfile163
-rwxr-xr-xtest/run_test.sh3
6 files changed, 50 insertions, 253 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..255d7e4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,23 @@
+FROM sysrepo/sysrepo-netopeer2:v0.7.7
+
+# Layer1: Prepare sweetcomb environement by installing sysrepo, netopeer2 & vpp
+# Layer2: Install sweetcomb
+
+
+#Clean sysrepo previous build because they forgot to do it
+RUN rm -rf /opt/dev/*
+
+#Install VPP
+RUN apt-get update && apt-get install -y \
+ #build utils
+ sudo curl \
+ #test utils
+ inetutils-ping \
+ && curl -s https://packagecloud.io/install/repositories/fdio/1904/script.deb.sh | sudo bash \
+ && apt-get -y --force-yes install vpp libvppinfra* vpp-plugin-* vpp-dev
+
+# Install sweetcomb
+COPY . /root/src/sweetcomb
+WORKDIR /root/src/sweetcomb
+
+RUN make install-dep && make build-scvpp && make build-plugins
diff --git a/Makefile b/Makefile
index be8e31d..9eeead7 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,7 @@ SYSREPO_DEB = libev-dev libavl-dev bison flex libpcre3-dev libprotobuf-c-dev pro
LIBSSH_DEB = zlib1g-dev
#Sum dependencies
DEB_DEPENDS = ${BUILD_DEB} ${NETOPEER2_DEB} ${CHECKSTYLE_DEB} ${SCVPP_DEB} \
- ${SYSREPO_DEB} ${LIBSSH-DEV}
+ ${SYSREPO_DEB} ${LIBSSH-DEB}
#Dependencies for grpc
DEB_GNMI_DEPENDS = libpugixml-dev libjsoncpp-dev libtool pkg-config
@@ -89,22 +89,23 @@ RPM_GNMI_DEPENDS = pugixml jsoncpp libtool pugixml-devel jsoncpp-devel ${GRPC_RP
.PHONY: help install-dep install-dep-extra install-vpp install-models uninstall-models \
install-dep-gnmi-extra build-scvpp build-plugins build-gnmi build-package docker \
- docker_test clean distclean _clean_dl _libssh _libyang _libnetconf2 _sysrepo _netopeer2
+ docker-test clean distclean _clean_dl _libssh _libyang _libnetconf2 _sysrepo _netopeer2
help:
@echo "Make Targets:"
@echo " install-dep - install software dependencies"
@echo " install-dep-extra - install software extra dependencies from source code"
@echo " install-vpp - install released vpp"
- @echo " install-models - install YANG models"
- @echo " uninstall-models - uninstall YANG models"
+ @echo " install-models - install YANG models"
+ @echo " uninstall-models - uninstall YANG models"
@echo " install-dep-gnmi-extra - install software extra dependencips from source code for gNMI"
@echo " build-scvpp - build scvpp"
+ @echo " test-scvpp - unit test for scvpp"
@echo " build-plugins - build plugins"
@echo " build-gnmi - build gNMIServer"
@echo " build-package - build rpm or deb package"
@echo " docker - build sweetcomb in docker enviroment"
- @echo " docker_test - run test in docker enviroment"
+ @echo " docker-test - run test in docker enviroment"
@echo " clean - clean all build"
@echo " distclean - remove all build directory"
@@ -124,17 +125,12 @@ else
$(error "This option currently works only on Ubuntu, Debian, Centos or openSUSE systems")
endif
-#Check if libssh already installed in appropriate version
_libssh:
-ifeq ( $(shell pkg-config libssh --atleast-version=0.6.4 ; echo $$?),0 )
- echo "libssh already installed in correct version"
-else
- @mkdir -p $(BR)/downloads/&&cd $(BR)/downloads/\
+ mkdir -p $(BR)/downloads/&&cd $(BR)/downloads/\
&&wget https://git.libssh.org/projects/libssh.git/snapshot/libssh-0.7.7.tar.gz\
&&tar xvf libssh-0.7.7.tar.gz && cd libssh-0.7.7 && mkdir build && cd build\
&&cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr ..\
- &&make -j$(nproc) &&sudo make install && sudo ldconfig&&cd ../../
-endif
+ &&make -j$(nproc) &&sudo make install && sudo ldconfig&&cd ../../; \
_libyang:
@mkdir -p $(BR)/downloads/&&cd $(BR)/downloads/\
@@ -160,7 +156,7 @@ _sysrepo:
@mkdir -p $(BR)/downloads/&&cd $(BR)/downloads/\
&&wget https://github.com/sysrepo/sysrepo/archive/v0.7.7.tar.gz\
&&tar xvf v0.7.7.tar.gz && cd sysrepo-0.7.7 && mkdir -p build && cd build\
- &&cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=/usr \
+ &&cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DGEN_LANGUAGE_BINDINGS=OFF -DGEN_CPP_BINDINGS=ON -DGEN_LUA_BINDINGS=OFF \
-DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF -DBUILD_EXAMPLES=OFF \
-DENABLE_TESTS=OFF ..\
@@ -226,7 +222,10 @@ endif
build-scvpp:
@mkdir -p $(BR)/build-scvpp/; cd $(BR)/build-scvpp; \
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/src/scvpp/;\
- make install ; make test
+ make install
+
+test-scvpp: build-scvpp
+ @cd $(BR)/build-scvpp; make test
build-plugins:
@mkdir -p $(BR)/build-plugins/; cd $(BR)/build-plugins/; \
@@ -266,10 +265,10 @@ uninstall-models:
&& sysrepoctl -u -m iana-if-type;
clean:
- @cd $(BR)/build-scvpp && make clean;
- @cd $(BR)/build-plugins && make clean;
- @cd $(BR)/build-package && make clean;
- @cd $(BR)/build-gnmi && make clean;
+ @if [ -d $(BR)/build-scvpp ] ; then cd $(BR)/build-scvpp && make clean; fi
+ @if [ -d $(BR)/build-plugins ] ; then cd $(BR)/build-plugins && make clean; fi
+ @if [ -d $(BR)/build-package ] ; then cd $(BR)/build-package && make clean; fi
+ @if [ -d $(BR)/build-gnmi ] ; then cd $(BR)/build-gnmi && make clean; fi
distclean:
@rm -rf $(BR)/build-scvpp
@@ -277,8 +276,8 @@ distclean:
@rm -rf $(BR)/build-package
@rm -rf $(BR)/build-gnmi
-docker:
+docker: distclean
@build-root/scripts/docker.sh
-docker_test:
+docker-test:
@test/run_test.sh
diff --git a/build-root/scripts/de_build.sh b/build-root/scripts/de_build.sh
deleted file mode 100755
index 70182d3..0000000
--- a/build-root/scripts/de_build.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2019 PANTHEON.tech.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-SWEETCOMB_DIR="/root/src/sweetcomb"
-
-function build_sweetcomb {
- cd /root/src/sweetcomb
- yes | make install-dep
- make build-scvpp
- make build-plugins
-}
-
-function main {
- build_sweetcomb
-}
-
-main $@
diff --git a/build-root/scripts/docker.sh b/build-root/scripts/docker.sh
index 8ed872e..baa994c 100755
--- a/build-root/scripts/docker.sh
+++ b/build-root/scripts/docker.sh
@@ -14,45 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+
IMAGE="sweetcomb_img"
CONTAINER="sweetcomb"
-function build_enviroment {
- FIND=`docker images | grep ${IMAGE}`
-
- if [ -n "${FIND}" ]; then
- return
- fi
-
- docker build -t ${IMAGE} ./src/Docker/Build
-}
-
-function create_container {
- docker run -id --privileged --name ${CONTAINER} \
- -v $(pwd)/../sweetcomb:/root/src/sweetcomb ${IMAGE}
-}
-
-function start_container {
- FIND=`docker container ls -a | grep ${CONTAINER}`
-
- if [ -z "${FIND}" ]; then
- create_container
- else
- FIND=`docker container ps | grep ${CONTAINER}`
- if [ -z "${FIND}" ]; then
- docker start ${CONTAINER}
- fi
- fi
-}
-
-function build_sweetcomb {
- docker exec -it ${CONTAINER} bash -c "/root/src/sweetcomb/build-root/scripts/de_build.sh"
-}
-
-function main {
- build_enviroment
- start_container
- build_sweetcomb
-}
+#Clean previous build: container and image
+docker rm ${CONTAINER} -f
+docker rmi ${IMAGE} -f
-main $@
+#Rebuild image and container
+docker build -t ${IMAGE} .
+docker run -id --privileged --name ${CONTAINER} ${IMAGE}
diff --git a/src/Docker/Build/Dockerfile b/src/Docker/Build/Dockerfile
deleted file mode 100644
index 4d4ad04..0000000
--- a/src/Docker/Build/Dockerfile
+++ /dev/null
@@ -1,163 +0,0 @@
-
-FROM ubuntu:18.04
-
-RUN apt-get update && apt-get install -y cmake make gcc git sudo autoconf \
- libtool libpugixml-dev libjsoncpp-dev screen inetutils-ping iproute2 \
- command-not-found net-tools traceroute ethtool
-
-RUN mkdir -p /usr/local/src
-
-#===============================================================================
-# VPP
-#===============================================================================
-
-WORKDIR /usr/local/src
-
-RUN git clone https://gerrit.fd.io/r/vpp
-
-WORKDIR /usr/local/src/vpp
-
-RUN git checkout tags/v19.04-rc0
-
-RUN yes | make install-dep
-
-RUN make build
-
-RUN make pkg-deb
-
-WORKDIR /usr/local/src/vpp/build-root
-
-RUN dpkg -i vpp-lib_*.deb vpp_*.deb vpp-dev_*.deb \
- vpp-plugins_*.deb vpp-dbg*.deb
-
-#===============================================================================
-# Protobuf
-#===============================================================================
-
-WORKDIR /usr/local/src
-
-RUN git clone https://github.com/google/protobuf.git
-
-WORKDIR /usr/local/src/protobuf
-
-RUN git checkout tags/v3.6.1
-
-RUN ./autogen.sh && ./configure --prefix=/usr && make && make install
-
-RUN ldconfig
-
-#===============================================================================
-# Cmocka
-#===============================================================================
-
-WORKDIR /usr/local/src
-
-RUN apt-get install -y git cmake build-essential bison flex libpcre3-dev libev-dev\
- libavl-dev valgrind python-dev lua5.2
-
-RUN git clone git://git.cryptomilk.org/projects/cmocka.git
-
-RUN mkdir -p ./cmocka/build
-
-WORKDIR /usr/local/src/cmocka/build
-
-RUN git checkout tags/cmocka-1.1.3
-
-RUN cmake -DCMAKE_BUILD_TYPE=Debug .. && make && make install
-
-#===============================================================================
-# Libyang
-#===============================================================================
-
-WORKDIR /usr/local/src
-
-RUN apt-get install -y libpcre3-dev
-
-RUN git clone https://github.com/CESNET/libyang.git
-
-RUN mkdir -p ./libyang/build
-
-WORKDIR /usr/local/src/libyang/build
-
-RUN git checkout tags/v0.16-r2
-
-RUN cmake .. && make && make install
-
-#===============================================================================
-# Sysrepo
-#===============================================================================
-
-WORKDIR /usr/local/src
-
-RUN apt-get install -y liblua5.1-0-dev protobuf-c-compiler libprotobuf-c-dev
-
-RUN git clone https://github.com/sysrepo/sysrepo.git
-
-RUN mkdir -p sysrepo/build
-
-WORKDIR /usr/local/src/sysrepo/build
-
-RUN git checkout tags/v0.7.6
-
-RUN cmake -DCMAKE_BUILD_TYPE=Debug -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install
-
-RUN ldconfig
-
-#===============================================================================
-# Libnetconf2
-#===============================================================================
-
-WORKDIR /usr/local/src
-
-RUN apt-get install -y libssh-dev
-
-RUN git clone https://github.com/CESNET/libnetconf2.git
-
-RUN mkdir -p libnetconf2/build
-
-WORKDIR /usr/local/src/libnetconf2/build
-
-RUN git checkout tags/v0.12-r1
-
-RUN cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
-
-RUN make && make install && ldconfig
-
-#===============================================================================
-# Netopeer2
-#===============================================================================
-
-WORKDIR /usr/local/src
-
-RUN git clone https://github.com/CESNET/Netopeer2.git
-
-WORKDIR /usr/local/src/Netopeer2
-
-RUN git checkout tags/v0.7-r1
-
-RUN mkdir -p ./keystored/build && mkdir -p ./cli/build && mkdir -p ./server/build
-
-WORKDIR /usr/local/src/Netopeer2/keystored/build
-
-RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
-
-RUN make && make install && ldconfig
-
-WORKDIR /usr/local/src/Netopeer2/server/build
-
-RUN cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
-
-RUN make && make install && ldconfig
-
-WORKDIR /usr/local/src/Netopeer2/cli/build
-
-RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
-
-RUN make && make install && ldconfig
-
-#===============================================================================
-# End
-#===============================================================================
-
-WORKDIR /root/src
-
diff --git a/test/run_test.sh b/test/run_test.sh
index aa28773..8df2f3a 100755
--- a/test/run_test.sh
+++ b/test/run_test.sh
@@ -25,7 +25,7 @@ function build_enviroment {
return
fi
- docker build -t ${IMAGE} ./src/Docker/Build
+ docker build -t ${IMAGE} .
}
function create_container {
@@ -47,7 +47,6 @@ function start_container {
}
function build_sweetcomb {
- docker exec -it ${CONTAINER} bash -c "/root/src/sweetcomb/build-root/scripts/de_build.sh"
docker exec -it ${CONTAINER} bash -c "apt-get install -y python3-pip && pip3 install pexpect && pip3 install pyroute2"
}