OSM client: Difference between revisions

From OSM Public Wiki
Jump to: navigation, search
No edit summary
No edit summary
Line 1: Line 1:
{{MARKDOWN}}
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 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 ==
## 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.
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
```bash
sudo apt install python-pip libcurl4-gnutls-dev libgnutls-dev
# Ubuntu pre-requirements
# CentOS pre-requirements
sudo apt install python-pip libcurl4-gnutls-dev libgnutls-dev
# sudo yum install python-pip libcurl-devel gnutls-devel
# CentOS pre-requirements
sudo -H pip install python-magic
# sudo yum install python-pip libcurl-devel gnutls-devel
# Install OSM client from You could install the latest from master in this way:
sudo -H pip install python-magic
sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient@v5.0.2
# Install OSM client from You could install the latest from master in this way:
# 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@v5.0.2
# sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient
# 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) ==
## Usage (client commands) ##


Once installed, type “osm” to see a list of commands. If installed in a host different from where OSM is running, 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. If installed in a host different from where OSM is running, 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"
  export OSM_HOSTNAME="127.0.0.1"


'''Usage:'''
**Usage:**
osm [OPTIONS] COMMAND [ARGS]...
```
osm [OPTIONS] COMMAND [ARGS]...
```


'''Options:'''
**Options:**
  --hostname TEXT        hostname of server.  Also can set OSM_HOSTNAME in
```
                          environment
--hostname TEXT        hostname of server.  Also can set OSM_HOSTNAME in
  --sol005 / --no-sol005  Use ETSI NFV SOL005 API (default) or the previous SO
                        environment
                          API. Also can set OSM_SOL005 in environment
--sol005 / --no-sol005  Use ETSI NFV SOL005 API (default) or the previous SO
  --user TEXT            user (only from Release FOUR, defaults to admin).
                        API. Also can set OSM_SOL005 in environment
                          Also can set OSM_USER in environment
--user TEXT            user (only from Release FOUR, defaults to admin).
  --password TEXT        password (only from Release FOUR, defaults to
                        Also can set OSM_USER in environment
                          admin). Also can set OSM_PASSWORD in environment
--password TEXT        password (only from Release FOUR, defaults to
  --project TEXT          project (only from Release FOUR, defaults to admin).
                        admin). Also can set OSM_PASSWORD in environment
                          Also can set OSM_PROJECT in environment
--project TEXT          project (only from Release FOUR, defaults to admin).
  --so-port TEXT          hostname of server.  Also can set OSM_SO_PORT in
                        Also can set OSM_PROJECT in environment
                          environment
--so-port TEXT          hostname of server.  Also can set OSM_SO_PORT in
  --so-project TEXT      Project Name in SO.  Also can set OSM_SO_PROJECT in
                        environment
                          environment
--so-project TEXT      Project Name in SO.  Also can set OSM_SO_PROJECT in
  --ro-hostname TEXT      hostname of RO server.  Also can set OSM_RO_HOSTNAME
                        environment
                          in environment
--ro-hostname TEXT      hostname of RO server.  Also can set OSM_RO_HOSTNAME
  --ro-port TEXT          hostname of RO server.  Also can set OSM_RO_PORT in
                        in environment
                          environment
--ro-port TEXT          hostname of RO server.  Also can set OSM_RO_PORT in
  --help                  Show this message and exit.
                        environment
--help                  Show this message and exit.
```


'''Commands:'''
**Commands:**
  config-agent-add          adds a config agent
```
  config-agent-delete        deletes a config agent NAME: name of the...
config-agent-add          adds a config agent
  config-agent-list          list config agents
config-agent-delete        deletes a config agent NAME: name of the...
  netslice-instance-create  creates a new Network Slice Instance
config-agent-list          list config agents
  netslice-instance-delete  deletes a Network Slice Instance (NSI)
netslice-instance-create  creates a new Network Slice Instance
  netslice-instance-list    list all Network Slice Instances (NSI)
netslice-instance-delete  deletes a Network Slice Instance (NSI)
  netslice-instance-op-list  shows the history of operations over a...
netslice-instance-list    list all Network Slice Instances (NSI)
  netslice-instance-op-show  shows the info of an operation over a Network
netslice-instance-op-list  shows the history of operations over a...
                            Slice Instance(NSI)
netslice-instance-op-show  shows the info of an operation over a Network
  netslice-instance-show    shows the content of a Network Slice Instance
                            Slice Instance(NSI)
                            (NSI)
netslice-instance-show    shows the content of a Network Slice Instance
  netslice-template-create  creates a new Network Slice Template (NST)
                            (NSI)
  netslice-template-delete  deletes a Network Slice Template (NST)
netslice-template-create  creates a new Network Slice Template (NST)
  netslice-template-list    list all Network Slice Templates (NST) in the...
netslice-template-delete  deletes a Network Slice Template (NST)
  netslice-template-show    shows the content of a Network Slice Template
