Developer HowTo: Difference between revisions
Calvinosanch (talk | contribs) No edit summary |
Calvinosanch (talk | contribs) No edit summary |
||
Line 49: | Line 49: | ||
IM: git clone https://osm.etsi.org/gerrit/osm/IM | IM: git clone https://osm.etsi.org/gerrit/osm/IM | ||
== | ==NBI== | ||
= | |||
docker service scale osm_nbi=0 | |||
git clone https://osm.etsi.org/gerrit/osm/NBI | |||
pip3 install -e . | |||
Python interpreter: Python3 | |||
Script: $INSTALLATION_FOLDER/NBI/osm_nbi/nbi.py | Script: $INSTALLATION_FOLDER/NBI/osm_nbi/nbi.py | ||
Line 59: | Line 64: | ||
** In case you develop in the same server as OSM is installed, then it should be "127.0.0.1" | ** In case you develop in the same server as OSM is installed, then it should be "127.0.0.1" | ||
OSM modules: | |||
common: git clone https://osm.etsi.org/gerrit/osm/common | |||
cd common | |||
pip3 install . | |||
==LCM== | |||
docker service scale osm_lcm=0 | |||
git clone https://osm.etsi.org/gerrit/osm/LCM | |||
pip3 install -e . | |||
Python interpreter: Python3 | |||
Script: $INSTALLATION_FOLDER/LCM/osm_lcm/lcm.py | Script: $INSTALLATION_FOLDER/LCM/osm_lcm/lcm.py | ||
Line 78: | Line 94: | ||
*** Configure the following ip-table rule in OSM host: | *** Configure the following ip-table rule in OSM host: | ||
**** sudo iptables -t nat -A PREROUTING -p tcp -d <OSM_IP> --dport 17070 -j DNAT --to <VCA_IP>:17070 | **** sudo iptables -t nat -A PREROUTING -p tcp -d <OSM_IP> --dport 17070 -j DNAT --to <VCA_IP>:17070 | ||
OSM modules: | |||
git clone https://osm.etsi.org/gerrit/osm/N2VC | |||
cd N2VC | |||
pip3 install . | |||
common: git clone https://osm.etsi.org/gerrit/osm/common | |||
cd common | |||
pip3 install . |
Revision as of 11:47, 17 August 2018
The aim of this entry is to provide a guide for developers to set up their environment, in order to ease
General steps
1.- Shutdown the module you want to use
OSM use a docker container for each module. First thing, you need to stop the module you want to develop:
docker service scale osm_lcm=0
2.- Clone the module
git clone https://osm.etsi.org/gerrit/osm/LCM
3.- Install the module
Inside the folder where the module is cloned type the following command:
pip3 install -e .
4.- Setup the IDE
For this tutorial we will use PyCharm as IDE. First thing, we will set "Python3" as default python interpreter:
Next we will configure a new debug environment. For that we will go to the "Run" tab "Edit configurations". In the new window that appears we will need to configure the script and the environment parameters.
5.- Other modules addresses
You need to provide your module the ip addresses of the modules it is going to communicate to. For that you can configure your "/etc/hosts" file.
In case you are using the same server where the rest of the modules are located, use "127.0.0.1" as the IP address of the modules:
127.0.0.1 localhost <vm name> mongo ro kafka
In case you use a different server, you need to provide the IP address of the host where OSM is running:
IP-OSM mongo ro kafka
6.- Install packages needed
Is it possible that you will need to install some additional packages in your server. If needed use the commands "pip3 install" or "apt-get install" for that.
Some modules imports another modules from OSM. The modules needed are:
n2vc: git clone https://osm.etsi.org/gerrit/osm/N2VC common: git clone https://osm.etsi.org/gerrit/osm/common IM: git clone https://osm.etsi.org/gerrit/osm/IM
NBI
docker service scale osm_nbi=0 git clone https://osm.etsi.org/gerrit/osm/NBI pip3 install -e .
Python interpreter: Python3 Script: $INSTALLATION_FOLDER/NBI/osm_nbi/nbi.py
Environment variables:
- OSMNBI_STORAGE_PATH: Path of the docker volume for filestorage
- In case you develop in a different server than OSM, then it only works if LCM is also running in develop mode.
- OSMNBI_DATABASE_HOST: Mongo IP in case it is not configured in "/etc/hosts" file
- In case you develop in the same server as OSM is installed, then it should be "127.0.0.1"
OSM modules:
common: git clone https://osm.etsi.org/gerrit/osm/common cd common pip3 install .
LCM
docker service scale osm_lcm=0 git clone https://osm.etsi.org/gerrit/osm/LCM pip3 install -e .
Python interpreter: Python3 Script: $INSTALLATION_FOLDER/LCM/osm_lcm/lcm.py
Environment variables:
- OSMLCM_STORAGE_PATH: Path of the docker volume for filestorage
- In case you develop in a different server than OSM, then it only works if NBI is also running in develop mode.
- OSMLCM_DATABASE_HOST: Mongo IP in case it is not configured in "/etc/hosts" file
- In case you develop in the same server as OSM is installed, then it should be "127.0.0.1"
- OSMLCM_RO_HOST: RO IP in case it is not configured in "/etc/hosts" file
- In case you develop in the same server as OSM is installed, then it should be "127.0.0.1"
- OSMLCM_VCA_SECRET: To get this value run the following command in the OSM host:
- grep password /home/ubuntu/.local/share/juju/accounts.yaml |awk '{print $2}'
- OSMLCM_VCA_HOST: Will be different depending on where your develop environment is running:
- In case you run it in the same server as OSM use the following command:
- juju show-controller|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'
- In case you use a different server than OSM:
- IP address from OSM
- Configure the following ip-table rule in OSM host:
- sudo iptables -t nat -A PREROUTING -p tcp -d <OSM_IP> --dport 17070 -j DNAT --to <VCA_IP>:17070
- In case you run it in the same server as OSM use the following command:
OSM modules:
git clone https://osm.etsi.org/gerrit/osm/N2VC cd N2VC pip3 install . common: git clone https://osm.etsi.org/gerrit/osm/common cd common pip3 install .