OSM client

From OSM Public Wiki
Revision as of 10:46, 11 December 2018 by Garciadeblas (talk | contribs)
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, so if you successfully installed OSM . 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
# Install OSM client from You could install the latest from master in this way:
sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient@v4.0.1
# You could also install the latest client from master branch in this way:
# 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
 --sol005 / --no-sol005  Use ETSI NFV SOL005 API (default) or the previous SO
                         API. Also can set OSM_SOL005 in environment
 --user TEXT             user (only from Release FOUR, defaults to admin).
                         Also can set OSM_USER in environment
 --password TEXT         password (only from Release FOUR, defaults to
                         admin). Also can set OSM_PASSWORD in environment
 --project TEXT          project (only from Release FOUR, defaults to admin).
                         Also can set OSM_PROJECT 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 TEXT          hostname of RO server.  Also can set OSM_RO_PORT in
                         environment
 --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
 netslice-instance-create   creates a new Network Slice Instance
 netslice-instance-delete   deletes a Network Slice Instance (NSI)
 netslice-instance-list     list all Network Slice Instances (NSI)
 netslice-instance-op-list  shows the history of operations over a...
 netslice-instance-op-show  shows the info of an operation over a Network
                            Slice Instance(NSI)
 netslice-instance-show     shows the content of a Network Slice Instance
                            (NSI)
 netslice-template-create   creates a new Network Slice Template (NST)
 netslice-template-delete   deletes a Network Slice Template (NST)
 netslice-template-list     list all Network Slice Templates (NST) in the...
 netslice-template-show     shows the content of a Network Slice Template
                            (NST)
 netslice-template-update   updates a Network Slice Template (NST)
 nf-list                    list all NF instances Options: --ns TEXT NS...
 nfpkg-create               creates a new NFpkg
 nfpkg-delete               deletes a NFpkg
 nfpkg-list                 list all NFpkg (VNFpkg, PNFpkg, HNFpkg) in...
 nfpkg-show                 shows the content of a NF Descriptor
 nfpkg-update               updates a NFpkg
 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 Network Service instance
 ns-delete                  deletes a NS instance
 ns-list                    list all NS instances Options: --filter...
 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
 nsi-create                 creates a new Network Slice Instance
 nsi-delete                 deletes a Network Slice Instance (NSI)
 nsi-list                   list all Network Slice Instances (NSI)
 nsi-op-list                shows the history of operations over a...
 nsi-op-show                shows the info of an operation over a Network
                            Slice Instance(NSI)
 nsi-show                   shows the content of a Network Slice Instance
                            (NSI)
 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
 nst-create                 creates a new Network Slice Template (NST)
 nst-delete                 deletes a Network Slice Template (NST)
 nst-list                   list all Network Slice Templates (NST) in the...
 nst-show                   shows the content of a Network Slice Template
                            (NST)
 nst-update                 updates a Network Slice Template (NST)
 pdu-create                 adds a new Physical Deployment Unit to the
                            catalog
 pdu-delete                 deletes a Physical Deployment Unit (PDU)
 pdu-list                   list all Physical Deployment Units (PDU)
 pdu-show                   shows the content of a Physical Deployment Unit
                            (PDU)
 project-create             Creates a new project NAME: name of the...
 project-delete             deletes a project NAME: name or ID of the...
 project-list               list all projects
 project-show               shows the details of a project NAME: name or...
 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:...
 user-create                Creates a new user USERNAME: name of the user
 user-delete                deletes a user NAME: name or ID of the user...
 user-list                  list all users
 user-show                  shows the details of a user NAME: name or ID...
 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 NF instances
 vnf-monitoring-show
 vnf-scale                  executes a VNF scale (adding/removing VDUs)...
 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