5 ROOTDIR=/tmp/openvpp-testing
11 VPP_VERSION=`cat ${ROOTDIR}/NSH_SFC_VER | grep VPP | awk -F'= ' '{print $2}'`
12 NSH_SFC_VERSION=`cat ${ROOTDIR}/NSH_SFC_VER | grep NSH_SFC | awk -F'= ' '{print $2}'`
14 VPP_CODE_DIR=${ROOTDIR}/vpp_codes
15 NSH_SFC_CODE_DIR=${ROOTDIR}/nsh_sfc_codes
17 #at first, we need to stop the vpp service if have
20 #uninstall the vpp and nsh sfc plugin
21 #and git clone the vpp and nsh sfc plugin source codes
22 #then compile and install them in the dut nodes.
24 sudo dpkg -l vpp-nsh-plugin >/dev/null 2>&1
26 nsh_plugin_version=`dpkg -s vpp-nsh-plugin | grep Version | awk -F' ' '{print $2}'`
27 if [ "${nsh_plugin_version}" \< "${NSH_SFC_VERSION}" ]; then
28 sudo dpkg -P vpp-nsh-plugin vpp-nsh-plugin-dbg vpp-nsh-plugin-dev >/dev/null 2>&1
29 test $? -eq 0 || exit 1
37 sudo dpkg -l vpp >/dev/null 2>&1
39 vpp_version=`dpkg -s vpp | grep Version | awk -F' ' '{print $2}'`
40 if [ "${vpp_version}" \< "${VPP_VERSION}" ]; then
41 sudo dpkg -P vpp vpp-dbg vpp-dev vpp-dpdk-dev vpp-dpdk-dkms vpp-lib \
42 vpp-plugins vpp-python-api >/dev/null 2>&1
43 test $? -eq 0 || exit 1
52 ##begin to clone the vpp source code
53 if [ ${vpp_need_install} -eq 1 ]; then
54 sudo rm -rf ${VPP_CODE_DIR}
55 sudo mkdir -p ${VPP_CODE_DIR}
57 git clone -b v${VPP_VERSION} https://gerrit.fd.io/r/vpp
63 make V=0 PLATFORM=vpp TAG=vpp install-deb
65 #after that, install vpp
70 ##begin to clone the nsh sfc source code
71 if [ ${nsh_need_install} -eq 1 ]; then
72 sudo rm -rf ${NSH_SFC_CODE_DIR}
73 sudo mkdir -p ${NSH_SFC_CODE_DIR}
74 cd ${NSH_SFC_CODE_DIR}
75 git clone -b v${NSH_SFC_VERSION} https://gerrit.fd.io/r/nsh_sfc
77 #compile the nsh sfc code
78 cd ./nsh_sfc/nsh-plugin/
82 #after that, install the nsh sfc plugin
88 #check and setup the hugepages
89 SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages)
90 if [ ${SYS_HUGEPAGE} -lt 1024 ]; then
91 MOUNT=$(mount | grep /mnt/huge)
92 while [ "${MOUNT}" != "" ]
96 MOUNT=$(mount | grep /mnt/huge)
99 echo 2048 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
100 echo 2048 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
102 sudo mkdir -p /mnt/huge
103 sudo mount -t hugetlbfs nodev /mnt/huge/
104 test $? -eq 0 || exit 1
107 #check and set the max map count
108 SYS_MAP=$(cat /proc/sys/vm/max_map_count)
109 if [ ${SYS_MAP} -lt 200000 ]; then
110 echo 200000 | sudo tee /proc/sys/vm/max_map_count
113 #after all, we can start the vpp service now
114 sudo service vpp start