How to run OSM on Vagrant: Difference between revisions

From OSM Public Wiki
Jump to: navigation, search
mNo edit summary
No edit summary
 
(28 intermediate revisions by 7 users not shown)
Line 1: Line 1:
'''THIS PAGE IS DEPRECATED'''. OSM User Guide has been moved to a new location: '''https://osm.etsi.org/docs/user-guide/'''
---
__TOC__
=== Basic instructions ===
Pre-built OSM vagrant images are available here: https://app.vagrantup.com/osm
Pre-built OSM vagrant images are available here: https://app.vagrantup.com/osm


1) Install vagrant (https://www.vagrantup.com) and virtualbox (https://www.virtualbox.org/), then create a working directory which will be dedicated to your OSM Vagrant VM.
The pre-built image requires 4GB of memory and 2 VCPUs.


2) From specified directory, create the initial Vagrantfile:
1) Install vagrant (https://www.vagrantup.com) and virtualbox (https://www.virtualbox.org/)


  vagrant init osm/releasefour --box-version 4.0.1
2) Create the initial Vagrantfile in a predefined directory of your choice:


3) Edit the generated Vagrantfile if you need to customize, for example, opened ports and assigned memory
  vagrant init osm/releasesix


If you would like to access the OSM Web client externally from the virtualbox VM, you can open up port 80 by uncommenting this line:
* Note: to ensure the latest version is downloaded, destroy any previous existing OSM boxes (vagrant box list / vagrant box remove)
  # config.vm.network "forwarded_port", guest: 80, host: 8080


By default the VM takes 6GB RAM, you can lower it down to 4GB (will work for minimal OSM installation), by uncommenting the corresponding section:
3) Edit the generated Vagrantfile if you need to customize, for example, opened ports and assigned memory:


config.vm.provider "virtualbox" do |vb|
* If you would like to access the OSM Web client externally from the virtualbox VM, you can open up port 80 (mapped to 8080 at your host) by uncommenting this line:
vb.memory = "4096"
  # config.vm.network "forwarded_port", guest: 80, host: 8080
end


4) Start OSM:
4) Start OSM:


   vagrant up
   vagrant up
* Note: warnings related to "Vagrant  unable to mount VirtualBox shared folders" can be safely ignored.


5) ssh to OSM:
5) ssh to OSM:
Line 26: Line 34:
   vagrant ssh
   vagrant ssh


6) Add the relevant environment variables for OSM client, either exporting them every time you access the shell, or copying the export lines to your .bashrc file:
You are ready to use OSM !
 
=== Additional notes ===
* If at any time you need to change something from the Vagrantfile, you can apply the changes by reloading the VM:
vagrant reload
 
* If you need to copy a file to your vagrant machine, just run 'vagrant ssh-config' and copy the private key path, then:
scp -P 2222 -i /path/to/private_key someFileName.txt vagrant@127.0.0.1:
 
* To use a manually downloaded image, add the box to Vagrant and create a matching Vagrantfile:
  vagrant box add osm/releasesix /path/to/vagrant.box
  vagrant init osm/releasesix
 
* If at any point you need to add the optional components (elk_stack, pm_stack...) you can do so by downloading the installer from inside your VM and executing it with the -o option, for example:
wget https://osm-download.etsi.org/ftp/osm-6.0-six/install_osm.sh
chmod +x install_osm.sh
./install_osm.sh -o pm_stack
 
* Please note that you may need to add more forwarded ports, for example, to access Grafana after adding the pm_stack, you would need to add a line like this one to your Vagrantfile, then run 'vagrant reload':
config.vm.network "forwarded_port", guest: 3000, host: 3000
 
=== Vagrant + VIM Emulator Quickstart ===
 
vagrant init osm/releasesix
vagrant up
vagrant ssh
 
# startup VIM-EMU
# new version of installer will have the vim-emu start by default
sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py


  export OSM_HOSTNAME=127.0.0.1
  export OSM_HOSTNAME=127.0.0.1
  export OSM_SOL005=True
  export OSM_SOL005=True


Additional notes:
export VIMEMU_HOSTNAME=$(sudo docker inspect -f '<nowiki>{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}</nowiki>' vim-emu)


* If at any time you need to change something from the Vagrantfile, you can apply the changes by reloading the VM:
osm vim-create --name emu-vim1 --user username --password password --auth_url http://$VIMEMU_HOSTNAME:6001/v2.0 --tenant tenantName --account_type openstack
vagrant reload


* If you need to copy a file to your vagrant machine, just run 'vagrant ssh-config' and copy the private key path, then:
git clone https://osm.etsi.org/gerrit/osm/vim-emu.git
  scp -P 2222 -i /path/to/private_key someFileName.txt vagrant@127.0.0.1:
osm vnfd-create vim-emu/examples/vnfs/ping.tar.gz
  osm vnfd-create vim-emu/examples/vnfs/pong.tar.gz
osm nsd-create vim-emu/examples/services/pingpong_nsd.tar.gz
osm ns-create --nsd_name pingpong --ns_name test --vim_account emu-vim1


