OSM client: Difference between revisions

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


## Installation ##
In those cases where you have an OSM already installed in a remote server, you might still want to operate it from your local computer using the OSM client. The OSM client provides you a client library and a command-line tool to operate OSM..


OSM client comes bundled with OSM installation, so if you successfully installed OSM.
## Installation
In addition you can also install it in a different computer.
 
OSM client comes bundled with OSM installation, so if you successfully installed OSM, you already have it.
 
In addition, you can also install it in a different computer. In order to install OSM client, you will need a Linux machine and follow this procedure.


```bash
```bash
# Ubuntu pre-requirements
wget -qO - https://osm-download.etsi.org/repository/osm/debian/ReleaseSIX/OSM%20ETSI%20Release%20Key.gpg | sudo apt-key add –
sudo apt install python-pip libcurl4-gnutls-dev libgnutls-dev
sudo add-apt-repository -y "deb [arch=amd64] https://osm-download.etsi.org/repository/osm/debian/ReleaseSIX stable devops osmclient"
# CentOS pre-requirements
sudo apt-get update
# sudo yum install python-pip libcurl-devel gnutls-devel
sudo apt-get install python-osmclient
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@v5.0.2
# 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"
 
```bash
export OSM_HOSTNAME="127.0.0.1"
```


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


**Options:**
**Options:**
```
 
--hostname TEXT         hostname of server.  Also can set OSM_HOSTNAME in
```bash
                        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
  --user TEXT     user (defaults to admin). Also can set OSM_USER in
--user TEXT             user (only from Release FOUR, defaults to admin).
                  environment
                        Also can set OSM_USER in environment
  --password TEXT password (defaults to admin). Also can set OSM_PASSWORD in
--password TEXT         password (only from Release FOUR, defaults to
                  environment
                        admin). Also can set OSM_PASSWORD in environment
  --project TEXT   project (defaults to admin). Also can set OSM_PROJECT in
--project TEXT         project (only from Release FOUR, defaults to admin).
                  environment
                        Also can set OSM_PROJECT in environment
  --help           Show this message and exit.
--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:**
**Commands:**
```
 
config-agent-add          adds a config agent
```bash
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 NF pkg (VNF pkg, PNF pkg, HNF pkg)...
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-op-list                shows the history of operations over a NS...
ns-metric-export          exports a metric to the internal OSM bus,...
  ns-op-show                shows the info of an operation
ns-monitoring-show
  ns-show                    shows the info of a NS instance
ns-op-list                shows the history of operations over a NS...
  nsd-create                creates a new NSD/NSpkg
ns-op-show                shows the info of an operation
  nsd-delete                deletes a NSD/NSpkg
ns-scale                  scales NS NS_NAME: name of the NS instance to...
  nsd-list                  list all NSD/NS pkg in the system
ns-scaling-show            shows the status of a NS scaling operation...
  nsd-show                  shows the content of a NSD
ns-show                    shows the info of a NS instance
  nsd-update                updates a NSD/NSpkg
nsd-create                creates a new NSD/NSpkg
  nsi-create                creates a new Network Slice Instance
nsd-delete                deletes a NSD/NSpkg
  nsi-delete                deletes a Network Slice Instance (NSI)
nsd-list                  list all NSD/NSpkg in the system
  nsi-list                  list all Network Slice Instances (NSI)
nsd-show                  shows the content of a NSD
  nsi-op-list                shows the history of operations over a...
nsd-update                updates a NSD/NSpkg
  nsi-op-show                shows the info of an operation over a Network
nsi-create                creates a new Network Slice Instance
                            Slice Instance(NSI)
nsi-delete                deletes a Network Slice Instance (NSI)
  nsi-show                  shows the content of a Network Slice Instance
nsi-list                  list all Network Slice Instances (NSI)
                            (NSI)
nsi-op-list                shows the history of operations over a...
  nspkg-create              creates a new NSD/NSpkg
nsi-op-show                shows the info of an operation over a Network
  nspkg-delete              deletes a NSD/NSpkg
                            Slice Instance(NSI)
  nspkg-list                list all NSD/NS pkg in the system
nsi-show                  shows the content of a Network Slice Instance
  nspkg-show                shows the content of a NSD
                            (NSI)
  nspkg-update              updates a NSD/NSpkg
nspkg-create              creates a new NSD/NSpkg
  nst-create                creates a new Network Slice Template (NST)
