diff options
Diffstat (limited to 'build-root/vagrant')
-rw-r--r-- | build-root/vagrant/.gitignore | 1 | ||||
-rw-r--r-- | build-root/vagrant/README | 54 | ||||
-rw-r--r-- | build-root/vagrant/Vagrantfile | 36 | ||||
-rw-r--r-- | build-root/vagrant/bootstrap.centos7.sh | 45 | ||||
-rw-r--r-- | build-root/vagrant/bootstrap.ubuntu1404.sh | 77 |
5 files changed, 213 insertions, 0 deletions
diff --git a/build-root/vagrant/.gitignore b/build-root/vagrant/.gitignore new file mode 100644 index 00000000000..a977916f658 --- /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 00000000000..0498615473e --- /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 00000000000..9c61dd33af2 --- /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 00000000000..1d811e45599 --- /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 00000000000..c89f098ce25 --- /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 |