* The vagrant box file can also be downloaded manually:
vagrant@vagrant:~$ osm ns-list
  wget https://vagrantcloud.com/osm/boxes/releasefour/versions/4.0.1/providers/virtualbox.box
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| ns instance name | id                                  | operational status | config status | detailed status                                                                            |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| test            | 05a363b0-4ac1-49a1-a4b1-9680e39b1ade | init              | init          | Waiting ns ready at RO. RO_id=2c569b2a-b21f-495b-9837-6a469f565044; VMs: 0/2, networks: 0/1 |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
vagrant@vagrant:~$ osm ns-list
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| ns instance name | id                                  | operational status | config status | detailed status                                                                            |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| test            | 05a363b0-4ac1-49a1-a4b1-9680e39b1ade | init              | init          | Waiting ns ready at RO. RO_id=2c569b2a-b21f-495b-9837-6a469f565044; VMs: 0/2, networks: 0/1 |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+

Latest revision as of 16:54, 17 February 2021

THIS PAGE IS DEPRECATED. OSM User Guide has been moved to a new location: https://osm.etsi.org/docs/user-guide/

---

Basic instructions

Pre-built OSM vagrant images are available here: https://app.vagrantup.com/osm

The pre-built image requires 4GB of memory and 2 VCPUs.

1) Install vagrant (https://www.vagrantup.com) and virtualbox (https://www.virtualbox.org/)

2) Create the initial Vagrantfile in a predefined directory of your choice:

 vagrant init osm/releasesix
  • Note: to ensure the latest version is downloaded, destroy any previous existing OSM boxes (vagrant box list / vagrant box remove)

3) Edit the generated Vagrantfile if you need to customize, for example, opened ports and assigned memory:

  • If you would like to access the OSM Web client externally from the virtualbox VM, you can open up port 80 (mapped to 8080 at your host) by uncommenting this line:
 # config.vm.network "forwarded_port", guest: 80, host: 8080

4) Start OSM:

 vagrant up
  • Note: warnings related to "Vagrant unable to mount VirtualBox shared folders" can be safely ignored.

5) ssh to OSM:

 vagrant ssh

You are ready to use OSM !

Additional notes

  • If at any time you need to change something from the Vagrantfile, you can apply the changes by reloading the VM:
vagrant reload
  • If you need to copy a file to your vagrant machine, just run 'vagrant ssh-config' and copy the private key path, then:
scp -P 2222 -i /path/to/private_key someFileName.txt vagrant@127.0.0.1:
  • To use a manually downloaded image, add the box to Vagrant and create a matching Vagrantfile:
 vagrant box add osm/releasesix /path/to/vagrant.box
 vagrant init osm/releasesix
  • If at any point you need to add the optional components (elk_stack, pm_stack...) you can do so by downloading the installer from inside your VM and executing it with the -o option, for example:
wget https://osm-download.etsi.org/ftp/osm-6.0-six/install_osm.sh
chmod +x install_osm.sh
./install_osm.sh -o pm_stack
  • Please note that you may need to add more forwarded ports, for example, to access Grafana after adding the pm_stack, you would need to add a line like this one to your Vagrantfile, then run 'vagrant reload':
config.vm.network "forwarded_port", guest: 3000, host: 3000

Vagrant + VIM Emulator Quickstart

vagrant init osm/releasesix
vagrant up
vagrant ssh
# startup VIM-EMU
# new version of installer will have the vim-emu start by default
sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py
export OSM_HOSTNAME=127.0.0.1
export OSM_SOL005=True
export VIMEMU_HOSTNAME=$(sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu)
osm vim-create --name emu-vim1 --user username --password password --auth_url http://$VIMEMU_HOSTNAME:6001/v2.0 --tenant tenantName --account_type openstack
git clone https://osm.etsi.org/gerrit/osm/vim-emu.git
osm vnfd-create vim-emu/examples/vnfs/ping.tar.gz
osm vnfd-create vim-emu/examples/vnfs/pong.tar.gz
osm nsd-create vim-emu/examples/services/pingpong_nsd.tar.gz
osm ns-create --nsd_name pingpong --ns_name test --vim_account emu-vim1
vagrant@vagrant:~$ osm ns-list
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| ns instance name | id                                   | operational status | config status | detailed status                                                                             |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| test             | 05a363b0-4ac1-49a1-a4b1-9680e39b1ade | init               | init          | Waiting ns ready at RO. RO_id=2c569b2a-b21f-495b-9837-6a469f565044; VMs: 0/2, networks: 0/1 |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
vagrant@vagrant:~$ osm ns-list
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| ns instance name | id                                   | operational status | config status | detailed status                                                                             |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+
| test             | 05a363b0-4ac1-49a1-a4b1-9680e39b1ade | init               | init          | Waiting ns ready at RO. RO_id=2c569b2a-b21f-495b-9837-6a469f565044; VMs: 0/2, networks: 0/1 |
+------------------+--------------------------------------+--------------------+---------------+---------------------------------------------------------------------------------------------+