cleanup and license header for examples and tests
[osm/vim-emu.git] / Vagrantfile
1 # Copyright (c) 2015 SONATA-NFV and Paderborn University
2 # ALL RIGHTS RESERVED.
3
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #    http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # Neither the name of the SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
17 # nor the names of its contributors may be used to endorse or promote
18 # products derived from this software without specific prior written
19 # permission.
20 #
21 # This work has been performed in the framework of the SONATA project,
22 # funded by the European Commission under Grant number 671517 through
23 # the Horizon 2020 and 5G-PPP programmes. The authors would like to
24 # acknowledge the contributions of their colleagues of the SONATA
25 # partner consortium (www.sonata-nfv.eu).
26
27 # -*- mode: ruby -*-
28 # vi: set ft=ruby :
29
30 #
31 # This Vagrant file create a son-emu VM.
32 #
33 #
34 # All Vagrant configuration is done below. The "2" in Vagrant.configure
35 # configures the configuration version (we support older styles for
36 # backwards compatibility). Please don't change it unless you know what
37 # you're doing.
38 Vagrant.configure(2) do |config|
39   # The most common configuration options are documented and commented below.
40   # For a complete reference, please see the online documentation at
41   # https://docs.vagrantup.com.
42
43   # Every Vagrant development environment requires a box. You can search for
44   # boxes at https://atlas.hashicorp.com/search.
45
46   # there is a bug in the /etc/hosts of 16.04: https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1561250
47   #config.vm.box = "ubuntu/xenial64"
48
49   # so we use 14.04 for now
50   config.vm.box = "ubuntu/trusty64"
51   
52
53   # Disable automatic box update checking. If you disable this, then
54   # boxes will only be checked for updates when the user runs
55   # `vagrant box outdated`. This is not recommended.
56   # config.vm.box_check_update = false
57
58   # Create a forwarded port mapping which allows access to a specific port
59   # within the machine from a port on the host machine. In the example below,
60   # accessing "localhost:8080" will access port 80 on the guest machine.
61   config.vm.network "forwarded_port", guest: 5000, host: 5000
62
63   # Create a private network, which allows host-only access to the machine
64   # using a specific IP.
65   # config.vm.network "private_network", ip: "192.168.33.10"
66
67   # Create a public network, which generally matched to bridged network.
68   # Bridged networks make the machine appear as another physical device on
69   # your network.
70   # config.vm.network "public_network"
71
72   # Share an additional folder to the guest VM. The first argument is
73   # the path on the host to the actual folder. The second argument is
74   # the path on the guest to mount the folder. And the optional third
75   # argument is a set of non-required options.
76   config.vm.synced_folder ".", "/vagrant", disabled: true
77   config.vm.synced_folder ".", "/home/vagrant/son-emu"
78   
79
80   # Provider-specific configuration so you can fine-tune various
81   # backing providers for Vagrant. These expose provider-specific options.
82   # Example for VirtualBox:
83   #
84   config.vm.provider "virtualbox" do |vb|
85     vb.name = "son-emu"
86   #   # Display the VirtualBox GUI when booting the machine
87   #   vb.gui = true
88   #
89   #   # Customize the amount of memory on the VM:
90     vb.memory = "1024"
91   end
92   #
93   # View the documentation for the provider you are using for more
94   # information on available options.
95
96   # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
97   # such as FTP and Heroku are also available. See the documentation at
98   # https://docs.vagrantup.com/v2/push/atlas.html for more information.
99   # config.push.define "atlas" do |push|
100   #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
101   # end
102
103   # Enable provisioning with a shell script. Additional provisioners such as
104   # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
105   # documentation for more information about their specific syntax and use.
106   config.vm.provision "shell", inline: <<-SHELL
107      sudo apt-get update
108      sudo apt-get install -y git ansible aptitude
109      sudo echo "localhost ansible_connection=local" >> /etc/ansible/hosts
110      # install containernet
111      git clone https://github.com/mpeuster/containernet.git
112      echo "Installing containernet (will take some time ~30 minutes) ..."
113      cd /home/vagrant/containernet/ansible
114      sudo ansible-playbook install.yml
115
116      # install son-emu
117      echo "Installing son-emu (will take some time) ..."
118      cd /home/vagrant/son-emu/ansible
119      sudo ansible-playbook install.yml
120
121      # execute son-emu tests at the end to validate installation
122      echo "Running son-emu unit tests to validate installation"
123      cd /home/vagrant/son-emu
124      sudo python setup.py develop
125      sudo py.test -v
126
127      # place motd
128      sudo cp utils/vagrant/motd /etc/motd
129   SHELL
130
131   # TODO the native ansible provisioner does not work so we directly call the shell commands
132   # install containernet using its ansible script
133   #config.vm.provision "ansible_local" do |ansible|
134   #  ansible.provisioning_path = "/home/vagrant/containernet/ansible"
135   #  ansible.playbook = "install.yml"
136   #  ansible.sudo = true
137   #  ansible.verbose = "v"
138   #  ansible.limit = "all"
139   #end
140 end