netslice-template-list    list all Network Slice Templates (NST) in the...
                            (NST)
netslice-template-show    shows the content of a Network Slice Template
  netslice-template-update  updates a Network Slice Template (NST)
                            (NST)
  nf-list                    list all NF instances Options: --ns TEXT NS...
netslice-template-update  updates a Network Slice Template (NST)
  nfpkg-create              creates a new NFpkg
nf-list                    list all NF instances Options: --ns TEXT NS...
  nfpkg-delete              deletes a NFpkg
nfpkg-create              creates a new NFpkg
  nfpkg-list                list all NFpkg (VNFpkg, PNFpkg, HNFpkg) in...
nfpkg-delete              deletes a NFpkg
  nfpkg-show                shows the content of a NF Descriptor
nfpkg-list                list all NFpkg (VNFpkg, PNFpkg, HNFpkg) in...
  nfpkg-update              updates a NFpkg
nfpkg-show                shows the content of a NF Descriptor
  ns-action                  executes an action/primitive over a NS...
nfpkg-update              updates a NFpkg
  ns-alarm-create            creates a new alarm for a NS instance
ns-action                  executes an action/primitive over a NS...
  ns-create                  creates a new Network Service instance
ns-alarm-create            creates a new alarm for a NS instance
  ns-delete                  deletes a NS instance
ns-create                  creates a new Network Service instance
  ns-list                    list all NS instances Options: --filter...
ns-delete                  deletes a NS instance
  ns-metric-export          exports a metric to the internal OSM bus,...
ns-list                    list all NS instances Options: --filter...
  ns-monitoring-show
ns-metric-export          exports a metric to the internal OSM bus,...
  ns-op-list                shows the history of operations over a NS...
ns-monitoring-show
  ns-op-show                shows the info of an operation
ns-op-list                shows the history of operations over a NS...
  ns-scale                  scales NS NS_NAME: name of the NS instance to...
ns-op-show                shows the info of an operation
  ns-scaling-show            shows the status of a NS scaling operation...
ns-scale                  scales NS NS_NAME: name of the NS instance to...
  ns-show                    shows the info of a NS instance
ns-scaling-show            shows the status of a NS scaling operation...
  nsd-create                creates a new NSD/NSpkg
ns-show                    shows the info of a NS instance
  nsd-delete                deletes a NSD/NSpkg
nsd-create                creates a new NSD/NSpkg
  nsd-list                  list all NSD/NSpkg in the system
nsd-delete                deletes a NSD/NSpkg
  nsd-show                  shows the content of a NSD
nsd-list                  list all NSD/NSpkg in the system
  nsd-update                updates a NSD/NSpkg
nsd-show                  shows the content of a NSD
  nsi-create                creates a new Network Slice Instance
nsd-update                updates a NSD/NSpkg
  nsi-delete                deletes a Network Slice Instance (NSI)
nsi-create                creates a new Network Slice Instance
  nsi-list                  list all Network Slice Instances (NSI)
nsi-delete                deletes a Network Slice Instance (NSI)
  nsi-op-list                shows the history of operations over a...
nsi-list                  list all Network Slice Instances (NSI)
  nsi-op-show                shows the info of an operation over a Network
nsi-op-list                shows the history of operations over a...
                            Slice Instance(NSI)
nsi-op-show                shows the info of an operation over a Network
  nsi-show                  shows the content of a Network Slice Instance
                            Slice Instance(NSI)
                            (NSI)
nsi-show                  shows the content of a Network Slice Instance
  nspkg-create              creates a new NSD/NSpkg
                            (NSI)
  nspkg-delete              deletes a NSD/NSpkg
nspkg-create              creates a new NSD/NSpkg
  nspkg-list                list all NSD/NSpkg in the system
nspkg-delete              deletes a NSD/NSpkg
  nspkg-show                shows the content of a NSD
nspkg-list                list all NSD/NSpkg in the system
  nspkg-update              updates a NSD/NSpkg
nspkg-show                shows the content of a NSD
  nst-create                creates a new Network Slice Template (NST)
nspkg-update              updates a NSD/NSpkg
  nst-delete                deletes a Network Slice Template (NST)
nst-create                creates a new Network Slice Template (NST)
  nst-list                  list all Network Slice Templates (NST) in the...
nst-delete                deletes a Network Slice Template (NST)
  nst-show                  shows the content of a Network Slice Template
nst-list                  list all Network Slice Templates (NST) in the...
                            (NST)
nst-show                  shows the content of a Network Slice Template
  nst-update                updates a Network Slice Template (NST)
                            (NST)
  pdu-create                adds a new Physical Deployment Unit to the
nst-update                updates a Network Slice Template (NST)
                            catalog
pdu-create                adds a new Physical Deployment Unit to the
  pdu-delete                deletes a Physical Deployment Unit (PDU)
                            catalog
  pdu-list                  list all Physical Deployment Units (PDU)