nspkg-delete              deletes a NSD/NSpkg
  nst-delete                deletes a Network Slice Template (NST)
nspkg-list                list all NSD/NSpkg in the system
  nst-list                  list all Network Slice Templates (NST) in the...
nspkg-show                shows the content of a NSD
  nst-show                  shows the content of a Network Slice Template
nspkg-update              updates a NSD/NSpkg
                            (NST)
nst-create                creates a new Network Slice Template (NST)
  nst-update                updates a Network Slice Template (NST)
nst-delete                deletes a Network Slice Template (NST)
  pdu-create                adds a new Physical Deployment Unit to the
nst-list                  list all Network Slice Templates (NST) in the...
                            catalog
nst-show                  shows the content of a Network Slice Template
  pdu-delete                deletes a Physical Deployment Unit (PDU)
                            (NST)
  pdu-list                  list all Physical Deployment Units (PDU)
nst-update                updates a Network Slice Template (NST)
  pdu-show                  shows the content of a Physical Deployment Unit
pdu-create                adds a new Physical Deployment Unit to the
                            (PDU)
                            catalog
  project-create            Creates a new project NAME: name of the...
pdu-delete                deletes a Physical Deployment Unit (PDU)
  project-delete            deletes a project NAME: name or ID of the...
pdu-list                  list all Physical Deployment Units (PDU)
  project-list              list all projects
pdu-show                  shows the content of a Physical Deployment Unit
  project-show              shows the details of a project NAME: name or...
                            (PDU)
  project-update            Update a project name :param ctx: :param...
project-create            Creates a new project NAME: name of the...
  role-create                creates a role
project-delete            deletes a project NAME: name or ID of the...
  role-delete                deletes a role
project-list              list all projects
  role-list                  list all roles
project-show              shows the details of a project NAME: name or...
  role-show                  show specific role
ro-dump                    shows RO agent information
  role-update                updates a role
sdnc-create                creates a new SDN controller
  sdnc-create                creates a new SDN controller
sdnc-delete                deletes an SDN controller NAME: name or ID of...
  sdnc-delete                deletes an SDN controller NAME: name or ID of...
sdnc-list                  list all SDN controllers
  sdnc-list                  list all SDN controllers
sdnc-show                  shows the details of an SDN controller NAME:...
  sdnc-show                  shows the details of an SDN controller NAME:...
sdnc-update                updates an SDN controller
  sdnc-update                updates an SDN controller
upload-package            uploads a VNF package or NS package FILENAME:...
  upload-package            uploads a VNF package or NS package FILENAME:...
user-create                Creates a new user USERNAME: name of the user
  user-create                Creates a new user USERNAME: name of the...
user-delete                deletes a user NAME: name or ID of the user...
  user-delete                deletes a user NAME: name or ID of the user...
user-list                  list all users
  user-list                  list all users
user-show                  shows the details of a user NAME: name or ID...
  user-show                  shows the details of a user NAME: name or ID...
vcs-list
  user-update                Update a user information USERNAME: name of...
vim-create                creates a new VIM account
  vim-create                creates a new VIM account
vim-delete                deletes a VIM account NAME: name or ID of the...
  vim-delete                deletes a VIM account NAME: name or ID of the...
vim-list                  list all VIM accounts
  vim-list                  list all VIM accounts
vim-show                  shows the details of a VIM account NAME: name...
  vim-show                  shows the details of a VIM account NAME: name...
vim-update                updates a VIM account
  vim-update                updates a VIM account
vnf-list                  list all NF instances
  vnf-list                  list all NF instances
vnf-monitoring-show
  vnf-scale                  Executes a VNF scale (adding/removing VDUs)...
vnf-scale                  executes a VNF scale (adding/removing VDUs)...
  vnf-show                  shows the info of a VNF instance
vnf-show                  shows the info of a VNF instance
  vnfd-create                creates a new VNFD/VNFpkg
vnfd-create                creates a new VNFD/VNFpkg
  vnfd-delete                deletes a VNFD/VNFpkg
vnfd-delete                deletes a VNFD/VNFpkg
  vnfd-list                  list all VNFD/VNF pkg in the system
vnfd-list                  list all VNFD/VNFpkg in the system
  vnfd-show                  shows the content of a VNFD
vnfd-show                  shows the content of a VNFD
  vnfd-update                updates a new VNFD/VNFpkg
vnfd-update                updates a new VNFD/VNFpkg
  vnfpkg-create              creates a new VNFD/VNFpkg
