3. SDVConfig Developer Guide

Welcome to the SDVConfig Developer Guide!

Who should use this guide?

If you want to extend SDVConfig by using a creating a module, adding functionality to an existing module, or expanding test coverage, this guide is for you. We’ve included detailed information for developers on how to test and document modules, as well as the prerequisites for getting your module be accepted into the main SDV repository.

3.1. Contents

  • Description of the project

  • Software architecture of the project

  • Software technologies uses

  • Setting up your local environment

  • Flow of the project

  • Project Structure

  • Code walkthrough of core functionalities

3.2. Description of the project

Cloud software validation is an upcoming project consisting of many microservices which all together form a single software validation solution. This documentation will be focused on one of the microservice namely SDV: Pre-Deployment Software Validation.

PDF(POD Descriptor File) is a standard, cloud-agnostic descriptor file meant to be used by Vendors/DC admins to describe the target Cloud Environment/Lab. One of the objectives of PDF is to provide interoperability between various Cloud-infrastructure and Vendors. My work at this internship aims to develop this PDF file further, add more details and develop some toolings around PDF to make it easier to consume by the end-user. The final process will involve validating PDF against installer manifests. The target installers being airship and TripleO.

In summary, the goals of the project are: - Develop the PDF file further, add more details and develop some tooling around PDF to make it easier to consume by the end-user. - Validate the existing PDF with installers.

3.3. Software architecture of the project

There were two modules in SDVConfig, one is the extrapolation, which is a tooling around the PDF and validation, which validates the existing pdf with installers.

The software architecture of extrapolation module is as follows. .. image:: extrapolation.png

The software architecture of validation module is as follows. .. image:: validation.png

3.4. Software technologies used

The software technologies used in the project are - Tornado module for creating rest-apis - json module for handling json data - yaml module for handling yaml data - requests module for pushing data to testapi

3.5. Setting up your local environment

Use Python Virtual Environment Manager.

` python3 -m pip install --user virtualenv python3 -m venv env source env/bin/activate `

Install the required packages from requirements.txt.

` pip install -r requirements.txt `

3.6. Flow of the project

The flow of the two modules is shown in this detailed picture as shown below.

The flow diagram of the extrapolation module is as follows.

../../_images/extrapolation-flow.png

The flow diagram of the validation module is as follows.

../../_images/validation-flow.png

3.7. Project Structure

The project structure is as follows.

sdvconfig
├── cli_validation.py
├── Dockerfile
├── extrapolation
│   ├── extrapolation.py
│   └── __init__.py
├── manifest
│   ├── __init__.py
│   └── manifest.py
├── mapping
│   ├── airship
│   │   ├── hardware-mapping.json
│   │   ├── info-mapping.json
│   │   ├── network-mapping.json
│   │   ├── platform-mapping.json
│   │   ├── software-mapping.json
│   │   └── storage-mapping.json
│   ├── template
│   │   ├── hardware-mapping.json
│   │   ├── info-mapping.json
│   │   ├── network-mapping.json
│   │   ├── platform-mapping.json
│   │   ├── software-mapping.json
│   │   └── storage-mapping.json
│   └── TripleO
│       ├── hardware-mapping.json
│       ├── info-mapping.json
│       ├── network-mapping.json
│       ├── platform-mapping.json
│       ├── software-mapping.json
│       └── storage-mapping.json
├── README.md
├── requirements.txt
├── server.py
├── testapi
│   ├── __init__.py
│   └── testapi.py
└── validation
    ├── hardware.py
    ├── info.py
    ├── __init__.py
    ├── network.py
    ├── platform.py
    ├── software.py
    └── storage.py

3.8. Code walkthrough of core functionalities

3.8.1. Extrapolation

The core code of extrapolation is as shown below.

We iterate through list of roles and generate list of servers with the following code. The IP values are picked from networks/ipmi/cidr from the pdf and is used in the extrapolation process.

3.8.2. Validation

The core code of validation is as shown below.

and one sample validation file, say hardware validation code is as follow.

and the core recursive code which is used to find keys in the manifest files is as follows.

The code first iterates through all the profiles, and for each profile it checks with each key, gets its corresponding mapped value from the mapping files and checks whether the key exists in the installer manifest or not.