pdu-delete                deletes a Physical Deployment Unit (PDU)
  pdu-show                  shows the content of a Physical Deployment Unit
pdu-list                  list all Physical Deployment Units (PDU)
                            (PDU)
pdu-show                  shows the content of a Physical Deployment Unit
  project-create            Creates a new project NAME: name of the...
                            (PDU)
  project-delete            deletes a project NAME: name or ID of the...
project-create            Creates a new project NAME: name of the...
  project-list              list all projects
project-delete            deletes a project NAME: name or ID of the...
  project-show              shows the details of a project NAME: name or...
project-list              list all projects
  ro-dump                    shows RO agent information
project-show              shows the details of a project NAME: name or...
  sdnc-create                creates a new SDN controller
ro-dump                    shows RO agent information
  sdnc-delete                deletes an SDN controller NAME: name or ID of...
sdnc-create                creates a new SDN controller
  sdnc-list                  list all SDN controllers
sdnc-delete                deletes an SDN controller NAME: name or ID of...
  sdnc-show                  shows the details of an SDN controller NAME:...
sdnc-list                  list all SDN controllers
  sdnc-update                updates an SDN controller
sdnc-show                  shows the details of an SDN controller NAME:...
  upload-package            uploads a VNF package or NS package FILENAME:...
sdnc-update                updates an SDN controller
  user-create                Creates a new user USERNAME: name of the user
upload-package            uploads a VNF package or NS package FILENAME:...
  user-delete                deletes a user NAME: name or ID of the user...
user-create                Creates a new user USERNAME: name of the user
  user-list                  list all users
user-delete                deletes a user NAME: name or ID of the user...
  user-show                  shows the details of a user NAME: name or ID...
user-list                  list all users
  vcs-list
user-show                  shows the details of a user NAME: name or ID...
  vim-create                creates a new VIM account
vcs-list
  vim-delete                deletes a VIM account NAME: name or ID of the...
vim-create                creates a new VIM account
  vim-list                  list all VIM accounts
vim-delete                deletes a VIM account NAME: name or ID of the...
  vim-show                  shows the details of a VIM account NAME: name...
vim-list                  list all VIM accounts
  vim-update                updates a VIM account
vim-show                  shows the details of a VIM account NAME: name...
  vnf-list                  list all NF instances
vim-update                updates a VIM account
  vnf-monitoring-show
vnf-list                  list all NF instances
  vnf-scale                  executes a VNF scale (adding/removing VDUs)...
vnf-monitoring-show
  vnf-show                  shows the info of a VNF instance
vnf-scale                  executes a VNF scale (adding/removing VDUs)...
  vnfd-create                creates a new VNFD/VNFpkg
vnf-show                  shows the info of a VNF instance
  vnfd-delete                deletes a VNFD/VNFpkg
vnfd-create                creates a new VNFD/VNFpkg
  vnfd-list                  list all VNFD/VNFpkg in the system
vnfd-delete                deletes a VNFD/VNFpkg
  vnfd-show                  shows the content of a VNFD
vnfd-list                  list all VNFD/VNFpkg in the system
  vnfd-update                updates a new VNFD/VNFpkg
vnfd-show                  shows the content of a VNFD
  vnfpkg-create              creates a new VNFD/VNFpkg
vnfd-update                updates a new VNFD/VNFpkg
  vnfpkg-delete              deletes a VNFD/VNFpkg
vnfpkg-create              creates a new VNFD/VNFpkg
  vnfpkg-list                list all VNFD/VNFpkg in the system
vnfpkg-delete              deletes a VNFD/VNFpkg
  vnfpkg-show                shows the content of a VNFD
vnfpkg-list                list all VNFD/VNFpkg in the system
  vnfpkg-update              updates a VNFD/VNFpkg
vnfpkg-show                shows the content of a VNFD
vnfpkg-update              updates a VNFD/VNFpkg
```


==Enable autocompletion==
##Enable autocompletion##


You can enable autocompletion in OSM client by creating a file osm-complete.sh in the following way:
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
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:
Then you can add it to your $HOME/.bashrc file:
. .bash_completion.d/osm-complete.sh
```
. .bash_completion.d/osm-complete.sh
```

Revision as of 10:16, 5 February 2019

Template:MARKDOWN 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.

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

```bash

  1. Ubuntu pre-requirements

sudo apt install python-pip libcurl4-gnutls-dev libgnutls-dev

  1. CentOS pre-requirements
  2. sudo yum install python-pip libcurl-devel gnutls-devel

sudo -H pip install python-magic

  1. 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@v5.0.2

  1. You could also install the latest client from master branch in this way:
  2. sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient

```

    1. Usage (client commands) ##

Once installed, type “osm” to see a list of commands. If installed in a host different from where OSM is running, 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

```

    1. 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 ```