vnfpkg-create              creates a new VNFD/VNFpkg
  vnfpkg-delete              deletes a VNFD/VNFpkg
vnfpkg-delete              deletes a VNFD/VNFpkg
  vnfpkg-list                list all VNFD/VNF pkg in the system
vnfpkg-list                list all VNFD/VNFpkg in the system
  vnfpkg-show                shows the content of a VNFD
vnfpkg-show                shows the content of a VNFD
  vnfpkg-update              updates a VNFD/VNFpkg
vnfpkg-update              updates a VNFD/VNFpkg
  wim-create                creates a new WIM account
  wim-delete                deletes a WIM account NAME: name or ID of the...
  wim-list                  list all WIM accounts
  wim-show                  shows the details of a WIM account NAME: name...
  wim-update                updates a WIM account
```
```


##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:
```
 
```bash
mkdir -p $HOME/.bash_completion.d
mkdir -p $HOME/.bash_completion.d
_OSM_COMPLETE=source osm > $HOME/.bash_completion.d/osm-complete.sh
_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 the following to your $HOME/.bashrc file:
```bash
. .bash_completion.d/osm-complete.sh
```
```
. .bash_completion.d/osm-complete.sh
 
## Other installation methods
 
### Installing from git repo
 
```bash
# 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 the git repo.
# You can install the latest client from master branch in this way:
sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient
# You could also install a specific tag/version in this way
sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient@v6.0.1
```
```

Revision as of 09:27, 13 September 2019

Template:MARKDOWN

In those cases where you have an OSM already installed in a remote server, you might still want to operate it from your local computer using the OSM client. The OSM client provides you a client library and a command-line tool to operate OSM..

    1. Installation

OSM client comes bundled with OSM installation, so if you successfully installed OSM, you already have it.

In addition, you can also install it in a different computer. In order to install OSM client, you will need a Linux machine and follow this procedure.

```bash wget -qO - https://osm-download.etsi.org/repository/osm/debian/ReleaseSIX/OSM%20ETSI%20Release%20Key.gpg | sudo apt-key add – sudo add-apt-repository -y "deb [arch=amd64] https://osm-download.etsi.org/repository/osm/debian/ReleaseSIX stable devops osmclient" sudo apt-get update sudo apt-get install python-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).

```bash export OSM_HOSTNAME="127.0.0.1" ```

    • Usage:**

```bash osm [OPTIONS] COMMAND [ARGS]... ```

    • Options:**

```bash

 --hostname TEXT  hostname of server.  Also can set OSM_HOSTNAME in
                  environment
 --user TEXT      user (defaults to admin). Also can set OSM_USER in
                  environment
 --password TEXT  password (defaults to admin). Also can set OSM_PASSWORD in
                  environment
 --project TEXT   project (defaults to admin). Also can set OSM_PROJECT in
                  environment
 --help           Show this message and exit.

```

    • Commands:**

```bash

 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 NF pkg (VNF pkg, PNF pkg, HNF pkg)...
 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-op-list                 shows the history of operations over a NS...
 ns-op-show                 shows the info of an 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/NS pkg 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/NS pkg 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...
 project-update             Update a project name :param ctx: :param...
 role-create                creates a role
 role-delete                deletes a role
 role-list                  list all roles
 role-show                  show specific role
 role-update                updates a role
 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-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...
 user-update                Update a user information USERNAME: name of...
 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-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/VNF pkg 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/VNF pkg in the system
 vnfpkg-show                shows the content of a VNFD
 vnfpkg-update              updates a VNFD/VNFpkg
 wim-create                 creates a new WIM account
 wim-delete                 deletes a WIM account NAME: name or ID of the...
 wim-list                   list all WIM accounts
 wim-show                   shows the details of a WIM account NAME: name...
 wim-update                 updates a WIM account

```

    1. Enable autocompletion

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

```bash mkdir -p $HOME/.bash_completion.d _OSM_COMPLETE=source osm > $HOME/.bash_completion.d/osm-complete.sh ```

Then you can add the following to your $HOME/.bashrc file: ```bash . .bash_completion.d/osm-complete.sh ```

    1. Other installation methods
      1. Installing from git repo

```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 the git repo.
  2. You can install the latest client from master branch in this way:

sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient

  1. You could also install a specific tag/version in this way

sudo -H pip install git+https://osm.etsi.org/gerrit/osm/osmclient@v6.0.1 ```