support vpp 20.05, modify openssl and nginx prefix and add verify 24/27324/3
authorxiaolongx.jiang <[email protected]>
Thu, 28 May 2020 10:23:26 +0000 (10:23 +0000)
committerxiaolongx.jiang <[email protected]>
Mon, 8 Jun 2020 09:55:44 +0000 (17:55 +0800)
Signed-off-by: xiaolongx.jiang <[email protected]>
Change-Id: I6d1b630944094fda50812b1070e4b61c1e8d9753

Makefile
README.md
configs/startup.conf
configs/vcl.conf
packages/nginx_ldp.mk
packages/nginx_vcl.mk
packages/openssl.mk
packages/verify.sh [new file with mode: 0755]
packages/vpp_ldp.mk
packages/vpp_vcl.mk

index b528e2a..75566a2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,8 @@ help:
        @echo " build-vcl       - build vcl vpp and vcl nginx"
        @echo " deb-ldp         - build ldp DEB package"
        @echo " build-ldp       - build ldp vpp and ldp nginx"
+       @echo " verify-vcl      - verify vcl starts properly"
+       @echo " verify-ldp      - verify ldp starts properly"
        @echo " clean           - clean up build environment."
        @echo " clean-vcl       - clean up build vcl environment."
        @echo " clean-ldp       - clean up build ldp environment."
@@ -85,13 +87,20 @@ build-vcl: $(BR)/.deps.ok openssl-dl nginx-dl openssl-build vpp_vcl-build nginx_
 .PHONY: build-ldp
 build-ldp: $(BR)/.deps.ok openssl-dl nginx-dl openssl-build vpp_ldp-build nginx_ldp-build
 
-
 .PHONY: deb-vcl
 deb-vcl: build-vcl openssl-deb vpp_vcl-deb nginx_vcl-deb
 
 .PHONY: deb-ldp
 deb-ldp: build-ldp openssl-deb vpp_ldp-deb nginx_ldp-deb
 
+.PHONY: verify-vcl
+verify-vcl: build-vcl
+       @./packages/verify.sh vcl
+
+.PHONY: verify-ldp
+verify-ldp: build-ldp
+       @./packages/verify.sh ldp
+
 .PHONY: dep
 dep:
 ifeq ($(OS_ID),ubuntu)
index 79e0e29..fc63d87 100644 (file)
--- a/README.md
+++ b/README.md
@@ -60,6 +60,12 @@ If you don't take the parameter, the default is master.
 For example:
 $ make deb-vcl
 
+Verify that vcl starts properly
+$ make verify-vcl
+
+Verify that ldp starts properly
+$ make verify-ldp
+
 Clean up build vcl environment, remove _build/.*vcl*. for example: rm _build/.vpp_vcl.build.ok and so on
 $ make clean-vcl
 
