From 01ff8bc9cb40826c86ae3bd25e43f1a4acc4d57a Mon Sep 17 00:00:00 2001 From: tierno Date: Mon, 3 Feb 2020 17:19:44 +0100 Subject: [PATCH 1/2] adding developer howto for CCLI Signed-off-by: tierno --- 03-developer-how-to-for-modules.md | 40 ++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/03-developer-how-to-for-modules.md b/03-developer-how-to-for-modules.md index 2db0483..ad14977 100644 --- a/03-developer-how-to-for-modules.md +++ b/03-developer-how-to-for-modules.md @@ -562,25 +562,43 @@ Creating a new SDN plugin is quite easy following these steps: `update_of_flows` ### Getting Started -TODO: fill in +The OSM CLI is by default installed in the VM where OSM is installed (not in a docker container). To get a developping instalation, you must clone it, remove the installed debian package (if OSM has been already installed), and re-install it using python pip3. + +### 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 -- GitLab From d9ed81db4ac836ad3304de9dc557df6ce44b2faa Mon Sep 17 00:00:00 2001 From: tierno Date: Mon, 3 Feb 2020 18:36:32 +0100 Subject: [PATCH 2/2] Minor changes in CLI how-to --- 03-developer-how-to-for-modules.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/03-developer-how-to-for-modules.md b/03-developer-how-to-for-modules.md index ad14977..d2ef06c 100644 --- a/03-developer-how-to-for-modules.md +++ b/03-developer-how-to-for-modules.md @@ -560,9 +560,9 @@ 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). -The OSM CLI is by default installed in the VM where OSM is installed (not in a docker container). To get a developping instalation, you must clone it, remove the installed debian package (if OSM has been already installed), and re-install it using python pip3. +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`. ### Remove debian package @@ -595,6 +595,7 @@ python3 -m pip install --user -e osmclient ``` 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 -- GitLab