Merge pull request #114 from mpeuster/master
authorpeusterm <manuel.peuster@uni-paderborn.de>
Thu, 9 Jun 2016 01:48:42 +0000 (10:48 +0900)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Thu, 9 Jun 2016 01:48:42 +0000 (10:48 +0900)
Improved Vagrant file

README.md
Vagrantfile
utils/vagrant/motd [new file with mode: 0644]

index b05908a..63f9778 100755 (executable)
--- a/README.md
+++ b/README.md
@@ -92,3 +92,13 @@ In the `~/son-emu` directory:
 
 ### CLI
 * [Full CLI command documentation](https://github.com/sonata-nfv/son-emu/wiki/CLI-Command-Overview)
+
+### Vagrant VM creation
+A Vagrantfile allows to automatically create and provision a VM in which son-emu is installed and ready to be used.
+
+* `cd ~/son-emu`
+* `vagrant up`
+* `vagrant ssh` to enter the new VM in which the emulator is installed.
+
+Follow the MOTD in the VM to run the example topology and the fake-gatekeeper. The fake-gatekeeper's default port 5000 is forwarded to the host machine and can be accessed from it by using, e.g., curl http://127.0.0.1:5000/packages.
+
index 401adf7..7cba18e 100644 (file)
@@ -32,7 +32,7 @@ Vagrant.configure(2) do |config|
   # Create a forwarded port mapping which allows access to a specific port
   # within the machine from a port on the host machine. In the example below,
   # accessing "localhost:8080" will access port 80 on the guest machine.
-  # config.vm.network "forwarded_port", guest: 80, host: 8080
+  config.vm.network "forwarded_port", guest: 5000, host: 5000
 
   # Create a private network, which allows host-only access to the machine
   # using a specific IP.
@@ -78,7 +78,7 @@ Vagrant.configure(2) do |config|
   # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
   # documentation for more information about their specific syntax and use.
   config.vm.provision "shell", inline: <<-SHELL
-     #sudo apt-get update
+     sudo apt-get update
      sudo apt-get install -y git ansible aptitude
      sudo echo "localhost ansible_connection=local" >> /etc/ansible/hosts
      # install containernet
@@ -95,7 +95,11 @@ Vagrant.configure(2) do |config|
      # execute son-emu tests at the end to validate installation
      echo "Running son-emu unit tests to validate installation"
      cd /home/vagrant/son-emu
+     sudo python setup.py develop
      sudo py.test -v
+
+     # place motd
+     sudo cp utils/vagrant/motd /etc/motd
   SHELL
 
   # TODO the native ansible provisioner does not work so we directly call the shell commands
diff --git a/utils/vagrant/motd b/utils/vagrant/motd
new file mode 100644 (file)
index 0000000..ea9e8ca
--- /dev/null
@@ -0,0 +1,17 @@
+************************************************************
+**           Welcome to SONATA's son-emu VM               **
+**                 http://sonata-nfv.eu                   **
+**                                                        **
+** To run the emulator with a simple example topology     **
+** and its fake-gatekeeper run the following commands.    **
+**                                                        **
+** Switch to example folder:                              **
+** - cd son-emu/src/emuvim/examples                       **
+**                                                        **
+** Start the emulator with SONATA's example topology:     **
+** - sudo python sonata_y1_demo_topology_1.py             **
+**                                                        **
+** The emulator will be started and the fake-gatekeeper   **
+** API will be accessible on port 5000 from both, the     **
+** VM and your host machine.                              **
+************************************************************
\ No newline at end of file