diff --git a/03-developer-how-to-for-modules.md b/03-developer-how-to-for-modules.md index d2ef06c05368f2bef0320682b2c09324df8bb41c..c260f417a23af484fca13662825c6eec476a83ce 100644 --- a/03-developer-how-to-for-modules.md +++ b/03-developer-how-to-for-modules.md @@ -560,45 +560,51 @@ Creating a new SDN plugin is quite easy following these steps: `update_of_flows` ## Developer Guide for OSM client -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). +The OSM client 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`. +However, in order to have a local instalation ready for development, you will need to clone the osmclient repo, and install it by using `python pip3`. -### Remove debian package +### Remove debian package (optional) + +__This is optional__: You can remove the osmclient debian package to assure that the only osmclient is the one from the cloned repo. In principle, this step is not required because the installation of the client with the instructions below will create an executable file in `$HOME/.local/bin` and that location is included in the PATH in Ubuntu 18.04 and later. ```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 +sudo apt-get remove -y python3-osmclient ``` ### Installation procedure -To install it +To install it: ```bash # Ubuntu 18.04 pre-requirements -# 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 +sudo apt-get install python3-pip libcurl4-openssl-dev libssl-dev +# Centos pre-requirements: +# sudo yum install python3-pip libcurl-devel gnutls-devel + +# Upgrade pip and install dependencies (python-magic, osm-im) +# Next instructions install the dependencies at system level with sudo -H +sudo -H python3 -m pip install -U pip +sudo -H python3 -m pip install python-magic +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. git clone https://osm.etsi.org/gerrit/osm/osmclient 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 +# Install osmclient using pip3 with the --user and -e options 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 +# Note: You may need to logout and login in order 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 +- **osmclient/sol005**: main folder with a module per command set To uninstall, just: