OSM client

From OSM Public Wiki
Jump to: navigation, search

osmclient

The osmclient was introduced with OSM Release Two to provide a python-based API and CLI to OSM.

sudo apt install python-pip libcurl4-gnutls-dev libgnutls-dev
sudo pip install git+https://osm.etsi.org/gerrit/osm/osmclient

Once installed, type “osm” to see a list of commands. At minimum, you will need to specify the OSM host, either via an environment variable or via the osm command line (see “osm –help” for info).

The client gives you a number of APIs to upload, onboard, instantiate, terminate, including a recent addition to scale the network service. Feel free to use this to learn the REST api, or even better feel free to extend and improve it to make it more feature rich.

Via the CLI, you can do the following:

 config-agent-add
 config-agent-delete
 config-agent-list
 ns-create
 ns-delete
 ns-list
 ns-monitoring-show
 ns-scale
 ns-scaling-show
 ns-show
 nsd-delete
 nsd-list
 ro-dump
 upload-package
 vcs-list
 vim-create
 vim-delete
 vim-list
 vim-show
 vnf-list
 vnf-monitoring-show
 vnf-show
 vnfd-delete
 vnfd-list

Enable autocompletion

You can enable autocompletion in OSM client by creating a file osm-complete.sh in the following way:

 _OSM_COMPLETE=source osm > $HOME/.bash_completion.d/osm-complete.sh

Then you can add it to your $HOME/.bashrc file:

. .bash_completion.d/osm-complete.sh