OSM client: Difference between revisions

From OSM Public Wiki
Jump to: navigation, search
No edit summary
Line 1: Line 1:
= osmclient =
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.


The osmclient was introduced with OSM Release Two to provide a python-based API and CLI to OSM.
== Installation ==
 
OSM client comes bundled with OSM installation. In addition you can also install it in a different computer.


  # Ubuntu pre-requirements
  # Ubuntu pre-requirements
Line 10: Line 12:
  sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient
  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).
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"
The client gives you a number of APIs to upload, onboard, instantiate, terminate, including a recent addition to scale the network serviceFeel 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.
 
   
'''Usage:'''
Via the CLI, you can do the following:
osm [OPTIONS] COMMAND [ARGS]...
   
 
   config-agent-add
'''Options:'''
   config-agent-delete
  --hostname TEXT    hostname of serverAlso can set OSM_HOSTNAME in
   config-agent-list
                      environment
   ns-create
  --so-port TEXT      hostname of server. Also can set OSM_SO_PORT in
   ns-delete
                      environment
   ns-list
  --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-monitoring-show
   ns-scale
  ns-op-list          shows the history of operations over a NS...
   ns-scaling-show
  ns-op-show          shows the info of an operation
   ns-show
   ns-scale             scales NS NS_NAME: name of the NS instance to...
   nsd-delete
   ns-scaling-show     shows the status of a NS scaling operation...
   nsd-list
   ns-show             shows the info of a NS instance
   ro-dump
  nsd-create          creates a new NSD/NSpkg
   upload-package
   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
   vcs-list
   vim-create
   vim-create           creates a new VIM account
   vim-delete
   vim-delete           deletes a VIM account NAME: name or ID of the...
   vim-list
   vim-list             list all VIM accounts
   vim-show
   vim-show             shows the details of a VIM account NAME: name...
   vnf-list
  vim-update          updates a VIM account
   vnf-list             list all VNF instances
   vnf-monitoring-show
   vnf-monitoring-show
   vnf-show
   vnf-show             shows the info of a VNF instance
   vnfd-delete
  vnfd-create          creates a new VNFD/VNFpkg
   vnfd-list
   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==
==Enable autocompletion==

Revision as of 16:10, 6 November 2018

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