From 48009e4c5732180ecc951ac6359b9b96d38b8dc2 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Thu, 20 Apr 2017 11:43:56 +0200 Subject: Move vagrant stuff to extras/ Change-Id: I7e3d6ecc3f23d862004c273e23e36e234ceb6015 Signed-off-by: Damjan Marion --- extras/vagrant/Vagrantfile | 113 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 extras/vagrant/Vagrantfile (limited to 'extras/vagrant/Vagrantfile') diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile new file mode 100644 index 00000000..b463d646 --- /dev/null +++ b/extras/vagrant/Vagrantfile @@ -0,0 +1,113 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + + # Pick the right distro and bootstrap, default is ubuntu1604 + distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") + if distro == 'centos7' + config.vm.box = "puppetlabs/centos-7.2-64-nocm" + config.ssh.insert_key = false + elsif distro == 'ubuntu1404' + config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" + else + config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" + end + config.vm.box_check_update = false + + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" + + post_build = ( ENV['VPP_VAGRANT_POST_BUILD'] ) + if post_build == "test" + config.vm.provision "shell", inline: "echo Testing VPP; cd /vpp; make test" + elsif post_build == "install" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") + end + + # Add .gnupg dir in so folks can sign patches + # Note, as gnupg puts socket files in that dir, we have + # to be cautious and make sure we are dealing with a plain file + homedir = File.expand_path("~/") + Dir["#{homedir}/.gnupg/**/*"].each do |fname| + if File.file?(fname) + destname = fname.sub(Regexp.escape("#{homedir}/"),'') + config.vm.provision "file", source: fname, destination: destname + end + end + + # Copy in the .gitconfig if it exists + if File.file?(File.expand_path("~/.gitconfig")) + config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" + end + + # vagrant-cachier caches apt/yum etc to speed subsequent + # vagrant up + # to enable, run + # vagrant plugin install vagrant-cachier + # + if Vagrant.has_plugin?("vagrant-cachier") + config.cache.scope = :box + end + + # Define some physical ports for your VMs to be used by DPDK + nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) + for i in 1..nics + config.vm.network "private_network", type: "dhcp" + end + + # use http proxy if avaiable + if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] + config.proxy.no_proxy = "localhost,127.0.0.1" + end + + vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) + vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) + + config.ssh.forward_agent = true + config.ssh.forward_x11 = true + + config.vm.provider "virtualbox" do |vb| + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.memory = "#{vmram}" + vb.cpus = "#{vmcpu}" + + # rsync the vpp directory if provision hasn't happened yet + unless File.exist? (".vagrant/machines/default/virtualbox/action_provision") + config.vm.synced_folder "../../", "/vpp", type: "rsync", + rsync__auto: false, + rsync__exclude: [ + "build-root/build*/", + "build-root/install*/", + "build-root/images*/", + "build-root/*.deb", + "build-root/*.rpm", + "build-root/*.changes", + "build-root/python", + "build-root/deb/debian/*.dkms", + "build-root/deb/debian/*.install", + "build-root/deb/debian/changes", + "build-root/tools"] + end + + #support for the SSE4.x instruction is required in some versions of VB. + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] + end + config.vm.provider "vmware_fusion" do |fusion,override| + fusion.vmx["memsize"] = "#{vmram}" + fusion.vmx["numvcpus"] = "#{vmcpu}" + end + config.vm.provider "libvirt" do |lv| + lv.memory = "#{vmram}" + lv.cpus = "#{vmcpu}" + end + config.vm.provider "vmware_workstation" do |vws,override| + vws.vmx["memsize"] = "#{vmram}" + vws.vmx["numvcpus"] = "#{vmcpu}" + end +end -- cgit 1.2.3-korg From 3079a64e19e997e6735b633377285bb5718f4067 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Wed, 6 Sep 2017 01:59:43 -0400 Subject: Fix socket_test.sh vagrant based multi-host tests. Change-Id: I8ef75a0c702098030c6814c127d3443820122327 Signed-off-by: Dave Wallace --- extras/vagrant/Vagrantfile | 4 +- extras/vagrant/update.sh | 2 +- extras/vagrant/vcl_test.sh | 23 +++ test/scripts/socket_test.sh | 406 ++++++++++++++++++++++++++++++-------------- 4 files changed, 307 insertions(+), 128 deletions(-) create mode 100644 extras/vagrant/vcl_test.sh (limited to 'extras/vagrant/Vagrantfile') diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile index b463d646..07db660c 100644 --- a/extras/vagrant/Vagrantfile +++ b/extras/vagrant/Vagrantfile @@ -8,8 +8,6 @@ Vagrant.configure(2) do |config| if distro == 'centos7' config.vm.box = "puppetlabs/centos-7.2-64-nocm" config.ssh.insert_key = false - elsif distro == 'ubuntu1404' - config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" else config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" end @@ -25,6 +23,8 @@ Vagrant.configure(2) do |config| config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") + elsif post_build == "vcl-test" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"vcl_test.sh"), :args => "/vpp vagrant" end # Add .gnupg dir in so folks can sign patches diff --git a/extras/vagrant/update.sh b/extras/vagrant/update.sh index f4139d74..b6304492 100755 --- a/extras/vagrant/update.sh +++ b/extras/vagrant/update.sh @@ -40,7 +40,7 @@ if [ $DISTRIB_ID == "Ubuntu" ]; then update-alternatives --install /bin/sh sh /bin/bash 100 # Install useful but non-mandatory tools - apt-get install -y emacs x11-utils git-review gdb gdbserver + apt-get install -y emacs x11-utils git-review gdb gdbserver xfce4-terminal iperf3 elif [ $DISTRIB_ID == "CentOS" ]; then # Standard update + upgrade dance yum check-update diff --git a/extras/vagrant/vcl_test.sh b/extras/vagrant/vcl_test.sh new file mode 100644 index 00000000..9fb924ae --- /dev/null +++ b/extras/vagrant/vcl_test.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Get Command Line arguements if present +VPP_DIR=$1 +if [ "x$1" != "x" ]; then + VPP_DIR=$1 +else + VPP_DIR=`dirname $0`/../../ +fi + +if [ "x$2" != "x" ]; then + SUDOCMD="sudo -H -u $2" +fi + +echo 'Building VCL test apps' +cd $VPP_DIR +$SUDOCMD perl -pi -e 's/noinst_PROGRAMS/bin_PROGRAMS/g' $VPP_DIR/src/uri.am +$SUDOCMD make build-release +echo "export WS_ROOT=$VPP_DIR" | sudo -H -u vagrant tee /home/vagrant/.bash_aliases +source /home/vagrant/.bash_aliases +sudo cp $VPP_DIR/src/vpp/conf/80-vpp.conf /etc/sysctl.d +sudo sysctl -p/etc/sysctl.d/80-vpp.conf +sudo modprobe uio_pci_generic diff --git a/test/scripts/socket_test.sh b/test/scripts/socket_test.sh index d8eb75e4..8c3f20a2 100755 --- a/test/scripts/socket_test.sh +++ b/test/scripts/socket_test.sh @@ -6,13 +6,16 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" vpp_dir="$WS_ROOT/build-root/install-vpp-native/vpp/bin/" vpp_debug_dir="$WS_ROOT/build-root/install-vpp_debug-native/vpp/bin/" vpp_shm_dir="/dev/shm/" +vpp_run_dir="/run/vpp" lib64_dir="$WS_ROOT/build-root/install-vpp-native/vpp/lib64/" lib64_debug_dir="$WS_ROOT/build-root/install-vpp_debug-native/vpp/lib64/" +dpdk_devbind="$WS_ROOT/build-root/install-vpp-native/dpdk/share/dpdk/usertools/dpdk-devbind.py" docker_vpp_dir="/vpp/" docker_app_dir="/vpp/" docker_lib64_dir="/vpp-lib64/" docker_os="ubuntu" vcl_ldpreload_lib="libvcl_ldpreload.so.0.0.0" +user_gid="$(id -g)" vpp_app="vpp" sock_srvr_app="sock_test_server" sock_clnt_app="sock_test_client" @@ -30,6 +33,7 @@ tmp_cmdfile_prefix="/tmp/socket_test_cmd" cmd1_file="${tmp_cmdfile_prefix}1.$$" cmd2_file="${tmp_cmdfile_prefix}2.$$" cmd3_file="${tmp_cmdfile_prefix}3.$$" +tmp_vpp_exec_file="/tmp/vpp_config.$$" tmp_gdb_cmdfile_prefix="/tmp/gdb_cmdfile" def_gdb_cmdfile_prefix="$WS_ROOT/extras/gdb/gdb_cmdfile" tmp_gdb_cmdfile_vpp="${tmp_gdb_cmdfile_prefix}_vpp.$$" @@ -64,6 +68,8 @@ OPTIONS: -d Run the vpp_debug version of all apps. -c Set VPPCOM_CONF to use the vppcom_test.conf file. -i Run iperf3 for client/server app in native tests. + -m c[lient] Run client in multi-host cfg (server on remote host) + s[erver] Run server in multi-host cfg (client on remote host) -e a[ll] Run all in emacs+gdb. c[lient] Run client in emacs+gdb. s[erver] Run server in emacs+gdb. @@ -109,7 +115,7 @@ declare -i leave_tmp_files=0 declare -i bash_after_exit=0 declare -i iperf3=0 -while getopts ":hitlbcde:g:p:E:I:N:P:R:S:T:UBVX" opt; do +while getopts ":hitlbcdm:e:g:p:E:I:N:P:R:S:T:UBVX" opt; do case $opt in h) usage ;; l) leave_tmp_files=1 @@ -145,6 +151,15 @@ while getopts ":hitlbcde:g:p:E:I:N:P:R:S:T:UBVX" opt; do vpp_dir=$vpp_debug_dir lib64_dir=$lib64_debug_dir ;; + m) if [ $OPTARG = "c" ] || [ $OPTARG = "client" ] ; then + multi_host="client" + elif [ $OPTARG = "s" ] || [ $OPTARG = "server" ] ; then + multi_host="server" + else + echo "ERROR: Option -e unknown argument \'$OPTARG\'" >&2 + usage + fi + ;; g) if [ $OPTARG = "a" ] || [ $OPTARG = "all" ] ; then gdb_client=1 gdb_server=1 @@ -227,7 +242,7 @@ done if [ -z "$WS_ROOT" ] ; then echo "ERROR: WS_ROOT environment variable not set!" >&2 echo " Please set WS_ROOT to VPP workspace root directory." >&2 - env_test_failed="true" + exit 1 fi if [ ! -d $vpp_dir ] ; then @@ -296,10 +311,17 @@ if [ -f "$VPPCOM_CONF" ] ; then vppcom_conf_dir="$(dirname $VPPCOM_CONF)/" api_prefix="$(egrep -s '^\s*api-prefix \w+' $VPPCOM_CONF | awk -e '{print $2}')" if [ -n "$api_prefix" ] ; then - api_segment=" api-segment { prefix $api_prefix }" + api_segment=" api-segment { gid $user_gid prefix $api_prefix }" fi fi -vpp_args="unix { interactive }${api_segment}" +if [ -z "$api_segment" ] ; then + api_segment=" api-segment { gid $user_gid }" +fi +if [ -n "$multi_host" ] ; then + vpp_args="unix { interactive exec $tmp_vpp_exec_file}${api_segment}" +else + vpp_args="unix { interactive }${api_segment}" +fi if [ $iperf3 -eq 1 ] ; then app_dir="$(dirname $(which iperf3))/" @@ -336,6 +358,57 @@ verify_no_vpp() { done exit 1 fi + if [ ! -d "$vpp_run_dir" ] ; then + sudo mkdir $vpp_run_dir + sudo chown root:$USER $vpp_run_dir + fi + if [ -n "$multi_host" ] ; then + vpp_eth_name="enp0s8" + vpp_eth_pci_id="$(ls -ld /sys/class/net/$vpp_eth_name/device | awk '{print $11}' | cut -d/ -f4)" + if [ -z "$vpp_eth_pci_id" ] ; then + echo "ERROR: Missing ethernet interface $vpp_eth_name!" + usage + fi + printf -v bus "%x" "0x$(echo $vpp_eth_pci_id | cut -d: -f2)" + printf -v slot "%x" "0x$(echo $vpp_eth_pci_id | cut -d: -f3 | cut -d. -f1)" + printf -v func "%x" "0x$(echo $vpp_eth_pci_id | cut -d. -f2)" + + vpp_eth_kernel_driver="$(basename $(ls -l /sys/bus/pci/devices/$vpp_eth_pci_id/driver | awk '{print $11}'))" + if [ -z "$vpp_eth_kernel_driver" ] ; then + echo "ERROR: Missing kernel driver for $vpp_eth_name!" + usage + fi + case $vpp_eth_kernel_driver in + e1000) + vpp_eth_ifname="GigabitEthernet$bus/$slot/$func" ;; + ixgbe) + vpp_eth_ifname="TenGigabitEthernet$bus/$slot/$func" ;; + *) + echo "ERROR: Unknown ethernet kernel driver $vpp_eth_kernel_driver!" + usage ;; + esac + + vpp_eth_ip4_addr="$(ip -4 -br addr show $vpp_eth_name | awk '{print $3}')" + if [ -z "$vpp_eth_ip4_addr" ] ; then + echo "ERROR: No inet address configured for $vpp_eth_name!" + usage + fi + vpp_eth_ip6_addr="$(ip -6 -br addr show $vpp_eth_name | awk '{print $3}')" + if [ -z "$vpp_eth_ip6_addr" ] ; then + echo "ERROR: No inet6 address configured for $vpp_eth_name!" + usage + fi + vpp_args="$vpp_args plugins { path $lib64_dir/vpp_plugins } dpdk { dev $vpp_eth_pci_id }" + + sudo ifdown $vpp_eth_name 2> /dev/null + echo "Configuring VPP to use $vpp_eth_name ($vpp_eth_pci_id), inet addr $vpp_eth_ip4_addr" + + cat <> $tmp_vpp_exec_file +set int state $vpp_eth_ifname up +set int ip addr $vpp_eth_ifname $vpp_eth_ip4_addr +EOF + + fi } verify_no_docker_containers() { @@ -385,15 +458,27 @@ write_script_header() { echo "$bash_header" > $1 echo -e "#\n# $1 generated on $(date)\n#" >> $1 if [ $leave_tmp_files -eq 0 ] ; then - echo "trap \"rm -f $1 $2\" $trap_signals" >> $1 + if [ -n "$multi_host" ] ; then + echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file; sudo $dpdk_devbind -e $vpp_eth_kernel_driver $vpp_eth_pci_id; sudo ifup $vpp_eth_name\" $trap_signals" >> $1 + else + echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file\" $trap_signals" >> $1 + fi fi echo "export VPPCOM_CONF=${vppcom_conf_dir}${vppcom_conf}" >> $1 if [ "$pre_cmd" = "$gdb_in_emacs " ] ; then - cat <> $1 + if [ -n "$multi_host" ] ; then + cat <> $1 +$gdb_in_emacs() { + sudo emacs --eval "(gdb \"gdb -x $2 -i=mi --args \$*\")" --eval "(setq frame-title-format \"$3\")" +} +EOF + else + cat <> $1 $gdb_in_emacs() { emacs --eval "(gdb \"gdb -x $2 -i=mi --args \$*\")" --eval "(setq frame-title-format \"$3\")" } EOF + fi fi if [ -n "$4" ] ; then echo "$4" >> $1 @@ -437,25 +522,29 @@ write_gdb_cmdfile() { native_kernel() { banner="Running NATIVE-KERNEL socket test" + if [ -z "$multi_host" ] || [ "$multi_host" = "server" ] ; then + title1="SERVER$title_dbg (Native-Kernel Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server + gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE + set_pre_cmd $emacs_server $gdb_server + write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" + echo "${pre_cmd}${app_dir}${srvr_app}" >> $cmd1_file + write_script_footer $cmd1_file $perf_server + chmod +x $cmd1_file + fi - title1="SERVER$title_dbg (Native-Kernel Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server - gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE - set_pre_cmd $emacs_server $gdb_server - write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" - echo "${pre_cmd}${app_dir}${srvr_app}" >> $cmd1_file - write_script_footer $cmd1_file $perf_server - - title2="CLIENT$title_dbg (Native-Kernel Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client - gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE - set_pre_cmd $emacs_client $gdb_client - write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" - echo "srvr_addr=\"$sock_srvr_addr\"" >> $cmd2_file - echo "${pre_cmd}${app_dir}${clnt_app}" >> $cmd2_file - write_script_footer $cmd2_file $perf_client - - chmod +x $cmd1_file $cmd2_file + if [ -z "$multi_host" ] || [ "$multi_host" = "client" ] ; then + title2="CLIENT$title_dbg (Native-Kernel Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client + gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE + set_pre_cmd $emacs_client $gdb_client + write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" + echo "srvr_addr=\"$sock_srvr_addr\"" >> $cmd2_file + echo "${pre_cmd}${app_dir}${clnt_app}" >> $cmd2_file + write_script_footer $cmd2_file $perf_client + chmod +x $cmd2_file + + fi } native_preload() { @@ -468,29 +557,37 @@ native_preload() { gdb_cmdfile=$VPP_GDB_CMDFILE set_pre_cmd $emacs_vpp $gdb_vpp write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" + if [ -n "$multi_host" ] && [ $emacs_vpp -eq 0 ] ; then + echo -n "sudo " >> $cmd1_file + fi echo "${pre_cmd}$vpp_dir$vpp_app $vpp_args " >> $cmd1_file write_script_footer $cmd1_file $perf_vpp + chmod +x $cmd1_file + + if [ -z "$multi_host" ] || [ "$multi_host" = "server" ] ; then + title2="SERVER$title_dbg (Native-Preload Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server + gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE + set_pre_cmd $emacs_server $gdb_server $ld_preload + write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" + echo "export LD_LIBRARY_PATH=\"$lib64_dir:$VCL_LDPRELOAD_LIB_DIR:$LD_LIBRARY_PATH\"" >> $cmd2_file + echo "${pre_cmd}${app_dir}${srvr_app}" >> $cmd2_file + write_script_footer $cmd2_file $perf_server + chmod +x $cmd2_file + fi - title2="SERVER$title_dbg (Native-Preload Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server - gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE - set_pre_cmd $emacs_server $gdb_server $ld_preload - write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" - echo "export LD_LIBRARY_PATH=\"$lib64_dir:$VCL_LDPRELOAD_LIB_DIR:$LD_LIBRARY_PATH\"" >> $cmd2_file - echo "${pre_cmd}${app_dir}${srvr_app}" >> $cmd2_file - write_script_footer $cmd2_file $perf_server - - title3="CLIENT$title_dbg (Native-Preload Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client - gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE - set_pre_cmd $emacs_client $gdb_client $ld_preload - write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" - echo "export LD_LIBRARY_PATH=\"$lib64_dir:$VCL_LDPRELOAD_LIB_DIR:$LD_LIBRARY_PATH\"" >> $cmd3_file - echo "srvr_addr=\"$sock_srvr_addr\"" >> $cmd3_file - echo "${pre_cmd}${app_dir}${clnt_app}" >> $cmd3_file - write_script_footer $cmd3_file $perf_client - - chmod +x $cmd1_file $cmd2_file $cmd3_file + if [ -z "$multi_host" ] || [ "$multi_host" = "client" ] ; then + title3="CLIENT$title_dbg (Native-Preload Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client + gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE + set_pre_cmd $emacs_client $gdb_client $ld_preload + write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" + echo "export LD_LIBRARY_PATH=\"$lib64_dir:$VCL_LDPRELOAD_LIB_DIR:$LD_LIBRARY_PATH\"" >> $cmd3_file + echo "srvr_addr=\"$sock_srvr_addr\"" >> $cmd3_file + echo "${pre_cmd}${app_dir}${clnt_app}" >> $cmd3_file + write_script_footer $cmd3_file $perf_client + chmod +x $cmd3_file + fi } native_vcl() { @@ -502,53 +599,65 @@ native_vcl() { gdb_cmdfile=$VPP_GDB_CMDFILE set_pre_cmd $emacs_vpp $gdb_vpp write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" + if [ -n "$multi_host" ] && [ $emacs_vpp -eq 0 ] ; then + echo -n "sudo " >> $cmd1_file + fi echo "${pre_cmd}$vpp_dir$vpp_app $vpp_args " >> $cmd1_file write_script_footer $cmd1_file $perf_vpp + chmod +x $cmd1_file + + if [ -z "$multi_host" ] || [ "$multi_host" = "server" ] ; then + title2="SERVER$title_dbg (Native-VCL Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server + gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE + set_pre_cmd $emacs_server $gdb_server + write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" + echo "export LD_LIBRARY_PATH=\"$lib64_dir:$LD_LIBRARY_PATH\"" >> $cmd2_file + echo "${pre_cmd}${app_dir}${srvr_app}" >> $cmd2_file + write_script_footer $cmd2_file $perf_server + chmod +x $cmd2_file + fi - title2="SERVER$title_dbg (Native-VCL Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server - gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE - set_pre_cmd $emacs_server $gdb_server - write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" - echo "export LD_LIBRARY_PATH=\"$lib64_dir:$LD_LIBRARY_PATH\"" >> $cmd2_file - echo "${pre_cmd}${app_dir}${srvr_app}" >> $cmd2_file - write_script_footer $cmd2_file $perf_server - - title3="CLIENT$title_dbg (Native-VCL Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client - gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE - set_pre_cmd $emacs_client $gdb_client - write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" - echo "export LD_LIBRARY_PATH=\"$lib64_dir:$LD_LIBRARY_PATH\"" >> $cmd3_file - echo "srvr_addr=\"$sock_srvr_addr\"" >> $cmd3_file - echo "${pre_cmd}${app_dir}${clnt_app}" >> $cmd3_file - write_script_footer $cmd3_file $perf_client - - chmod +x $cmd1_file $cmd2_file $cmd3_file + if [ -z "$multi_host" ] || [ "$multi_host" = "client" ] ; then + title3="CLIENT$title_dbg (Native-VCL Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client + gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE + set_pre_cmd $emacs_client $gdb_client + write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" + echo "export LD_LIBRARY_PATH=\"$lib64_dir:$LD_LIBRARY_PATH\"" >> $cmd3_file + echo "srvr_addr=\"$sock_srvr_addr\"" >> $cmd3_file + echo "${pre_cmd}${app_dir}${clnt_app}" >> $cmd3_file + write_script_footer $cmd3_file $perf_client + chmod +x $cmd3_file + fi } docker_kernel() { verify_no_docker_containers banner="Running DOCKER-KERNEL socket test" - title1="SERVER$title_dbg (Docker-Native Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server - gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE - set_pre_cmd $emacs_server $gdb_server - write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" - echo "docker run -it --cpuset-cpus='4-7' -v $vpp_dir:$docker_vpp_dir -p $sock_srvr_port:$sock_srvr_port $docker_os ${docker_app_dir}${srvr_app}" >> $cmd1_file - write_script_footer $cmd1_file $perf_server - - title2="CLIENT$title_dbg (Docker-Native Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client - gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE - set_pre_cmd $emacs_client $gdb_client - write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" - echo "$get_docker_server_ip4addr" >> $cmd2_file - echo "docker run -it --cpuset-cpus='4-7' -v $vpp_dir:$docker_vpp_dir $docker_os ${docker_app_dir}${clnt_app}" >> $cmd2_file - write_script_footer $cmd2_file $perf_client + if [ -z "$multi_host" ] || [ "$multi_host" = "server" ] ; then + title1="SERVER$title_dbg (Docker-Native Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server + gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE + set_pre_cmd $emacs_server $gdb_server + write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" + echo "docker run -it --cpuset-cpus='4-7' --cpuset-cpus='4-7' -v $vpp_dir:$docker_vpp_dir -p $sock_srvr_port:$sock_srvr_port $docker_os ${docker_app_dir}${srvr_app}" >> $cmd1_file + write_script_footer $cmd1_file $perf_server + chmod +x $cmd1_file + fi - chmod +x $cmd1_file $cmd2_file + if [ -z "$multi_host" ] || [ "$multi_host" = "client" ] ; then + title2="CLIENT$title_dbg (Docker-Native Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client + gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE + set_pre_cmd $emacs_client $gdb_client + write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" + echo "$get_docker_server_ip4addr" >> $cmd2_file + echo "docker run -it --cpuset-cpus='4-7' -v $vpp_dir:$docker_vpp_dir $docker_os ${docker_app_dir}${clnt_app}" >> $cmd2_file + write_script_footer $cmd2_file $perf_client + chmod +x $cmd2_file + fi } docker_preload() { @@ -565,27 +674,35 @@ docker_preload() { gdb_cmdfile=$VPP_GDB_CMDFILE set_pre_cmd $emacs_vpp $gdb_vpp write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" + if [ -n "$multi_host" ] ; then + echo -n "sudo " >> $cmd1_file + fi echo "${pre_cmd}$vpp_dir$vpp_app $vpp_args" >> $cmd1_file write_script_footer $cmd1_file $perf_vpp - - title2="SERVER$title_dbg (Docker-Preload Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server - gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE - set_pre_cmd $emacs_server $gdb_server $docker_ld_preload_lib - write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" - echo "docker run -it --cpuset-cpus='4-7' -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $ld_preload_dir:$docker_ld_preload_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -p $sock_srvr_port:$sock_srvr_port -e VPPCOM_CONF=${docker_vppcom_conf_dir}$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir:$docker_ld_preload_dir ${docker_ld_preload}$docker_os ${docker_app_dir}${srvr_app}" >> $cmd2_file - write_script_footer $cmd2_file $perf_server - - title3="CLIENT$title_dbg (Docker-Preload Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client - gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE - set_pre_cmd $emacs_client $gdb_client $docker_ld_preload_lib - write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" - echo "$get_docker_server_ip4addr" >> $cmd3_file - echo "docker run -it --cpuset-cpus='4-7' -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $ld_preload_dir:$docker_ld_preload_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -e VPPCOM_CONF=${docker_vppcom_conf_dir}$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir ${docker_ld_preload}$docker_os ${docker_app_dir}${clnt_app}" >> $cmd3_file - write_script_footer $cmd3_file $perf_client - - chmod +x $cmd1_file $cmd2_file $cmd3_file + chmod +x $cmd1_file + + if [ -z "$multi_host" ] || [ "$multi_host" = "server" ] ; then + title2="SERVER$title_dbg (Docker-Preload Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server + gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE + set_pre_cmd $emacs_server $gdb_server $docker_ld_preload_lib + write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" + echo "docker run -it -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $ld_preload_dir:$docker_ld_preload_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -p $sock_srvr_port:$sock_srvr_port -e VPPCOM_CONF=${docker_vppcom_conf_dir}$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir:$docker_ld_preload_dir ${docker_ld_preload}$docker_os ${docker_app_dir}${srvr_app}" >> $cmd2_file + write_script_footer $cmd2_file $perf_server + chmod +x $cmd2_file + fi + + if [ -z "$multi_host" ] || [ "$multi_host" = "client" ] ; then + title3="CLIENT$title_dbg (Docker-Preload Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client + gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE + set_pre_cmd $emacs_client $gdb_client $docker_ld_preload_lib + write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" + echo "$get_docker_server_ip4addr" >> $cmd3_file + echo "docker run -it --cpuset-cpus='4-7' -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $ld_preload_dir:$docker_ld_preload_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -e VPPCOM_CONF=${docker_vppcom_conf_dir}$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir ${docker_ld_preload}$docker_os ${docker_app_dir}${clnt_app}" >> $cmd3_file + write_script_footer $cmd3_file $perf_client + chmod +x $cmd3_file + fi } docker_vcl() { @@ -598,27 +715,35 @@ docker_vcl() { gdb_cmdfile=$VPP_GDB_CMDFILE set_pre_cmd $emacs_vpp $gdb_vpp write_script_header $cmd1_file $tmp_gdb_cmdfile "$title1" + if [ -n "$multi_host" ] ; then + echo -n "sudo " >> $cmd1_file + fi echo "${pre_cmd}$vpp_dir$vpp_app $vpp_args" >> $cmd1_file write_script_footer $cmd1_file $perf_vpp - - title2="SERVER$title_dbg (Docker-VCL Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server - gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE - set_pre_cmd $emacs_server $gdb_server - write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" - echo "docker run -it --cpuset-cpus='4-7' -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -p $sock_srvr_port:$sock_srvr_port -e VPPCOM_CONF=${docker_vppcom_conf_dir}/$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir $docker_os ${docker_app_dir}${srvr_app}" >> $cmd2_file - write_script_footer $cmd2_file $perf_server - - title3="CLIENT$title_dbg (Docker-VCL Socket Test)" - tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client - gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE - set_pre_cmd $emacs_client $gdb_client - write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" - echo "$get_docker_server_ip4addr" >> $cmd3_file - echo "docker run -it --cpuset-cpus='4-7' -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -e VPPCOM_CONF=${docker_vppcom_conf_dir}/$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir $docker_os ${docker_app_dir}${clnt_app}" >> $cmd3_file - write_script_footer $cmd3_file $perf_client - - chmod +x $cmd1_file $cmd2_file $cmd3_file + chmod +x $cmd1_file + + if [ -z "$multi_host" ] || [ "$multi_host" = "server" ] ; then + title2="SERVER$title_dbg (Docker-VCL Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server + gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE + set_pre_cmd $emacs_server $gdb_server + write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" + echo "docker run -it --cpuset-cpus='4-7' -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -p $sock_srvr_port:$sock_srvr_port -e VPPCOM_CONF=${docker_vppcom_conf_dir}/$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir $docker_os ${docker_app_dir}${srvr_app}" >> $cmd2_file + write_script_footer $cmd2_file $perf_server + chmod +x $cmd2_file + fi + + if [ -z "$multi_host" ] || [ "$multi_host" = "client" ] ; then + title3="CLIENT$title_dbg (Docker-VCL Socket Test)" + tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client + gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE + set_pre_cmd $emacs_client $gdb_client + write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" + echo "$get_docker_server_ip4addr" >> $cmd3_file + echo "docker run -it --cpuset-cpus='4-7' -v $vpp_shm_dir:$vpp_shm_dir -v $vpp_dir:$docker_vpp_dir -v $lib64_dir:$docker_lib64_dir -v $vppcom_conf_dir:$docker_vppcom_conf_dir -e VPPCOM_CONF=${docker_vppcom_conf_dir}/$vppcom_conf -e LD_LIBRARY_PATH=$docker_lib64_dir $docker_os ${docker_app_dir}${clnt_app}" >> $cmd3_file + write_script_footer $cmd3_file $perf_client + chmod +x $cmd3_file + fi } if [[ $run_test ]] ; then @@ -631,14 +756,41 @@ fi if (( $(which xfce4-terminal | wc -l) > 0 )) ; then xterm_cmd="xfce4-terminal --geometry $xterm_geom" if [[ $use_tabs ]] ; then + declare -a tab_cmd_files + declare -a tab_titles + declare -i i=0 + + if [ -x "$cmd1_file" ] ; then + tab_cmd_files[$i]="$cmd1_file" + tab_titles[$i]="$title1" + (( i++ )) + fi + if [ -x "$cmd2_file" ] ; then + tab_cmd_files[$i]="$cmd2_file" + tab_titles[$i]="$title2" + (( i++ )) + fi if [ -x "$cmd3_file" ] ; then - $xterm_cmd --title "$title1" --command "$cmd1_file" --tab --title "$title2" --command "$cmd2_file" --tab --title "$title3" --command "$cmd3_file" + tab_cmd_files[$i]="$cmd3_file" + tab_titles[$i]="$title3" + fi + + if [ -n "${tab_cmd_files[2]}" ] ; then + $xterm_cmd --title "${tab_titles[0]}" --command "${tab_cmd_files[0]}" --tab --title "${tab_titles[1]}" --command "${tab_cmd_files[1]}" --tab --title "${tab_titles[2]}" --command "${tab_cmd_files[2]}" + elif [ -n "${tab_cmd_files[1]}" ] ; then + $xterm_cmd --title "${tab_titles[0]}" --command "${tab_cmd_files[0]}" --tab --title "${tab_titles[1]}" --command "${tab_cmd_files[1]}" + else - $xterm_cmd --title "$title1" --command "$cmd1_file" --tab --title "$title2" --command "$cmd2_file" + $xterm_cmd --title "${tab_titles[0]}" --command "${tab_cmd_files[0]}" fi + else - ($xterm_cmd --title "$title1" --command "$cmd1_file" &) - ($xterm_cmd --title "$title2" --command "$cmd2_file" &) + if [ -x "$cmd1_file" ] ; then + ($xterm_cmd --title "$title1" --command "$cmd1_file" &) + fi + if [ -x "$cmd2_file" ] ; then + ($xterm_cmd --title "$title2" --command "$cmd2_file" &) + fi if [ -x "$cmd3_file" ] ; then ($xterm_cmd --title "$title3" --command "$cmd3_file" &) fi @@ -649,8 +801,12 @@ else echo "Sorry, plain ol' xterm doesn't support tabs." fi xterm_cmd="xterm -fs 10 -geometry $xterm_geom" - ($xterm_cmd -title "$title1" -e "$cmd1_file" &) - ($xterm_cmd -title "$title2" -e "$cmd2_file" &) + if [ -x "$cmd1_file" ] ; then + ($xterm_cmd -title "$title1" -e "$cmd1_file" &) + fi + if [ -x "$cmd2_file" ] ; then + ($xterm_cmd -title "$title2" -e "$cmd2_file" &) + fi if [ -x "$cmd3_file" ] ; then ($xterm_cmd -title "$title3" -e "$cmd3_file" &) fi -- cgit 1.2.3-korg From 1948161b65aa89613f3b6d3714158048091a903c Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Fri, 15 Sep 2017 18:47:44 -0400 Subject: Add multi-vm Vagrantfile for vcl-test. - Existing Vagrantfile is symbolic link to the default Vagrantfile. - In order to run the multi-host vcl test, change Vagrantfile -> Vagrantfile.vcl_test - Fix socket_test.sh & vppcom bugs. Change-Id: I965b7f799135c86e989c08bf6c5909677ef38dea Signed-off-by: Dave Wallace --- extras/vagrant/Vagrantfile | 114 +----------------------------------- extras/vagrant/Vagrantfile.default | 111 +++++++++++++++++++++++++++++++++++ extras/vagrant/Vagrantfile.vcl_test | 110 ++++++++++++++++++++++++++++++++++ extras/vagrant/vcl_test.sh | 20 ++++--- src/uri/vppcom.c | 48 +++++++++------ test/scripts/socket_test.sh | 13 +++- 6 files changed, 272 insertions(+), 144 deletions(-) mode change 100644 => 120000 extras/vagrant/Vagrantfile create mode 100644 extras/vagrant/Vagrantfile.default create mode 100644 extras/vagrant/Vagrantfile.vcl_test (limited to 'extras/vagrant/Vagrantfile') diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile deleted file mode 100644 index 07db660c..00000000 --- a/extras/vagrant/Vagrantfile +++ /dev/null @@ -1,113 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure(2) do |config| - - # Pick the right distro and bootstrap, default is ubuntu1604 - distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") - if distro == 'centos7' - config.vm.box = "puppetlabs/centos-7.2-64-nocm" - config.ssh.insert_key = false - else - config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" - end - config.vm.box_check_update = false - - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" - - post_build = ( ENV['VPP_VAGRANT_POST_BUILD'] ) - if post_build == "test" - config.vm.provision "shell", inline: "echo Testing VPP; cd /vpp; make test" - elsif post_build == "install" - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") - elsif post_build == "vcl-test" - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"vcl_test.sh"), :args => "/vpp vagrant" - end - - # Add .gnupg dir in so folks can sign patches - # Note, as gnupg puts socket files in that dir, we have - # to be cautious and make sure we are dealing with a plain file - homedir = File.expand_path("~/") - Dir["#{homedir}/.gnupg/**/*"].each do |fname| - if File.file?(fname) - destname = fname.sub(Regexp.escape("#{homedir}/"),'') - config.vm.provision "file", source: fname, destination: destname - end - end - - # Copy in the .gitconfig if it exists - if File.file?(File.expand_path("~/.gitconfig")) - config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" - end - - # vagrant-cachier caches apt/yum etc to speed subsequent - # vagrant up - # to enable, run - # vagrant plugin install vagrant-cachier - # - if Vagrant.has_plugin?("vagrant-cachier") - config.cache.scope = :box - end - - # Define some physical ports for your VMs to be used by DPDK - nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) - for i in 1..nics - config.vm.network "private_network", type: "dhcp" - end - - # use http proxy if avaiable - if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") - config.proxy.http = ENV['http_proxy'] - config.proxy.https = ENV['https_proxy'] - config.proxy.no_proxy = "localhost,127.0.0.1" - end - - vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) - vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) - - config.ssh.forward_agent = true - config.ssh.forward_x11 = true - - config.vm.provider "virtualbox" do |vb| - vb.customize ["modifyvm", :id, "--ioapic", "on"] - vb.memory = "#{vmram}" - vb.cpus = "#{vmcpu}" - - # rsync the vpp directory if provision hasn't happened yet - unless File.exist? (".vagrant/machines/default/virtualbox/action_provision") - config.vm.synced_folder "../../", "/vpp", type: "rsync", - rsync__auto: false, - rsync__exclude: [ - "build-root/build*/", - "build-root/install*/", - "build-root/images*/", - "build-root/*.deb", - "build-root/*.rpm", - "build-root/*.changes", - "build-root/python", - "build-root/deb/debian/*.dkms", - "build-root/deb/debian/*.install", - "build-root/deb/debian/changes", - "build-root/tools"] - end - - #support for the SSE4.x instruction is required in some versions of VB. - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] - end - config.vm.provider "vmware_fusion" do |fusion,override| - fusion.vmx["memsize"] = "#{vmram}" - fusion.vmx["numvcpus"] = "#{vmcpu}" - end - config.vm.provider "libvirt" do |lv| - lv.memory = "#{vmram}" - lv.cpus = "#{vmcpu}" - end - config.vm.provider "vmware_workstation" do |vws,override| - vws.vmx["memsize"] = "#{vmram}" - vws.vmx["numvcpus"] = "#{vmcpu}" - end -end diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile new file mode 120000 index 00000000..a0bc2252 --- /dev/null +++ b/extras/vagrant/Vagrantfile @@ -0,0 +1 @@ +Vagrantfile.default \ No newline at end of file diff --git a/extras/vagrant/Vagrantfile.default b/extras/vagrant/Vagrantfile.default new file mode 100644 index 00000000..8d6d02a6 --- /dev/null +++ b/extras/vagrant/Vagrantfile.default @@ -0,0 +1,111 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + + # Pick the right distro and bootstrap, default is ubuntu1604 + distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") + if distro == 'centos7' + config.vm.box = "puppetlabs/centos-7.2-64-nocm" + config.ssh.insert_key = false + else + config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" + end + config.vm.box_check_update = false + + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" + + post_build = ( ENV['VPP_VAGRANT_POST_BUILD'] ) + if post_build == "test" + config.vm.provision "shell", inline: "echo Testing VPP; cd /vpp; make test" + elsif post_build == "install" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") + end + + # Add .gnupg dir in so folks can sign patches + # Note, as gnupg puts socket files in that dir, we have + # to be cautious and make sure we are dealing with a plain file + homedir = File.expand_path("~/") + Dir["#{homedir}/.gnupg/**/*"].each do |fname| + if File.file?(fname) + destname = fname.sub(Regexp.escape("#{homedir}/"),'') + config.vm.provision "file", source: fname, destination: destname + end + end + + # Copy in the .gitconfig if it exists + if File.file?(File.expand_path("~/.gitconfig")) + config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" + end + + # vagrant-cachier caches apt/yum etc to speed subsequent + # vagrant up + # to enable, run + # vagrant plugin install vagrant-cachier + # + if Vagrant.has_plugin?("vagrant-cachier") + config.cache.scope = :box + end + + # Define some physical ports for your VMs to be used by DPDK + nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) + for i in 1..nics + config.vm.network "private_network", type: "dhcp" + end + + # use http proxy if avaiable + if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] + config.proxy.no_proxy = "localhost,127.0.0.1" + end + + vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) + vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) + + config.ssh.forward_agent = true + config.ssh.forward_x11 = true + + config.vm.provider "virtualbox" do |vb| + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.memory = "#{vmram}" + vb.cpus = "#{vmcpu}" + + # rsync the vpp directory if provision hasn't happened yet + unless File.exist? (".vagrant/machines/default/virtualbox/action_provision") + config.vm.synced_folder "../../", "/vpp", type: "rsync", + rsync__auto: false, + rsync__exclude: [ + "build-root/build*/", + "build-root/install*/", + "build-root/images*/", + "build-root/*.deb", + "build-root/*.rpm", + "build-root/*.changes", + "build-root/python", + "build-root/deb/debian/*.dkms", + "build-root/deb/debian/*.install", + "build-root/deb/debian/changes", + "build-root/tools"] + end + + #support for the SSE4.x instruction is required in some versions of VB. + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] + end + config.vm.provider "vmware_fusion" do |fusion,override| + fusion.vmx["memsize"] = "#{vmram}" + fusion.vmx["numvcpus"] = "#{vmcpu}" + end + config.vm.provider "libvirt" do |lv| + lv.memory = "#{vmram}" + lv.cpus = "#{vmcpu}" + end + config.vm.provider "vmware_workstation" do |vws,override| + vws.vmx["memsize"] = "#{vmram}" + vws.vmx["numvcpus"] = "#{vmcpu}" + end +end diff --git a/extras/vagrant/Vagrantfile.vcl_test b/extras/vagrant/Vagrantfile.vcl_test new file mode 100644 index 00000000..92d6832a --- /dev/null +++ b/extras/vagrant/Vagrantfile.vcl_test @@ -0,0 +1,110 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + + # Pick the right distro and bootstrap, default is ubuntu1604 + distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") + if distro == 'centos7' + config.vm.box = "puppetlabs/centos-7.2-64-nocm" + config.ssh.insert_key = false + else + config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" + end + config.vm.box_check_update = false + + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" + + # Create VCL client and server VM's + config.vm.define "vcl-server" do |server| + server.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"vcl_test.sh"), :args => "/vpp vagrant vcl-server" + end + config.vm.define "vcl-client" do |client| + client.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"vcl_test.sh"), :args => "/vpp vagrant vcl-client" + end + + # Add .gnupg dir in so folks can sign patches + # Note, as gnupg puts socket files in that dir, we have + # to be cautious and make sure we are dealing with a plain file + homedir = File.expand_path("~/") + Dir["#{homedir}/.gnupg/**/*"].each do |fname| + if File.file?(fname) + destname = fname.sub(Regexp.escape("#{homedir}/"),'') + config.vm.provision "file", source: fname, destination: destname + end + end + + # Copy in the .gitconfig if it exists + if File.file?(File.expand_path("~/.gitconfig")) + config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" + end + + # vagrant-cachier caches apt/yum etc to speed subsequent + # vagrant up + # to enable, run + # vagrant plugin install vagrant-cachier + # + if Vagrant.has_plugin?("vagrant-cachier") + config.cache.scope = :box + end + + # Define some physical ports for your VMs to be used by DPDK + nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) + for i in 1..nics + config.vm.network "private_network", type: "dhcp" + end + + # use http proxy if avaiable + if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] + config.proxy.no_proxy = "localhost,127.0.0.1" + end + + vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) + vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) + + config.ssh.forward_agent = true + config.ssh.forward_x11 = true + + config.vm.provider "virtualbox" do |vb| + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.memory = "#{vmram}" + vb.cpus = "#{vmcpu}" + + # rsync the vpp directory if provision hasn't happened yet + unless File.exist? (".vagrant/machines/client/virtualbox/action_provision") + config.vm.synced_folder "../../", "/vpp", type: "rsync", + rsync__auto: false, + rsync__exclude: [ + "build-root/build*/", + "build-root/install*/", + "build-root/images*/", + "build-root/*.deb", + "build-root/*.rpm", + "build-root/*.changes", + "build-root/python", + "build-root/deb/debian/*.dkms", + "build-root/deb/debian/*.install", + "build-root/deb/debian/changes", + "build-root/tools"] + end + + #support for the SSE4.x instruction is required in some versions of VB. + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] + end + config.vm.provider "vmware_fusion" do |fusion,override| + fusion.vmx["memsize"] = "#{vmram}" + fusion.vmx["numvcpus"] = "#{vmcpu}" + end + config.vm.provider "libvirt" do |lv| + lv.memory = "#{vmram}" + lv.cpus = "#{vmcpu}" + end + config.vm.provider "vmware_workstation" do |vws,override| + vws.vmx["memsize"] = "#{vmram}" + vws.vmx["numvcpus"] = "#{vmcpu}" + end +end diff --git a/extras/vagrant/vcl_test.sh b/extras/vagrant/vcl_test.sh index 9fb924ae..3be18517 100644 --- a/extras/vagrant/vcl_test.sh +++ b/extras/vagrant/vcl_test.sh @@ -1,23 +1,25 @@ #!/bin/bash -# Get Command Line arguements if present -VPP_DIR=$1 -if [ "x$1" != "x" ]; then +if [ -n "$1" ]; then VPP_DIR=$1 else VPP_DIR=`dirname $0`/../../ fi -if [ "x$2" != "x" ]; then +if [ -n "$2" ]; then SUDOCMD="sudo -H -u $2" fi echo 'Building VCL test apps' cd $VPP_DIR $SUDOCMD perl -pi -e 's/noinst_PROGRAMS/bin_PROGRAMS/g' $VPP_DIR/src/uri.am -$SUDOCMD make build-release -echo "export WS_ROOT=$VPP_DIR" | sudo -H -u vagrant tee /home/vagrant/.bash_aliases -source /home/vagrant/.bash_aliases -sudo cp $VPP_DIR/src/vpp/conf/80-vpp.conf /etc/sysctl.d -sudo sysctl -p/etc/sysctl.d/80-vpp.conf +$SUDOCMD make dpdk-install-dev build-release +sudo sysctl -p$VPP_DIR/src/vpp/conf/80-vpp.conf sudo modprobe uio_pci_generic + +if [ "$2" = "vagrant" ] && [ -d "/home/vagrant" ] ; then + dot_bash_aliases="/home/$2/.bash_aliases" + echo "export WS_ROOT=$VPP_DIR" | $SUDOCMD tee $dot_bash_aliases + source $dot_bash_aliases +fi + diff --git a/src/uri/vppcom.c b/src/uri/vppcom.c index aa307f1d..8a8a806c 100644 --- a/src/uri/vppcom.c +++ b/src/uri/vppcom.c @@ -852,19 +852,15 @@ vl_api_unbind_sock_reply_t_handler (vl_api_unbind_sock_reply_t * mp) clib_spinlock_lock (&vcm->sessions_lockp); rv = vppcom_session_at_index (vcm->bind_session_index, &session); - if (PREDICT_FALSE (rv)) + if (rv == VPPCOM_OK) { - if (VPPCOM_DEBUG > 1) - clib_warning ("[%d] invalid session, sid (%d) has been closed!", - vcm->my_pid, vcm->bind_session_index); - } + if ((VPPCOM_DEBUG > 1) && (mp->retval)) + clib_warning ("[%d] unbind failed: %U", vcm->my_pid, format_api_error, + ntohl (mp->retval)); - if (mp->retval) - clib_warning ("[%d] unbind failed: %U", vcm->my_pid, format_api_error, - ntohl (mp->retval)); - - vcm->bind_session_index = ~0; - session->state = STATE_START; + vcm->bind_session_index = ~0; + session->state = STATE_START; + } clib_spinlock_unlock (&vcm->sessions_lockp); } @@ -993,6 +989,7 @@ vl_api_accept_session_t_handler (vl_api_accept_session_t * mp) unix_shared_memory_queue_t *); session->state = STATE_ACCEPT; session->is_cut_thru = 0; + session->is_server = 1; session->port = ntohs (mp->port); session->is_ip4 = mp->is_ip4; clib_memcpy (session->ip, mp->ip, sizeof (session->ip)); @@ -1277,10 +1274,6 @@ vppcom_session_disconnect (u32 session_index) vcm->my_pid, vppcom_retval_str (rv), rv); return rv; } - - clib_spinlock_lock (&vcm->sessions_lockp); - pool_put_index (vcm->sessions, session_index); - clib_spinlock_unlock (&vcm->sessions_lockp); return VPPCOM_OK; } @@ -1853,14 +1846,31 @@ vppcom_session_close (uint32_t session_index) if (session->is_cut_thru) { if (session->is_server) - rv = vppcom_session_unbind_cut_thru (session); + { + rv = vppcom_session_unbind_cut_thru (session); + if ((VPPCOM_DEBUG > 0) && (rv < 0)) + clib_warning ("[%d] unbind cut-thru (session %d) failed, " + "rv = %s (%d)", + vcm->my_pid, session_index, + vppcom_retval_str (rv), rv); + } + } + else if (session->is_server) + { + rv = vppcom_session_unbind (session_index); + if ((VPPCOM_DEBUG > 0) && (rv < 0)) + clib_warning ("[%d] unbind (session %d) failed, rv = %s (%d)", + vcm->my_pid, session_index, vppcom_retval_str (rv), rv); } else { - rv = (session->is_server) ? - vppcom_session_unbind (session_index) : - vppcom_session_disconnect (session_index); + rv = vppcom_session_disconnect (session_index); + if ((VPPCOM_DEBUG > 0) && (rv < 0)) + clib_warning ("[%d] disconnect (session %d) failed, rv = %s (%d)", + vcm->my_pid, session_index, vppcom_retval_str (rv), rv); } + if (rv < 0) + return rv; clib_spinlock_lock (&vcm->sessions_lockp); pool_put_index (vcm->sessions, session_index); diff --git a/test/scripts/socket_test.sh b/test/scripts/socket_test.sh index 8c3f20a2..1573b48a 100755 --- a/test/scripts/socket_test.sh +++ b/test/scripts/socket_test.sh @@ -9,7 +9,7 @@ vpp_shm_dir="/dev/shm/" vpp_run_dir="/run/vpp" lib64_dir="$WS_ROOT/build-root/install-vpp-native/vpp/lib64/" lib64_debug_dir="$WS_ROOT/build-root/install-vpp_debug-native/vpp/lib64/" -dpdk_devbind="$WS_ROOT/build-root/install-vpp-native/dpdk/share/dpdk/usertools/dpdk-devbind.py" +dpdk_devbind="/usr/share/dpdk/usertools/dpdk-devbind.py" docker_vpp_dir="/vpp/" docker_app_dir="/vpp/" docker_lib64_dir="/vpp-lib64/" @@ -302,6 +302,13 @@ if [[ $run_test =~ .*"_vcl" ]] && [ $iperf3 -eq 1 ] ; then env_test_failed="true" fi +if [ -n "$mult_host"] && [ ! -f "$dpdk_devbind" ] ; then + echo "ERROR: Can't find dpdk-devbind.py!" + echo " Run \"cd \$WS_ROOT; make dpdk-install-dev\" to install it." + echo + env_test_failed="true" +fi + if [ -n "$env_test_failed" ] ; then exit 1 fi @@ -458,8 +465,8 @@ write_script_header() { echo "$bash_header" > $1 echo -e "#\n# $1 generated on $(date)\n#" >> $1 if [ $leave_tmp_files -eq 0 ] ; then - if [ -n "$multi_host" ] ; then - echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file; sudo $dpdk_devbind -e $vpp_eth_kernel_driver $vpp_eth_pci_id; sudo ifup $vpp_eth_name\" $trap_signals" >> $1 + if [ -n "$multi_host" ] && [[ "$3" == VPP* ]] ; then + echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file; sudo $dpdk_devbind -b $vpp_eth_kernel_driver $vpp_eth_pci_id; sudo ifup $vpp_eth_name\" $trap_signals" >> $1 else echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file\" $trap_signals" >> $1 fi -- cgit 1.2.3-korg From d4c623eea44ed779b044edb706858044300ccb44 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Mon, 25 Sep 2017 16:12:16 -0400 Subject: Vagrant fails if Vagrantfile is a symlink on Windows 10. - Revert Vagrantfile symlink to the default - Update README and env.sh Change-Id: Ib1a557b897e0217b162c31118a4c265769dd1760 Signed-off-by: Dave Wallace --- extras/vagrant/README | 23 ++++++-- extras/vagrant/Vagrantfile | 112 ++++++++++++++++++++++++++++++++++++- extras/vagrant/Vagrantfile.default | 111 ------------------------------------ extras/vagrant/env.sh | 2 +- 4 files changed, 131 insertions(+), 117 deletions(-) mode change 120000 => 100644 extras/vagrant/Vagrantfile delete mode 100644 extras/vagrant/Vagrantfile.default (limited to 'extras/vagrant/Vagrantfile') diff --git a/extras/vagrant/README b/extras/vagrant/README index 238c90ce..4b7c7aa1 100644 --- a/extras/vagrant/README +++ b/extras/vagrant/README @@ -4,21 +4,21 @@ This is a vagrant environment for VPP. VPP currently works under Linux and has support for: -- Ubuntu 14.04, Ubuntu 16.04 and Centos7.2 +- Ubuntu 16.04 and Centos7.2 The VM builds VPP from source which can be located at /vpp VM PARTICULARS: This vagrant environment creates a VM based on environment variables found in ./env.sh -To use, edit env.sh then +To customize the vm for your use case, edit env.sh then source ./env.sh vagrant up By default, the VM created is/has: -- Ubuntu 14.04 +- Ubuntu 16.04 - 2 vCPUs - 4G of RAM -- 2 NICs (1 x NAT - host access, 1 x VPP DPDK enabled) +- 3 NICs (1 x NAT - host access, 2 x VPP DPDK enabled) PROVIDERS: @@ -26,3 +26,18 @@ Supported vagrant providers are: - Virtualbox, VMware Fusion/Workstation, Libvirt +ALTERNATE CONFIGURATIONS + +The following Vagrantfiles provide alternate configurations for specific testing purposes. To use them, + +1. Copy the desired configuration to Vagrantfile +2. Run "vagrant up" +3. vagrant ssh + +When testing is complete +4. Run "vagrant destroy" to stop the VM's and delete files. +5. Run "git checkout -- Vagrantfile" to restore the default configuration + +Available Vagrantfiles: + +Vagrantfile.vcl_test - Create two vm's for multi-host VppCommLib testing diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile deleted file mode 120000 index a0bc2252..00000000 --- a/extras/vagrant/Vagrantfile +++ /dev/null @@ -1 +0,0 @@ -Vagrantfile.default \ No newline at end of file diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile new file mode 100644 index 00000000..8d6d02a6 --- /dev/null +++ b/extras/vagrant/Vagrantfile @@ -0,0 +1,111 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + + # Pick the right distro and bootstrap, default is ubuntu1604 + distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") + if distro == 'centos7' + config.vm.box = "puppetlabs/centos-7.2-64-nocm" + config.ssh.insert_key = false + else + config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" + end + config.vm.box_check_update = false + + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" + + post_build = ( ENV['VPP_VAGRANT_POST_BUILD'] ) + if post_build == "test" + config.vm.provision "shell", inline: "echo Testing VPP; cd /vpp; make test" + elsif post_build == "install" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") + end + + # Add .gnupg dir in so folks can sign patches + # Note, as gnupg puts socket files in that dir, we have + # to be cautious and make sure we are dealing with a plain file + homedir = File.expand_path("~/") + Dir["#{homedir}/.gnupg/**/*"].each do |fname| + if File.file?(fname) + destname = fname.sub(Regexp.escape("#{homedir}/"),'') + config.vm.provision "file", source: fname, destination: destname + end + end + + # Copy in the .gitconfig if it exists + if File.file?(File.expand_path("~/.gitconfig")) + config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" + end + + # vagrant-cachier caches apt/yum etc to speed subsequent + # vagrant up + # to enable, run + # vagrant plugin install vagrant-cachier + # + if Vagrant.has_plugin?("vagrant-cachier") + config.cache.scope = :box + end + + # Define some physical ports for your VMs to be used by DPDK + nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) + for i in 1..nics + config.vm.network "private_network", type: "dhcp" + end + + # use http proxy if avaiable + if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] + config.proxy.no_proxy = "localhost,127.0.0.1" + end + + vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) + vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) + + config.ssh.forward_agent = true + config.ssh.forward_x11 = true + + config.vm.provider "virtualbox" do |vb| + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.memory = "#{vmram}" + vb.cpus = "#{vmcpu}" + + # rsync the vpp directory if provision hasn't happened yet + unless File.exist? (".vagrant/machines/default/virtualbox/action_provision") + config.vm.synced_folder "../../", "/vpp", type: "rsync", + rsync__auto: false, + rsync__exclude: [ + "build-root/build*/", + "build-root/install*/", + "build-root/images*/", + "build-root/*.deb", + "build-root/*.rpm", + "build-root/*.changes", + "build-root/python", + "build-root/deb/debian/*.dkms", + "build-root/deb/debian/*.install", + "build-root/deb/debian/changes", + "build-root/tools"] + end + + #support for the SSE4.x instruction is required in some versions of VB. + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] + vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] + end + config.vm.provider "vmware_fusion" do |fusion,override| + fusion.vmx["memsize"] = "#{vmram}" + fusion.vmx["numvcpus"] = "#{vmcpu}" + end + config.vm.provider "libvirt" do |lv| + lv.memory = "#{vmram}" + lv.cpus = "#{vmcpu}" + end + config.vm.provider "vmware_workstation" do |vws,override| + vws.vmx["memsize"] = "#{vmram}" + vws.vmx["numvcpus"] = "#{vmcpu}" + end +end diff --git a/extras/vagrant/Vagrantfile.default b/extras/vagrant/Vagrantfile.default deleted file mode 100644 index 8d6d02a6..00000000 --- a/extras/vagrant/Vagrantfile.default +++ /dev/null @@ -1,111 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure(2) do |config| - - # Pick the right distro and bootstrap, default is ubuntu1604 - distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") - if distro == 'centos7' - config.vm.box = "puppetlabs/centos-7.2-64-nocm" - config.ssh.insert_key = false - else - config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" - end - config.vm.box_check_update = false - - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" - - post_build = ( ENV['VPP_VAGRANT_POST_BUILD'] ) - if post_build == "test" - config.vm.provision "shell", inline: "echo Testing VPP; cd /vpp; make test" - elsif post_build == "install" - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") - end - - # Add .gnupg dir in so folks can sign patches - # Note, as gnupg puts socket files in that dir, we have - # to be cautious and make sure we are dealing with a plain file - homedir = File.expand_path("~/") - Dir["#{homedir}/.gnupg/**/*"].each do |fname| - if File.file?(fname) - destname = fname.sub(Regexp.escape("#{homedir}/"),'') - config.vm.provision "file", source: fname, destination: destname - end - end - - # Copy in the .gitconfig if it exists - if File.file?(File.expand_path("~/.gitconfig")) - config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" - end - - # vagrant-cachier caches apt/yum etc to speed subsequent - # vagrant up - # to enable, run - # vagrant plugin install vagrant-cachier - # - if Vagrant.has_plugin?("vagrant-cachier") - config.cache.scope = :box - end - - # Define some physical ports for your VMs to be used by DPDK - nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) - for i in 1..nics - config.vm.network "private_network", type: "dhcp" - end - - # use http proxy if avaiable - if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") - config.proxy.http = ENV['http_proxy'] - config.proxy.https = ENV['https_proxy'] - config.proxy.no_proxy = "localhost,127.0.0.1" - end - - vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) - vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) - - config.ssh.forward_agent = true - config.ssh.forward_x11 = true - - config.vm.provider "virtualbox" do |vb| - vb.customize ["modifyvm", :id, "--ioapic", "on"] - vb.memory = "#{vmram}" - vb.cpus = "#{vmcpu}" - - # rsync the vpp directory if provision hasn't happened yet - unless File.exist? (".vagrant/machines/default/virtualbox/action_provision") - config.vm.synced_folder "../../", "/vpp", type: "rsync", - rsync__auto: false, - rsync__exclude: [ - "build-root/build*/", - "build-root/install*/", - "build-root/images*/", - "build-root/*.deb", - "build-root/*.rpm", - "build-root/*.changes", - "build-root/python", - "build-root/deb/debian/*.dkms", - "build-root/deb/debian/*.install", - "build-root/deb/debian/changes", - "build-root/tools"] - end - - #support for the SSE4.x instruction is required in some versions of VB. - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] - end - config.vm.provider "vmware_fusion" do |fusion,override| - fusion.vmx["memsize"] = "#{vmram}" - fusion.vmx["numvcpus"] = "#{vmcpu}" - end - config.vm.provider "libvirt" do |lv| - lv.memory = "#{vmram}" - lv.cpus = "#{vmcpu}" - end - config.vm.provider "vmware_workstation" do |vws,override| - vws.vmx["memsize"] = "#{vmram}" - vws.vmx["numvcpus"] = "#{vmcpu}" - end -end diff --git a/extras/vagrant/env.sh b/extras/vagrant/env.sh index f0edfd88..bd329ea7 100644 --- a/extras/vagrant/env.sh +++ b/extras/vagrant/env.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export VPP_VAGRANT_DISTRO="ubuntu1404" +export VPP_VAGRANT_DISTRO="ubuntu1604" export VPP_VAGRANT_NICS=2 export VPP_VAGRANT_VMCPU=4 export VPP_VAGRANT_VMRAM=4096 -- cgit 1.2.3-korg From d51020cdfc1c023f1953a7b6970f12cf09985900 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Tue, 26 Sep 2017 18:15:47 -0400 Subject: Update vagrant centos config to CentOS 7.4 Change-Id: I45c1227b53ba9e57b94f1bc68de939cd3ce9d619 Signed-off-by: Dave Wallace --- extras/vagrant/Vagrantfile | 3 ++- extras/vagrant/Vagrantfile.vcl_test | 3 ++- extras/vagrant/update.sh | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'extras/vagrant/Vagrantfile') diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile index 8d6d02a6..714ba94c 100644 --- a/extras/vagrant/Vagrantfile +++ b/extras/vagrant/Vagrantfile @@ -6,7 +6,8 @@ Vagrant.configure(2) do |config| # Pick the right distro and bootstrap, default is ubuntu1604 distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") if distro == 'centos7' - config.vm.box = "puppetlabs/centos-7.2-64-nocm" + config.vm.box = "centos/7" + config.vm.box_version = "1708.01" config.ssh.insert_key = false else config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" diff --git a/extras/vagrant/Vagrantfile.vcl_test b/extras/vagrant/Vagrantfile.vcl_test index 92d6832a..d0559424 100644 --- a/extras/vagrant/Vagrantfile.vcl_test +++ b/extras/vagrant/Vagrantfile.vcl_test @@ -6,7 +6,8 @@ Vagrant.configure(2) do |config| # Pick the right distro and bootstrap, default is ubuntu1604 distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604") if distro == 'centos7' - config.vm.box = "puppetlabs/centos-7.2-64-nocm" + config.vm.box = "centos/7" + config.vm.box_version = "1708.01" config.ssh.insert_key = false else config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" diff --git a/extras/vagrant/update.sh b/extras/vagrant/update.sh index b6304492..b4962bfc 100755 --- a/extras/vagrant/update.sh +++ b/extras/vagrant/update.sh @@ -42,6 +42,11 @@ if [ $DISTRIB_ID == "Ubuntu" ]; then # Install useful but non-mandatory tools apt-get install -y emacs x11-utils git-review gdb gdbserver xfce4-terminal iperf3 elif [ $DISTRIB_ID == "CentOS" ]; then + if [ "$(echo $DISTRIB_RELEASE | cut -d'.' -f1)" == "7" ]; then + rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + yum groupinstall "X Window system" -y + yum groupinstall xfce -y + fi # Standard update + upgrade dance yum check-update yum update -y -- cgit 1.2.3-korg