| commit | 12b478cb4a6b2dd74d61c4e7272fb0eda635c8b9 | [log] [tgz] |
|---|---|---|
| author | garciadeblas <gerardo.garciadeblas@telefonica.com> | Sun Jun 19 00:49:47 2022 +0200 |
| committer | garciadeblas <gerardo.garciadeblas@telefonica.com> | Sun Jun 19 00:52:28 2022 +0200 |
| tree | 29389a9babb6e7e464a3b5707e537f56d70defcd | |
| parent | 3984c7f63e1a92853c87175ef6d1d72b38d3f0ac [diff] |
Support of several VNF and VDU in ns-heal and vnf-heal commands Click does not allow advanced patterns for positional options. This makes impossible to request the healing of several VNF or VDU with different options like --count-index or --run-day1. This change introduces a processing of the args used in ns-heal and vnf-heal commands to allow those patterns. In addition, the change introduces the logic to use either the VNF instance ID or the identifier of a VNF inside a NS, known as "member-vnf-index-ref". Change-Id: I8b2f18aff6146ce579da33e67054f4a0f98c706a Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
OSM client library and console script
# Ubuntu 18.04 pre-requirements sudo apt-get install python3-pip libcurl4-openssl-dev libssl-dev # CentOS pre-requirements # sudo yum install python3-pip libcurl-devel gnutls-devel sudo -H python3 -m pip install python-magic # Install OSM Information model sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/IM --upgrade # Install OSM client from the git repo. # You can install the latest client from master branch in this way: sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient # You could also install a specific tag/version in this way # sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/osmclient@v7.0.0rc1
# Ubuntu 18.04 pre-requirements sudo apt-get install python3-pip libcurl4-openssl-dev libssl-dev # Centos pre-requirements # sudo yum install python3-pip libcurl-devel gnutls-devel sudo -H python3 -m pip install python-magic # Install OSM Information model sudo -H python3 -m pip install git+https://osm.etsi.org/gerrit/osm/IM --upgrade # Clone the osmclient repo and install OSM client from the git repo. git clone https://osm.etsi.org/gerrit/osm/osmclient cd osmclient python3 -m pip install --user -e . # logout and login so that PATH can be updated. Executable osm will be found in /home/ubuntu/.local/bin
Set the OSM_HOSTNAME variable to the host of the OSM server (default: localhost).
localhost$ export OSM_HOSTNAME=<hostname>
localhost$ osm upload-package ubuntu_xenial_vnf.tar.gz {'transaction_id': 'ec12af77-1b91-4c84-b233-60f2c2c16d14'} localhost$ osm vnfd-list +--------------------+--------------------+ | vnfd name | id | +--------------------+--------------------+ | ubuntu_xenial_vnfd | ubuntu_xenial_vnfd | +--------------------+--------------------+
localhost$ osm upload-package ubuntu_xenial_ns.tar.gz {'transaction_id': 'b560c9cb-43e1-49ef-a2da-af7aab24ce9d'} localhost$ osm nsd-list +-------------------+-------------------+ | nsd name | id | +-------------------+-------------------+ | ubuntu_xenial_nsd | ubuntu_xenial_nsd | +-------------------+-------------------+
localhost$ osm vim-list +-------------+-----------------+--------------------------------------+ | ro-account | datacenter name | uuid | +-------------+-----------------+--------------------------------------+ | osmopenmano | openstack-site | 2ea04690-0e4a-11e7-89bc-00163e59ff0c | +-------------+-----------------+--------------------------------------+
localhost$ osm ns-create ubuntu_xenial_nsd testns openstack-site {'success': ''} localhost$ osm ns-list +------------------+--------------------------------------+-------------------+--------------------+---------------+ | ns instance name | id | catalog name | operational status | config status | +------------------+--------------------------------------+-------------------+--------------------+---------------+ | testns | 6b0d2906-13d4-11e7-aa01-b8ac6f7d0c77 | ubuntu_xenial_nsd | running | configured | +------------------+--------------------------------------+-------------------+--------------------+---------------+
Assuming that you have installed python-osmclient package, it's pretty simple to write some Python code to interact with OSM.
from osmclient import client from osmclient.common.exceptions import ClientException hostname = "127.0.0.1" myclient = client.Client(host=hostname, sol005=True) resp = myclient.nsd.list() print yaml.safe_dump(resp, indent=4, default_flow_style=False)
The code will print for each package a pretty table, then the full details in yaml
from osmclient import client from osmclient.common.exceptions import ClientException import yaml from prettytable import PrettyTable hostname = "127.0.0.1" user = admin password = admin project = admin kwargs = {} if user is not None: kwargs['user']=user if password is not None: kwargs['password']=password if project is not None: kwargs['project']=project myclient = client.Client(host=hostname, sol005=True, **kwargs) resp = myclient.vnfd.list() print yaml.safe_dump(resp, indent=4, default_flow_style=False)
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 the following to your $HOME/.bashrc file:
. .bash_completion.d/osm-complete.sh