Project

General

Profile

Task #2436

Updated by Junxiao Shi over 9 years ago

Vagrant system is specifically designed to recreate necessary environments. 
    One of the use cases is [multi-machine scenario](https://docs.vagrantup.com/v2/multi-machine/) "multi-machine" scenario (https://docs.vagrantup.com/v2/multi-machine/) which is exactly what is needed to run integrated tests. 

 This Task is So far, the following script allow to design a `Vagrantfile` that recreates the network topology specified in `multi-hosts.conf`. instantiate two VMs and install prerequisites for ndn-cxx 

 Vagrantfile 

     # -*- mode: ruby -*- 
     # vi: set ft=ruby : 
    
     # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 
     VAGRANTFILE_API_VERSION = "2" 
    
     $script = <<SCRIPT 
     sudo sudo apt-get -y install software-properties-common 
     sudo add-apt-repository -y ppa:named-data/ppa 
     sudo apt-get update -qq 
    
     sudo apt-get install -y build-essential git 
     sudo apt-get install -y libsqlite3-dev libcrypto++-dev libboost-all-dev 
     sudo apt-get install -y pkg-config libpcap-dev 
     SCRIPT 
    
     Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
       config.vm.box = "ubuntu/trusty64" 
    
       config.vm.provider "virtualbox" do |vb| 
         vb.gui = false 
         vb.customize ["modifyvm", :id, "--memory", "1024", "--cpus", "1"] 
       end 
    
       config.vm.define "hub" do |hub| 
         hub.vm.network "private_network", ip: "192.168.1.2" 
         hub.vm.provision "shell", inline: $script, privileged: false 
         hub.vm.provision "shell", privileged: true, inline: <<SCRIPT 
     apt-get install -y nfd ndn-autoconfig-server 
     echo "FACE_URI=\"udp4://192.168.1.2:6363\"" > /etc/default/ndn-autoconfig-server 
     echo "ROUTABLE_PREFIXES=\"-p /test/prefix1 -p /test/prefix2\"" >> /etc/default/ndn-autoconfig-server 
     restart ndn-autoconfig-server 
     SCRIPT 
       end 
    
       config.vm.define "client" do |client| 
         client.vm.network "private_network", ip: "192.168.1.100" 
         client.vm.provision "shell", inline: $script, privileged: false 
         client.vm.provider "virtualbox" do |vb| 
           vb.gui = false 
           vb.customize ["modifyvm", :id, "--memory", "4024", "--cpus", "4"] 
         end 
       end 
    
     end

Back