X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=README.md;h=c8ec7e8352e982b84b8c8f5a5efca199bf91b2b2;hb=c0420cf86aaed737f59666516dd9e4de5c5db16c;hp=1791594c20feb1bc55d8b986a478d05035630bb2;hpb=404b4ea6e3fa2adf4349883488dadca4862dcaf7;p=osm%2Fosmclient.git diff --git a/README.md b/README.md index 1791594..c8ec7e8 100644 --- a/README.md +++ b/README.md @@ -20,40 +20,37 @@ OSM client library and console script ## Installation -### From git-repo - ```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@v7.0.0rc1 +# Ubuntu pre-requirements +sudo apt-get install python3-pip +# Centos pre-requirements +# sudo yum install python3-pip ``` -### From cloned repo (for developers) +Clone the osmclient repo: -``` -# 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. +```bash git clone https://osm.etsi.org/gerrit/osm/osmclient cd osmclient -python3 -m pip install --user -e . +``` + +Finally install osmclient with pip. For development, you should install osmclient in editable mode (`--user -e`): + +```bash +# Install osmclient +python3 -m pip install --user . -r requirements.txt -r requirements-dev.txt +# Install osmclient in editable mode (-e) +# python3 -m pip install --user -e . -r requirements.txt -r requirements-dev.txt # logout and login so that PATH can be updated. Executable osm will be found in /home/ubuntu/.local/bin ``` +After logging out and in, you can check that osm is running with: + +```bash +which osm +osm version +``` + ## Setup Set the OSM_HOSTNAME variable to the host of the OSM server (default: localhost). @@ -126,7 +123,7 @@ from osmclient.common.exceptions import ClientException hostname = "127.0.0.1" myclient = client.Client(host=hostname, sol005=True) resp = myclient.nsd.list() -print yaml.safe_dump(resp) +print yaml.safe_dump(resp, indent=4, default_flow_style=False) ``` ### Simple Python code to get the list of VNF packages from a specific user and project @@ -151,7 +148,7 @@ if project is not None: kwargs['project']=project myclient = client.Client(host=hostname, sol005=True, **kwargs) resp = myclient.vnfd.list() -print yaml.safe_dump(resp) +print yaml.safe_dump(resp, indent=4, default_flow_style=False) ``` ## Enable autocompletion @@ -169,3 +166,11 @@ Then you can add the following to your $HOME/.bashrc file: . .bash_completion.d/osm-complete.sh ``` +## Future work + +- Option `-c` for list and show operations to filter output and show only selected columns +- Option `-o ` to adapt output format (table, csv, yaml, json, jsonpath) +- Command ns-status to show the deployment status (RO) and configuration status (VCA) in an appealing format +- See how to deprecate commands and options: +- Evaluate the possibility to re-structure code to uniform all commands: `check`, `table_headers`, `run`, `output` +