index b9260b4..059ae5c 100644 (file)
@@ -28,18 +28,19 @@ cpu {
 
 tcp {cc-algo cubic}
 
-dpdk {
-       dev <pci-address> {
-               name eth0
-               
-                ##the value of num-rx-queues should be the same as the number
-               ##of VPP worker
-               ##If 1
-               num-rx-queues 1
-               ##If 4
-               #num-rx-queues 4
-                num-rx-desc 512
-                num-tx-desc 512
-
-       }
-}
+#Delete the # sign below and set the PCI-Address of the network card.
+#dpdk {
+#      dev <pci-address> {
+#              name eth0
+#
+#                ##the value of num-rx-queues should be the same as the number
+#              ##of VPP worker
+#              ##If 1
+#              num-rx-queues 1
+#              ##If 4
+#              #num-rx-queues 4
+#                num-rx-desc 512
+#                num-tx-desc 512
+#
+#      }
+#}
index c6e7da9..e81459c 100644 (file)
@@ -7,7 +7,7 @@ rx-fifo-size 5000
 tx-fifo-size 5000
 app-scope-local
 app-scope-global
-api-socket-name /path/to/vpp-api.sock
+api-socket-name /run/vpp/api.sock
 event-queue-size 1000000
 segment-size 1024000000
 add-segment-size 1024000000
index 96f2953..5dbe375 100644 (file)
@@ -13,7 +13,7 @@
 
 nginx_ldp_version            := 1.14.2
 nginx_ldp_src_dir            := $(B)/nginx_ldp
-nginx_ldp_install_dir        := $(I)/local/nginx
+nginx_ldp_install_dir        := /usr/local/nginx
 nginx_ldp_deb_inst_dir       := /usr/local/nginx
 nginx_ldp_pkg_deb_name       := nginx
 nginx_ldp_pkg_deb_dir        := $(I)/deb-ldp
index 1ad163b..8c53733 100644 (file)
@@ -15,7 +15,7 @@ nginx_vcl_version            := 1.14.2
 nginx_vcl_patch_dir          := $(CURDIR)/nginx_patches
 nginx_vcl_src_dir            := $(B)/nginx_vcl
 vpp_vcl_src_dir              := $(CURDIR)/vpp
-nginx_vcl_install_dir        := $(I)/local/nginx
+nginx_vcl_install_dir        := /usr/local/nginx
 nginx_vcl_deb_inst_dir       := /usr/local/nginx
 nginx_vcl_pkg_deb_name       := nginx
 nginx_vcl_pkg_deb_dir        := $(I)/deb-vcl
index 3f76a7b..f395efa 100644 (file)
@@ -12,7 +12,7 @@
 # limitations under the License.
 
 openssl_version            := 3.0.0-alpha2
-openssl_install_dir        := $(I)/local/ssl
+openssl_install_dir        := /usr/local/ssl
 openssl_deb_inst_dir       := /usr/local/ssl
 openssl_pkg_deb_name       := openssl3
 openssl_pkg_deb_dir        := $(I)/openssl-deb
diff --git a/packages/verify.sh b/packages/verify.sh
new file mode 100755 (executable)
index 0000000..6b3d7a3
--- /dev/null
@@ -0,0 +1,147 @@
+#!/bin/bash
+
+ngxvcl=${BR}/_build/nginx_vcl
+ngxldp=${BR}/_build/nginx_ldp
+
+function test_vcl(){
+    echo ""
+    echo "===================================================================="
+    echo "Testing ..."
+    echo ""
+    export LD_LIBRARY_PATH=/usr/local/ssl/lib
+    cp ${BR}/configs/startup.conf ${BR}/configs/startup-test.conf
+
+    sed -i 's|/var/log/vpp/vpp.log|/tmp/vpp.log|' ${BR}/configs/startup-test.conf
+    sed -i 's|cli-vpp1.sock|cli.sock|' ${BR}/configs/startup-test.conf
+    sed -i 's|/path/to/configs/vppenvset|configs/vppset|' ${BR}/configs/startup-test.conf
+    sed -i 's|socket-name /path/to/vpp-api.sock|default|' ${BR}/configs/startup-test.conf
+    echo "set int state local0 up" > ${BR}/configs/vppset
+
+    ${BR}/vpp/build-root/install-vpp-native/vpp/bin/vpp -c configs/startup-test.conf &
+    vpp_pid=$!
+
+    sleep 5
+
+    export VCL_CONFIG=${BR}/configs/vcl.conf
+
+    export NGXVCL_TLS_ON=1
+    export NGXVCL_TLS_CERT=${BR}/configs/tls-test-cert
+    export NGXVCL_TLS_KEY=${BR}/configs/tls-test-key
+
+    export LD_LIBRARY_PATH=${BR}/vpp/build-root/install-vpp-native/vpp/lib
+
+    sudo killall -v -s 9 nginx || echo "continue execute"
+
+    cp ${BR}/configs/nginx.conf ${BR}/configs/nginx-test.conf
+    sed -i 's|#worker_processes 1|worker_processes 1|' ${BR}/configs/nginx-test.conf
+
+    ${ngxvcl}/objs/nginx -c ${BR}/configs/nginx-test.conf &
+    nginx_pid=$!
+    sleep 5
+
+    echo "===================================================================="
+    ret=0
+    v=`ps -A|grep "${vpp_pid}" | wc -l`
+    if [ ${v} -eq 1 ]; then
+        echo "VCL test: vpp                                                 OK"
+    else
+        echo "VCL test: vpp                                                 FAIL"
+        ret=1
+    fi
+
+    v=`ps -A|grep "${nginx_pid}" | wc -l`
+    if [ ${v} -eq 1 ]; then
+        echo "VCL test: nginx                                               OK"
+    else
+        echo "VCL test: nginx                                               FAIL"
+        ret=1
+    fi
+    echo "===================================================================="
+
+    sudo killall -v -s 9 nginx || echo ""
+    sudo kill -9 ${vpp_pid} || echo ""
+    rm -f ${BR}/configs/nginx-test.conf
+    rm -f ${BR}/configs/startup-test.conf
+    rm -f ${BR}/configs/vppset
+    rm -f /tmp/vpp.log
+
+    if [ ${ret} -eq 1 ]; then
+        exit 1;
+    fi
+}
+
+function test_ldp(){
+    echo ""
+    echo "===================================================================="
+    echo "Testing ..."
+    echo ""
+
+    export LD_LIBRARY_PATH=/usr/local/ssl/lib
+    cp ${BR}/configs/startup.conf ${BR}/configs/startup-test.conf
+
+    sed -i 's|/var/log/vpp/vpp.log|/tmp/vpp.log|' ${BR}/configs/startup-test.conf
+    sed -i 's|cli-vpp1.sock|cli.sock|' ${BR}/configs/startup-test.conf
+    sed -i 's|/path/to/configs/vppenvset|configs/vppset|' ${BR}/configs/startup-test.conf
+    sed -i 's|socket-name /path/to/vpp-api.sock|default|' ${BR}/configs/startup-test.conf
+    echo "set int state local0 up" > ${BR}/configs/vppset
+
+    ${BR}/vpp/build-root/install-vpp-native/vpp/bin/vpp -c configs/startup-test.conf &
+    vpp_pid=$!
+
+    sleep 5
+
+    cp ${BR}/configs/nginx.conf ${BR}/configs/nginx-test.conf
+    sed -i 's|#worker_processes 1|worker_processes 1|' ${BR}/configs/nginx-test.conf
+
+    export VCL_CONFIG=${BR}/configs/vcl.conf
+    export LDP_TRANSPARENT_TLS=1
+    export LDP_TLS_CERT_FILE=${BR}/configs/tls-test-cert
+    export LDP_TLS_KEY_FILE=${BR}/configs/tls-test-key
+    LD_PRELOAD=${BR}/vpp/build-root/install-vpp-native/vpp/lib/libvcl_ldpreload.so \
+        ${ngxldp}/objs/nginx -c ${BR}/configs/nginx-test.conf &
+
+    nginx_pid=$!
+    sleep 5
+
+    echo "===================================================================="
+    ret=0
+    v=`ps -A|grep "${vpp_pid}" | wc -l`
+    if [ ${v} -eq 1 ]; then
+        echo "LDP test: vpp                                                 OK"
+    else
+        echo "LDP test: vpp                                                 FAIL"
+        ret=1
+    fi
+
+
+    v=`ps -A|grep "${nginx_pid}" | wc -l`
+    if [ ${v} -eq 1 ]; then
+        echo "LDP test: nginx                                               OK"
+    else
+        echo "LDP test: nginx                                               FAIL"
+        ret=1
+    fi
+    echo "===================================================================="
+
+    sudo killall -v -s 9 nginx || echo ""
+    sudo kill -9 ${vpp_pid} || echo ""
+
+    rm -f ${BR}/configs/nginx-test.conf
+    rm -f ${BR}/configs/startup-test.conf
+    rm -f ${BR}/configs/vppset
+    rm -rf /tmp/vpp.log
+
+    if [ ${ret} -eq 1 ]; then
+        exit 1
+    fi
+}
+
+args=("$@")
+case ${1} in
+    vcl)
+        test_vcl
+        ;;
+    ldp)
+        test_ldp
+        ;;
+esac
index 2f4eae1..37a72bb 100644 (file)
@@ -17,6 +17,7 @@ vpp_ldp_install_dir        := $(I)/local
 vpp_ldp_pkg_deb_name       := vpp
 vpp_ldp_pkg_deb_dir        := $(CURDIR)/vpp/build-root
 vpp_ldp_desc               := "ldp vpp"
