aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorSwarup Nayak <swarupnpvt@gmail.com>2018-04-19 11:03:19 +0530
committeryinzhongyi <yinzhongyi@huawei.com>2018-05-16 19:22:46 +0800
commit3a8b1b01c87ede23390657b906f14a49d89624f6 (patch)
tree118bcd0116b1fb3e30512f001878fb58c725e4eb /resources
parenta053de6bf115a29bb6f643b2d53d317e93a7da3e (diff)
Simple test setup using VM
User can test their app. Steps at: https://wiki.fd.io/view/DMM Change-Id: I0ff33b60cea34a441e91253ae918e1a5720fbaf8 Signed-off-by: Swarup Nayak <swarupnpvt@gmail.com> Signed-off-by: Yalei Wang <william.wangyalei@huawei.com> Signed-off-by: yinzhongyi <yinzhongyi@huawei.com>
Diffstat (limited to 'resources')
-rw-r--r--resources/extras/Vagrantfile64
-rw-r--r--resources/extras/env.sh7
-rw-r--r--resources/extras/install_prereq.sh39
3 files changed, 110 insertions, 0 deletions
diff --git a/resources/extras/Vagrantfile b/resources/extras/Vagrantfile
new file mode 100644
index 0000000..70c0d78
--- /dev/null
+++ b/resources/extras/Vagrantfile
@@ -0,0 +1,64 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure(2) do |config|
+
+ # Pick the right distro and bootstrap, default is ubuntu1604
+ distro = ( ENV['DMM_VAGRANT_DISTRO'] || "ubuntu")
+ if distro == 'centos7'
+ config.vm.box = "puppetlabs/centos-7.2-64-nocm"
+ #config.vm.box = "centos/7"
+ #config.vm.box_version = "1708.01"
+ #config.ssh.insert_key = false
+ else
+ config.vm.box = "fdio-csit/ubuntu-14.04.4_2016-05-25_1.0"
+ end
+ config.vm.box_check_update = false
+
+ # Create DMM client and server VM's
+ config.vm.define "dmm-test-server" do |server|
+ server.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install_prereq.sh")
+ server.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"../../scripts/build.sh"), :args => "/dmm vagrant"
+ end
+ config.vm.define "dmm-test-client" do |client|
+ client.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install_prereq.sh")
+ client.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"../../scripts/build.sh"), :args => "/dmm vagrant"
+ 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['DMM_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['DMM_VAGRANT_VMCPU'] || 4)
+ vmram=(ENV['DMM_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}"
+
+ config.vm.synced_folder "../../", "/dmm", type: "rsync"
+ end
+end
diff --git a/resources/extras/env.sh b/resources/extras/env.sh
new file mode 100644
index 0000000..96ad346
--- /dev/null
+++ b/resources/extras/env.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+#export DMM_VAGRANT_DISTRO="ubuntu1604"
+export DMM_VAGRANT_DISTRO="centos7"
+export DMM_VAGRANT_NICS=2
+export DMM_VAGRANT_VMCPU=4
+export DMM_VAGRANT_VMRAM=8192
diff --git a/resources/extras/install_prereq.sh b/resources/extras/install_prereq.sh
new file mode 100644
index 0000000..29e9cf2
--- /dev/null
+++ b/resources/extras/install_prereq.sh
@@ -0,0 +1,39 @@
+#!/bin/bash -x
+log_file="/dmm/resources/extras/install_log.txt-`date +'%Y-%m-%d_%H-%M-%S'`"
+exec 1> >(tee -a "$log_file") 2>&1
+
+if [ "$(uname)" <> "Darwin" ]; then
+ OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
+ OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
+fi
+
+if [ "$OS_ID" == "ubuntu" ]; then
+ # Standard update + upgrade dance
+ cat << EOF >> /etc/apt/sources.list
+ deb http://in.archive.ubuntu.com/ubuntu/ trusty main restricted
+ deb-src http://in.archive.ubuntu.com/ubuntu/ trusty main restricted
+ deb http://in.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
+ deb-src http://in.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
+ deb http://in.archive.ubuntu.com/ubuntu/ trusty universe
+ deb-src http://in.archive.ubuntu.com/ubuntu/ trusty universe
+ deb http://in.archive.ubuntu.com/ubuntu/ trusty-updates universe
+ deb-src http://in.archive.ubuntu.com/ubuntu/ trusty-updates universe
+ deb http://in.archive.ubuntu.com/ubuntu/ trusty multiverse
+ deb-src http://in.archive.ubuntu.com/ubuntu/ trusty multiverse
+ deb http://in.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
+ deb-src http://in.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
+ deb http://in.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
+ deb-src http://in.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
+ deb http://security.ubuntu.com/ubuntu trusty-security main restricted
+ deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
+ deb http://security.ubuntu.com/ubuntu trusty-security universe
+ deb-src http://security.ubuntu.com/ubuntu trusty-security universe
+ deb http://security.ubuntu.com/ubuntu trusty-security multiverse
+ deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
+ deb http://extras.ubuntu.com/ubuntu trusty main
+ deb-src http://extras.ubuntu.com/ubuntu trusty main
+EOF
+elif [ "$OS_ID" == "centos" ]; then
+
+ echo centos
+fi