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 many drivers(HPA Discovery Driver). if we want to add new HPA feature or modify the implementation code for the currently feature, we just need to modify HPA Discovery Driver code.
Extract the original HPA discovery part code and make it into a driver.
we need to add hook in Openstack, Kubernetes and others plugin. then we develop 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.
2.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.
3.Add New hardware feature driver
- The hardware vendor determines whether to share the driver to community.
- 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.
- 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)
4.Driver Version Control
We will put HPA discovery drivers as pip package to release pip REPO. name like onap-device-driver-<drivername>
4.1 Construct package:
$ python setup.py build
4.2 upload package
python
5. Usage
For python, run below command in create docker image
$ python setup.py build
$ python setup.py install
6. Test
Unit Tests with tox, Integration test will use SRIOV-NIC as example.