+openssl_install_dir        ?= /usr/local/ssl
 
 
 define  vpp_ldp_extract_cmds
@@ -27,16 +28,16 @@ define  vpp_ldp_patch_cmds
        @echo "--- ldp vpp patching ---"
        @cd $(vpp_ldp_src_dir); \
                git reset --hard; git clean -f; git checkout master; \
-               if [ ! -z $(_VPP_VER) -a $(_VPP_VER) != "master" ] ; then \
+               if [ $(_VPP_VER) != "master" ] ; then \
                        echo "--- vpp version: $(_VPP_VER) ---"; \
-                       git checkout remotes/origin/stable/$(_VPP_VER); \
+                       git checkout stable/$(_VPP_VER); \
                        git reset --hard; git clean -f; \
                fi
        @for f in $(CURDIR)/vpp_patches/common/*.patch ; do \
                echo Applying patch: $$(basename $$f) ; \
                patch -p1 -d $(vpp_ldp_src_dir) < $$f ; \
        done
-       @if [ -z $(_VPP_VER) -o $(_VPP_VER) = "master" ]; then \
+       @if [ $(_VPP_VER) = "master" -o $(_VPP_VER) = "2005" ]; then \
                echo "--- vpp master ---"; \
                for f in $(CURDIR)/vpp_patches/common/master/*.patch ; do \
                        echo Applying patch: $$(basename $$f) ; \
@@ -49,7 +50,7 @@ define  vpp_ldp_patch_cmds
                        patch -p1 -d $(vpp_ldp_src_dir) < $$f ; \
                done; \
        fi
-       @if [ -z $(_VPP_VER) ]; then \
+       @if [ $(_VPP_VER) = "master" ]; then \
                echo "--- patch master ---"; \
                for f in $(CURDIR)/vpp_patches/ldp/master/*.patch ; do \
                        echo Applying patch: $$(basename $$f) ; \
@@ -73,8 +74,8 @@ endef
 define  vpp_ldp_build_cmds
        @cd $(vpp_ldp_src_dir); \
        echo "---build : $(vpp_ldp_src_dir)"; \
-               export OPENSSL_ROOT_DIR=$(I)/local/ssl; \
-               export LD_LIBRARY_PATH=$(I)/local/ssl/lib; \
+               export OPENSSL_ROOT_DIR=$(openssl_install_dir); \
+               export LD_LIBRARY_PATH=$(openssl_install_dir)/lib; \
                $(MAKE) wipe-release; \
                rm -f $(vpp_ldp_pkg_deb_dir)/*.deb; \
                $(MAKE) build-release; \
index d8c9600..1a7ffce 100644 (file)
@@ -17,6 +17,7 @@ vpp_vcl_install_dir        := $(I)/local
 vpp_vcl_pkg_deb_name       := vpp
 vpp_vcl_pkg_deb_dir        := $(CURDIR)/vpp/build-root
 vpp_vcl_desc               := "vcl vpp"
+openssl_install_dir        ?= /usr/local/ssl
 
 
 define  vpp_vcl_extract_cmds
@@ -27,16 +28,16 @@ define  vpp_vcl_patch_cmds
        @echo "--- vpp patching ---"
        @cd $(vpp_vcl_src_dir); \
                git reset --hard; git clean -f; git checkout master; \
-               if [ ! -z $(_VPP_VER) -a $(_VPP_VER) != "master" ]; then \
+               if [ $(_VPP_VER) != "master" ]; then \
                        echo "--- vpp version: $(_VPP_VER) ---"; \
-                       git checkout origin/stable/$(_VPP_VER); \
+                       git checkout stable/$(_VPP_VER); \
                        git reset --hard; git clean -f; \
                fi
        @for f in $(CURDIR)/vpp_patches/common/*.patch ; do \
                echo Applying patch: $$(basename $$f) ; \
                patch -p1 -d $(vpp_vcl_src_dir) < $$f ; \
        done
-       @if [ -z $(_VPP_VER) -o $(_VPP_VER) = "master" ]; then \
+       @if [ $(_VPP_VER) = "2005" -o $(_VPP_VER) = "master" ]; then \
                echo "--- vpp master ---"; \
                for f in $(CURDIR)/vpp_patches/common/master/*.patch ; do \
                        echo Applying patch: $$(basename $$f) ; \
@@ -65,8 +66,8 @@ endef
 define  vpp_vcl_build_cmds
        @cd $(vpp_vcl_src_dir); \
                echo "--- build : $(vpp_vcl_src_dir)"; \
-               export OPENSSL_ROOT_DIR=$(I)/local/ssl; \
-               export LD_LIBRARY_PATH=$(I)/local/ssl/lib; \
+               export OPENSSL_ROOT_DIR=$(openssl_install_dir); \
+               export LD_LIBRARY_PATH=$(openssl_install_dir)/lib; \
                $(MAKE) wipe-release; \
                rm -f $(vpp_vcl_pkg_deb_dir)/*.deb; \
                $(MAKE) build-release; \