OSM client

From OSM Public Wiki
Revision as of 16:10, 6 November 2018 by Garciadeblas (talk | contribs) (Garciadeblas moved page OsmClient to OSM client: Better name for the page)
Jump to: navigation, search

The OSM client was introduced with OSM Release TWO to provide a python-based API and CLI to OSM. It provides you a number of APIs to upload, onboard, instantiate, terminate, including a recent addition to scale the network service.

Installation

OSM client comes bundled with OSM installation. In addition you can also install it in a different computer.

# Ubuntu pre-requirements
sudo apt install python-pip libcurl4-gnutls-dev libgnutls-dev
# CentOS pre-requirements
# sudo yum install python-pip libcurl-devel gnutls-devel
sudo -H pip install python-magic
sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient

Usage (client commands)

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).

export OSM_HOSTNAME="127.0.0.1"

Usage:

osm [OPTIONS] COMMAND [ARGS]...

Options:

 --hostname TEXT     hostname of server.  Also can set OSM_HOSTNAME in
                     environment
 --so-port TEXT      hostname of server.  Also can set OSM_SO_PORT in
                     environment
 --so-project TEXT   Project Name in SO.  Also can set OSM_SO_PROJECT in
                     environment
 --ro-hostname TEXT  hostname of RO server.  Also can set OSM_RO_HOSTNAME in
                     environment
 --ro-port INTEGER   hostname of RO server.  Also can set OSM_RO_PORT in
                     environment
 --sol005            Use ETSI NFV SOL005 API
 --help              Show this message and exit.

Commands:

 config-agent-add     adds a config agent
 config-agent-delete  deletes a config agent NAME: name of the...
 config-agent-list    list config agents
 ns-action            executes an action/primitive over a NS...
 ns-alarm-create      creates a new alarm for a NS instance
 ns-create            creates a new NS instance
 ns-delete            deletes a NS instance
 ns-list              list all NS instances
 ns-metric-export     exports a metric to the internal OSM bus,...
 ns-monitoring-show
 ns-op-list           shows the history of operations over a NS...
 ns-op-show           shows the info of an operation
 ns-scale             scales NS NS_NAME: name of the NS instance to...
 ns-scaling-show      shows the status of a NS scaling operation...
 ns-show              shows the info of a NS instance
 nsd-create           creates a new NSD/NSpkg
 nsd-delete           deletes a NSD/NSpkg
 nsd-list             list all NSD/NSpkg in the system
 nsd-show             shows the content of a NSD
 nsd-update           updates a NSD/NSpkg
 nspkg-create         creates a new NSD/NSpkg
 nspkg-delete         deletes a NSD/NSpkg
 nspkg-list           list all NSD/NSpkg in the system
 nspkg-show           shows the content of a NSD
 nspkg-update         updates a NSD/NSpkg
 ro-dump              shows RO agent information
 sdnc-create          creates a new SDN controller
 sdnc-delete          deletes an SDN controller NAME: name or ID of...
 sdnc-list            list all SDN controllers
 sdnc-show            shows the details of an SDN controller NAME:...
 sdnc-update          updates an SDN controller
 upload-package       uploads a VNF package or NS package FILENAME:...
 vcs-list
 vim-create           creates a new VIM account
 vim-delete           deletes a VIM account NAME: name or ID of the...
 vim-list             list all VIM accounts
 vim-show             shows the details of a VIM account NAME: name...
 vim-update           updates a VIM account
 vnf-list             list all VNF instances
 vnf-monitoring-show
 vnf-show             shows the info of a VNF instance
 vnfd-create          creates a new VNFD/VNFpkg
 vnfd-delete          deletes a VNFD/VNFpkg
 vnfd-list            list all VNFD/VNFpkg in the system
 vnfd-show            shows the content of a VNFD
 vnfd-update          updates a new VNFD/VNFpkg
 vnfpkg-create        creates a new VNFD/VNFpkg
 vnfpkg-delete        deletes a VNFD/VNFpkg
 vnfpkg-list          list all VNFD/VNFpkg in the system
 vnfpkg-show          shows the content of a VNFD
 vnfpkg-update        updates a VNFD/VNFpkg

Enable autocompletion

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

mkdir -p $HOME/.bash_completion.d
_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