Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1.Overview

To better support more HPA capabilities without modifying the implementation code for Multi-cloud. so we need to extract the HPA discovery part of the code make it into a plug-inmany drivers(HPA Discovery PluginDriver). if we want to add new HPA feature or modify the implementation code for the currently feature, we just need to modify HPA Discovery Plugin Driver code.


Image RemovedImage Added

Extract the original hpa HPA discovery part code and make it into a plug-indriver.
we need to add hook in openstackOpenstack, kubernetes Kubernetes and others plugin. then we develop
plug-ins driver for various languages.

We plan to develop python language and GO language(in R6 support python language).


2. Design

2.1 Security(results too large)


we solve one flavor each time, the result maximin is 1500 bytes. We will verify the validity of the data

2.2 CRUD

Driver don't write AAI, plugin will write AAI. driver just format data.

Create
fill discover hpa content
transfer data, format data in the driver, and then return the data, call AAI.

Delete
driver don't write aai.

flavors = cloudregiondata.get("flavors", None)
for flavor in flavors.get("flavor", []) if flavors else []:
resource_url = delete_hpa_capabilities(flavor, cloud_owner, cloud_region_id)
# remove hpa-capability
retcode, content, status_code = \
restcall.req_to_aai(resource_url, "DELETE")

Update
update same as create, please see https://git.onap.org/multicloud/openstack/tree/share/common/msapi/helper.py L142

2.3 Consume

Q1 OOF understand new driver schema, OOF output?(cloud_region, flavor)
A1: OOF can parse the AAI data, the driver just need to follow AAI schema. OOF output is oof_directives which is defined in https://git.onap.org/multicloud/framework/tree/docs/specs/multicloud_infra_workload.rst

Q2: Consume more info.
networking, (create SRIOV-NIC, sriov physical network id, pci vendor id, pci device id)
common or driver code()

search check_vim_capacity

VIM capacity will store in driver. driver will get information from "Collectd". This will be completed in next release.

2.4 FCAPS

Driver with some issue: alarm(pool or other mode).
if driver have some issues, the hpa capabilities will be empty.

3.Driver code Management

For python language driver, we put it into multi-cloud openstack plugin.

For golang language driver, we put it into multi-cloud kubernetes plugin.

4.Add New hardware feature driver

  1. The hardware vendor determines whether to share the driver to community.
  2. If vendor share the driver to community, then submitted the driver code to multi-cloud repo, then we  will put the driver to the docker image and release it.
  3. if vendor didn't share the driver to community, he/she can make new image base on the releasing docker image and upload to local docker image repo, then change the oom helm charts file to point this image repo.

           # Dockerfile

           from multi-windriver:1.4.0

           add hpa-discovery-driver1(device vendor1)

           add hpa-discovery-driver2(device vendor2)

5.Driver Version Control

We will put HPA discovery drivers as pip package to release pip REPO. name like onap-device-driver-<drivername>-<version>

when we release the plugin, we will add the driver of pip package to the docker.

5.1 Construct package:

$ python setup.py build

$ python setup.py bdist_wheel

5.2 upload package

  1. Create pypirc: The Pypirc file stores the PyPi repository information. Create a file in the home director for *nix ~/.pypirc 
  2. And add the following content to it. Replace javatechy with your username.
    [distutils] 
    index-servers=pypi
    [pypi] 
    repository = https://upload.pypi.org/legacy/ 
    username =haibin

      3.  To upload your dist/*.whl file on PyPi, use Twine:

    python -m twine upload dist/*


6. Usage

6.1 Local use

For python, run below command in openstack plugincreate docker image

$ python setup.py build

$ python setup.py install

6.2 based on pip package

$ pip install <package-name>

7. Test

Unit Tests with tox, Integration test will use SRIOV-NIC as example.