diff --git a/03-developer-how-to-for-modules.md b/03-developer-how-to-for-modules.md index 2db0483ec54530d21e9c820691eda81e14483e74..d2ef06c05368f2bef0320682b2c09324df8bb41c 100644 --- a/03-developer-how-to-for-modules.md +++ b/03-developer-how-to-for-modules.md @@ -560,27 +560,46 @@ Creating a new SDN plugin is quite easy following these steps: `update_of_flows` ## Developer Guide for OSM client -### Getting Started +The OSM CLI is installed by default in the own host where OSM is installed (i.e. it does not run in a docker container). + +However, in order to have a local instalation ready for development, you will need to clone the CLI client repo, remove the installed debian package (if OSM has been already installed), and then re-install it by using `python pip3`. -TODO: fill in +### Remove debian package + +```bash +# check if already present, and other osm packages +dpkg -l | grep python3-osm +# Remove debian package +sudo apt-get remove python3-osmclient -y +# do not remove python3-magic python3-pycurl python3-osm-im +``` ### Installation procedure +To install it + ```bash # Ubuntu 18.04 pre-requirements -sudo apt-get install python3-pip libcurl4-openssl-dev libssl-dev -# Centos pre-requirements: -# sudo yum install python3-pip libcurl-devel gnutls-devel -sudo -H python3 -m pip install python-magic -# Install OSM Information model -sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/IM --upgrade -# Clone the osmclient repo and install OSM client from the git repo. +# Install and upgrade pip3 +python3 -m pip install pip -U --user +# Install dependencies (not needed if package python3-osmclient has been installed as part of OSM installation) +sudo -H apt-get install -y python3-pycurl +python3 -m pip install git+https://osm.etsi.org/gerrit/osm/IM.git#egg=osm-im +# Clone and configure gerrit commit-msg hook git clone https://osm.etsi.org/gerrit/osm/osmclient -cd osmclient -python3 -m pip install --user -e . -# logout and login so that PATH can be updated. Executable osm will be found in /home/ubuntu/.local/bin +curl -Lo osmclient/.git/hooks/commit-msg http://osm.etsi.org/gerrit/tools/hooks/commit-msg +chmod u+x osmclient/.git/hooks/commit-msg +# Install osmclient using pip3 with the -e option +python3 -m pip install --user -e osmclient +# Note: Maybe you must logout and login to have "/home/ubuntu/.local/bin" at PATH before executing osm ``` +Any changes done at your cloned osmclient folder applies to 'osm' command. Relevant code files are: + +- **osmclient/scripts/osm.py**: main entry when using CLI +- **osmclient/client.py**: main entry when used as library +- **osmclient/sol005**: there is a module per command + To uninstall, just: ```bash