From da65bf77ce706451392008bcda54aefed41c418b Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 8 Jul 2022 14:40:32 +0200 Subject: [PATCH 1/3] Update osmclient doc: how to install in ubuntu, rhel and for developers Signed-off-by: garciadeblas --- 10-osm-client-commands-reference.md | 144 +++++++++++++++++++++------- 1 file changed, 107 insertions(+), 37 deletions(-) diff --git a/10-osm-client-commands-reference.md b/10-osm-client-commands-reference.md index 28fb897..87d60b3 100644 --- a/10-osm-client-commands-reference.md +++ b/10-osm-client-commands-reference.md @@ -142,64 +142,134 @@ Commands: wim-update updates a WIM account ``` -## Installing standalone OSM Client +## How to install standalone OSM client -OSM client is installed by default in the host where OSM is installed, but it can be also installed as a standalone client. +### How to install OSM Client in Ubuntu 20.04 (RECOMMENDED) -### Installing with debian package - -In order to install the OSM Client in your local Linux machine, you should follow this procedure: +OSM client is installed by default in the host where OSM is installed, but it can be also installed as a standalone client in an Ubuntu 20.04 system, following the procedure below: ```bash # Clean the previous repos that might exist sudo sed -i "/osm-download.etsi.org/d" /etc/apt/sources.list -wget -qO - https://osm-download.etsi.org/repository/osm/debian/ReleaseTWELVE/OSM%20ETSI%20Release%20Key.gpg | sudo apt-key add - + +# Install dependencies +sudo apt-get update +sudo apt-get install -y libcurl4-openssl-dev libssl-dev software-properties-common apt-transport-https +sudo apt-get install -y python3.8 python3-setuptools python3-dev python3-pip + +# Add OSM debian repo +curl -q -o OSM-ETSI-Release-key.gpg https://osm-download.etsi.org/repository/osm/debian/ReleaseTWELVE/OSM%20ETSI%20Release%20Key.gpg +sudo apt-key add OSM-ETSI-Release-key.gpg sudo add-apt-repository -y "deb [arch=amd64] https://osm-download.etsi.org/repository/osm/debian/ReleaseTWELVE stable devops IM osmclient" sudo apt-get update -sudo apt-get install -y python3-pip -sudo -H python3 -m pip install -U pip -sudo -H python3 -m pip install python-magic pyangbind verboselogs -sudo apt-get install python3-osmclient + +# Install OSM IM and osmclient packages from deb repo +sudo apt-get install python3-osm-im python3-osmclient + +# Install osmclient and osm_im dependencies via pip +sudo -H python3 -m pip install -r /usr/lib/python3/dist-packages/osm_im/requirements.txt -r /usr/lib/python3/dist-packages/osmclient/requirements.txt + +# Install charm to be able to build OSM packages with charms +sudo snap install charm --classic ``` -### Installing from git repo +### How to install OSM Client in Ubuntu 20.04 via pip (ALTERNATIVE) ```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 -# Install OSM client from the git repo. -# You can install the latest client from master branch in this way: -sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient -# You could also install a specific tag/version in this way -sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient@v8.0.0rc1 +# Install dependencies +sudo apt-get update +sudo apt-get install -y libcurl4-openssl-dev libssl-dev software-properties-common apt-transport-https +sudo apt-get install -y git wget make +sudo apt-get install -y python3.8 python3-setuptools python3-dev python3-pip + +# Upgrade pip to the latest version (with sudo, to install it globally for all users) +sudo -H python3 -m pip install -U pip + +# Decide which version to use (e.g., v12.0) +export OSM_CLIENT_VERSION=v12.0 + +# Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users) +sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}" +sudo -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade + +# Clone osmclient repo and checkut the desired version +git clone https://osm.etsi.org/gerrit/osm/osmclient +git -C osmclient checkout ${OSM_CLIENT_VERSION} + +# Install osmclient using pip +sudo -H python3 -m pip install -r osmclient/requirements.txt +sudo -H python3 -m pip install ./osmclient + +# Install charm to be able to build OSM packages with charms +sudo snap install charm --classic ``` -### Installing from cloned repo (for developers) +### How to install OSM Client in RHEL 8.4 ```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 pyangbind verboselogs -# 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 dependencies +sudo dnf upgrade -y +sudo dnf install -y libcurl-devel openssl-devel +sudo dnf install -y git wget make patch gcc +sudo dnf install -y python38 python38-devel + +# Upgrade pip to the latest version (with sudo, to install it globally for all users) +sudo -H python3 -m pip install -U pip + +# Decide which version to use (e.g., v12.0) +export OSM_CLIENT_VERSION=v12.0 + +# Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users) +sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}" +sudo -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade + +# Clone osmclient repo and checkut the desired version 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 +git -C osmclient checkout ${OSM_CLIENT_VERSION} + +# Install osmclient using pip +sudo -H python3 -m pip install -r osmclient/requirements.txt +sudo -H python3 -m pip install ./osmclient + +# Install charm to be able to build OSM packages with charms +wget -O charm.sh "https://osm.etsi.org/gitweb/?p=osm/tests.git;a=blob;f=charm.sh;hb=${OSM_CLIENT_VERSION}" +sudo cp charm.sh /usr/sbin/charm +sudo 755 /usr/sbin/charm + ``` -To uninstall, just: +### How to install OSM Client for developers in Ubuntu 20.04 ```bash -python3 -m pip uninstall osmclient +# Install dependencies +sudo apt-get update +sudo apt-get install -y libcurl4-openssl-dev libssl-dev software-properties-common apt-transport-https +sudo apt-get install -y git wget make +sudo apt-get install -y python3.8 python3-setuptools python3-dev python3-pip + +# Upgrade pip to the latest version (with sudo, to install it globally for all users) +sudo -H python3 -m pip install -U pip + +# Decide which version to use (e.g., v12.0) +export OSM_CLIENT_VERSION=v12.0 + +# Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users) +sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}" +sudo -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade + +# Clone osmclient repo and checkut the desired version +git clone https://osm.etsi.org/gerrit/osm/osmclient +cd osmclient +git checkout ${OSM_CLIENT_VERSION} + +# Install osmclient directly from the repo for development purposes +python3 -m pip install --user -e osmclient -r osmclient/requirements.txt -r osmclient/requirements-dev.txt + +# Install charm to be able to build OSM packages with charm +sudo snap install charm --classic + +# Logout and login so that PATH can be updated. Executable osm will be found in /home/ubuntu/.local/bin +which osm ``` ## Getting help -- GitLab From 0adf69bb6fcf990792e243c3db9c412013460775 Mon Sep 17 00:00:00 2001 From: aguilard Date: Tue, 12 Jul 2022 09:59:05 +0000 Subject: [PATCH 2/3] Update 10-osm-client-commands-reference.md Fix error related to pyang when installing osm-im. --- 10-osm-client-commands-reference.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/10-osm-client-commands-reference.md b/10-osm-client-commands-reference.md index 87d60b3..daed785 100644 --- a/10-osm-client-commands-reference.md +++ b/10-osm-client-commands-reference.md @@ -221,7 +221,8 @@ export OSM_CLIENT_VERSION=v12.0 # Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users) sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}" -sudo -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade +sudo -H bash -c "echo -e \"\nexport PATH=$PATH:/usr/local/bin\" >> /root/.bashrc" +sudo -i -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade # Clone osmclient repo and checkut the desired version git clone https://osm.etsi.org/gerrit/osm/osmclient @@ -234,7 +235,7 @@ sudo -H python3 -m pip install ./osmclient # Install charm to be able to build OSM packages with charms wget -O charm.sh "https://osm.etsi.org/gitweb/?p=osm/tests.git;a=blob;f=charm.sh;hb=${OSM_CLIENT_VERSION}" sudo cp charm.sh /usr/sbin/charm -sudo 755 /usr/sbin/charm +sudo chmod 755 /usr/sbin/charm ``` -- GitLab From 738aff0f42681039484d47c016be41e0b4779ba7 Mon Sep 17 00:00:00 2001 From: aguilard Date: Tue, 12 Jul 2022 11:28:19 +0000 Subject: [PATCH 3/3] Update 10-osm-client-commands-reference.md --- 10-osm-client-commands-reference.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/10-osm-client-commands-reference.md b/10-osm-client-commands-reference.md index daed785..fdc343d 100644 --- a/10-osm-client-commands-reference.md +++ b/10-osm-client-commands-reference.md @@ -221,8 +221,7 @@ export OSM_CLIENT_VERSION=v12.0 # Install OSM IM and its dependencies via pip (installed with sudo, to install it globally for all users) sudo -H python3 -m pip install -r "https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=${OSM_CLIENT_VERSION}" -sudo -H bash -c "echo -e \"\nexport PATH=$PATH:/usr/local/bin\" >> /root/.bashrc" -sudo -i -H python3 -m pip install "git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im" --upgrade +sudo -H bash -c "PATH=$PATH:/usr/local/bin python3 -m pip install \"git+https://osm.etsi.org/gerrit/osm/IM.git@${OSM_CLIENT_VERSION}#egg=osm-im\" --upgrade" # Clone osmclient repo and checkut the desired version git clone https://osm.etsi.org/gerrit/osm/osmclient -- GitLab