From cb9cadad578297ffd78fa8a33670bdf1ab669e7e Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 8 Dec 2015 15:45:58 -0700 Subject: Initial commit of vpp code. Change-Id: Ib246f1fbfce93274020ee93ce461e3d8bd8b9f17 Signed-off-by: Ed Warnicke --- build-root/vagrant/.gitignore | 1 + build-root/vagrant/README | 54 +++++++++++++++++++++ build-root/vagrant/Vagrantfile | 36 ++++++++++++++ build-root/vagrant/bootstrap.centos7.sh | 45 +++++++++++++++++ build-root/vagrant/bootstrap.ubuntu1404.sh | 77 ++++++++++++++++++++++++++++++ 5 files changed, 213 insertions(+) create mode 100644 build-root/vagrant/.gitignore create mode 100644 build-root/vagrant/README create mode 100644 build-root/vagrant/Vagrantfile create mode 100644 build-root/vagrant/bootstrap.centos7.sh create mode 100644 build-root/vagrant/bootstrap.ubuntu1404.sh (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/.gitignore b/build-root/vagrant/.gitignore new file mode 100644 index 00000000..a977916f --- /dev/null +++ b/build-root/vagrant/.gitignore @@ -0,0 +1 @@ +.vagrant/ diff --git a/build-root/vagrant/README b/build-root/vagrant/README new file mode 100644 index 00000000..04986154 --- /dev/null +++ b/build-root/vagrant/README @@ -0,0 +1,54 @@ +To run vpp with the debug shell: + +sudo ~vagrant/git/vpp/build-root/install-vpp_debug-native/vpp/bin/vpe unix interactive + +which will result in a prompt that looks like: + +DBGvpd# + +To give it a spin, we can create a tap interface and try a simple ping +(with trace). + +To create the tap: + +DBGvpd# tap connect foobar +Created tap-0 for Linux tap 'foobar' +DBGvpd# show int + +To assign it an ip address (and 'up' the interface): + +DBGvpd# set int ip address tap-0 192.168.1.1/24 +DBGvpd# set int state tap-0 up + +To turn on packet tracing for the tap interface: +DBGvpd# trace add tapcli-rx 10 + +Now, to set up and try the other end from the unix prompt: +vagrant@vagrant-ubuntu-trusty-64:~$ sudo ip addr add 192.168.1.2/24 dev foobar +vagrant@vagrant-ubuntu-trusty-64:~$ ping -c 3 192.168.1.1 + +To look at the trace, back in the vpp CLI: +DBGvpd# show trace + +And to stop tracing: + +DBGvpd# clear trace + +Other fun things to look at: + +The vlib packet processing graph: +DBGvpd# show vlib graph + +which will produce output like: + + Name Next Previous +ip4-icmp-input error-punt [0] ip4-local + ip4-icmp-echo-request [1] + vpe-icmp4-oam [2] + +To read this, the first column (Name) is the name of the node. +The second column (Next) is the name of the children of that node. +The third column (Previous) is the name of the parents of this node. + +To see this README again: +cat /vagrant/README \ No newline at end of file diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile new file mode 100644 index 00000000..9c61dd33 --- /dev/null +++ b/build-root/vagrant/Vagrantfile @@ -0,0 +1,36 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + + # Pick the right distro and bootstrap, default is ubuntu1404 + distro = ENV['VPP_VAGRANT_DISTRO'] + if distro == 'centos7' + config.vm.box = "puppetlabs/centos-7.0-64-nocm" + config.vm.provision 'shell', path: 'bootstrap.centos7.sh' + else + config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" + config.vm.provision 'shell', path: 'bootstrap.ubuntu1404.sh' + 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 + + config.vm.synced_folder "../../", "/vpp", disabled: false + config.vm.provider "virtualbox" do |vb| + vb.memory = "4096" + end + config.vm.provider "vmware_fusion" do |fusion,override| + fusion.vmx["memsize"] = "4096" + end + config.vm.provider "vmware_workstation" do |vws,override| + vws.vmx["memsize"] = "8192" + vws.vmx["numvcpus"] = "4" + end +end diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh new file mode 100644 index 00000000..1d811e45 --- /dev/null +++ b/build-root/vagrant/bootstrap.centos7.sh @@ -0,0 +1,45 @@ + +# Standard update + upgrade dance +yum check-update +yum update -y + +# Install build tools +yum groupinstall 'Development Tools' -y +yum install openssl-devel -y +yum install glibc-static -y + +# Install jdk and maven +yum install -y java-1.8.0-openjdk-devel + +# Load the uio kernel module +modprobe uio_pci_generic + +echo uio_pci_generic >> /etc/modules-load.d/uio_pci_generic.conf + +# Setup for hugepages using upstart so it persists across reboots +sysctl -w vm.nr_hugepages=1024 +echo "vm.nr_hugepages=1024" >> /etc/sysctl.conf +mkdir -p /mnt/huge +echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab +mount /mnt/huge + +# Setup the vpp code +cd ~vagrant/ +sudo -u vagrant mkdir git +cd git/ + +# You will need to alter this line to reflect reality. +sudo -H -u vagrant git clone /vpp +cd vpp + +# Initial vpp build +if [ -d build-root ]; then + # Bootstrap vpp + cd build-root/ + sudo -H -u vagrant ./bootstrap.sh + + # Build vpp + sudo -H -u vagrant make PLATFORM=vpp TAG=vpp_debug install-packages + cd ~vagrant/ + cat /vagrant/README +fi diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh new file mode 100644 index 00000000..c89f098c --- /dev/null +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -0,0 +1,77 @@ +# Standard update + upgrade dance +apt-get update +apt-get upgrade -y + +# Fix the silly notion that /bin/sh should point to dash by pointing it to bash + +sudo update-alternatives --install /bin/sh sh /bin/bash 100 + +# Install build tools +apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper + +# Install other stuff +# apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils + +# Install uio +apt-get install -y linux-image-extra-`uname -r` + +# Install jdk and maven +apt-get install -y openjdk-7-jdk +# $$$ comment out for the moment +# apt-get install -y --force-yes maven3 + +# Install debian packaging tools +apt-get install -y debhelper dkms + +# Setup for hugepages using upstart so it persists across reboots +echo "vm.nr_hugepages=1024" >> /etc/sysctl.d/20-hugepages.conf +sysctl --system + +cat << EOF > /etc/init/hugepages.conf +start on runlevel [2345] + +task + +script + mkdir -p /run/hugepages/kvm || true + rm -f /run/hugepages/kvm/* || true + rm -f /dev/shm/* || true + mount -t hugetlbfs nodev /run/hugepages/kvm +end script +EOF + +# Make sure we run that hugepages.conf right now +start hugepages + +# Setup the vpp code +cd ~vagrant/ +sudo -u vagrant mkdir git +cd git/ + +# You will need to alter this line to reflect reality. +sudo -H -u vagrant git clone /vpp +cd vpp/ + +# Initial vpp build +if [ -d build-root ]; then + # Bootstrap vpp + cd build-root/ + sudo -H -u vagrant ./bootstrap.sh + + # Build vpp + sudo -H -u vagrant make PLATFORM=vpp TAG=vpp_debug install-deb + + # Stick the dpdk module in the canonical place + cp ./install-vpp_debug-native/dpdk/kmod/igb_uio.ko /lib/modules/`uname -r`/kernel/drivers/uio/ + depmod + + # Load igb_uio into the kernel + modprobe igb_uio + + # Make sure igb_uio loads at boot time + # Make sure uio loads at boot time + echo igb_uio >> /lib/modprobe.d/igb_uio.conf + cd ~vagrant/ + cat /vagrant/README + +fi -- cgit 1.2.3-korg From b73f2675c79e2a5eed198579bb181bbb472d4817 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Mon, 14 Dec 2015 16:08:45 -0700 Subject: Fix to make it easy to use http proxy with Vagrant Many thanks to Keith Burns for the suggestion. Change-Id: Iae52c8afd43357e955825fbafbad057c0e6a97c7 Signed-off-by: Ed Warnicke --- build-root/vagrant/Vagrantfile | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 9c61dd33..4e2669b5 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -22,6 +22,13 @@ Vagrant.configure(2) do |config| config.cache.scope = :box end + # use http proxy if avaiable + if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = "$http_proxy" + config.proxy.https = "$https_proxy" + config.proxy.no_proxy = "localhost,127.0.0.1" + end + config.vm.synced_folder "../../", "/vpp", disabled: false config.vm.provider "virtualbox" do |vb| vb.memory = "4096" -- cgit 1.2.3-korg From b463ec886b6639cc072d7aaf584cffa23d9b6ea6 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 22 Dec 2015 20:04:54 -0700 Subject: Update vagrant/ to install vpp packages and use vppctl Change-Id: I30f0cb52152bed174fa82a09fb8584c193df4d2c Signed-off-by: Ed Warnicke --- build-root/vagrant/README | 43 +++++++++++++++++------------- build-root/vagrant/bootstrap.ubuntu1404.sh | 12 +++------ 2 files changed, 29 insertions(+), 26 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README b/build-root/vagrant/README index 04986154..05a3c652 100644 --- a/build-root/vagrant/README +++ b/build-root/vagrant/README @@ -1,43 +1,50 @@ -To run vpp with the debug shell: +VPP has now been built, installed, and started. -sudo ~vagrant/git/vpp/build-root/install-vpp_debug-native/vpp/bin/vpe unix interactive +To give it a spin, we can create a tap interface and try a simple ping +(with trace). -which will result in a prompt that looks like: +Make sure you have run: -DBGvpd# +$ vagrant ssh -To give it a spin, we can create a tap interface and try a simple ping -(with trace). +To get to the vagrant VM: + +vagrant@localhost:~$ + +Confirm that vpp is running with + +vagrant@localhost:~$ sudo status vpp +vpp start/running, process 25202 To create the tap: -DBGvpd# tap connect foobar +vagrant@localhost:~$ sudo vppctl tap connect foobar Created tap-0 for Linux tap 'foobar' -DBGvpd# show int +vagrant@localhost:~$ sudo vppctl show int To assign it an ip address (and 'up' the interface): -DBGvpd# set int ip address tap-0 192.168.1.1/24 -DBGvpd# set int state tap-0 up +vagrant@localhost:~$ sudo vppctl set int ip address tap-0 192.168.1.1/24 +vagrant@localhost:~$ sudo vppctl set int state tap-0 up To turn on packet tracing for the tap interface: -DBGvpd# trace add tapcli-rx 10 +vagrant@localhost:~$ sudo vppctl trace add tapcli-rx 10 -Now, to set up and try the other end from the unix prompt: -vagrant@vagrant-ubuntu-trusty-64:~$ sudo ip addr add 192.168.1.2/24 dev foobar -vagrant@vagrant-ubuntu-trusty-64:~$ ping -c 3 192.168.1.1 +Now, to set up and try the other end: +vagrant@localhost:~$ sudo ip addr add 192.168.1.2/24 dev foobar +vagrant@localhost:~$ ping -c 3 192.168.1.1 -To look at the trace, back in the vpp CLI: -DBGvpd# show trace +To look at the trace: +vagrant@localhost:~$ sudo vppctl show trace And to stop tracing: -DBGvpd# clear trace +vagrant@localhost:~$ sudo vppctl clear trace Other fun things to look at: The vlib packet processing graph: -DBGvpd# show vlib graph +vagrant@localhost:~$ sudo vppctl show vlib graph which will produce output like: diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index c89f098c..89cd4e8e 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -61,16 +61,12 @@ if [ -d build-root ]; then # Build vpp sudo -H -u vagrant make PLATFORM=vpp TAG=vpp_debug install-deb - # Stick the dpdk module in the canonical place - cp ./install-vpp_debug-native/dpdk/kmod/igb_uio.ko /lib/modules/`uname -r`/kernel/drivers/uio/ - depmod + # Install debian packages + dpkg -i *.deb - # Load igb_uio into the kernel - modprobe igb_uio + # Start vpp + start vpp - # Make sure igb_uio loads at boot time - # Make sure uio loads at boot time - echo igb_uio >> /lib/modprobe.d/igb_uio.conf cd ~vagrant/ cat /vagrant/README -- cgit 1.2.3-korg From 3b566bb613ff918e5a016a190cb2efcfdea02f5f Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Mon, 11 Jan 2016 12:16:46 -0800 Subject: Fix vagrant grub issue with ubuntu & virtualbox Change-Id: I8ff952a02c9c51070c41bdca72fb4f7ed8a7c8ba Signed-off-by: Matt Johnson --- build-root/vagrant/bootstrap.ubuntu1404.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index 89cd4e8e..18023010 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -1,3 +1,6 @@ +# Fix grub-pc on Virtualbox with Ubuntu +export DEBIAN_FRONTEND=noninteractive + # Standard update + upgrade dance apt-get update apt-get upgrade -y @@ -7,7 +10,7 @@ apt-get upgrade -y sudo update-alternatives --install /bin/sh sh /bin/bash 100 # Install build tools -apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper +apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs # Install other stuff # apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils -- cgit 1.2.3-korg From 1d3be19c77e965309ba7f2fd43994b4a7952aade Mon Sep 17 00:00:00 2001 From: Vincent JARDIN Date: Thu, 14 Jan 2016 17:01:08 -0800 Subject: build - Vagrant template to get more emulated PCI NICs For some testing, it an be usefull to have more physical NICS that DPDK's PMDs can bind to. Example to run vpp within a VM with 3 emulated NICs: export VPP_VAGRANT_NICS=3 vagrant up Change-Id: I82d70f21c0a9ceba126ab6620c3b869d590d8de1 Signed-off-by: Vincent JARDIN --- build-root/vagrant/Vagrantfile | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 4e2669b5..f00233d6 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -22,6 +22,15 @@ Vagrant.configure(2) do |config| config.cache.scope = :box end + # Define some physical ports for your VMs to be used by DPDK + nics = 0 + if ENV.key?('VPP_VAGRANT_NICS') + nics = ENV['VPP_VAGRANT_NICS'].to_i(10) + end + 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 = "$http_proxy" -- cgit 1.2.3-korg From c23f7bc9a1602b069faba8e559e24bb859476276 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Thu, 28 Jan 2016 09:36:05 -0500 Subject: vpp metrics upload via gmond plugin The gmond module (gmod) isn't built by default, pending CentOS packaging work. Change-Id: I78493a60f431cf9924a28d31ba29423a03aa79b3 Signed-off-by: Dave Barach --- build-data/packages/gmod.mk | 9 ++ build-root/vagrant/bootstrap.ubuntu1404.sh | 2 +- gmod/Makefile.am | 27 ++++++ gmod/configure.ac | 9 ++ gmod/gmod/mod_vpp.c | 138 +++++++++++++++++++++++++++++ gmod/gmod/vpp.conf | 26 ++++++ 6 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 build-data/packages/gmod.mk create mode 100644 gmod/Makefile.am create mode 100644 gmod/configure.ac create mode 100644 gmod/gmod/mod_vpp.c create mode 100644 gmod/gmod/vpp.conf (limited to 'build-root/vagrant') diff --git a/build-data/packages/gmod.mk b/build-data/packages/gmod.mk new file mode 100644 index 00000000..62b31d42 --- /dev/null +++ b/build-data/packages/gmod.mk @@ -0,0 +1,9 @@ +gmod_configure_depend = vppinfra-install svm-install + +gmod_configure_args = # --libdir=$(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/ganglia + +gmod_CPPFLAGS = $(call installed_includes_fn, vppinfra svm) +gmod_CPPFLAGS += -I/usr/include/apr-1.0 +gmod_LDFLAGS = $(call installed_libs_fn, vppinfra svm) + +gmod_image_include = echo $(arch_lib_dir)/ganglia/libgmodvpp.so etc diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index 18023010..04f341a4 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -10,7 +10,7 @@ apt-get upgrade -y sudo update-alternatives --install /bin/sh sh /bin/bash 100 # Install build tools -apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs +apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev # Install other stuff # apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils diff --git a/gmod/Makefile.am b/gmod/Makefile.am new file mode 100644 index 00000000..e57f5788 --- /dev/null +++ b/gmod/Makefile.am @@ -0,0 +1,27 @@ +# Copyright (c) 2015 Cisco and/or its affiliates. +# 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. + +AUTOMAKE_OPTIONS = foreign subdir-objects + +AM_CFLAGS = -Wall + +lib_LTLIBRARIES = libgmodvpp.la + +libgmodvpp_la_SOURCES = gmod/mod_vpp.c + +libgmodvpp_la_LDFLAGS = -module -avoid-version + +libgmodvpp_la_LIBADD = -lsvm -lsvmdb -lvppinfra + +gconfdir = $(prefix)/etc/conf.d +gconf_DATA = gmod/vpp.conf diff --git a/gmod/configure.ac b/gmod/configure.ac new file mode 100644 index 00000000..c26ca055 --- /dev/null +++ b/gmod/configure.ac @@ -0,0 +1,9 @@ +AC_INIT(gmod, 1.0) +AM_INIT_AUTOMAKE + +AC_PROG_LIBTOOL +AM_PROG_AS +AC_PROG_CC +AM_PROG_CC_C_O + +AC_OUTPUT([Makefile]) diff --git a/gmod/gmod/mod_vpp.c b/gmod/gmod/mod_vpp.c new file mode 100644 index 00000000..951d3528 --- /dev/null +++ b/gmod/gmod/mod_vpp.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +mmodule vpp_module; +static svmdb_client_t *svmdb_client; + +static int vpp_metric_init (apr_pool_t *p) +{ + const char* str_params = vpp_module.module_params; + apr_array_header_t *list_params = vpp_module.module_params_list; + mmparam *params; + char *chroot_path = 0; + int i; + + if (str_params) { + debug_msg("[mod_vpp]Received string params: %s", str_params); + } + /* Multiple name/value pair parameters. */ + if (list_params) { + debug_msg("[mod_vpp]Received following params list: "); + params = (mmparam*) list_params->elts; + for(i=0; i< list_params->nelts; i++) { + debug_msg("\tParam: %s = %s", params[i].name, params[i].value); + } + } + + svmdb_client = svmdb_map_chroot (chroot_path); + + + /* Initialize the metadata storage for each of the metrics and then + * store one or more key/value pairs. The define MGROUPS defines + * the key for the grouping attribute. */ + for (i = 0; vpp_module.metrics_info[i].name != NULL; i++) { + MMETRIC_INIT_METADATA(&(vpp_module.metrics_info[i]),p); + MMETRIC_ADD_METADATA(&(vpp_module.metrics_info[i]),MGROUP,"VPP"); + } + + return 0; +} + +static void vpp_metric_cleanup (void) +{ + svmdb_unmap (svmdb_client); +} + +static g_val_t vpp_metric_handler (int metric_index) +{ + g_val_t val; + pid_t *vpp_pidp; + f64 *vector_ratep, *vpp_rx_ratep; + + switch (metric_index) { + case 0: + vector_ratep = svmdb_local_get_vec_variable + (svmdb_client, "vlib_vector_rate", sizeof (*vector_ratep)); + if (vector_ratep) { + val.d = *vector_ratep; + vec_free (vector_ratep); + } + else + val.d = 0.0; + break; + case 1: + vpp_pidp = svmdb_local_get_vec_variable + (svmdb_client, + "vpp_pid", sizeof (*vpp_pidp)); + if (vpp_pidp && *vpp_pidp) { + if (kill(*vpp_pidp, 0) == 0 || errno != ESRCH) { + val.d = 1.0; + } else { + val.d = 0.0; + } + vec_free (vpp_pidp); + } else + val.d = 0; + break; + + case 2: + vpp_rx_ratep = svmdb_local_get_vec_variable + (svmdb_client, "vnet_input_rate", sizeof (*vector_ratep)); + if (vpp_rx_ratep) { + val.d = *vpp_rx_ratep; + vec_free (vpp_rx_ratep); + } else + val.d = 0.0; + break; + + default: + val.d = 0.0; + } + + return val; +} + +static Ganglia_25metric vpp_metric_info[] = +{ + {0, "Vector_Rate", 100, GANGLIA_VALUE_DOUBLE, "Packets/Frame", + "both", "%.1f", + UDP_HEADER_SIZE+8, "VPP Vector Rate"}, + {0, "VPP_State", 100, GANGLIA_VALUE_DOUBLE, "Run=1", "both", "%.0f", + UDP_HEADER_SIZE+8, "VPP State"}, + {0, "Input_Rate", 100, GANGLIA_VALUE_DOUBLE, "5 sec RX rate", + "both", "%.1f", + UDP_HEADER_SIZE+8, "VPP Aggregate RX Rate"}, + {0, NULL} +}; + +mmodule vpp_module = +{ + STD_MMODULE_STUFF, + vpp_metric_init, + vpp_metric_cleanup, + vpp_metric_info, + vpp_metric_handler, +}; diff --git a/gmod/gmod/vpp.conf b/gmod/gmod/vpp.conf new file mode 100644 index 00000000..6df20ed1 --- /dev/null +++ b/gmod/gmod/vpp.conf @@ -0,0 +1,26 @@ +modules { + module { + name = "vpp_module" + path = "libgmodvpp.so" + } +} + +collection_group { + collect_every = 2 + time_threshold = 10 + metric { + name = "Vector_Rate" + value_threshold = 20.0 + title = "Vector Rate" + } + metric { + name = "VPP_State" + value_threshold = 0.5 + title = "VPP State" + } + metric { + name = "Input_Rate" + value_threshold = 10000.0 + title = "VPP Aggregate RX rate" + } +} -- cgit 1.2.3-korg From f5a857d52c5810d1360cff213d8c1f34ce8ef4d0 Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Sun, 31 Jan 2016 20:53:46 +0100 Subject: Vagrantfile doesn't rm git/vpp and vagrant reload --provision result is not expected. ie don't get updates - only applied ubuntu changes in this patch. Change-Id: I194f5120734d63f1b815f86bb510f0c0981dd89b Signed-off-by: Keith Burns (alagalah) --- build-root/vagrant/bootstrap.ubuntu1404.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index 04f341a4..35865faf 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -48,10 +48,12 @@ start hugepages # Setup the vpp code cd ~vagrant/ + sudo -u vagrant mkdir git cd git/ -# You will need to alter this line to reflect reality. +# Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision" +[ -d vpp ] && rm -rf vpp sudo -H -u vagrant git clone /vpp cd vpp/ -- cgit 1.2.3-korg From d5201c80078fdecad8e6524e430b4b255f91b6b6 Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Sun, 31 Jan 2016 21:15:27 +0100 Subject: Changes to Centos bootstrap to remove ~/git/vpp if it exists before attempting clone - fixes issue with vagrant reload --provision not updating clone of clone Change-Id: I506d4cbca90b30bf787c1be7e4ad39d748ea7f5b Signed-off-by: Keith Burns (alagalah) --- build-root/vagrant/bootstrap.centos7.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh index 1d811e45..f55e68a2 100644 --- a/build-root/vagrant/bootstrap.centos7.sh +++ b/build-root/vagrant/bootstrap.centos7.sh @@ -28,7 +28,8 @@ cd ~vagrant/ sudo -u vagrant mkdir git cd git/ -# You will need to alter this line to reflect reality. +# Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision" +[ -d vpp ] && rm -rf vpp sudo -H -u vagrant git clone /vpp cd vpp -- cgit 1.2.3-korg From b10277dedc04da0c4334fadf2ac6b18a453f6491 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Tue, 2 Feb 2016 10:57:15 -0500 Subject: Enable ganglia module integration build Change-Id: Ia49e9f246e8318ba74195c3397472fb0c102389b Signed-off-by: Dave Barach --- build-data/packages/gmod.mk | 2 +- build-data/platforms/vpp.mk | 2 +- build-root/vagrant/bootstrap.centos7.sh | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-data/packages/gmod.mk b/build-data/packages/gmod.mk index 3f9a9f7f..a6ba42d0 100644 --- a/build-data/packages/gmod.mk +++ b/build-data/packages/gmod.mk @@ -3,7 +3,7 @@ gmod_configure_depend = vppinfra-install svm-install gmod_configure_args = --libdir=$(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/ganglia gmod_CPPFLAGS = $(call installed_includes_fn, vppinfra svm) -gmod_CPPFLAGS += -I/usr/include/apr-1.0 -I/usr/include +gmod_CPPFLAGS += -I/usr/include/apr-1.0 -I/usr/include/apr-1 -I/usr/include gmod_LDFLAGS = $(call installed_libs_fn, vppinfra svm) gmod_image_include = echo $(arch_lib_dir)/ganglia/libgmodvpp.so etc diff --git a/build-data/platforms/vpp.mk b/build-data/platforms/vpp.mk index a09b0307..4c75d74d 100644 --- a/build-data/platforms/vpp.mk +++ b/build-data/platforms/vpp.mk @@ -16,7 +16,7 @@ vpp_arch = native vpp_native_tools = vppapigen vpp_root_packages = vpp vlib vlib-api vnet svm dpdk vpp-api-test \ - vpp-japi + vpp-japi gmod vpp_configure_args_vpp = --with-dpdk vnet_configure_args_vpp = --with-dpdk diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh index f55e68a2..d874d3c3 100644 --- a/build-root/vagrant/bootstrap.centos7.sh +++ b/build-root/vagrant/bootstrap.centos7.sh @@ -11,6 +11,14 @@ yum install glibc-static -y # Install jdk and maven yum install -y java-1.8.0-openjdk-devel +# Install EPEL +yum install -y epel-release + +# Install components to build Ganglia modules +yum install -y apr-devel +yum install -y --enablerepo=epel libconfuse-devel +yum install -y --enablerepo=epel ganglia-devel + # Load the uio kernel module modprobe uio_pci_generic -- cgit 1.2.3-korg From f1bb047ae820a4068fe32c23aea46e6a84db7c9c Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Tue, 2 Feb 2016 16:59:04 -0500 Subject: Add pciutils to the CentOS vagrant bootstrap; needed to install vpp rpms Change-Id: Ia0cbf88a509392c1bd75fb242985da07c8356739 Signed-off-by: Dave Barach --- build-root/vagrant/bootstrap.centos7.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh index d874d3c3..60c2456d 100644 --- a/build-root/vagrant/bootstrap.centos7.sh +++ b/build-root/vagrant/bootstrap.centos7.sh @@ -19,6 +19,9 @@ yum install -y apr-devel yum install -y --enablerepo=epel libconfuse-devel yum install -y --enablerepo=epel ganglia-devel +# PCIutils +yum install -y pciutils + # Load the uio kernel module modprobe uio_pci_generic -- cgit 1.2.3-korg From eeee9e2b1820ae1ca194ba0093d49519b66558f8 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 2 Feb 2016 17:47:17 -0800 Subject: Switched vagrant for ~/git/vpp to /vpp build-root/vagrant/Vagrantfile was always mounting the vpp into /vpp Now rather than cloning it and building, we just use it as mounted. In order to let folks know what happened, a README.moved is copied into the ~/git/vpp so folks know what happened. In addition to make it easier for folks to do commits from withing the vagrant, we install git-review, and copy in the users .gitconfig and .gnupg directory. A couple of notes about this. VMWare goes much much faster in all cases. Virtualbox is a bit slower in the very first run (without ccache). One of the benefits of using the mounted /vpp though is that after your first vagrant up, you always have access to the .ccache, as it lives outside the vagrant, and so in steady state everything is faster. Change-Id: I2cd2c28181b3d7e664240dfe2249b5be3f1b9241 Signed-off-by: Ed Warnicke --- build-root/vagrant/README.moved | 5 +++++ build-root/vagrant/Vagrantfile | 16 ++++++++++++++++ build-root/vagrant/bootstrap.ubuntu1404.sh | 11 ++++------- 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 build-root/vagrant/README.moved (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README.moved b/build-root/vagrant/README.moved new file mode 100644 index 00000000..2bbf6564 --- /dev/null +++ b/build-root/vagrant/README.moved @@ -0,0 +1,5 @@ +The location of the vpp code has moved from +~/git/vpp +To +/vpp +/vpp is a mount of the source code from outside the Vagrant, and should make it much easier to interact with the system. diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index f00233d6..f4021659 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -13,6 +13,22 @@ Vagrant.configure(2) do |config| config.vm.provision 'shell', path: 'bootstrap.ubuntu1404.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 diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index 35865faf..a8381bb4 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -10,7 +10,7 @@ apt-get upgrade -y sudo update-alternatives --install /bin/sh sh /bin/bash 100 # Install build tools -apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev +apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev git-review # Install other stuff # apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils @@ -49,13 +49,10 @@ start hugepages # Setup the vpp code cd ~vagrant/ -sudo -u vagrant mkdir git -cd git/ +sudo -u vagrant mkdir -p git/vpp +cp /vagrant/README.moved git/vpp/ -# Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision" -[ -d vpp ] && rm -rf vpp -sudo -H -u vagrant git clone /vpp -cd vpp/ +cd /vpp/ # Initial vpp build if [ -d build-root ]; then -- cgit 1.2.3-korg From d255ee13f57a73d2374dbcd63b1a377d88672557 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Wed, 3 Feb 2016 22:34:04 -0500 Subject: Change non-default route ethernet interfaces state to down so VPP will use them. Change-Id: Icdb1a8d35a97e01d5e1be13fdc89ce3f9ec62e1a Signed-off-by: Dave Wallace --- build-root/vagrant/bootstrap.ubuntu1404.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index a8381bb4..fc1a3b8d 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -52,6 +52,18 @@ cd ~vagrant/ sudo -u vagrant mkdir -p git/vpp cp /vagrant/README.moved git/vpp/ +# Disable all ethernet interfaces other than the default route +# interface so VPP will use those interfaces. The VPP auto-blacklist +# algorithm prevents the use of any physical interface contained in the +# routing table (i.e. "route --inet --inet6") preventing the theft of +# the management ethernet interface by VPP from the kernel. +for intf in $(ls /sys/class/net) ; do + if [ -d /sys/class/net/$intf/device ] && + [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then + ifconfig $intf down + fi +done + cd /vpp/ # Initial vpp build -- cgit 1.2.3-korg From efe710fe56f9dc6117f5777dc1f9dbd6748352e4 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Wed, 3 Feb 2016 22:40:07 -0500 Subject: Remove redundant apt-get install of dkms and debhelper. Change-Id: Id2caea331f86a71f26990e1ae11288826157e737 Signed-off-by: Dave Wallace --- build-root/vagrant/bootstrap.ubuntu1404.sh | 3 --- 1 file changed, 3 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index fc1a3b8d..d6729073 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -23,9 +23,6 @@ apt-get install -y openjdk-7-jdk # $$$ comment out for the moment # apt-get install -y --force-yes maven3 -# Install debian packaging tools -apt-get install -y debhelper dkms - # Setup for hugepages using upstart so it persists across reboots echo "vm.nr_hugepages=1024" >> /etc/sysctl.d/20-hugepages.conf sysctl --system -- cgit 1.2.3-korg From 525d5957f0c449cbf677b9875d8bce1b10929c69 Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Fri, 19 Feb 2016 06:18:46 +0100 Subject: Add GDB and GDB Server to bootstrap files Validated following images used do not contain gdb, gdbserver: puppetlabs/centos-7.0-64-nocm puppetlabs/ubuntu-14.04-64-nocm Note that centos7 does not include emacs Change-Id: I091a64a7c667e081574763537de724f9feaae0dc Signed-off-by: Keith Burns (alagalah) --- build-root/vagrant/bootstrap.centos7.sh | 4 ++++ build-root/vagrant/bootstrap.ubuntu1404.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh index 60c2456d..72ee2460 100644 --- a/build-root/vagrant/bootstrap.centos7.sh +++ b/build-root/vagrant/bootstrap.centos7.sh @@ -8,6 +8,10 @@ yum groupinstall 'Development Tools' -y yum install openssl-devel -y yum install glibc-static -y +# Install development tools +yum install gdb -y +yum install gdbserver -y + # Install jdk and maven yum install -y java-1.8.0-openjdk-devel diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index d6729073..2b6bbcb0 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -10,7 +10,7 @@ apt-get upgrade -y sudo update-alternatives --install /bin/sh sh /bin/bash 100 # Install build tools -apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev git-review +apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev git-review gdb gdbserver # Install other stuff # apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils -- cgit 1.2.3-korg From c841eac7730c3e80fc14006481edb5d9221bf45c Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 22 Mar 2016 16:10:07 -0500 Subject: Fix vagrant centos flavor to work with top level make file Change-Id: I89044ed27130a036536ed33aba847034ed15ad7d Signed-off-by: Ed Warnicke --- build-root/vagrant/Vagrantfile | 2 +- build-root/vagrant/bootstrap.centos7.sh | 84 ++++++++++++--------------------- 2 files changed, 31 insertions(+), 55 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index f4021659..1f6a3b9c 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -6,7 +6,7 @@ Vagrant.configure(2) do |config| # Pick the right distro and bootstrap, default is ubuntu1404 distro = ENV['VPP_VAGRANT_DISTRO'] if distro == 'centos7' - config.vm.box = "puppetlabs/centos-7.0-64-nocm" + config.vm.box = "puppetlabs/centos-7.2-64-nocm" config.vm.provision 'shell', path: 'bootstrap.centos7.sh' else config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh index 72ee2460..0f815868 100644 --- a/build-root/vagrant/bootstrap.centos7.sh +++ b/build-root/vagrant/bootstrap.centos7.sh @@ -3,59 +3,35 @@ yum check-update yum update -y -# Install build tools -yum groupinstall 'Development Tools' -y -yum install openssl-devel -y -yum install glibc-static -y - -# Install development tools -yum install gdb -y -yum install gdbserver -y - -# Install jdk and maven -yum install -y java-1.8.0-openjdk-devel - -# Install EPEL -yum install -y epel-release - -# Install components to build Ganglia modules -yum install -y apr-devel -yum install -y --enablerepo=epel libconfuse-devel -yum install -y --enablerepo=epel ganglia-devel - -# PCIutils -yum install -y pciutils - -# Load the uio kernel module +# Install dependencies +cd /vpp +make install-dep + +# Build rpms +make bootstrap +make pkg-rpm + +# Install rpms + +(cd build-root/;sudo rpm -Uvh *.rpm) + +# Disable all ethernet interfaces other than the default route +# interface so VPP will use those interfaces. The VPP auto-blacklist +# algorithm prevents the use of any physical interface contained in the +# routing table (i.e. "route --inet --inet6") preventing the theft of +# the management ethernet interface by VPP from the kernel. +for intf in $(ls /sys/class/net) ; do + if [ -d /sys/class/net/$intf/device ] && + [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then + ifconfig $intf down + fi +done + +# Install uio-pci-generic modprobe uio_pci_generic -echo uio_pci_generic >> /etc/modules-load.d/uio_pci_generic.conf - -# Setup for hugepages using upstart so it persists across reboots -sysctl -w vm.nr_hugepages=1024 -echo "vm.nr_hugepages=1024" >> /etc/sysctl.conf -mkdir -p /mnt/huge -echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab -mount /mnt/huge - -# Setup the vpp code -cd ~vagrant/ -sudo -u vagrant mkdir git -cd git/ - -# Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision" -[ -d vpp ] && rm -rf vpp -sudo -H -u vagrant git clone /vpp -cd vpp - -# Initial vpp build -if [ -d build-root ]; then - # Bootstrap vpp - cd build-root/ - sudo -H -u vagrant ./bootstrap.sh - - # Build vpp - sudo -H -u vagrant make PLATFORM=vpp TAG=vpp_debug install-packages - cd ~vagrant/ - cat /vagrant/README -fi +# Start vpp +service vpp start + +# cat README +cat /vagrant/README -- cgit 1.2.3-korg From 31854abeb91a5d67585780e737d6f6e8bb718240 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 29 Mar 2016 08:26:29 -0500 Subject: Fix to centos vagrant file Change-Id: I5ceae4354c029cb92527b2eeb1a71b76dc2b0311 Signed-off-by: Ed Warnicke --- build-root/vagrant/bootstrap.centos7.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh index 0f815868..36af564a 100644 --- a/build-root/vagrant/bootstrap.centos7.sh +++ b/build-root/vagrant/bootstrap.centos7.sh @@ -8,8 +8,8 @@ cd /vpp make install-dep # Build rpms -make bootstrap -make pkg-rpm +sudo -H -u vagrant make bootstrap +sudo -H -u vagrant make pkg-rpm # Install rpms -- cgit 1.2.3-korg From 7c38f1ff143c5a311df7be6fe6161d55d4b5d7eb Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Wed, 6 Apr 2016 12:21:03 -0700 Subject: Migrate bootstrap.ubuntu.sh to using top level Makefile This script moves to using the top level Makefile in vagrant. The reason for not merging yet is to make sure that we don't put the training at risk. The patch should be fine (its been tested), but better safe than sorry. Change-Id: Ic57cfe1f26867c820784e5511d418e68f24b5fcd Signed-off-by: Ed Warnicke --- build-root/vagrant/bootstrap.ubuntu1404.sh | 69 ++++++------------------------ 1 file changed, 12 insertions(+), 57 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh index 2b6bbcb0..daa68bc4 100644 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ b/build-root/vagrant/bootstrap.ubuntu1404.sh @@ -9,45 +9,19 @@ apt-get upgrade -y sudo update-alternatives --install /bin/sh sh /bin/bash 100 -# Install build tools -apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev git-review gdb gdbserver +cd /vpp +sudo -H -u vagrant make install-dep -# Install other stuff -# apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils +# Install useful but non-mandatory tools +apt-get install -y emacs git-review gdb gdbserver -# Install uio -apt-get install -y linux-image-extra-`uname -r` +sudo -H -u vagrant make bootstrap +sudo -H -u vagrant make pkg-deb +(cd build-root/;dpkg -i *.deb) -# Install jdk and maven -apt-get install -y openjdk-7-jdk -# $$$ comment out for the moment -# apt-get install -y --force-yes maven3 - -# Setup for hugepages using upstart so it persists across reboots -echo "vm.nr_hugepages=1024" >> /etc/sysctl.d/20-hugepages.conf -sysctl --system - -cat << EOF > /etc/init/hugepages.conf -start on runlevel [2345] - -task - -script - mkdir -p /run/hugepages/kvm || true - rm -f /run/hugepages/kvm/* || true - rm -f /dev/shm/* || true - mount -t hugetlbfs nodev /run/hugepages/kvm -end script -EOF - -# Make sure we run that hugepages.conf right now -start hugepages - -# Setup the vpp code -cd ~vagrant/ - -sudo -u vagrant mkdir -p git/vpp -cp /vagrant/README.moved git/vpp/ +# Capture all the interface IPs, in case we need them later +ifconfig -a > ~vagrant/ifconfiga +chown vagrant:vagrant ~vagrant/ifconfiga # Disable all ethernet interfaces other than the default route # interface so VPP will use those interfaces. The VPP auto-blacklist @@ -61,24 +35,5 @@ for intf in $(ls /sys/class/net) ; do fi done -cd /vpp/ - -# Initial vpp build -if [ -d build-root ]; then - # Bootstrap vpp - cd build-root/ - sudo -H -u vagrant ./bootstrap.sh - - # Build vpp - sudo -H -u vagrant make PLATFORM=vpp TAG=vpp_debug install-deb - - # Install debian packages - dpkg -i *.deb - - # Start vpp - start vpp - - cd ~vagrant/ - cat /vagrant/README - -fi +start vpp +cat /vagrant/README -- cgit 1.2.3-korg From ecec279029a8a507483bc54ace3dca7f623f3fb7 Mon Sep 17 00:00:00 2001 From: Jeff Shaw Date: Tue, 5 Apr 2016 10:23:17 -0700 Subject: vagrant: libvirt configuration. Configure the proxy, vcpu, and memory parameters for the libvirt provider. Change-Id: Id662e60f76b4b424d3a5d98929a44ef2587ef258 Signed-off-by: Jeff Shaw --- build-root/vagrant/Vagrantfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 1f6a3b9c..6e42bf27 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -49,8 +49,8 @@ Vagrant.configure(2) do |config| # use http proxy if avaiable if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") - config.proxy.http = "$http_proxy" - config.proxy.https = "$https_proxy" + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] config.proxy.no_proxy = "localhost,127.0.0.1" end @@ -61,6 +61,10 @@ Vagrant.configure(2) do |config| config.vm.provider "vmware_fusion" do |fusion,override| fusion.vmx["memsize"] = "4096" end + config.vm.provider "libvirt" do |lv| + lv.memory = 4096 + lv.cpus = 8 + end config.vm.provider "vmware_workstation" do |vws,override| vws.vmx["memsize"] = "8192" vws.vmx["numvcpus"] = "4" -- cgit 1.2.3-korg From 0777915b2a98ea6353e6c0951c3aa195d4751d35 Mon Sep 17 00:00:00 2001 From: Srivatsa Sangli Date: Fri, 15 Apr 2016 13:59:00 -0700 Subject: ubuntu 16.04 build support. Supporting systemd with vpp.service files. Incorporating review comments : modified debian/control dependencies Change-Id: Ib2fe85d81eb7f1803ef8f54294c7c18cd07c61ba Signed-off-by: Srivatsa Sangli --- Makefile | 2 +- build-root/deb/debian/control | 2 +- build-root/deb/debian/rules | 2 +- build-root/deb/debian/vpp.service | 14 +++++++++++ build-root/vagrant/bootstrap.ubuntu1604.sh | 39 ++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 build-root/deb/debian/vpp.service create mode 100644 build-root/vagrant/bootstrap.ubuntu1604.sh (limited to 'build-root/vagrant') diff --git a/Makefile b/Makefile index 68652836..fd1d0ff9 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ MINIMAL_STARTUP_CONF="unix { interactive }" GDB_ARGS= -ex "handle SIGUSR1 noprint nostop" DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache -DEB_DEPENDS += debhelper dkms default-jdk git libtool libganglia1-dev libapr1-dev +DEB_DEPENDS += debhelper dkms default-jdk git libtool libganglia1-dev libapr1-dev dh-systemd DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope RPM_DEPENDS_GROUPS = 'Development Tools' diff --git a/build-root/deb/debian/control b/build-root/deb/debian/control index cf22fd02..97464e42 100644 --- a/build-root/deb/debian/control +++ b/build-root/deb/debian/control @@ -2,7 +2,7 @@ Source: vpp Section: net Priority: extra Maintainer: Cisco OpenVPP Packaging Team -Build-Depends: debhelper (>= 9), dkms +Build-Depends: debhelper (>= 9), dkms, dh-systemd Standards-Version: 3.9.4 Package: vpp diff --git a/build-root/deb/debian/rules b/build-root/deb/debian/rules index bcee0121..b5afbdb6 100755 --- a/build-root/deb/debian/rules +++ b/build-root/deb/debian/rules @@ -18,7 +18,7 @@ include /usr/share/dpkg/default.mk # main packaging script based on dh7 syntax %: - dh $@ --with dkms + dh $@ --with dkms --with systemd override_dh_install: dh_install --exclude .git diff --git a/build-root/deb/debian/vpp.service b/build-root/deb/debian/vpp.service new file mode 100644 index 00000000..a2849296 --- /dev/null +++ b/build-root/deb/debian/vpp.service @@ -0,0 +1,14 @@ +[Unit] +Description=vector packet processing engine +After=network.target + +[Service] +Type=simple +ExecStartPre=-/bin/rm -f /dev/shm/* +ExecStartPre=-/sbin/modprobe igb_uio +ExecStart=/usr/bin/vpp -c /etc/vpp/startup.conf +ExecStopPost=/bin/rm -f /dev/shm/* +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/build-root/vagrant/bootstrap.ubuntu1604.sh b/build-root/vagrant/bootstrap.ubuntu1604.sh new file mode 100644 index 00000000..2e607f1e --- /dev/null +++ b/build-root/vagrant/bootstrap.ubuntu1604.sh @@ -0,0 +1,39 @@ +# Fix grub-pc on Virtualbox with Ubuntu +export DEBIAN_FRONTEND=noninteractive + +# Standard update + upgrade dance +apt-get update +apt-get upgrade -y + +# Fix the silly notion that /bin/sh should point to dash by pointing it to bash + +sudo update-alternatives --install /bin/sh sh /bin/bash 100 + +cd /vpp +sudo -H -u vagrant make install-dep + +# Install useful but non-mandatory tools +apt-get install -y emacs git-review gdb gdbserver + +sudo -H -u vagrant make bootstrap +sudo -H -u vagrant make pkg-deb +(cd build-root/;dpkg -i *.deb) + +# Capture all the interface IPs, in case we need them later +ifconfig -a > ~vagrant/ifconfiga +chown vagrant:vagrant ~vagrant/ifconfiga + +# Disable all ethernet interfaces other than the default route +# interface so VPP will use those interfaces. The VPP auto-blacklist +# algorithm prevents the use of any physical interface contained in the +# routing table (i.e. "route --inet --inet6") preventing the theft of +# the management ethernet interface by VPP from the kernel. +for intf in $(ls /sys/class/net) ; do + if [ -d /sys/class/net/$intf/device ] && + [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then + ifconfig $intf down + fi +done + +systemctl start vpp +cat /vagrant/README -- cgit 1.2.3-korg From d6a0fc5ea696763c3cba67dc47d8e7943ae7649b Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 12 Apr 2016 17:34:48 -0500 Subject: Break boostrap.sh into pieces In order to make it easier for folks who have existing Centos or Ubuntu boxes to utilize the same 'Getting started' scripting that is used in Vagrant, as well as enable us to use that scripting in CI, broke up bootstrap.sh into update.sh - Things like apt-get update build.sh - Install any dependencies and build vpp clearinterfaces.sh - Clean off any non-default gateway interfaces. Used by vagrant. run.sh - Start vpp as a service on the box. A user (or CI) just wanting to get going and build on an existing Ubuntu or Centos image (ie, not via vagrant) can simply run build.sh Change-Id: I8f19342f163cad07c6c05def943a5fb8e394b879 Signed-off-by: Ed Warnicke --- build-root/vagrant/README.moved | 5 --- build-root/vagrant/Vagrantfile | 9 +++-- build-root/vagrant/bootstrap.centos7.sh | 37 -------------------- build-root/vagrant/bootstrap.ubuntu1404.sh | 39 --------------------- build-root/vagrant/bootstrap.ubuntu1604.sh | 39 --------------------- build-root/vagrant/build.sh | 54 ++++++++++++++++++++++++++++++ build-root/vagrant/clearinterfaces.sh | 17 ++++++++++ build-root/vagrant/run.sh | 22 ++++++++++++ build-root/vagrant/update.sh | 45 +++++++++++++++++++++++++ 9 files changed, 144 insertions(+), 123 deletions(-) delete mode 100644 build-root/vagrant/README.moved delete mode 100644 build-root/vagrant/bootstrap.centos7.sh delete mode 100644 build-root/vagrant/bootstrap.ubuntu1404.sh delete mode 100644 build-root/vagrant/bootstrap.ubuntu1604.sh create mode 100755 build-root/vagrant/build.sh create mode 100755 build-root/vagrant/clearinterfaces.sh create mode 100755 build-root/vagrant/run.sh create mode 100755 build-root/vagrant/update.sh (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README.moved b/build-root/vagrant/README.moved deleted file mode 100644 index 2bbf6564..00000000 --- a/build-root/vagrant/README.moved +++ /dev/null @@ -1,5 +0,0 @@ -The location of the vpp code has moved from -~/git/vpp -To -/vpp -/vpp is a mount of the source code from outside the Vagrant, and should make it much easier to interact with the system. diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 6e42bf27..5e6fe755 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -7,12 +7,15 @@ Vagrant.configure(2) do |config| distro = ENV['VPP_VAGRANT_DISTRO'] if distro == 'centos7' config.vm.box = "puppetlabs/centos-7.2-64-nocm" - config.vm.provision 'shell', path: 'bootstrap.centos7.sh' else config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" - config.vm.provision 'shell', path: 'bootstrap.ubuntu1404.sh' end + config.vm.provision :shell, :path => "update.sh" + config.vm.provision :shell, :path => "build.sh", :args => "/vpp vagrant" + config.vm.provision :shell, :path => "clearinterfaces.sh" + config.vm.provision :shell, :path => "run.sh" + # 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 @@ -39,7 +42,7 @@ Vagrant.configure(2) do |config| end # Define some physical ports for your VMs to be used by DPDK - nics = 0 + nics = 2 if ENV.key?('VPP_VAGRANT_NICS') nics = ENV['VPP_VAGRANT_NICS'].to_i(10) end diff --git a/build-root/vagrant/bootstrap.centos7.sh b/build-root/vagrant/bootstrap.centos7.sh deleted file mode 100644 index 36af564a..00000000 --- a/build-root/vagrant/bootstrap.centos7.sh +++ /dev/null @@ -1,37 +0,0 @@ - -# Standard update + upgrade dance -yum check-update -yum update -y - -# Install dependencies -cd /vpp -make install-dep - -# Build rpms -sudo -H -u vagrant make bootstrap -sudo -H -u vagrant make pkg-rpm - -# Install rpms - -(cd build-root/;sudo rpm -Uvh *.rpm) - -# Disable all ethernet interfaces other than the default route -# interface so VPP will use those interfaces. The VPP auto-blacklist -# algorithm prevents the use of any physical interface contained in the -# routing table (i.e. "route --inet --inet6") preventing the theft of -# the management ethernet interface by VPP from the kernel. -for intf in $(ls /sys/class/net) ; do - if [ -d /sys/class/net/$intf/device ] && - [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then - ifconfig $intf down - fi -done - -# Install uio-pci-generic -modprobe uio_pci_generic - -# Start vpp -service vpp start - -# cat README -cat /vagrant/README diff --git a/build-root/vagrant/bootstrap.ubuntu1404.sh b/build-root/vagrant/bootstrap.ubuntu1404.sh deleted file mode 100644 index daa68bc4..00000000 --- a/build-root/vagrant/bootstrap.ubuntu1404.sh +++ /dev/null @@ -1,39 +0,0 @@ -# Fix grub-pc on Virtualbox with Ubuntu -export DEBIAN_FRONTEND=noninteractive - -# Standard update + upgrade dance -apt-get update -apt-get upgrade -y - -# Fix the silly notion that /bin/sh should point to dash by pointing it to bash - -sudo update-alternatives --install /bin/sh sh /bin/bash 100 - -cd /vpp -sudo -H -u vagrant make install-dep - -# Install useful but non-mandatory tools -apt-get install -y emacs git-review gdb gdbserver - -sudo -H -u vagrant make bootstrap -sudo -H -u vagrant make pkg-deb -(cd build-root/;dpkg -i *.deb) - -# Capture all the interface IPs, in case we need them later -ifconfig -a > ~vagrant/ifconfiga -chown vagrant:vagrant ~vagrant/ifconfiga - -# Disable all ethernet interfaces other than the default route -# interface so VPP will use those interfaces. The VPP auto-blacklist -# algorithm prevents the use of any physical interface contained in the -# routing table (i.e. "route --inet --inet6") preventing the theft of -# the management ethernet interface by VPP from the kernel. -for intf in $(ls /sys/class/net) ; do - if [ -d /sys/class/net/$intf/device ] && - [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then - ifconfig $intf down - fi -done - -start vpp -cat /vagrant/README diff --git a/build-root/vagrant/bootstrap.ubuntu1604.sh b/build-root/vagrant/bootstrap.ubuntu1604.sh deleted file mode 100644 index 2e607f1e..00000000 --- a/build-root/vagrant/bootstrap.ubuntu1604.sh +++ /dev/null @@ -1,39 +0,0 @@ -# Fix grub-pc on Virtualbox with Ubuntu -export DEBIAN_FRONTEND=noninteractive - -# Standard update + upgrade dance -apt-get update -apt-get upgrade -y - -# Fix the silly notion that /bin/sh should point to dash by pointing it to bash - -sudo update-alternatives --install /bin/sh sh /bin/bash 100 - -cd /vpp -sudo -H -u vagrant make install-dep - -# Install useful but non-mandatory tools -apt-get install -y emacs git-review gdb gdbserver - -sudo -H -u vagrant make bootstrap -sudo -H -u vagrant make pkg-deb -(cd build-root/;dpkg -i *.deb) - -# Capture all the interface IPs, in case we need them later -ifconfig -a > ~vagrant/ifconfiga -chown vagrant:vagrant ~vagrant/ifconfiga - -# Disable all ethernet interfaces other than the default route -# interface so VPP will use those interfaces. The VPP auto-blacklist -# algorithm prevents the use of any physical interface contained in the -# routing table (i.e. "route --inet --inet6") preventing the theft of -# the management ethernet interface by VPP from the kernel. -for intf in $(ls /sys/class/net) ; do - if [ -d /sys/class/net/$intf/device ] && - [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then - ifconfig $intf down - fi -done - -systemctl start vpp -cat /vagrant/README diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh new file mode 100755 index 00000000..b608b853 --- /dev/null +++ b/build-root/vagrant/build.sh @@ -0,0 +1,54 @@ +#!/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 0:$0 +echo 1:$1 +echo 2:$2 +echo VPP_DIR: $VPP_DIR +echo SUDOCMD: $SUDOCMD + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + sudo yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi +echo DISTRIB_ID: $DISTRIB_ID +echo DISTRIB_RELEASE: $DISTRIB_RELEASE +echo DISTRIB_CODENAME: $DISTRIB_CODENAME +echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION + +# Install dependencies +cd $VPP_DIR +make install-dep + +# Really really clean things up so we can be sure +# that the build works even when switching distros +make wipe +(cd build-root/;make distclean) +rm -f build-root/.bootstrap.ok + +# Build and install packaging +$SUDOCMD make bootstrap +if [ $DISTRIB_ID == "Ubuntu" ]; then + $SUDOCMD make pkg-deb + (cd build-root/;sudo dpkg -i *.deb) +elif [ $DISTRIB_ID == "CentOS" ]; then + $SUDOCMD make pkg-rpm + (cd build-root/;sudo rpm -Uvh *.rpm) +fi + diff --git a/build-root/vagrant/clearinterfaces.sh b/build-root/vagrant/clearinterfaces.sh new file mode 100755 index 00000000..78f6705c --- /dev/null +++ b/build-root/vagrant/clearinterfaces.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Capture all the interface IPs, in case we need them later +ip -o addr show > ~vagrant/ifconfiga +chown vagrant:vagrant ~vagrant/ifconfiga + +# Disable all ethernet interfaces other than the default route +# interface so VPP will use those interfaces. The VPP auto-blacklist +# algorithm prevents the use of any physical interface contained in the +# routing table (i.e. "route --inet --inet6") preventing the theft of +# the management ethernet interface by VPP from the kernel. +for intf in $(ls /sys/class/net) ; do + if [ -d /sys/class/net/$intf/device ] && + [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then + ifconfig $intf down + fi +done diff --git a/build-root/vagrant/run.sh b/build-root/vagrant/run.sh new file mode 100755 index 00000000..7342f388 --- /dev/null +++ b/build-root/vagrant/run.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi + +if [ $DISTRIB_ID == "Ubuntu" ]; then + start vpp +elif [ $DISTRIB_ID == "CentOS" ]; then + # Install uio-pci-generic + modprobe uio_pci_generic + + # Start vpp + service vpp start +fi diff --git a/build-root/vagrant/update.sh b/build-root/vagrant/update.sh new file mode 100755 index 00000000..77bf49a7 --- /dev/null +++ b/build-root/vagrant/update.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Make sure that we get the hugepages we need on provision boot +# Note: The package install should take care of this at the end +# But sometimes after all the work of provisioning, we can't +# get the requested number of hugepages without rebooting. +# So do it here just in case +sysctl -w vm.nr_hugepages=1024 +HUGEPAGES=`sysctl -n vm.nr_hugepages` +if [ $HUGEPAGES != 1024 ]; then + echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish." + exit +fi + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi + +# Do initial setup for the system +if [ $DISTRIB_ID == "Ubuntu" ]; then + # Fix grub-pc on Virtualbox with Ubuntu + export DEBIAN_FRONTEND=noninteractive + + # Standard update + upgrade dance + apt-get update + apt-get upgrade -y + + # Fix the silly notion that /bin/sh should point to dash by pointing it to bash + + update-alternatives --install /bin/sh sh /bin/bash 100 + + # Install useful but non-mandatory tools + apt-get install -y emacs git-review gdb gdbserver +elif [ $DISTRIB_ID == "CentOS" ]; then + # Standard update + upgrade dance + yum check-update + yum update -y +fi \ No newline at end of file -- cgit 1.2.3-korg From 3d5916dee601311c264a4aa1b24a6eeb9e36c58f Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Sun, 1 May 2016 09:12:18 -0700 Subject: VPP-32 Increase # cpus to 2, leave RAM at 4G for virtualbox vagrant users Change-Id: Ifb40316db96e019d6c14ff6a6e9653579009d4c3 Signed-off-by: Keith Burns (alagalah) --- build-root/vagrant/Vagrantfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 5e6fe755..71b47686 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -59,7 +59,9 @@ Vagrant.configure(2) do |config| config.vm.synced_folder "../../", "/vpp", disabled: false config.vm.provider "virtualbox" do |vb| - vb.memory = "4096" + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.memory = 4096 + vb.cpus = 2 end config.vm.provider "vmware_fusion" do |fusion,override| fusion.vmx["memsize"] = "4096" -- cgit 1.2.3-korg From efa7f9e6c2ee9fc68e87fb2cddd5f82842c4330e Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Sun, 1 May 2016 20:33:53 -0500 Subject: Break out install.sh from build.sh This is necessary because we are now using build.sh for CI... and we shouldn't install packages on CI boxes. Change-Id: I68f7880dfc75bbc4aa278ab0765a43e3fb899f3d Signed-off-by: Ed Warnicke --- build-root/vagrant/Vagrantfile | 1 + build-root/vagrant/build.sh | 2 -- build-root/vagrant/install.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 build-root/vagrant/install.sh (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 71b47686..4c720de6 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -13,6 +13,7 @@ Vagrant.configure(2) do |config| config.vm.provision :shell, :path => "update.sh" config.vm.provision :shell, :path => "build.sh", :args => "/vpp vagrant" + config.vm.provision :shell, :path => "install.sh", :args => "/vpp" config.vm.provision :shell, :path => "clearinterfaces.sh" config.vm.provision :shell, :path => "run.sh" diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh index b608b853..45a7eb4d 100755 --- a/build-root/vagrant/build.sh +++ b/build-root/vagrant/build.sh @@ -46,9 +46,7 @@ rm -f build-root/.bootstrap.ok $SUDOCMD make bootstrap if [ $DISTRIB_ID == "Ubuntu" ]; then $SUDOCMD make pkg-deb - (cd build-root/;sudo dpkg -i *.deb) elif [ $DISTRIB_ID == "CentOS" ]; then $SUDOCMD make pkg-rpm - (cd build-root/;sudo rpm -Uvh *.rpm) fi diff --git a/build-root/vagrant/install.sh b/build-root/vagrant/install.sh new file mode 100644 index 00000000..a53faa4d --- /dev/null +++ b/build-root/vagrant/install.sh @@ -0,0 +1,30 @@ +#!/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 + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + sudo yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi +echo DISTRIB_ID: $DISTRIB_ID +echo DISTRIB_RELEASE: $DISTRIB_RELEASE +echo DISTRIB_CODENAME: $DISTRIB_CODENAME +echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION + +if [ $DISTRIB_ID == "Ubuntu" ]; then + (cd ${VPP_DIR}/build-root/;sudo dpkg -i *.deb) +elif [ $DISTRIB_ID == "CentOS" ]; then + (cd ${VPP_DIR}/build-root/;sudo rpm -Uvh *.rpm) +fi \ No newline at end of file -- cgit 1.2.3-korg From c5e8681b320884f780508458ebff873761d5e04a Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 2 May 2016 19:40:27 +0200 Subject: Re-do java-8 handling, add unattended switch to toplevel Makefile Change-Id: Ifaea353be5b42bb6edbcfa0506d02b721c00e392 Signed-off-by: Damjan Marion --- Makefile | 39 +++++++++++++++++++++------------------ build-root/vagrant/build.sh | 2 +- 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'build-root/vagrant') diff --git a/Makefile b/Makefile index 53930928..f9a95437 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,12 @@ MINIMAL_STARTUP_CONF="unix { interactive }" GDB_ARGS= -ex "handle SIGUSR1 noprint nostop" +# +# OS Detection +# +OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') +OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') + DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache DEB_DEPENDS += debhelper dkms openjdk-8-jdk git libtool libganglia1-dev libapr1-dev dh-systemd DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope @@ -34,6 +40,10 @@ ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),) STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf endif +ifeq ($(findstring y,$(UNATTENDED)),y) +CONFIRM=-y +endif + .PHONY: help bootstrap wipe wipe-release build build-release rebuild rebuild-release .PHONY: run run-release debug debug-release build-vat run-vat pkg-deb pkg-rpm .PHONY: ctags cscope @@ -77,19 +87,8 @@ help: @echo " PLATFORM = $(PLATFORM)" @echo " DPDK_VERSION = $(DPDK_VERSION)" -# openjdk-8-jdk is not available in 14.04 repos by default -define use_ppa_for_jdk8 -if [ "$(shell lsb_release -r | awk '{print $$2}')"=="14.04" ]; then \ - sudo apt-get -y install software-properties-common; \ - sudo add-apt-repository -y ppa:openjdk-r/ppa; \ - sudo apt-get update; \ -fi; -endef - $(BR)/.bootstrap.ok: -ifeq ("$(shell lsb_release -si)", "Ubuntu") - $(use_ppa_for_jdk8) - +ifeq ($(OS_ID),ubuntu) @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \ if [ -n "$$MISSING" ] ; then \ echo "\nPlease install missing packages: \n$$MISSING\n" ; \ @@ -118,13 +117,17 @@ endif bootstrap: $(BR)/.bootstrap.ok install-dep: -ifeq ("$(shell lsb_release -si)", "Ubuntu") - $(use_ppa_for_jdk8) - @sudo apt-get -y install $(DEB_DEPENDS) +ifeq ($(OS_ID),ubuntu) +ifeq ($(OS_VERSION_ID),14.04) + @sudo apt-get $(CONFIRM) install software-properties-common + @sudo add-apt-repository $(CONFIRM) ppa:openjdk-r/ppa + @sudo apt-get update +endif + @sudo apt-get $(CONFIRM) install $(DEB_DEPENDS) else ifneq ("$(wildcard /etc/redhat-release)","") - @sudo yum groupinstall -y $(RPM_DEPENDS_GROUPS) - @sudo yum install -y $(RPM_DEPENDS) - @sudo yum install -y --enablerepo=epel $(EPEL_DEPENDS) + @sudo yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS) + @sudo yum install $(CONFIRM) $(RPM_DEPENDS) + @sudo yum install $(CONFIRM) --enablerepo=epel $(EPEL_DEPENDS) @sudo debuginfo-install glibc-2.17-106.el7_2.4.x86_64 openssl-libs-1.0.1e-51.el7_2.4.x86_64 zlib-1.2.7-15.el7.x86_64 else $(error "This option currently works only on Ubuntu or Centos systems") diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh index 45a7eb4d..aaaa62f6 100755 --- a/build-root/vagrant/build.sh +++ b/build-root/vagrant/build.sh @@ -34,7 +34,7 @@ echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION # Install dependencies cd $VPP_DIR -make install-dep +make UNATTENDED=yes install-dep # Really really clean things up so we can be sure # that the build works even when switching distros -- cgit 1.2.3-korg From d6a779c41160f5ff50a6bfa2114bedcca12605e0 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 3 May 2016 16:47:50 -0500 Subject: Fix for unattended in Makefile Also works around verify Change-Id: I79ac470ec3fa9943c3a0913ebfaaf91176eb9a81 Signed-off-by: Ed Warnicke --- Makefile | 2 +- build-root/vagrant/build.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/Makefile b/Makefile index f9a95437..226c7951 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ else ifneq ("$(wildcard /etc/redhat-release)","") @sudo yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS) @sudo yum install $(CONFIRM) $(RPM_DEPENDS) @sudo yum install $(CONFIRM) --enablerepo=epel $(EPEL_DEPENDS) - @sudo debuginfo-install glibc-2.17-106.el7_2.4.x86_64 openssl-libs-1.0.1e-51.el7_2.4.x86_64 zlib-1.2.7-15.el7.x86_64 + @sudo debuginfo-install $(CONFIRM) glibc-2.17-106.el7_2.4.x86_64 openssl-libs-1.0.1e-51.el7_2.4.x86_64 zlib-1.2.7-15.el7.x86_64 else $(error "This option currently works only on Ubuntu or Centos systems") endif diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh index aaaa62f6..7fd7e3a6 100755 --- a/build-root/vagrant/build.sh +++ b/build-root/vagrant/build.sh @@ -42,6 +42,18 @@ make wipe (cd build-root/;make distclean) rm -f build-root/.bootstrap.ok +if [ $DISTRIB_ID == "CentOS" ]; then + echo rpm -V apr-devel + rpm -V apr-devel + if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi + echo rpm -V ganglia-devel + rpm -V ganglia-devel + if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi + echo rpm -V libconfuse-devel + rpm -V libconfuse-devel + if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi +fi + # Build and install packaging $SUDOCMD make bootstrap if [ $DISTRIB_ID == "Ubuntu" ]; then -- cgit 1.2.3-korg From 30aff24e10610923d419c8f905e545f2c31d9c8c Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Fri, 6 May 2016 12:58:31 -0500 Subject: Small improvement to vagrant file Change-Id: Ia85ed0ef55cb5da118289667d7b217d8890d487e Signed-off-by: Ed Warnicke --- build-root/vagrant/Vagrantfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 4c720de6..06063e35 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -11,11 +11,11 @@ Vagrant.configure(2) do |config| config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" end - config.vm.provision :shell, :path => "update.sh" - config.vm.provision :shell, :path => "build.sh", :args => "/vpp vagrant" - config.vm.provision :shell, :path => "install.sh", :args => "/vpp" - config.vm.provision :shell, :path => "clearinterfaces.sh" - config.vm.provision :shell, :path => "run.sh" + 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" + 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") # Add .gnupg dir in so folks can sign patches # Note, as gnupg puts socket files in that dir, we have -- cgit 1.2.3-korg From cf9b712f57e3e81662e0815bd19ce19583783650 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Wed, 11 May 2016 21:46:19 -0500 Subject: Whitespace change for testing CI Change-Id: I52bf3c1c8ece08a4b52fce1f34704b944f9c1888 Signed-off-by: Ed Warnicke --- build-root/vagrant/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README b/build-root/vagrant/README index 05a3c652..eb6aa2fd 100644 --- a/build-root/vagrant/README +++ b/build-root/vagrant/README @@ -58,4 +58,4 @@ The second column (Next) is the name of the children of that node. The third column (Previous) is the name of the parents of this node. To see this README again: -cat /vagrant/README \ No newline at end of file +cat /vagrant/README -- cgit 1.2.3-korg From beabdf01613b64bc96887922cddafef45f81a142 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Thu, 12 May 2016 04:06:05 +0000 Subject: Revert "Whitespace change for testing CI" This reverts commit cf9b712f57e3e81662e0815bd19ce19583783650. This reverts gerrit: https://gerrit.fd.io/r/#/c/1078/ Change-Id: I4cf8c238fd81b5dc8bd077bbdd00cf72aef796ed Signed-off-by: Ed Warnicke --- build-root/vagrant/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README b/build-root/vagrant/README index eb6aa2fd..05a3c652 100644 --- a/build-root/vagrant/README +++ b/build-root/vagrant/README @@ -58,4 +58,4 @@ The second column (Next) is the name of the children of that node. The third column (Previous) is the name of the parents of this node. To see this README again: -cat /vagrant/README +cat /vagrant/README \ No newline at end of file -- cgit 1.2.3-korg From a20935192accf60cf0e3f01bd7b44db20c7cd754 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Mon, 9 May 2016 14:43:06 -0500 Subject: Whitespace probe for CI Change-Id: I3744ee19a21dcea2885aef2800244c93aa19763a Signed-off-by: Ed Warnicke --- build-root/vagrant/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README b/build-root/vagrant/README index 05a3c652..eb6aa2fd 100644 --- a/build-root/vagrant/README +++ b/build-root/vagrant/README @@ -58,4 +58,4 @@ The second column (Next) is the name of the children of that node. The third column (Previous) is the name of the parents of this node. To see this README again: -cat /vagrant/README \ No newline at end of file +cat /vagrant/README -- cgit 1.2.3-korg From 9d6c0ab31158f78976a6ba614a5de09f05305a74 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Wed, 1 Jun 2016 10:02:04 +0200 Subject: vagrant: disable automatic update on start The box update requires an internet connection. It is better to disable it on vagrant start. It still can be updated with the manual command: vagrant box update Change-Id: I04e05ea08477bf36f25672c54d0a057d995d4a42 Signed-off-by: Thomas Monjalon --- build-root/vagrant/Vagrantfile | 1 + 1 file changed, 1 insertion(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 06063e35..7067bfc0 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -10,6 +10,7 @@ Vagrant.configure(2) do |config| else config.vm.box = "puppetlabs/ubuntu-14.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" -- cgit 1.2.3-korg From 431cd2f15087834069f081ac96e09ac538ebed2c Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Fri, 3 Jun 2016 17:09:11 -0400 Subject: VPP-112: linux kernel info missing from build log Change-Id: I343418d409d682b00e74e41236382fdc6b3c780c Signed-off-by: Dave Wallace --- build-root/vagrant/build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh index 7fd7e3a6..aecb1d64 100755 --- a/build-root/vagrant/build.sh +++ b/build-root/vagrant/build.sh @@ -27,6 +27,15 @@ elif [ -f /etc/redhat-release ];then DISTRIB_CODENAME=`lsb_release -sc` DISTRIB_DESCRIPTION=`lsb_release -sd` fi +KERNEL_OS=`uname -o` +KERNEL_MACHINE=`uname -m` +KERNEL_RELEASE=`uname -r` +KERNEL_VERSION=`uname -v` + +echo KERNEL_OS: $KERNEL_OS +echo KERNEL_MACHINE: $KERNEL_MACHINE +echo KERNEL_RELEASE: $KERNEL_RELEASE +echo KERNEL_VERSION: $KERNEL_VERSION echo DISTRIB_ID: $DISTRIB_ID echo DISTRIB_RELEASE: $DISTRIB_RELEASE echo DISTRIB_CODENAME: $DISTRIB_CODENAME -- cgit 1.2.3-korg From e0965d4e05c3d43cec43c1fd31d6bc774ca79310 Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Sun, 19 Jun 2016 07:58:51 -0700 Subject: Using env.sh file for Vagrantfile inputs, but assume some defaults Change-Id: Ia4b45d88be5943d413d61435ff38796d1b6a32a2 Signed-off-by: Keith Burns (alagalah) --- build-root/vagrant/README | 69 +++++++++++------------------------------- build-root/vagrant/Vagrantfile | 25 +++++++-------- build-root/vagrant/WELCOME | 61 +++++++++++++++++++++++++++++++++++++ build-root/vagrant/env.sh | 6 ++++ 4 files changed, 98 insertions(+), 63 deletions(-) create mode 100644 build-root/vagrant/WELCOME create mode 100644 build-root/vagrant/env.sh (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README b/build-root/vagrant/README index eb6aa2fd..168b6b52 100644 --- a/build-root/vagrant/README +++ b/build-root/vagrant/README @@ -1,61 +1,28 @@ -VPP has now been built, installed, and started. +INTRO: -To give it a spin, we can create a tap interface and try a simple ping -(with trace). +This is a vagrant environment for VPP. -Make sure you have run: +VPP currently works under Linux and has support for: -$ vagrant ssh +- Ubuntu 14.04, Ubuntu 16.04 and Centos7.2 -To get to the vagrant VM: +The VM builds VPP from source which can be located at /vpp -vagrant@localhost:~$ +VM PARTICULARS: +This vagrant environment creates a VM based on environment variables found in ./env.sh +To use, edit env.sh then + source ./env.sh + vagrant up -Confirm that vpp is running with +By default, the VM created is/has: +- Ubuntu 14.04 +- 2 vCPUs +- 2G of RAM +- 2 NICs (1 x NAT - host access, 1 x VPP DPDK enabled) -vagrant@localhost:~$ sudo status vpp -vpp start/running, process 25202 +PROVIDERS: -To create the tap: +Supported vagrant providers are: -vagrant@localhost:~$ sudo vppctl tap connect foobar -Created tap-0 for Linux tap 'foobar' -vagrant@localhost:~$ sudo vppctl show int +- Virtualbox, VMware Fusion/Workstation, Libvirt -To assign it an ip address (and 'up' the interface): - -vagrant@localhost:~$ sudo vppctl set int ip address tap-0 192.168.1.1/24 -vagrant@localhost:~$ sudo vppctl set int state tap-0 up - -To turn on packet tracing for the tap interface: -vagrant@localhost:~$ sudo vppctl trace add tapcli-rx 10 - -Now, to set up and try the other end: -vagrant@localhost:~$ sudo ip addr add 192.168.1.2/24 dev foobar -vagrant@localhost:~$ ping -c 3 192.168.1.1 - -To look at the trace: -vagrant@localhost:~$ sudo vppctl show trace - -And to stop tracing: - -vagrant@localhost:~$ sudo vppctl clear trace - -Other fun things to look at: - -The vlib packet processing graph: -vagrant@localhost:~$ sudo vppctl show vlib graph - -which will produce output like: - - Name Next Previous -ip4-icmp-input error-punt [0] ip4-local - ip4-icmp-echo-request [1] - vpe-icmp4-oam [2] - -To read this, the first column (Name) is the name of the node. -The second column (Next) is the name of the children of that node. -The third column (Previous) is the name of the parents of this node. - -To see this README again: -cat /vagrant/README diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 7067bfc0..9bb53b91 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -4,7 +4,7 @@ Vagrant.configure(2) do |config| # Pick the right distro and bootstrap, default is ubuntu1404 - distro = ENV['VPP_VAGRANT_DISTRO'] + distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1404") if distro == 'centos7' config.vm.box = "puppetlabs/centos-7.2-64-nocm" else @@ -44,10 +44,7 @@ Vagrant.configure(2) do |config| end # Define some physical ports for your VMs to be used by DPDK - nics = 2 - if ENV.key?('VPP_VAGRANT_NICS') - nics = ENV['VPP_VAGRANT_NICS'].to_i(10) - end + nics = (ENV['VPP_VAGRANT_NICS'] || 2).to_i(10) for i in 1..nics config.vm.network "private_network", type: "dhcp" end @@ -59,21 +56,25 @@ Vagrant.configure(2) do |config| config.proxy.no_proxy = "localhost,127.0.0.1" end + vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) + vmram=(ENV['VPP_VAGRANT_VMRAM'] || 2048) + config.vm.synced_folder "../../", "/vpp", disabled: false config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--ioapic", "on"] - vb.memory = 4096 - vb.cpus = 2 + vb.memory = "#{vmram}" + vb.cpus = "#{vmcpu}" end config.vm.provider "vmware_fusion" do |fusion,override| - fusion.vmx["memsize"] = "4096" + fusion.vmx["memsize"] = "#{vmram}" + fusion.vmx["numvcpus"] = "#{vmcpu}" end config.vm.provider "libvirt" do |lv| - lv.memory = 4096 - lv.cpus = 8 + lv.memory = "#{vmram}" + lv.cpus = "#{vmcpu}" end config.vm.provider "vmware_workstation" do |vws,override| - vws.vmx["memsize"] = "8192" - vws.vmx["numvcpus"] = "4" + vws.vmx["memsize"] = "#{vmram}" + vws.vmx["numvcpus"] = "#{vmcpu}" end end diff --git a/build-root/vagrant/WELCOME b/build-root/vagrant/WELCOME new file mode 100644 index 00000000..eb6aa2fd --- /dev/null +++ b/build-root/vagrant/WELCOME @@ -0,0 +1,61 @@ +VPP has now been built, installed, and started. + +To give it a spin, we can create a tap interface and try a simple ping +(with trace). + +Make sure you have run: + +$ vagrant ssh + +To get to the vagrant VM: + +vagrant@localhost:~$ + +Confirm that vpp is running with + +vagrant@localhost:~$ sudo status vpp +vpp start/running, process 25202 + +To create the tap: + +vagrant@localhost:~$ sudo vppctl tap connect foobar +Created tap-0 for Linux tap 'foobar' +vagrant@localhost:~$ sudo vppctl show int + +To assign it an ip address (and 'up' the interface): + +vagrant@localhost:~$ sudo vppctl set int ip address tap-0 192.168.1.1/24 +vagrant@localhost:~$ sudo vppctl set int state tap-0 up + +To turn on packet tracing for the tap interface: +vagrant@localhost:~$ sudo vppctl trace add tapcli-rx 10 + +Now, to set up and try the other end: +vagrant@localhost:~$ sudo ip addr add 192.168.1.2/24 dev foobar +vagrant@localhost:~$ ping -c 3 192.168.1.1 + +To look at the trace: +vagrant@localhost:~$ sudo vppctl show trace + +And to stop tracing: + +vagrant@localhost:~$ sudo vppctl clear trace + +Other fun things to look at: + +The vlib packet processing graph: +vagrant@localhost:~$ sudo vppctl show vlib graph + +which will produce output like: + + Name Next Previous +ip4-icmp-input error-punt [0] ip4-local + ip4-icmp-echo-request [1] + vpe-icmp4-oam [2] + +To read this, the first column (Name) is the name of the node. +The second column (Next) is the name of the children of that node. +The third column (Previous) is the name of the parents of this node. + +To see this README again: +cat /vagrant/README diff --git a/build-root/vagrant/env.sh b/build-root/vagrant/env.sh new file mode 100644 index 00000000..f0edfd88 --- /dev/null +++ b/build-root/vagrant/env.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +export VPP_VAGRANT_DISTRO="ubuntu1404" +export VPP_VAGRANT_NICS=2 +export VPP_VAGRANT_VMCPU=4 +export VPP_VAGRANT_VMRAM=4096 -- cgit 1.2.3-korg From 010972a95df6d8abfce40325a3009cf6e9238a30 Mon Sep 17 00:00:00 2001 From: Srivatsa Sangli Date: Tue, 21 Jun 2016 12:58:19 -0700 Subject: Vagrantfile syntax error correction - requires string input instead of integer. Change-Id: Ib291662c4ea2f5bef0f2c417b16d256f5c480d5c Signed-off-by: Srivatsa Sangli --- build-root/vagrant/Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 9bb53b91..49141e80 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -44,7 +44,7 @@ Vagrant.configure(2) do |config| end # Define some physical ports for your VMs to be used by DPDK - nics = (ENV['VPP_VAGRANT_NICS'] || 2).to_i(10) + nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) for i in 1..nics config.vm.network "private_network", type: "dhcp" end -- cgit 1.2.3-korg From f8035649e928c45b6315dade2d33767b94209661 Mon Sep 17 00:00:00 2001 From: "Keith Burns (alagalah)" Date: Sat, 25 Jun 2016 03:50:28 -0700 Subject: Vagrantfile RAM default is too small. - Will raise JIRA for someone to convert this to use binaries by default - This means we should be able to get away with smaller VM for non-dev users Change-Id: If3d9283ba2c169792a1ab71ff692c25de82d41f4 Signed-off-by: Keith Burns (alagalah) --- build-root/vagrant/README | 2 +- build-root/vagrant/Vagrantfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/README b/build-root/vagrant/README index 168b6b52..238c90ce 100644 --- a/build-root/vagrant/README +++ b/build-root/vagrant/README @@ -17,7 +17,7 @@ To use, edit env.sh then By default, the VM created is/has: - Ubuntu 14.04 - 2 vCPUs -- 2G of RAM +- 4G of RAM - 2 NICs (1 x NAT - host access, 1 x VPP DPDK enabled) PROVIDERS: diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 49141e80..fac37ead 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -57,7 +57,7 @@ Vagrant.configure(2) do |config| end vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) - vmram=(ENV['VPP_VAGRANT_VMRAM'] || 2048) + vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) config.vm.synced_folder "../../", "/vpp", disabled: false config.vm.provider "virtualbox" do |vb| -- cgit 1.2.3-korg From 9387e51acbbcb676222740f26b98973430ab28e1 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 20 Jul 2016 13:13:18 +0100 Subject: build-root/vagrant: Fix SSE4.x for VB Number of users are reporting issues using VPP with Vagrant and the VirtualBox provider. VPP quits complaining that SSE support is not enabled. This change explicity enables SSE4.x support in the VirtualBox VM. Change-Id: Ia26dc43276aae4179609febfd705d868fa3e07c6 Signed-off-by: Ray --- build-root/vagrant/Vagrantfile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index fac37ead..5b374f2d 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -64,6 +64,10 @@ Vagrant.configure(2) do |config| vb.customize ["modifyvm", :id, "--ioapic", "on"] vb.memory = "#{vmram}" vb.cpus = "#{vmcpu}" + + #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}" -- cgit 1.2.3-korg From 7b75d211ae7b28ace7c6eee8e00005a0c45df45d Mon Sep 17 00:00:00 2001 From: Thomas F Herbert Date: Mon, 1 Aug 2016 18:33:48 -0400 Subject: Fix for broken vagrant installs when using Vagrant 1.8.5. I upgraded Fedora23 which installed kernel 4.6.4 which in turn required VirtualBox 5.1.2 which in turn required Vagrant 1.8.5. Workaround for a change in Vagrant 1.8.5 that breaks Centos. The newer version of Vagrant doesn't chmod the ssh directory before trying to copy new public key during installs. This will be fixed upstream in Vagrant 1.8.6. Bug doesn't affect Ubuntu because it uses a different umask whereas Centos uses 0002. Change-Id: I8108d4cc208fc47fa69f8a5cf27b2bba7e34293e Signed-off-by: Thomas F Herbert --- build-root/vagrant/Vagrantfile | 1 + 1 file changed, 1 insertion(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 5b374f2d..641397e8 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -7,6 +7,7 @@ Vagrant.configure(2) do |config| distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1404") if distro == 'centos7' config.vm.box = "puppetlabs/centos-7.2-64-nocm" + config.ssh.insert_key = false else config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" end -- cgit 1.2.3-korg From 3ba4d36d927444cfd1929c3d130af7dc9194ea6c Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Thu, 1 Sep 2016 11:54:27 -0700 Subject: VPP-373: stop building from /vpp mount Change-Id: I7f8fe8fa6c24b4229b0cb45e6c83e7cb2828e2da Signed-off-by: Ed Warnicke --- build-root/vagrant/Vagrantfile | 10 +++++--- build-root/vagrant/build.sh | 4 ++-- build-root/vagrant/clone.sh | 54 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 5 deletions(-) create mode 100755 build-root/vagrant/clone.sh (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 641397e8..47709033 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -14,8 +14,9 @@ Vagrant.configure(2) do |config| 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" - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clone.sh") + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/home/vagrant/git/vpp vagrant" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/home/vagrant/git/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") @@ -59,8 +60,11 @@ Vagrant.configure(2) do |config| vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) - + + config.ssh.forward_agent = true + config.vm.synced_folder "../../", "/vpp", disabled: false + config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--ioapic", "on"] vb.memory = "#{vmram}" diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh index aecb1d64..8695b030 100755 --- a/build-root/vagrant/build.sh +++ b/build-root/vagrant/build.sh @@ -47,8 +47,8 @@ make UNATTENDED=yes install-dep # Really really clean things up so we can be sure # that the build works even when switching distros -make wipe -(cd build-root/;make distclean) +$SUDOCMD make wipe +(cd build-root/;$SUDOCMD make distclean) rm -f build-root/.bootstrap.ok if [ $DISTRIB_ID == "CentOS" ]; then diff --git a/build-root/vagrant/clone.sh b/build-root/vagrant/clone.sh new file mode 100755 index 00000000..813c5f43 --- /dev/null +++ b/build-root/vagrant/clone.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + sudo yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi +KERNEL_OS=`uname -o` +KERNEL_MACHINE=`uname -m` +KERNEL_RELEASE=`uname -r` +KERNEL_VERSION=`uname -v` + +echo KERNEL_OS: $KERNEL_OS +echo KERNEL_MACHINE: $KERNEL_MACHINE +echo KERNEL_RELEASE: $KERNEL_RELEASE +echo KERNEL_VERSION: $KERNEL_VERSION +echo DISTRIB_ID: $DISTRIB_ID +echo DISTRIB_RELEASE: $DISTRIB_RELEASE +echo DISTRIB_CODENAME: $DISTRIB_CODENAME +echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION + +# Make sure git is installed +if [ $DISTRIB_ID == "CentOS" ]; then + yum -y install git +elif [ $DISTRIB_ID == "Ubuntu" ]; then + apt-get -y install git +fi + +# Setup the vpp code +cd ~vagrant/ +sudo -u vagrant mkdir git +cd git/ +echo "SSH_AUTH_SOCK $SSH_AUTH_SOCK x" +chmod 777 $SSH_AUTH_SOCK + +CLONE_URL=`cd /vpp;git remote -v | grep origin |grep fetch |awk '{print $2}'` +echo "CLONE_URL $CLONE_URL" +echo $CLONE_URL | grep -q "^ssh:" +if [ $? == 0 ]; then + SSH_HOST=`echo $CLONE_URL| awk -F/ '{print $3}'` + SSH_PORT=`echo $SSH_HOST| awk -F: '{print $2}'` + if [ -n $SSH_PORT ]; then + SSH_PORT="-p $SSH_PORT" + fi + SSH_HOST=`echo $SSH_HOST| awk -F: '{print $1}'` + echo "SSH_HOST $SSH_HOST" + echo "SSH_PORT $SSH_PORT" + sudo -HE -u vagrant ssh -oStrictHostKeyChecking=no -v $SSH_PORT $SSH_HOST +fi +sudo -HE -u vagrant git clone $CLONE_URL -- cgit 1.2.3-korg From 81ee70f93f42132cbf8a5a1b461bb9b17e3b54c9 Mon Sep 17 00:00:00 2001 From: Thomas F Herbert Date: Mon, 1 Aug 2016 18:33:48 -0400 Subject: VPP-308: Added workaround for failed vnet build. For some reason the clock slew is greater with Vagrant 1.8.5 which causes Makefile.am to be timestamped as newer which causes builds to fail. Change-Id: Id0d35c41ac66a2841c5aae20dd678f4bc125e41b Signed-off-by: Thomas F Herbert --- build-root/vagrant/build.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh index 8695b030..e500240b 100755 --- a/build-root/vagrant/build.sh +++ b/build-root/vagrant/build.sh @@ -68,6 +68,7 @@ $SUDOCMD make bootstrap if [ $DISTRIB_ID == "Ubuntu" ]; then $SUDOCMD make pkg-deb elif [ $DISTRIB_ID == "CentOS" ]; then + (cd $VPP_DIR/vnet ;aclocal; automake -a) $SUDOCMD make pkg-rpm fi -- cgit 1.2.3-korg From 8cb034b397d718d64317953f27684ff444194072 Mon Sep 17 00:00:00 2001 From: Billy McFall Date: Thu, 20 Oct 2016 08:50:11 -0400 Subject: VPP-504: Permissions Error on Centos Vagrant VPP VM Change-Id: I5e63538e0ba2395fb13f99f0c7c2ca3123a34e59 Signed-off-by: Billy McFall --- build-root/vagrant/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh index e500240b..76838e28 100755 --- a/build-root/vagrant/build.sh +++ b/build-root/vagrant/build.sh @@ -68,7 +68,7 @@ $SUDOCMD make bootstrap if [ $DISTRIB_ID == "Ubuntu" ]; then $SUDOCMD make pkg-deb elif [ $DISTRIB_ID == "CentOS" ]; then - (cd $VPP_DIR/vnet ;aclocal; automake -a) + (cd $VPP_DIR/vnet ;$SUDOCMD aclocal;$SUDOCMD automake -a) $SUDOCMD make pkg-rpm fi -- cgit 1.2.3-korg From ee49bf82f5548959e0489e9dfac3a071c99f70de Mon Sep 17 00:00:00 2001 From: Ray Kinsella Date: Wed, 21 Dec 2016 12:10:43 +0000 Subject: vagrant: updated Vagrantfile to use rsync Replacing problematic nfs & git clone, with a simplier rsync. Change-Id: I26a95bd81b7fbf6ea0179cd62361e0902f2d22ed Signed-off-by: Ray Kinsella --- build-root/vagrant/Vagrantfile | 20 ++++++++++++---- build-root/vagrant/clone.sh | 54 ------------------------------------------ 2 files changed, 16 insertions(+), 58 deletions(-) delete mode 100755 build-root/vagrant/clone.sh (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 47709033..1f8cf9ab 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -14,9 +14,8 @@ Vagrant.configure(2) do |config| 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__),"clone.sh") - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/home/vagrant/git/vpp vagrant" - config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/home/vagrant/git/vpp" + config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" + 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") @@ -63,7 +62,20 @@ Vagrant.configure(2) do |config| config.ssh.forward_agent = true - config.vm.synced_folder "../../", "/vpp", disabled: false + 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"] config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--ioapic", "on"] diff --git a/build-root/vagrant/clone.sh b/build-root/vagrant/clone.sh deleted file mode 100755 index 813c5f43..00000000 --- a/build-root/vagrant/clone.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Figure out what system we are running on -if [ -f /etc/lsb-release ];then - . /etc/lsb-release -elif [ -f /etc/redhat-release ];then - sudo yum install -y redhat-lsb - DISTRIB_ID=`lsb_release -si` - DISTRIB_RELEASE=`lsb_release -sr` - DISTRIB_CODENAME=`lsb_release -sc` - DISTRIB_DESCRIPTION=`lsb_release -sd` -fi -KERNEL_OS=`uname -o` -KERNEL_MACHINE=`uname -m` -KERNEL_RELEASE=`uname -r` -KERNEL_VERSION=`uname -v` - -echo KERNEL_OS: $KERNEL_OS -echo KERNEL_MACHINE: $KERNEL_MACHINE -echo KERNEL_RELEASE: $KERNEL_RELEASE -echo KERNEL_VERSION: $KERNEL_VERSION -echo DISTRIB_ID: $DISTRIB_ID -echo DISTRIB_RELEASE: $DISTRIB_RELEASE -echo DISTRIB_CODENAME: $DISTRIB_CODENAME -echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION - -# Make sure git is installed -if [ $DISTRIB_ID == "CentOS" ]; then - yum -y install git -elif [ $DISTRIB_ID == "Ubuntu" ]; then - apt-get -y install git -fi - -# Setup the vpp code -cd ~vagrant/ -sudo -u vagrant mkdir git -cd git/ -echo "SSH_AUTH_SOCK $SSH_AUTH_SOCK x" -chmod 777 $SSH_AUTH_SOCK - -CLONE_URL=`cd /vpp;git remote -v | grep origin |grep fetch |awk '{print $2}'` -echo "CLONE_URL $CLONE_URL" -echo $CLONE_URL | grep -q "^ssh:" -if [ $? == 0 ]; then - SSH_HOST=`echo $CLONE_URL| awk -F/ '{print $3}'` - SSH_PORT=`echo $SSH_HOST| awk -F: '{print $2}'` - if [ -n $SSH_PORT ]; then - SSH_PORT="-p $SSH_PORT" - fi - SSH_HOST=`echo $SSH_HOST| awk -F: '{print $1}'` - echo "SSH_HOST $SSH_HOST" - echo "SSH_PORT $SSH_PORT" - sudo -HE -u vagrant ssh -oStrictHostKeyChecking=no -v $SSH_PORT $SSH_HOST -fi -sudo -HE -u vagrant git clone $CLONE_URL -- cgit 1.2.3-korg From 1a9b5b71cddac0a26d788f8d1e66076666087888 Mon Sep 17 00:00:00 2001 From: Ray Kinsella Date: Wed, 21 Dec 2016 14:25:40 +0000 Subject: vagrant: Fixing sudo related vagrant errors The dpkg sudo trigger appears to want to run interactively despite the noninteractive debconf setting. This is a problem upstream for vagrant also, see. https://github.com/hashicorp/terraform/issues/9763 Incorporating the recommended fix to Vagrantfile from upstream https://github.com/hashicorp/terraform/pull/9783 Change-Id: I8da8522fc9e80fc3bd268b347a786054ad019170 Signed-off-by: Ray Kinsella --- Makefile | 2 +- build-root/vagrant/update.sh | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'build-root/vagrant') diff --git a/Makefile b/Makefile index b3ffaf30..292b0d28 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ endif DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache DEB_DEPENDS += debhelper dkms git libtool libganglia1-dev libapr1-dev dh-systemd DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope -DEB_DEPENDS += python-dev python-virtualenv python-pip lcov chrpath +DEB_DEPENDS += python-dev python-virtualenv python-pip lcov chrpath autoconf ifeq ($(OS_VERSION_ID),14.04) DEB_DEPENDS += openjdk-8-jdk-headless else diff --git a/build-root/vagrant/update.sh b/build-root/vagrant/update.sh index 77bf49a7..2a377398 100755 --- a/build-root/vagrant/update.sh +++ b/build-root/vagrant/update.sh @@ -25,21 +25,24 @@ fi # Do initial setup for the system if [ $DISTRIB_ID == "Ubuntu" ]; then - # Fix grub-pc on Virtualbox with Ubuntu + + export DEBIAN_PRIORITY=critical export DEBIAN_FRONTEND=noninteractive + export DEBCONF_NONINTERACTIVE_SEEN=true + APT_OPTS="--assume-yes --no-install-suggests --no-install-recommends -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\"" # Standard update + upgrade dance - apt-get update - apt-get upgrade -y + apt-get update ${APT_OPTS} >/dev/null + apt-get upgrade ${APT_OPTS} >/dev/null # Fix the silly notion that /bin/sh should point to dash by pointing it to bash update-alternatives --install /bin/sh sh /bin/bash 100 # Install useful but non-mandatory tools - apt-get install -y emacs git-review gdb gdbserver + apt-get install -y emacs git-review gdb gdbserver elif [ $DISTRIB_ID == "CentOS" ]; then # Standard update + upgrade dance yum check-update yum update -y -fi \ No newline at end of file +fi -- cgit 1.2.3-korg From 46f133d522b0f247f3b395ad39a12f6898cb67eb Mon Sep 17 00:00:00 2001 From: Padraig Connolly Date: Tue, 17 Jan 2017 14:13:03 +0000 Subject: vagrant: stop rsync from wiping changes from /vpp *Fixes issue where any changes to the vpp directory withing vagrant are wiped if user reboots the vagrant vm *Rsync will now only run if provisioning hasn't occured before Change-Id: Ic29eb1321fba33e82df4075e7a95c96fa2e6739f Signed-off-by: Padraig Connolly --- build-root/vagrant/Vagrantfile | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 1f8cf9ab..9e03a84e 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -62,26 +62,29 @@ Vagrant.configure(2) do |config| config.ssh.forward_agent = true - 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"] - 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"] -- cgit 1.2.3-korg From ed0e49c51841e84c72a5bb2c6d538ee779b734d4 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Thu, 26 Jan 2017 21:42:00 -0500 Subject: Update default Vagrant box to Ubuntu 16.04, VPP-616 - Make puppetlabs/ubuntu-16.04-64-nocm the default box - Enable x11 forwarding - Install x11-utils required for emacs to work over X11 - Refactor run.sh - Add VPP_VAGRANT_POST_BUILD environment variable to allow selection of installing VPP or run "make test". - Fix dependencies in src/vppapigen.am Change-Id: I0ec054fdc83feb71ca8396df53ed02bf82ecd7e7 Signed-off-by: Dave Wallace --- build-root/vagrant/Vagrantfile | 21 +++++++++++++++------ build-root/vagrant/run.sh | 11 ++++++----- build-root/vagrant/update.sh | 2 +- src/vppapigen.am | 13 +++++-------- 4 files changed, 27 insertions(+), 20 deletions(-) (limited to 'build-root/vagrant') diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile index 9e03a84e..b463d646 100644 --- a/build-root/vagrant/Vagrantfile +++ b/build-root/vagrant/Vagrantfile @@ -3,21 +3,29 @@ Vagrant.configure(2) do |config| - # Pick the right distro and bootstrap, default is ubuntu1404 - distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1404") + # 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 + 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" - 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") + + 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 @@ -61,6 +69,7 @@ Vagrant.configure(2) do |config| 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"] diff --git a/build-root/vagrant/run.sh b/build-root/vagrant/run.sh index 7342f388..1cd33826 100755 --- a/build-root/vagrant/run.sh +++ b/build-root/vagrant/run.sh @@ -11,12 +11,13 @@ elif [ -f /etc/redhat-release ];then DISTRIB_DESCRIPTION=`lsb_release -sd` fi -if [ $DISTRIB_ID == "Ubuntu" ]; then - start vpp -elif [ $DISTRIB_ID == "CentOS" ]; then +if [ $DISTRIB_ID == "CentOS" ]; then # Install uio-pci-generic modprobe uio_pci_generic - - # Start vpp +fi +echo "Starting VPP..." +if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_CODENAME = "trusty" ] ; then + start vpp +else service vpp start fi diff --git a/build-root/vagrant/update.sh b/build-root/vagrant/update.sh index 2a377398..f4139d74 100755 --- a/build-root/vagrant/update.sh +++ b/build-root/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 git-review gdb gdbserver + apt-get install -y emacs x11-utils git-review gdb gdbserver elif [ $DISTRIB_ID == "CentOS" ]; then # Standard update + upgrade dance yum check-update diff --git a/src/vppapigen.am b/src/vppapigen.am index 5c25e1ec..fe9ff03e 100644 --- a/src/vppapigen.am +++ b/src/vppapigen.am @@ -13,20 +13,17 @@ bin_PROGRAMS += vppapigen -# We cannot rely on BUILT_SOURCES here as other built sources are relying -# on vppapigen, so make can start compiling lex.c before gram.h is created. -# This way we introduce new dependency by running C preprocessor. - -tools/vppapigen/lex_e.c: tools/vppapigen/lex.c tools/vppapigen/gram.y +tools/vppapigen/gram.h: tools/vppapigen/gram.y @$(YACC) -d @srcdir@/tools/vppapigen/gram.y @mv y.tab.h tools/vppapigen/gram.h @rm y.tab.c - @$(CC) -I. -E -o $@ $< -vppapigen_SOURCES = tools/vppapigen/gram.y tools/vppapigen/lex_e.c tools/vppapigen/node.c +tools/vppapigen/lex.o: tools/vppapigen/gram.h +tools/vppapigen/node.o: tools/vppapigen/gram.h + +vppapigen_SOURCES = tools/vppapigen/gram.y tools/vppapigen/lex.c tools/vppapigen/node.c vppapigen_LDADD = libvppinfra.la vppapigen_LDFLAGS = -static CLEANFILES += tools/vppapigen/gram.c tools/vppapigen/gram.h -CLEANFILES += tools/vppapigen/lex_e.c # vi:syntax=automake -- cgit 1.2.3-korg 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 --- README.md | 4 +- build-root/vagrant | 1 + build-root/vagrant/.gitignore | 1 - build-root/vagrant/README | 28 --------- build-root/vagrant/Vagrantfile | 113 ---------------------------------- build-root/vagrant/WELCOME | 61 ------------------ build-root/vagrant/build.sh | 74 ---------------------- build-root/vagrant/clearinterfaces.sh | 17 ----- build-root/vagrant/env.sh | 6 -- build-root/vagrant/install.sh | 30 --------- build-root/vagrant/run.sh | 23 ------- build-root/vagrant/update.sh | 48 --------------- extras/vagrant/.gitignore | 1 + extras/vagrant/README | 28 +++++++++ extras/vagrant/Vagrantfile | 113 ++++++++++++++++++++++++++++++++++ extras/vagrant/WELCOME | 61 ++++++++++++++++++ extras/vagrant/build.sh | 74 ++++++++++++++++++++++ extras/vagrant/clearinterfaces.sh | 17 +++++ extras/vagrant/env.sh | 6 ++ extras/vagrant/install.sh | 30 +++++++++ extras/vagrant/run.sh | 23 +++++++ extras/vagrant/update.sh | 48 +++++++++++++++ 22 files changed, 404 insertions(+), 403 deletions(-) create mode 120000 build-root/vagrant delete mode 100644 build-root/vagrant/.gitignore delete mode 100644 build-root/vagrant/README delete mode 100644 build-root/vagrant/Vagrantfile delete mode 100644 build-root/vagrant/WELCOME delete mode 100755 build-root/vagrant/build.sh delete mode 100755 build-root/vagrant/clearinterfaces.sh delete mode 100644 build-root/vagrant/env.sh delete mode 100644 build-root/vagrant/install.sh delete mode 100755 build-root/vagrant/run.sh delete mode 100755 build-root/vagrant/update.sh create mode 100644 extras/vagrant/.gitignore create mode 100644 extras/vagrant/README create mode 100644 extras/vagrant/Vagrantfile create mode 100644 extras/vagrant/WELCOME create mode 100755 extras/vagrant/build.sh create mode 100755 extras/vagrant/clearinterfaces.sh create mode 100644 extras/vagrant/env.sh create mode 100644 extras/vagrant/install.sh create mode 100755 extras/vagrant/run.sh create mode 100755 extras/vagrant/update.sh (limited to 'build-root/vagrant') diff --git a/README.md b/README.md index b70103fb..7f429d12 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ To install system dependencies, build VPP and then install it, simply run the build script. This should be performed a non-privileged user with `sudo` access from the project base directory: - ./build-root/vagrant/build.sh + ./extras/vagrant/build.sh If you want a more fine-grained approach because you intend to do some development work, the `Makefile` in the root directory of the source tree @@ -79,7 +79,7 @@ interest. To see the available targets run: ### Quick-start: Vagrant -The directory `build-root/vagrant` contains a `VagrantFile` and supporting +The directory `extras/vagrant` contains a `VagrantFile` and supporting scripts to bootstrap a working VPP inside a Vagrant-managed Virtual Machine. This VM can then be used to test concepts with VPP or as a development platform to extend VPP. Some obvious caveats apply when using a VM for VPP diff --git a/build-root/vagrant b/build-root/vagrant new file mode 120000 index 00000000..ada25b83 --- /dev/null +++ b/build-root/vagrant @@ -0,0 +1 @@ +../extras/vagrant \ No newline at end of file diff --git a/build-root/vagrant/.gitignore b/build-root/vagrant/.gitignore deleted file mode 100644 index a977916f..00000000 --- a/build-root/vagrant/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.vagrant/ diff --git a/build-root/vagrant/README b/build-root/vagrant/README deleted file mode 100644 index 238c90ce..00000000 --- a/build-root/vagrant/README +++ /dev/null @@ -1,28 +0,0 @@ -INTRO: - -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 - -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 - source ./env.sh - vagrant up - -By default, the VM created is/has: -- Ubuntu 14.04 -- 2 vCPUs -- 4G of RAM -- 2 NICs (1 x NAT - host access, 1 x VPP DPDK enabled) - -PROVIDERS: - -Supported vagrant providers are: - -- Virtualbox, VMware Fusion/Workstation, Libvirt - diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile deleted file mode 100644 index b463d646..00000000 --- a/build-root/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 - 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 diff --git a/build-root/vagrant/WELCOME b/build-root/vagrant/WELCOME deleted file mode 100644 index eb6aa2fd..00000000 --- a/build-root/vagrant/WELCOME +++ /dev/null @@ -1,61 +0,0 @@ -VPP has now been built, installed, and started. - -To give it a spin, we can create a tap interface and try a simple ping -(with trace). - -Make sure you have run: - -$ vagrant ssh - -To get to the vagrant VM: - -vagrant@localhost:~$ - -Confirm that vpp is running with - -vagrant@localhost:~$ sudo status vpp -vpp start/running, process 25202 - -To create the tap: - -vagrant@localhost:~$ sudo vppctl tap connect foobar -Created tap-0 for Linux tap 'foobar' -vagrant@localhost:~$ sudo vppctl show int - -To assign it an ip address (and 'up' the interface): - -vagrant@localhost:~$ sudo vppctl set int ip address tap-0 192.168.1.1/24 -vagrant@localhost:~$ sudo vppctl set int state tap-0 up - -To turn on packet tracing for the tap interface: -vagrant@localhost:~$ sudo vppctl trace add tapcli-rx 10 - -Now, to set up and try the other end: -vagrant@localhost:~$ sudo ip addr add 192.168.1.2/24 dev foobar -vagrant@localhost:~$ ping -c 3 192.168.1.1 - -To look at the trace: -vagrant@localhost:~$ sudo vppctl show trace - -And to stop tracing: - -vagrant@localhost:~$ sudo vppctl clear trace - -Other fun things to look at: - -The vlib packet processing graph: -vagrant@localhost:~$ sudo vppctl show vlib graph - -which will produce output like: - - Name Next Previous -ip4-icmp-input error-punt [0] ip4-local - ip4-icmp-echo-request [1] - vpe-icmp4-oam [2] - -To read this, the first column (Name) is the name of the node. -The second column (Next) is the name of the children of that node. -The third column (Previous) is the name of the parents of this node. - -To see this README again: -cat /vagrant/README diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh deleted file mode 100755 index 76838e28..00000000 --- a/build-root/vagrant/build.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/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 0:$0 -echo 1:$1 -echo 2:$2 -echo VPP_DIR: $VPP_DIR -echo SUDOCMD: $SUDOCMD - -# Figure out what system we are running on -if [ -f /etc/lsb-release ];then - . /etc/lsb-release -elif [ -f /etc/redhat-release ];then - sudo yum install -y redhat-lsb - DISTRIB_ID=`lsb_release -si` - DISTRIB_RELEASE=`lsb_release -sr` - DISTRIB_CODENAME=`lsb_release -sc` - DISTRIB_DESCRIPTION=`lsb_release -sd` -fi -KERNEL_OS=`uname -o` -KERNEL_MACHINE=`uname -m` -KERNEL_RELEASE=`uname -r` -KERNEL_VERSION=`uname -v` - -echo KERNEL_OS: $KERNEL_OS -echo KERNEL_MACHINE: $KERNEL_MACHINE -echo KERNEL_RELEASE: $KERNEL_RELEASE -echo KERNEL_VERSION: $KERNEL_VERSION -echo DISTRIB_ID: $DISTRIB_ID -echo DISTRIB_RELEASE: $DISTRIB_RELEASE -echo DISTRIB_CODENAME: $DISTRIB_CODENAME -echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION - -# Install dependencies -cd $VPP_DIR -make UNATTENDED=yes install-dep - -# Really really clean things up so we can be sure -# that the build works even when switching distros -$SUDOCMD make wipe -(cd build-root/;$SUDOCMD make distclean) -rm -f build-root/.bootstrap.ok - -if [ $DISTRIB_ID == "CentOS" ]; then - echo rpm -V apr-devel - rpm -V apr-devel - if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi - echo rpm -V ganglia-devel - rpm -V ganglia-devel - if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi - echo rpm -V libconfuse-devel - rpm -V libconfuse-devel - if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi -fi - -# Build and install packaging -$SUDOCMD make bootstrap -if [ $DISTRIB_ID == "Ubuntu" ]; then - $SUDOCMD make pkg-deb -elif [ $DISTRIB_ID == "CentOS" ]; then - (cd $VPP_DIR/vnet ;$SUDOCMD aclocal;$SUDOCMD automake -a) - $SUDOCMD make pkg-rpm -fi - diff --git a/build-root/vagrant/clearinterfaces.sh b/build-root/vagrant/clearinterfaces.sh deleted file mode 100755 index 78f6705c..00000000 --- a/build-root/vagrant/clearinterfaces.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Capture all the interface IPs, in case we need them later -ip -o addr show > ~vagrant/ifconfiga -chown vagrant:vagrant ~vagrant/ifconfiga - -# Disable all ethernet interfaces other than the default route -# interface so VPP will use those interfaces. The VPP auto-blacklist -# algorithm prevents the use of any physical interface contained in the -# routing table (i.e. "route --inet --inet6") preventing the theft of -# the management ethernet interface by VPP from the kernel. -for intf in $(ls /sys/class/net) ; do - if [ -d /sys/class/net/$intf/device ] && - [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then - ifconfig $intf down - fi -done diff --git a/build-root/vagrant/env.sh b/build-root/vagrant/env.sh deleted file mode 100644 index f0edfd88..00000000 --- a/build-root/vagrant/env.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -export VPP_VAGRANT_DISTRO="ubuntu1404" -export VPP_VAGRANT_NICS=2 -export VPP_VAGRANT_VMCPU=4 -export VPP_VAGRANT_VMRAM=4096 diff --git a/build-root/vagrant/install.sh b/build-root/vagrant/install.sh deleted file mode 100644 index a53faa4d..00000000 --- a/build-root/vagrant/install.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 - -# Figure out what system we are running on -if [ -f /etc/lsb-release ];then - . /etc/lsb-release -elif [ -f /etc/redhat-release ];then - sudo yum install -y redhat-lsb - DISTRIB_ID=`lsb_release -si` - DISTRIB_RELEASE=`lsb_release -sr` - DISTRIB_CODENAME=`lsb_release -sc` - DISTRIB_DESCRIPTION=`lsb_release -sd` -fi -echo DISTRIB_ID: $DISTRIB_ID -echo DISTRIB_RELEASE: $DISTRIB_RELEASE -echo DISTRIB_CODENAME: $DISTRIB_CODENAME -echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION - -if [ $DISTRIB_ID == "Ubuntu" ]; then - (cd ${VPP_DIR}/build-root/;sudo dpkg -i *.deb) -elif [ $DISTRIB_ID == "CentOS" ]; then - (cd ${VPP_DIR}/build-root/;sudo rpm -Uvh *.rpm) -fi \ No newline at end of file diff --git a/build-root/vagrant/run.sh b/build-root/vagrant/run.sh deleted file mode 100755 index 1cd33826..00000000 --- a/build-root/vagrant/run.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Figure out what system we are running on -if [ -f /etc/lsb-release ];then - . /etc/lsb-release -elif [ -f /etc/redhat-release ];then - yum install -y redhat-lsb - DISTRIB_ID=`lsb_release -si` - DISTRIB_RELEASE=`lsb_release -sr` - DISTRIB_CODENAME=`lsb_release -sc` - DISTRIB_DESCRIPTION=`lsb_release -sd` -fi - -if [ $DISTRIB_ID == "CentOS" ]; then - # Install uio-pci-generic - modprobe uio_pci_generic -fi -echo "Starting VPP..." -if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_CODENAME = "trusty" ] ; then - start vpp -else - service vpp start -fi diff --git a/build-root/vagrant/update.sh b/build-root/vagrant/update.sh deleted file mode 100755 index f4139d74..00000000 --- a/build-root/vagrant/update.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# Make sure that we get the hugepages we need on provision boot -# Note: The package install should take care of this at the end -# But sometimes after all the work of provisioning, we can't -# get the requested number of hugepages without rebooting. -# So do it here just in case -sysctl -w vm.nr_hugepages=1024 -HUGEPAGES=`sysctl -n vm.nr_hugepages` -if [ $HUGEPAGES != 1024 ]; then - echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish." - exit -fi - -# Figure out what system we are running on -if [ -f /etc/lsb-release ];then - . /etc/lsb-release -elif [ -f /etc/redhat-release ];then - yum install -y redhat-lsb - DISTRIB_ID=`lsb_release -si` - DISTRIB_RELEASE=`lsb_release -sr` - DISTRIB_CODENAME=`lsb_release -sc` - DISTRIB_DESCRIPTION=`lsb_release -sd` -fi - -# Do initial setup for the system -if [ $DISTRIB_ID == "Ubuntu" ]; then - - export DEBIAN_PRIORITY=critical - export DEBIAN_FRONTEND=noninteractive - export DEBCONF_NONINTERACTIVE_SEEN=true - APT_OPTS="--assume-yes --no-install-suggests --no-install-recommends -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\"" - - # Standard update + upgrade dance - apt-get update ${APT_OPTS} >/dev/null - apt-get upgrade ${APT_OPTS} >/dev/null - - # Fix the silly notion that /bin/sh should point to dash by pointing it to bash - - 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 -elif [ $DISTRIB_ID == "CentOS" ]; then - # Standard update + upgrade dance - yum check-update - yum update -y -fi diff --git a/extras/vagrant/.gitignore b/extras/vagrant/.gitignore new file mode 100644 index 00000000..a977916f --- /dev/null +++ b/extras/vagrant/.gitignore @@ -0,0 +1 @@ +.vagrant/ diff --git a/extras/vagrant/README b/extras/vagrant/README new file mode 100644 index 00000000..238c90ce --- /dev/null +++ b/extras/vagrant/README @@ -0,0 +1,28 @@ +INTRO: + +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 + +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 + source ./env.sh + vagrant up + +By default, the VM created is/has: +- Ubuntu 14.04 +- 2 vCPUs +- 4G of RAM +- 2 NICs (1 x NAT - host access, 1 x VPP DPDK enabled) + +PROVIDERS: + +Supported vagrant providers are: + +- Virtualbox, VMware Fusion/Workstation, Libvirt + 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 diff --git a/extras/vagrant/WELCOME b/extras/vagrant/WELCOME new file mode 100644 index 00000000..eb6aa2fd --- /dev/null +++ b/extras/vagrant/WELCOME @@ -0,0 +1,61 @@ +VPP has now been built, installed, and started. + +To give it a spin, we can create a tap interface and try a simple ping +(with trace). + +Make sure you have run: + +$ vagrant ssh + +To get to the vagrant VM: + +vagrant@localhost:~$ + +Confirm that vpp is running with + +vagrant@localhost:~$ sudo status vpp +vpp start/running, process 25202 + +To create the tap: + +vagrant@localhost:~$ sudo vppctl tap connect foobar +Created tap-0 for Linux tap 'foobar' +vagrant@localhost:~$ sudo vppctl show int + +To assign it an ip address (and 'up' the interface): + +vagrant@localhost:~$ sudo vppctl set int ip address tap-0 192.168.1.1/24 +vagrant@localhost:~$ sudo vppctl set int state tap-0 up + +To turn on packet tracing for the tap interface: +vagrant@localhost:~$ sudo vppctl trace add tapcli-rx 10 + +Now, to set up and try the other end: +vagrant@localhost:~$ sudo ip addr add 192.168.1.2/24 dev foobar +vagrant@localhost:~$ ping -c 3 192.168.1.1 + +To look at the trace: +vagrant@localhost:~$ sudo vppctl show trace + +And to stop tracing: + +vagrant@localhost:~$ sudo vppctl clear trace + +Other fun things to look at: + +The vlib packet processing graph: +vagrant@localhost:~$ sudo vppctl show vlib graph + +which will produce output like: + + Name Next Previous +ip4-icmp-input error-punt [0] ip4-local + ip4-icmp-echo-request [1] + vpe-icmp4-oam [2] + +To read this, the first column (Name) is the name of the node. +The second column (Next) is the name of the children of that node. +The third column (Previous) is the name of the parents of this node. + +To see this README again: +cat /vagrant/README diff --git a/extras/vagrant/build.sh b/extras/vagrant/build.sh new file mode 100755 index 00000000..76838e28 --- /dev/null +++ b/extras/vagrant/build.sh @@ -0,0 +1,74 @@ +#!/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 0:$0 +echo 1:$1 +echo 2:$2 +echo VPP_DIR: $VPP_DIR +echo SUDOCMD: $SUDOCMD + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + sudo yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi +KERNEL_OS=`uname -o` +KERNEL_MACHINE=`uname -m` +KERNEL_RELEASE=`uname -r` +KERNEL_VERSION=`uname -v` + +echo KERNEL_OS: $KERNEL_OS +echo KERNEL_MACHINE: $KERNEL_MACHINE +echo KERNEL_RELEASE: $KERNEL_RELEASE +echo KERNEL_VERSION: $KERNEL_VERSION +echo DISTRIB_ID: $DISTRIB_ID +echo DISTRIB_RELEASE: $DISTRIB_RELEASE +echo DISTRIB_CODENAME: $DISTRIB_CODENAME +echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION + +# Install dependencies +cd $VPP_DIR +make UNATTENDED=yes install-dep + +# Really really clean things up so we can be sure +# that the build works even when switching distros +$SUDOCMD make wipe +(cd build-root/;$SUDOCMD make distclean) +rm -f build-root/.bootstrap.ok + +if [ $DISTRIB_ID == "CentOS" ]; then + echo rpm -V apr-devel + rpm -V apr-devel + if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi + echo rpm -V ganglia-devel + rpm -V ganglia-devel + if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi + echo rpm -V libconfuse-devel + rpm -V libconfuse-devel + if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi +fi + +# Build and install packaging +$SUDOCMD make bootstrap +if [ $DISTRIB_ID == "Ubuntu" ]; then + $SUDOCMD make pkg-deb +elif [ $DISTRIB_ID == "CentOS" ]; then + (cd $VPP_DIR/vnet ;$SUDOCMD aclocal;$SUDOCMD automake -a) + $SUDOCMD make pkg-rpm +fi + diff --git a/extras/vagrant/clearinterfaces.sh b/extras/vagrant/clearinterfaces.sh new file mode 100755 index 00000000..78f6705c --- /dev/null +++ b/extras/vagrant/clearinterfaces.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Capture all the interface IPs, in case we need them later +ip -o addr show > ~vagrant/ifconfiga +chown vagrant:vagrant ~vagrant/ifconfiga + +# Disable all ethernet interfaces other than the default route +# interface so VPP will use those interfaces. The VPP auto-blacklist +# algorithm prevents the use of any physical interface contained in the +# routing table (i.e. "route --inet --inet6") preventing the theft of +# the management ethernet interface by VPP from the kernel. +for intf in $(ls /sys/class/net) ; do + if [ -d /sys/class/net/$intf/device ] && + [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then + ifconfig $intf down + fi +done diff --git a/extras/vagrant/env.sh b/extras/vagrant/env.sh new file mode 100644 index 00000000..f0edfd88 --- /dev/null +++ b/extras/vagrant/env.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +export VPP_VAGRANT_DISTRO="ubuntu1404" +export VPP_VAGRANT_NICS=2 +export VPP_VAGRANT_VMCPU=4 +export VPP_VAGRANT_VMRAM=4096 diff --git a/extras/vagrant/install.sh b/extras/vagrant/install.sh new file mode 100644 index 00000000..a53faa4d --- /dev/null +++ b/extras/vagrant/install.sh @@ -0,0 +1,30 @@ +#!/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 + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + sudo yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi +echo DISTRIB_ID: $DISTRIB_ID +echo DISTRIB_RELEASE: $DISTRIB_RELEASE +echo DISTRIB_CODENAME: $DISTRIB_CODENAME +echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION + +if [ $DISTRIB_ID == "Ubuntu" ]; then + (cd ${VPP_DIR}/build-root/;sudo dpkg -i *.deb) +elif [ $DISTRIB_ID == "CentOS" ]; then + (cd ${VPP_DIR}/build-root/;sudo rpm -Uvh *.rpm) +fi \ No newline at end of file diff --git a/extras/vagrant/run.sh b/extras/vagrant/run.sh new file mode 100755 index 00000000..1cd33826 --- /dev/null +++ b/extras/vagrant/run.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi + +if [ $DISTRIB_ID == "CentOS" ]; then + # Install uio-pci-generic + modprobe uio_pci_generic +fi +echo "Starting VPP..." +if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_CODENAME = "trusty" ] ; then + start vpp +else + service vpp start +fi diff --git a/extras/vagrant/update.sh b/extras/vagrant/update.sh new file mode 100755 index 00000000..f4139d74 --- /dev/null +++ b/extras/vagrant/update.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Make sure that we get the hugepages we need on provision boot +# Note: The package install should take care of this at the end +# But sometimes after all the work of provisioning, we can't +# get the requested number of hugepages without rebooting. +# So do it here just in case +sysctl -w vm.nr_hugepages=1024 +HUGEPAGES=`sysctl -n vm.nr_hugepages` +if [ $HUGEPAGES != 1024 ]; then + echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish." + exit +fi + +# Figure out what system we are running on +if [ -f /etc/lsb-release ];then + . /etc/lsb-release +elif [ -f /etc/redhat-release ];then + yum install -y redhat-lsb + DISTRIB_ID=`lsb_release -si` + DISTRIB_RELEASE=`lsb_release -sr` + DISTRIB_CODENAME=`lsb_release -sc` + DISTRIB_DESCRIPTION=`lsb_release -sd` +fi + +# Do initial setup for the system +if [ $DISTRIB_ID == "Ubuntu" ]; then + + export DEBIAN_PRIORITY=critical + export DEBIAN_FRONTEND=noninteractive + export DEBCONF_NONINTERACTIVE_SEEN=true + APT_OPTS="--assume-yes --no-install-suggests --no-install-recommends -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\"" + + # Standard update + upgrade dance + apt-get update ${APT_OPTS} >/dev/null + apt-get upgrade ${APT_OPTS} >/dev/null + + # Fix the silly notion that /bin/sh should point to dash by pointing it to bash + + 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 +elif [ $DISTRIB_ID == "CentOS" ]; then + # Standard update + upgrade dance + yum check-update + yum update -y +fi -- cgit 1.2.3-korg