diff options
author | fsandoval <frank.sandoval@oamtechnologies.com> | 2018-05-31 09:36:45 -0600 |
---|---|---|
committer | Frank Sandoval <frank.sandoval@oamtechnologies.com> | 2018-06-01 19:03:52 +0000 |
commit | 1c89312dc29505f7a5881d7462fb59306c7602fc (patch) | |
tree | 5743bb16a4b377cb9bbcca4d46d4c5189f125825 | |
parent | 6808592a9533c02d58981c3a4317ceb5dd056899 (diff) |
moved docs to has/docs
Issue-ID: OPTFRA-242
Change-Id: Ib46a96f5d7281084cb8c859b4bbe56265b8ccdba
Signed-off-by: fsandoval <frank.sandoval@oamtechnologies.com>
(cherry picked from commit 40db765dbfa3f18d59f08e84a49f08aa58b66ca0)
-rw-r--r-- | conductor/README.md | 16 | ||||
-rw-r--r-- | conductor/README.rst | 26 | ||||
-rw-r--r-- | conductor/doc/api/README.md | 283 | ||||
-rw-r--r-- | conductor/doc/distribution/README.md | 551 | ||||
-rw-r--r-- | conductor/doc/examples/README.md | 96 | ||||
-rw-r--r-- | conductor/doc/glossary/README.md | 26 | ||||
-rw-r--r-- | conductor/doc/template/README.md | 1259 | ||||
-rw-r--r-- | conductor/setup.cfg | 1 |
8 files changed, 0 insertions, 2258 deletions
diff --git a/conductor/README.md b/conductor/README.md deleted file mode 100644 index ba0316d..0000000 --- a/conductor/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Conductor - -OF-HAS is the implementation of the ONAP Homing Service. The formal project name in ONAP is *OF-HAS*. The informal name for the project is *Conductor* (inherited from the seed-code), which is interchangeably used through the project. - -Given the description of what needs to be deployed (demands) and the placement requirements (constraints), Conductor determines placement candidates that meet all constraints while optimizing the resource usage of the AIC infrastructure. A customer request may be satisfied by deploying new VMs in AIC (AIC inventory) or by using existing service instances with enough remaining capacity (service inventory). - -From a canonical standpoint, Conductor is known as a *homing service*, in the same way OpenStack Heat is an orchestration service, or Nova is a compute service. - -* License: Licensed under the Apache License, Version 2.0 -* [PyPI]() - package installation -* [Python/Linux Distribution Notes](/doc/distribution/README.md) -* [Conductor Template Guide](/doc/template/README.md) -* [Example Templates](/doc/examples/README.md) -* [Homing API](/doc/api/README.md) -* [Bugs](https://jira.onap.org/projects/OPTFRA/summary) - issue tracking -* [Source](https://gerrit.onap.org/r/optf/has) diff --git a/conductor/README.rst b/conductor/README.rst deleted file mode 100644 index c90eff6..0000000 --- a/conductor/README.rst +++ /dev/null @@ -1,26 +0,0 @@ -========= -Conductor -========= - -OF-HAS is the implementation of the ONAP Homing Service. The formal project name in ONAP is *OF-HAS*. The informal name for the project is *Conductor* (inherited from the seed-code), which is interchangeably used through the project. - -Given the description of what needs to be deployed (demands) and the placement requirements (constraints), Conductor determines placement candidates that meet all constraints while optimizing the resource usage of the AIC infrastructure. A customer request may be satisfied by deploying new VMs in AIC (AIC inventory) or by using existing service instances with enough remaining capacity (service inventory). - -From a canonical standpoint, Conductor is known as a *homing service*, in the same way OpenStack Heat is an orchestration service, or Nova is a compute service. - -* License: Licensed under the Apache License, Version 2.0 -* `PyPI`_ - package installation -* `Python/Linux Distribution Notes`_ -* `Conductor Template Guide`_ -* `Example Templates`_ -* `Homing API`_ -* `Bugs`_ - issue tracking -* `Source`_ - -.. _PyPI: -.. _Python/Linux Distribution Notes: /doc/distribution/README.md -.. _Conductor Template Guide: /doc/template/README.md -.. _Example Templates: /examples/README.md -.. _Homing API: /doc/api/README.md -.. _Bugs: https://jira.onap.org/projects/OPTFRA/summary -.. _Source: https://gerrit.onap.org/r/optf/has diff --git a/conductor/doc/api/README.md b/conductor/doc/api/README.md deleted file mode 100644 index 59bc295..0000000 --- a/conductor/doc/api/README.md +++ /dev/null @@ -1,283 +0,0 @@ -# Homing API v1 - -*Updated: 4 April 2017* - -This document describes the Homing API, used by the Conductor service. It is a work in progress and subject to frequent revision. - -# General API Information - -Authenticated calls that target a known URI but that use an HTTP method the implementation does not support return a 405 Method Not Allowed status. In addition, the HTTP OPTIONS method is supported for each known URI. In both cases, the Allow response header indicates the supported HTTP methods. See the API Errors section for more information about the error response structure. - -# API versions - -## List all Homing API versions - -**GET** ``/``F - -**Normal response codes:** 200 - -```json -{ - "versions": [ - { - "status": "EXPERIMENTAL", - "id": "v1", - "updated": "2016-11-01T00:00:00Z", - "media-types": [ - { - "base": "application/json", - "type": "application/vnd.ecomp.homing-v1+json" - } - ], - "links": [ - { - "href": "http://135.197.226.83:8091/v1", - "rel": "self" - }, - { - "href": "http://conductor.research.att.com/", - "type": "text/html", - "rel": "describedby" - } - ] - } - ] -} -``` - -This operation does not accept a request body. - -# Plans - -## Create a plan - -**POST** ``/v1/plans`` - -* **Normal response codes:** 201 -* **Error response codes:** badRequest (400), unauthorized (401), internalServerError (500) - -Request an inventory plan for one or more related service demands. - -The request includes or references a declarative **template**, consisting of: - -* **Parameters** that can be referenced like macros -* **Demands** for service made against inventory -* **Locations** that are common to the overall plan -* **Constraints** made against demands, resulting in a set of inventory candidates -* **Optimizations** to further narrow down the remaining candidates - -The response contains an inventory **plan**, consisting of one or more sets of recommended pairings of demands with an inventory candidate's attributes and region. - -### Request Parameters - -| Parameter | Style | Type | Description | -|-----------|-------|------|-------------| -| ``name`` (Optional) | plain | xsd:string | A name for the new plan. If a name is not provided, it will be auto-generated based on the homing template. This name must be unique within a given Conductor environment. When deleting a plan, its name will not become available for reuse until the deletion completes successfully. Must only contain letters, numbers, hypens, full stops, underscores, and tildes (RFC 3986, Section 2.3). This parameter is immutable. | -| ``id`` (Optional) | plain | csapi:UUID | The UUID of the plan. UUID is assigned by Conductor if no id is provided in the request. | -| ``transaction_id`` | plain | csapi:UUID | The transaction id assigned by MSO. The logs should have this transaction id for tracking purposes. | -| ``files`` (Optional) | plain | xsd:dict | Supplies the contents of files referenced in the template. Conductor templates can explicitly reference files by using the ``get_file`` intrinsic function. The value is a JSON object, where each key is a relative or absolute URI which serves as the name of a file, and the associated value provides the contents of the file. Additionally, some template authors encode their user data in a local file. The Homing client (e.g., a CLI) can examine the template for the ``get_file`` intrinsic function (e.g., ``{get_file: file.yaml}``) and add an entry to the ``files`` map with the path to the file as the name and the file contents as the value. Do not use this parameter to provide the content of the template located at the ``template_url`` address. Instead, use the ``template`` parameter to supply the template content as part of the request. | -| ``template_url`` (Optional) | plain | xsd:string | A URI to the location containing the template on which to perform the operation. See the description of the ``template`` parameter for information about the expected template content located at the URI. This parameter is only required when you omit the ``template`` parameter. If you specify both parameters, this parameter is ignored. | -| ``template``| plain | xsd:string or xsd:dict | The template on which to perform the operation. See the [Conductor Template Guide](/doc/template/README.md) for complete information on the format. This parameter is either provided as a ``string`` or ``dict`` in the JSON request body. For ``string`` content it may be a JSON- or YAML-formatted Conductor template. For ``dict`` content it must be a direct JSON representation of the Conductor template. This parameter is required only when you omit the ``template_url`` parameter. If you specify both parameters, this value overrides the ``template_url`` parameter value. | -| ``timeout`` (Optional) | plain | xsd:number | The timeout for plan creation in minutes. Default is 1. | -| ``limit`` (Optional) | plain | xsd:number | The maximum number of recommendations to return. Default is 1. | - -**NOTE**: ``files``, ``template_url``, and ``timeout`` are not yet supported. - -### Response Parameters - -| Parameter | Style | Type | Description | -|-----------|-------|------|-------------| -| ``plan`` | plain | xsd:dict | The ``plan`` object. | -| ``id`` | plain | csapi:UUID | The UUID of the plan. | -| ``transaction_id`` | plain | csapi:UUID | The transaction id assigned by the MSO. | -| ``name`` | plain | xsd:string | The plan name. | -| ``status`` | plain | xsd:string | The plan status. One of ``template``, ``translated``, ``solving``, ``solved``, or ``error``. See **Plan Status** table for descriptions of each value. | -| ``message`` | plain | xsd:string | Additional context, if any, around the message status. If the status is ``error``, this may include a reason and suggested remediation, if available. | -| ``links`` | plain | xsd:list | A list of URLs for the plan. Each URL is a JSON object with an ``href`` key indicating the URL and a ``rel`` key indicating its relationship to the plan in question. There may be multiple links returned. The ``self`` relationship identifies the URL of the plan itself. | -| ``recommendations`` | plain | xsd:list | A list of one or more recommendations. A recommendation pairs each requested demand with an inventory provider, a single candidate, and an opaque dictionary of attributes. Refer to the Demand candidate schema in the [Conductor Template Guide](/doc/template/README.md) for further details. (Note that, when ``inventory_type`` is ``cloud`` the candidate's ``candidate_id`` field is redundant and thus omitted.) | - -### Plan Status - -| Status | Description | -|--------|-------------| -| ``template`` | Plan request and homing template have been received. Awaiting translation. | -| ``translated`` | Homing template has been translated, and candidates have been obtained from inventory providers. Awaiting solving. | -| ``solving`` | Search for a solution is in progress. This may incorporate requests to service controllers for additional information. | -| ``solved`` | Search is complete. A solution with one or more recommendations was found. | -| ``not found`` | Search is complete. No recommendations were found. | -| ``error`` | An error was encountered. | - -#### State Diagram - -```text - ---------------------------------------- - | | - | /---> solved ---> reserving ---> done - | / / - template -> translated -> solving ------> not found / - | ^ | \ / - | | conditionally | \---> error <----/ - | | (see note) | ^ - | \---------------/ | - \---------------------------------------/ -``` -**NOTE**: When Conductor's solver service is started in non-concurrent mode (the default), it will reset any plans found waiting and stuck in the ``solving`` state back to ``translated``. - -```json -{ - "name": "PLAN_NAME", - "template": "CONDUCTOR_TEMPLATE", - "limit": 3 -} -``` - -```json -{ - "plan": { - "name": "PLAN_NAME", - "id": "ee1c5269-c7f0-492a-8652-f0ceb15ed3bc", - "transaction_id": "6bca5f2b-ee7e-4637-8b58-1b4b36ed10f9", - "status": "solved", - "message", "Plan PLAN_NAME is solved.", - "links": [ - { - "href": "http://homing/v1/plans/ee1c5269-c7f0-492a-8652-f0ceb15ed3bc", - "rel": "self" - } - ], - "recommendations": [ - { - "DEMAND_NAME_1": { - "inventory_provider": "aai", - "service_resource_id": "4feb0545-69e2-424c-b3c4-b270e5f2a15d", - "candidate": { - "candidate_id": "99befee8-e8c0-425b-8f36-fb7a8098d9a9", - "inventory_type": "service", - "location_type": "aic", - "location_id": "dal01", - "host_id" : "vig20002vm001vig001" - }, - "attributes": {OPAQUE-DICT} - }, - "DEMAND_NAME_2": { - "inventory_provider": "aai", - "service_resource_id": "578eb063-b24a-4654-ba9e-1e5cf7eb9183", - "candidate": { - "inventory_type": "cloud", - "location_type": "aic", - "location_id": "dal02" - }, - "attributes": {OPAQUE-DICT} - } - }, - { - "DEMAND_NAME_1": { - "inventory_provider": "aai", - "service_resource_id": "4feb0545-69e2-424c-b3c4-b270e5f2a15d", - "candidate": { - "candidate_id": "99befee8-e8c0-425b-8f36-fb7a8098d9a9", - "inventory_type": "service", - "location_type": "aic", - "location_id": "dal03", - "host_id" : "vig20001vm001vig001" - }, - "attributes": {OPAQUE-DICT} - }, - "DEMAND_NAME_2": { - "inventory_provider": "aai", - "service_resource_id": "578eb063-b24a-4654-ba9e-1e5cf7eb9183", - "candidate": { - "inventory_type": "cloud", - "location_type": "aic", - "location_id": "dal04" - }, - "attributes": {OPAQUE-DICT} - } - }, - ... - ] - } -} -``` - -## Show plan details - -**GET** ``/v1/plans/{plan_id}`` - -* **Normal response codes:** 200 -* **Error response codes:** unauthorized (401), itemNotFound (404) - -### Request parameters - -| Parameter | Style | Type | Description | -|-------------|-------|------------|---------------------------------------------------| -| ``plan_id`` | plain | csapi:UUID | The UUID of the plan. | - -### Response Parameters - -See the Response Parameters for **Create a plan**. - -## Delete a plan - -**DELETE** ``/v1/plans/{plan_id}`` - -* **Normal response codes:** 204 -* **Error response codes:** badRequest (400), unauthorized (401), itemNotFound (404) - -### Request parameters - -| Parameter | Style | Type | Description | -|-------------|-------|------------|---------------------------------------------------| -| ``plan_id`` | plain | csapi:UUID | The UUID of the plan. | - -This operation does not accept a request body and does not return a response body. - -## API Errors - -In the event of an error with a status other than unauthorized (401), a detailed repsonse body is returned. - -### Response parameters - -| Parameter | Style | Type | Description | -|-------------|-------|------------|---------------------------------------------------| -| ``title`` | plain | xsd:string | Human-readable name. | -| ``explanation`` | plain | xsd:string | Detailed explanation with remediation (if any). | -| ``code`` | plain | xsd:int | HTTP Status Code. | -| ``error`` | plain | xsd:dict | Error dictionary. Keys include **message**, **traceback**, and **type**. | -| ``message`` | plain | xsd:string | Internal error message. | -| ``traceback`` | plain | xsd:string | Python traceback (if available). | -| ``type`` | plain | xsd:string | HTTP Status class name (from python-webob) | - -#### Examples - -A plan with the name "pl an" is considered a bad request because the name contains a space. - -```json -{ - "title": "Bad Request", - "explanation": "-> name -> pl an did not pass validation against callable: plan_name_type (must contain only uppercase and lowercase letters, decimal digits, hyphens, periods, underscores, and tildes [RFC 3986, Section 2.3])", - "code": 400, - "error": { - "message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", - "type": "HTTPBadRequest" - } -} -``` - -The HTTP COPY method was attempted but is not allowed. - -```json -{ - "title": "Method Not Allowed", - "explanation": "The COPY method is not allowed.", - "code": 405, - "error": { - "message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", - "type": "HTTPMethodNotAllowed" - } -} -``` - -## Contact ## - -Shankar Narayanan <shankarpnsn@gmail.com> diff --git a/conductor/doc/distribution/README.md b/conductor/doc/distribution/README.md deleted file mode 100644 index 2b8f5dc..0000000 --- a/conductor/doc/distribution/README.md +++ /dev/null @@ -1,551 +0,0 @@ -# Python/Linux Distribution Notes - -*Updated: 10 Nov 2017 23:30 GMT* - -This document exists to help bridge the gap between the Conductor python package and any downstream distribution. The steps outlined herein may be taken into consideration when creating an AT&T SWM package, Ubuntu/Debian package, Chef cookbook, or Ansible playbook. - -## Components - -Conductor consists of five services that work together: - -* **``conductor-api``**: An HTTP REST API -* **``conductor-controller``**: Validation, translation, and status/results -* **``conductor-data``**: Inventory provider and service controller gateway -* **``conductor-solver``**: Processing and solution calculation -* **``conductor-reservation``**: Reserves the suggested solution solved by Solver component. - -## Workflow - -* Deployment **plans** are created, viewed, and deleted via ``conductor-api`` and its [REST API](doc/api/README.md). -* Included within each ``conductor-api`` plan request is a [Homing Template](doc/template/README.md). -* Homing Templates describe a set of inventory demands and constraints to be solved against. -* ``conductor-api`` hands off all API requests to ``conductor-controller`` for handling. -* All deployment plans are assigned a unique identifier (UUID-4), which can be used to check for solution status asynchronously. (Conductor does not support callbacks at this time.) -* ``conductor-controller`` ensures templates are well-formed and valid. Errors and remediation are made visible through ``conductor-api``. When running in debug mode, the API will also include a python traceback in the response body, if available. -* ``conductor-controller`` uses ``conductor-data`` to resolve demands against a particular **inventory provider** (e.g., A&AI). -* ``conductor-controller`` translates the template into a format suitable for solving. -* As each template is translated, ``conductor-solver`` begins working on it. -* ``conductor-solver`` uses ``conductor-data`` to resolve constraints against a particular **service controller** (e.g., SDN-C). -* ``conductor-solver`` determines the most suitable inventory to recommend. -* ``conductor-reservation`` attempts to reserve the solved solution in SDN-GC - -**NOTE**: There is no Command Line Interface or Python API Library at this time. - -## Pre-Flight and Pre-Installation Considerations - -### AT&T Application Identifiers and Roles - -* App/Tool Name: ECOMP Conductor -* MOTS Application ID: 26213 -* MechID: m04308 -* ECOMP Feature ID: F13704 -* PMT: 461306 -* UAM Role Name: Conductor Production Support -* UAM Role id: 0000025248 - -### Root - -Be aware that some commands may require ``sudo``, depending on the account being used to perform the installation. - -### Proxy - -If line-of-sight to internet-facing repositories is permitted and available, set the following shell environment variables if AT&T proxy services are required: - -```bash -$ export http_proxy="http://one.proxy.att.com:8080/" -$ export https_proxy="http://one.proxy.att.com:8080/" -``` - -### Requirements - -Conductor is officially supported on [Ubuntu 14.04 LTS (Trusty Tahr)](http://releases.ubuntu.com/14.04/), though it should also work on newer releases. - -Ensure the following Ubuntu packages are present, as they may not be included by default: - -* [libffi-dev](http://packages.ubuntu.com/trusty/libffi-dev) -* [postgresql-server-dev-9.3](http://packages.ubuntu.com/trusty/postgresql-server-dev-9.3) -* [python2.7](http://packages.ubuntu.com/trusty/python2.7) - -``conductor-api`` may be run as-is for development and test purposes. When used in a production environment, it is recommended that ``conductor-api`` run under a multithreaded httpd service supporting [WSGI](https://www.wikipedia.org/wiki/Web_Server_Gateway_Interface), tuned as appropriate. - -Configuration instructions for **apache2 httpd** and **nginx** are included herein. Respective package requirements are: - -* [apache2](http://packages.ubuntu.com/trusty/apache2) and [libapache2-mod-wsgi](http://packages.ubuntu.com/trusty/libapache2-mod-wsgi) -* [nginx](http://packages.ubuntu.com/trusty/nginx) and [uwsgi](http://packages.ubuntu.com/trusty/uwsgi) - -All Conductor services use AT&T [Music](https://github.com/att/music) for data storage/persistence and/or as a RPC transport mechanism. Consult the [Music Local Installation Guide](https://github.com/att/music/blob/master/README.md) for installation/configuration steps. - -### Networking - -All conductor services require line-of-sight access to all Music servers/ports. - -The ``conductor-api`` service uses TCP port 8091. - -### Security - -``conductor-api`` is accessed via HTTP. SSL/TLS certificates and AuthN/AuthZ (e.g., AAF) are not supported at this time. - -Conductor makes use of plugins that act as gateways to *inventory providers* and *service controllers*. At present, two plugins are supported out-of-the-box: **A&AI** and **SDN-C**, respectively. - -A&AI requires two-way SSL/TLS. Certificates must be registered and whitelisted with A&AI. SDN-C uses HTTP Basic Authentication. Consult with each respective service for official information on how to obtain access. - -### Storage - -For a cloud environment in particular, it may be desirable to use a separate block storage device (e.g., an OpenStack Cinder volume) for logs, configuration, and other data persistence. In this way, it becomes a trivial matter to replace the entire VM if necessary, followed by reinstallation of the app and any supplemental configuration. Take this into consideration when setting various Conductor config options. - -### Python Virtual Environments - -At present, Conductor installation is only supported at the (upstream) python package level and not the (downstream) Ubuntu distribution or SWM package levels. - -To mitigate/eliminate the risk of introducing conflicts with other python applications or Ubuntu/SWM package dependencies, consider installing Conductor in a [python virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/) (or *venv* for short). - -Example venv-aware WSGI app configurations, sysvinit scripts, and upstart scripts can be found in the Conductor repository under [examples](/examples/). - -### Python Package Dependencies - -Conductor is installed using the python ``pip`` command. ``pip`` uses a python project's [requirements manifest](/requirements.txt) to install all python module dependencies. - -**NOTE**: When line-of-sight access to a PyPI-compatible package index is not available, advance installation of Conductor's python package dependencies is required *before* installation. - -### Other Production Environment Considerations - -TBD. ``:)`` - -Over time, considerations may include services such as: - -* AAF -* AppMetrics -* Introscope -* Nagios -* Splunk -* UAM - -## Installation and Configuration - -**IMPORTANT**: Perform the steps in this section after *optionally* configuring and activating a python virtual environment. - -### Installing From a PyPI Repository - -In ONAP, the ``conductor`` package can be found on ````. - -Installation is via the ``pip`` command. Here is an example ``pip.conf`` file that uses both the internet and intranet-facing PyPI repositories: - -```ini -[global] -index = https://pypi.python.org/pypi -index-url = https://pypi.python.org/simple -extra-index-url = -trusted-host = -``` - -Once the configuration is in place, installation is simple: - -```bash -$ pip install of-has -``` - -To upgrade or downgrade, simply re-run ``pip install`` using the appropriate ``pip`` command line options. - -**NOTE**: Be sure proxy settings are in place if they're required to access ``pypi.python.org``. - -### Installing From Source - -Conductor source in ONAP is maintained in https://gerrit.onap.org/r/optf/has. - -Clone the git repository, and then install from within the ``conductor`` directory: - -```bash -$ git clone https://gerrit.onap.org/r/optf/has -Cloning into 'conductor'... -remote: Counting objects: 2291, done. -remote: Compressing objects: 88% (1918/2179) -remote: Compressing objects: 100% (2179/2179), done. -remote: Total 2291 (delta 1422), reused 0 (delta 0) -Receiving objects: 100% (2291/2291), 477.59 KiB | 0 bytes/s, done. -Resolving deltas: 100% (1422/1422), done. -$ cd conductor -$ pip install . -``` - -The latest source can be pulled from ONAP at any time and reinstalled: - -```bash -$ git pull -$ pip install . -``` - -### Verifying Installation - -Each of the five Conductor services may be invoked with the ``--help`` option: - -```bash -$ conductor-api -- --help -$ conductor-controller --help -$ conductor-data --help -$ conductor-solver --help -$ conductor-reservation --help -``` - -**NOTE**: The ``conductor-api`` command is deliberate. ``--`` is used as as separator between the arguments used to start the WSGI server and the arguments passed to the WSGI application. - -## Post-Flight and Post-Installation Considerations - -### User and Group - -It's good practice to create an unprivileged account (e.g., a user/group named ``conductor``) and run all Conductor services as that user: - -```bash -$ sudo addgroup --system conductor -$ sudo adduser --system --home /var/lib/conductor --ingroup conductor --no-create-home --shell /bin/false conductor -``` - -### SSL/TLS Certificates - -The A&AI Inventory Provider Plugin requiries two-way SSL/TLS. After provisioning a certificate per A&AI guidelines, it will be necessary to securely install the certificate, key, and certificate authority bundle. - -When running conductor services as ``conductor:conductor`` (recommended), consider co-locating all of these files under the configuration directory. For example, when using ``/etc/conductor``: - -```bash -$ # Certificate files (crt extension, 644 permissions) -$ sudo mkdir /etc/conductor/ssl/certs -$ # Private Certificate Key files (key extension, 640 permissions) -$ sudo mkdir /etc/conductor/ssl/private -$ # Certificate Authority (CA) Bundles (crt extension, 644 permissions) -$ sudo mkdir /etc/conductor/ssl/ca-certificates -$ # Add files to newly created directories, then set ownership -$ sudo chmod -R conductor:conductor /etc/conductor/ssl -``` - -For a hypothetical domain name ``imacculate.client.research.att.com``, example filenames could be as follows: - -```bash -$ find ssl -type f -printf '%M %u:%g %f\n' --rw-r----- conductor:conductor imacculate.client.research.att.com.key --rw-r--r-- conductor:conductor Symantec_Class_3_Secure_Server_CA.crt --rw-r--r-- conductor:conductor imacculate.client.research.att.com.crt -``` - -When running conductor services as ``root``, consider these existing Ubuntu filesystem locations for SSL/TLS files: - -**Certificate** files (``crt`` extension) are typically stored in ``/etc/ssl/certs`` with ``root:root`` ownership and 644 permissions. - -**Private Certificate Key** files (``key`` extension) are typically stored in ``/etc/ssl/private`` with ``root:root`` ownership and 640 permissions. - -**Certificate Authority (CA) Bundles** (``crt`` extension) are typically stored in ``/usr/share/ca-certificates/conductor`` with ``root:root`` ownership, and 644 permissions. These Bundle files are then symlinked within ``/etc/ssl/certs`` using equivalent filenames, a ``pem`` extension, and ``root:root`` ownership. - -**NOTE**: LUKS (Linux Unified Key Setup) is not supported by Conductor at this time. - -### Configuration - -Configuration files are located in ``etc/conductor`` relative to the python environment Conductor is installed in. - -To generate a sample configuration file, change to the directory just above where ``etc/conductor`` is located (e.g., `/` for the default environment, or the virtual environment root directory). Then: - -```bash -$ oslo-config-generator --config-file=etc/conductor/conductor-config-generator.conf -``` - -This will generate ``etc/conductor/conductor.conf.sample``. - -Because the configuration directory and files will include credentials, consider removing world permissions: - -```bash -$ find etc/conductor -type f -exec chmod 640 {} + -$ find etc/conductor -type d -exec chmod 750 {} + -``` - -The sample config may then be copied and edited. Be sure to backup any previous ``conductor.conf`` if necessary. - -```bash -$ cd etc/conductor -$ cp -p conductor.conf.sample conductor.conf -``` - -``conductor.conf`` is fully annotated with descriptions of all options. Defaults are included, with all options commented out. Conductor will use defaults even if an option is not present in the file. To change an option, simply uncomment it and edit its value. - -With the exception of the ``DEFAULT`` section, it's best to restart the Conductor services after making any config changes. In some cases, only one particular service actually needs to be restarted. When in doubt, however, it's best to restart all of them. - -A few options in particular warrant special attention: - -``` -[DEFAULT] - -# If set to true, the logging level will be set to DEBUG instead of the default -# INFO level. (boolean value) -# Note: This option can be changed without restarting. -#debug = false -``` - -For more verbose logging across all Conductor services, set ``debug`` to true. - -``` -[aai] - -# Base URL for A&AI, up to and not including the version, and without a -# trailing slash. (string value) -#server_url = https://controller:8443/aai - -# SSL/TLS certificate file in pem format. This certificate must be registered -# with the A&AI endpoint. (string value) -#certificate_file = certificate.pem - -# Private Certificate Key file in pem format. (string value) -#certificate_key_file = certificate_key.pem - -# Certificate Authority Bundle file in pem format. Must contain the appropriate -# trust chain for the Certificate file. (string value) -#certificate_authority_bundle_file = certificate_authority_bundle.pem -``` - -Set ``server_url`` to the A&AI server URL, to but not including the version, omitting any trailing slash. Conductor supports A&AI API v9 at a minimum. - -Set the ``certificate`` prefixed keys to the appropriate SSL/TLS-related files. - -**IMPORTANT**: The A&AI server may have a mismatched host/domain name and SSL/TLS certificate. In such cases, certificate verification will fail. To mitigate this, ``certificate_authority_bundle_file`` may be set to an empty value. While Conductor normally requires a CA Bundle (otherwise why bother using SSL/TLS), this requirement has been temporarily relaxed so that development and testing may continue. - -``` -[messaging_server] - -# Log debug messages. Default value is False. (boolean value) -#debug = false -``` - -When the ``DEFAULT`` section's ``debug`` option is ``true``, set this section's ``debug`` option to ``true`` to enable detailed Conductor-side RPC-over-Music debug messages. - -Be aware, it is voluminous. "You have been warned." ``:)`` - -``` -[music_api] - -# List of hostnames (round-robin access) (list value) -#hostnames = localhost - -# Log debug messages. Default value is False. (boolean value) -#debug = false -``` - -Set ``hostnames`` to match wherever the Music REST API is being hosted (wherever Apache Tomcat and ``MUSIC.war`` are located). - -When the ``DEFAULT`` section's ``debug`` option is ``true``, set this section's ``debug`` option to ``true`` to enable detailed Conductor-side MUSIC API debug messages. - -The previous comment around the volume of log lines applies even more so here. (Srsly. We're not kidding.) - -**IMPORTANT**: Conductor does not presently use Music's atomic consistency features due to concern around lock creation/acquisition. Instead, Conductor uses eventual consistency. For this reason, consistency issues may occur when using Music in a multi-server, High Availability configuration. - -``` -[sdnc] - -# Base URL for SDN-C. (string value) -#server_url = https://controller:8443/restconf - -# Basic Authentication Username (string value) -#username = <None> - -# Basic Authentication Password (string value) -#password = <None> - -``` - -Set ``server_url`` to the SDN-C server URL, omitting any trailing slash. - -Set ``username`` and ``password`` to the appropriate values as directed by SDN-C. - -### Running for the First Time - -Each Conductor component may be run interactively. In this case, the user does not necessarily matter. - -When running interactively, it is suggested to run each command in a separate terminal session and in the following order: - -```bash -conductor-data --config-file=/etc/conductor/conductor.conf -conductor-controller --config-file=/etc/conductor/conductor.conf -conductor-solver --config-file=/etc/conductor/conductor.conf -conductor-reservation --config-file=/etc/conductor/conductor.conf -conductor-api --port=8091 -- --config-file=/etc/conductor/conductor.conf -``` - -Optionally, use an application like [screen](http://packages.ubuntu.com/trusty/screen) to nest all five terminal sessions within one detachable session. (This is also the same package used by [DevStack](https://docs.openstack.org/developer/devstack/).) - -To verify that ``conductor-api`` can be reached, browse to ``http://HOST:8091/``, where HOST is the hostname ``conductor-api`` is running on. No AuthN/AuthZ is required at this time. Depending on network considerations, it may be necessary to use a command like ``wget`` instead of a desktop browser. - -The response should look similar to: - -```json -{ - "versions": { - "values": [ - { - "status": "development", - "updated": "2016-11-01T00:00:00Z", - "media-types": [ - { - "base": "application/json", - "type": "application/vnd.ecomp.homing-v1+json" - } - ], - "id": "v1", - "links": [ - { - "href": "http://127.0.0.1:8091/v1", - "rel": "self" - }, - { - "href": "http://conductor.research.att.com/", - "type": "text/html", - "rel": "describedby" - } - ] - } - ] - } -} -``` - -### Sample API Calls and Homing Templates - -A [Postman](http://getpostman.com/) collection illustrating sample requests is available upon request. The collection will also be added in a future revision. - -[Sample homing templates](/doc/examples/README.md) are also available. - -### Ubuntu Service Scripts - -Ubuntu sysvinit (init.d) and upstart (init) scripts are typically installed at the Ubuntu package level. Since there is no such packaging at this time, example scripts have been provided in the repository. - -To install, place all Conductor [sysvinit scripts](/examples/distribution/ubuntu/init.d) in ``/etc/init.d``, and all [upstart scripts](/examples/distribution/ubuntu/init) in ``/etc/init``. - -Set file permissions: - -```bash -$ sudo chmod 644 /etc/init/conductor* -$ sudo chmod 755 /etc/init.d/conductor* -``` - -If a python virtual environment is being used, edit each ``/etc/init/conductor*`` and ``/etc/init.d/conductor*`` prefixed file so that ``PYTHON_HOME`` is set to the python virtual environment root directory. - -Next, enable the scripts: - -```bash -$ sudo update-rc.d conductor-api defaults -$ sudo update-rc.d conductor-controller defaults -$ sudo update-rc.d conductor-data defaults -$ sudo update-rc.d conductor-solver defaults -$ sudo update-rc.d conductor-reservation defaults -$ sudo initctl reload-configuration -``` - -Conductor components may now be started/stopped like any other Ubuntu service, for example: - -```bash -$ sudo service conductor-api start -$ sudo service conductor-api status -$ sudo service conductor-api restart -$ sudo service conductor-api stop -``` - -Conductor service scripts automatically create directories for ``log``, ``lock``, ``run``, ``lib``, and ``log`` files, e.g., ``/var/log/conductor`` and so on. - -### Log File Rotation - -Sample ``logrotate.d`` configuration files have been provided in the repository. - -To install, place all Conductor [logrotate files](/examples/distribution/ubuntu/logrotate.d) in ``/etc/logrotate.d``. - -Set file ownership and permissions: - -```bash -$ sudo chown root:root /etc/logrotate.d/conductor* -$ sudo chmod 644 /etc/logrotate.d/conductor* -``` - -``logrotate.d`` automatically recognizes new files at the next log rotation opportunity and does not require restarting. - -## Running conductor-api Under apache2 httpd and mod_wsgi - -Sample configuration files have been provided in the repository. - -These instructions presume a ``conductor`` user exists. See the **Service Scripts** section for details. - -First, set up a few directories: - -```bash -$ sudo mkdir -p /var/www/conductor -$ sudo mkdir /var/log/apache2/conductor -``` - -To install, place the Conductor [WSGI application file](/conductor/api/app.wsgi) in ``/var/www/conductor``. - -Set the owner/group of both directories/files to ``conductor``: - -```bash -$ sudo chown -R conductor:conductor /var/log/apache2/conductor /var/www/conductor -``` - -Next, place the Conductor [apache2 httpd site config file](/examples/apache2/conductor.conf) in ``/etc/apache2/sites-available``. - -Set the owner/group to ``root``: - -```bash -$ sudo chown -R root:root /etc/apache2/sites-available/conductor.conf -``` - -If Conductor was installed in a python virtual environment, append ``python-home=VENV`` to ``WSGIDaemonProcess``, where ``VENV`` is the python virtual environment root directory. - -**IMPORTANT**: Before proceeding, disable the ``conductor-api`` sysvinit and upstart services, as the REST API will now be handled by apache2 httpd. Otherwise there will be a port conflict, and you will be sad. - -Enable the Conductor site, ensure the configuration syntax is valid, and gracefully restart apache2 httpd. - -```bash -$ sudo a2ensite conductor -$ sudo apachectl -t -Syntax OK -$ sudo apachectl graceful -``` - -To disable the Conductor site, run ``sudo a2dissite conductor``, then gracefully restart once again. Optionally, re-enable the ``conductor-api`` sysvinit and upstart services. - -## Running conductor-api Under nginx and uWSGI - -Sample configuration files have been provided in the repository. - -These instructions presume a ``conductor`` user exists. See the **Service Scripts** section for details. - -To install, place the Conductor [nginx config files](/examples/nginx/) and [WSGI application file](/conductor/api/app.wsgi) in ``/etc/nginx`` (taking care to backup any prior configuration files). It may be desirable to incorporate Conductor's ``nginx.conf`` into the existing config. - -Rename ``app.wsgi`` to ``conductor.wsgi``: - -```bash -$ cd /etc/nginx -$ sudo mv app.wsgi conductor.wsgi -``` - -In ``nginx.conf``, set ``CONDUCTOR_API_FQDN`` to the server name. - -**IMPORTANT**: Before proceeding, disable the ``conductor-api`` sysvinit and upstart services, as the REST API will now be handled by nginx. Otherwise there will be a port conflict, and you will be sad. - -Restart nginx: - -```bash -$ sudo service nginx restart -``` - -Then, run ``conductor-api`` under nginx using uWSGI: - -```bash -$ sudo uwsgi -s /tmp/uwsgi.sock --chmod-socket=777 --wsgi-file /etc/nginx/conductor.wsgi --callable application --set port=8091 -``` - -To use a python virtual environment, add ``--venv VENV`` to the ``uwsgi`` command, where ``VENV`` is the python virtual environment root directory. - -## Uninstallation - -Activate a virtual environment (venv) first, if necessary, then uninstall with: - -```bash -$ pip uninstall ecomp-conductor -``` - -Remove any previously made configuration file changes, user accounts, Ubuntu/SWM packages, and other settings as needed. - -## Bug Reporting and Feedback - -... is encouraged. Please raise an issue at: https://jira.onap.org/projects/OPTFRA/summary diff --git a/conductor/doc/examples/README.md b/conductor/doc/examples/README.md deleted file mode 100644 index 84e7e6b..0000000 --- a/conductor/doc/examples/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# Example Conductor Templates - -*Updated: 10 Oct 2017* - -## Example 1 - -```yaml - -# Homing Specification Version -homing_template_version: 2017-10-10 - -# Runtime order Parameters -parameters: - service_name: Residential vCPE - service_id: vcpe_service_id - customer_lat: 32.897480 - customer_long: -97.040443 - -# List of geographical locations -locations: - customer_loc: - latitude: {get_param: customer_lat} - longitude: {get_param: customer_long} - -# List of VNFs (demands) to be homed -demands: - vGMuxInfra: - - inventory_provider: aai - inventory_type: service - attributes: - equipment_type: vG_Mux - customer_id: some_company - excluded_candidates: - - candidate_id: - 1ac71fb8-ad43-4e16-9459-c3f372b8236d - existing_placement: - - candidate_id: 21d5f3e8-e714-4383-8f99-cc480144505a - vG: - - inventory_provider: aai - inventory_type: service - attributes: - equipment_type: vG - modelId: vG_model_id - customer_id: some_company - excluded_candidates: - - candidate_id: 1ac71fb8-ad43-4e16-9459-c3f372b8236d - existing_placement: - - candidate_id: 21d5f3e8-e714-4383-8f99-cc480144505a - - inventory_provider: aai - inventory_type: cloud - -# List of homing policies (constraints) -constraints: - # distance constraint - - constraint_vgmux_customer: - type: distance_to_location - demands: [vGMuxInfra] - properties: - distance: <Â 100Â km - location: customer_loc - # cloud region co-location constraint - - colocation: - type: zone - demands: [vGMuxInfra, vG] - properties: - qualifier: same - category: region - # platform capability constraint - - numa_cpu_pin_capabilities: - type: attribute - demands: [vG] - properties: - evaluate: - vcpu_pinning: True - numa_topology: numa_spanning - # cloud provider constraint - - cloud_version_capabilities: - type: attribute - demands: [vGMuxInfra] - properties: - evaluate: - cloud_version: 1.11.84 - cloud_provider: AWS - -# Objective function to minimize -optimization: - minimize: - sum: - - {distance_between: [customer_loc, vGMuxInfra]} - - {distance_between: [customer_loc, vG]} - -``` - -## Contact ## - -Shankar Narayanan <shankarpnsn@gmail.com> diff --git a/conductor/doc/glossary/README.md b/conductor/doc/glossary/README.md deleted file mode 100644 index 5b673ac..0000000 --- a/conductor/doc/glossary/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Glossary - -| Term | Description | -|------|-------------| -| **A&AI** | Active and Available Inventory | -| **Cloud** | tbd | -| **Conductor** | The AIC/ECOMP Homing service. | -| **Constraint** | tbd | -| **Cost Function** | tbd | -| **Data Center** | tbd | -| **DCAE** | Data Collection, Analytics, and Events | -| **Demand** | tbd | -| **Homing** | Canonical service name for Conductor. | -| **Host** | tbd | -| **Inventory** | tbd | -| **Inventory Source** | tbd | -| **LCP (and vLCP)** | Local Control Plane (or virtual LCP). Synonymous with **Region**. | -| **Location** | tbd | -| **Network Link** | tbd | -| **Region** | Synonymous with **LCP**. | -| **Service Inventory** | tbd | -| **Site** | tbd | - -## Contact ## - -Joe D'Andrea <jdandrea@research.att.com> diff --git a/conductor/doc/template/README.md b/conductor/doc/template/README.md deleted file mode 100644 index a2a60bf..0000000 --- a/conductor/doc/template/README.md +++ /dev/null @@ -1,1259 +0,0 @@ -###### Apache License, Version 2.0 - -=========================== - -``Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.`` - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - -# Homing Specification Guide - -*Updated: 10 October 2017* - -This document describes the Homing Template format, used by the Homing service. It is a work in progress and subject to frequent revision. - -## Template Structure - -Homing templates are defined in YAML and follow the structure outlined below. - -```yaml -homing_template_version: 2017-10-10 -parameters: - PARAMETER_DICT -locations: - LOCATION_DICT -demands: - DEMAND_DICT -constraints: - CONSTRAINT_DICT -reservations: - RESERVATION_DICT -optimization: - OPTIMIZATION -``` - -* ``homing_template_version``: This key with value 2017-10-10 (or a later date) indicates that the YAML document is a Homing template of the specified version. -* ``parameters``: This section allows for specifying input parameters that have to be provided when instantiating the homing template. Typically, this section is used for providing runtime parameters (like SLA thresholds), which in turn is used in the existing homing policies. The section is optional and can be omitted when no input is required. -* ``locations``: This section contains the declaration of geographic locations. This section is optional and can be omitted when no input is required. -* ``demands``: This section contains the declaration of demands. This section with at least one demand should be defined in any Homing template, or the template would not really do anything when being instantiated. -* ``constraints``: This section contains the declaration of constraints. The section is optional and can be omitted when no input is required. -* ``reservations``: This section contains the declaration of required reservations. This section is optional and can be omitted when reservations are not required. -* ``optimization``: This section allows the declaration of an optimization. This section is optional and can be omitted when no input is required. - -## Homing Template Version - -The value of ``homing_template_version`` tells HAS not only the format of the template but also features that will be validated and supported. Only one value is supported: ``2017-10-10`` in the initial release of HAS. - -```yaml -homing_template_version: 2017-10-10 -``` - -## Parameters - -The **parameters** section allows for specifying input parameters that have to be provided when instantiating the template. Such parameters are typically used for providing runtime inputs (like SLA thresholds), which in turn is used in the existing homing policies. This also helps build reusable homing constraints where these parameters can be embedded design time, and it corresponding values can be supplied during runtime. - -Each parameter is specified with the name followed by its value. Values can be strings, lists, or dictionaries. - -### Example - -In this example, ``provider_name`` is a string and ``service_info`` is a dictionary containing both a string and a list (keyed by ``base_url`` and ``nod_config``, respectively). - -```yaml -parameters: - provider_name: multicloud - service_info: - base_url: http://serviceprovider.sdngc.com/ - nod_config: - - http://nod/config_a.yaml - - http://nod/config_b.yaml - - http://nod/config_c.yaml - - http://nod/config_d.yaml -``` - -A parameter can be referenced in place of any value. See the **Intrinsic Functions** section for more details. - -## Locations - -One or more **locations** may be declared. A location may be referenced by one or more ``constraints``. Locations may be defined in any of the following ways: - -### Coordinate - -A geographic coordinate expressed as a latitude and longitude. - -| Key | Value | -|-----------------------------|----------------------------| -| ``latitude`` | Latitude of the location. | -| ``longitude`` | Longitude of the location. | - -### Host Name - -An opaque host name that can be translated to a coordinate via an inventory provider (e.g., A&AI). - -| Key | Value | -|-----------------------------|----------------------------| -| ``host_name`` | Host name identifying a location. | - -### CLLI - -Common Language Location Identification (CLLI) code(https://en.wikipedia.org/wiki/CLLI_code). - -| Key | Value | -|-----------------------------|----------------------------| -| ``clli_code`` | 8 character CLLI. | - -**Questions** - -* Do we need functions that can convert one of these to the other? E.g., CLLI Codes to a latitude/longitude - -### Placemark - -An address expressed in geographic region-agnostic terms (referred to as a *placemark*). - -*Support for this schema is deferred.* - -| Key | Value | -|-----------------------------|----------------------------| -| ``iso_country_code`` | The abbreviated country name associated with the placemark. | -| ``postal_code`` | The postal code associated with the placemark. | -| ``administrative_area`` | The state or province associated with the placemark. | -| ``sub_administrative_area`` | Additional administrative area information for the placemark. | -| ``locality`` | The city associated with the placemark. | -| ``sub_locality`` | Additional city-level information for the placemark. | -| ``thoroughfare`` | The street address associated with the placemark. | -| ``sub_thoroughfare`` | Additional street-level information for the placemark. | - -**Questions** - -* What geocoder can we use to convert placemarks to a latitude/longitude? - -### Examples - -The following examples illustrate a location expressed in coordinate, host_name, CLLI, and placemark, respectively. - -```yaml -locations: - location_using_coordinates: - latitude: 32.897480 - longitude: -97.040443 - - host_location_using_host_name: - host_name: USESTCDLLSTX55ANZ123 - - location_using_clli: - clli_code: DLLSTX55 - - location_using_placemark: - sub_thoroughfare: 1 - thoroughfare: ATT Way - locality: Bedminster - administrative_area: NJ - postal_code: 07921-2694 -``` - -## Demands - -A **demand** can be satisfied by using candidates drawn from inventories. Each demand is uniquely named. Inventory is considered to be opaque and can represent anything from which candidates can be drawn. - -A demand's resource requirements are determined by asking an **inventory provider** for one or more sets of **inventory candidates** against which the demand will be made. An explicit set of candidates may also be declared, for example, if the only candidates for a demand are predetermined. - -Demand criteria is dependent upon the inventory provider in use. - -**Provider-agnostic Schema** - -| Key | Value | -|------------------------|--------------------------| -| ``inventory_provider`` | A HAS-supported inventory provider. | -| ``inventory_type`` | The reserved word ``cloud`` (for cloud regions) or the reserved word ``service`` (for existing service instances). Exactly one inventory type may be specified. | -| ``attributes`` (Optional) | A list of key-value pairs, that is used to select inventory candidates that match *all* the specified attributes. The key should be a uniquely identifiable attribute at the inventory provider. | -| ``service_type`` (Optional) | If ``inventory_type`` is ``service``, a list of one or more provider-defined service types. If only one service type is specified, it may appear without list markers (``[]``). | -| ``service_id`` (Optional) | If ``inventory_type`` is ``service``, a list of one or more provider-defined service ids. If only one service id is specified, it may appear without list markers (``[]``). | -| ``default_cost`` (Optional) | The default cost of an inventory candidate, expressed as currency. This must be specified if the inventory provider may not always return a cost. | -| ``required_candidates`` (Optional) | A list of one or more candidates from which a solution will be explored. Must be a valid candidate as described in the **candidate schema**. | -| ``excluded_candidates`` (Optional) | A list of one or more candidates that should be excluded from the search space. Must be a valid candidate as described in the **candidate schema**. | -| ``existing_placement`` (Optional) | The current placement for the demand. Must be a valid candidate as described in the **candidate schema**. | - - -### Examples - -The following example helps understand a demand specification using Active & Available Inventory (A&AI), the inventory provider-of-record for ONAP. - -**Inventory Provider Criteria** - -| Key | Value | -|------------------------|--------------------------| -| ``inventory_provider`` | Examples: ``aai``, ``multicloud``. | -| ``inventory_type`` | The reserved word ``cloud`` (for new inventory) or the reserved word ``service`` (for existing inventory). Exactly one inventory type may be specified. | -| ``attributes`` (Optional) | A list of key-value pairs to match against inventory when drawing candidates. | -| ``service_type`` (Optional) | Examples may include ``vG``, ``vG_MuxInfra``, etc. | -| ``service_id`` (Optional) | Must be a valid service id. Examples may include ``vCPE``, ``VoLTE``, etc. | -| ``default_cost`` (Optional) | The default cost of an inventory candidate, expressed as a unitless number. | -| ``required_candidates`` (Optional) | A list of one or more valid candidates. See **Candidate Schema** for details. | -| ``excluded_candidates`` (Optional) | A list of one or more valid candidates. See **Candidate Schema** for details. | -| ``existing_placement`` (Optional) | A single valid candidate, representing the current placement for the demand. See **candidate schema** for details. | - -**Candidate Schema** - -The following is the schema for a valid ``candidate``: -* ``candidate_id`` uniquely identifies a candidate. Currently, it is either a Service Instance ID or Cloud Region ID. -* ``candidate_type`` identifies the type of the candidate. Currently, it is either ``cloud`` or ``service``. -* ``inventory_type`` is defined as described in **Inventory Provider Criteria** (above). -* ``inventory_provider`` identifies the inventory from which the candidate was drawn. -* ``host_id`` is an ID of a specific host (used only when referring to service/existing inventory). -* ``cost`` is expressed as a unitless number. -* ``location_id`` is always a location ID of the specified location type (e.g., for a type of ``cloud`` this will be an Cloud Region ID). -* ``location_type`` is an inventory provider supported location type. -* ``latitude`` is a valid latitude corresponding to the *location_id*. -* ``longitude`` is a valid longitude corresponding to the *location_id*. -* ``city`` (Optional) city corresponding to the *location_id*. -* ``state`` (Optional) state corresponding to the *location_id*. -* ``country`` (Optional) country corresponding to the *location_id*. -* ``region`` (Optional) geographic region corresponding to the *location_id*. -* ``complex_name`` (Optional) Name of the complex corresponding to the *location_id*. -* ``cloud_owner`` (Optional) refers to the *cloud owner* (e.g., ``azure``, ``aws``, ``att``, etc.). -* ``cloud_region_version`` (Optional) is an inventory provider supported version of the cloud region. -* ``physical_location_id`` (Optional) is an inventory provider supported CLLI code corresponding to the cloud region. - -**Examples** - -**``Service Candidate``** -```json -{ - "candidate_id": "1ac71fb8-ad43-4e16-9459-c3f372b8236d", - "candidate_type": "service", - "inventory_type": "service", - "inventory_provider": "aai", - "host_id": "vnf_123456", - "cost": "100", - "location_id": "DLLSTX9A", - "location_type": "azure", - "latitude": "32.897480", - "longitude": "-97.040443", - "city": "Dallas", - "state": "TX", - "country": "USA", - "region": "US", - "complex_name": "dalls_one", - "cloud_owner": "att-aic", - "cloud_region_version": "1.1", - "physical_location_id": "DLLSTX9A" -} -``` -**``Cloud Candidate``** -```json -{ - "candidate_id": "NYCNY55", - "candidate_type": "cloud", - "inventory_type": "cloud", - "inventory_provider": "aai", - "cost": "100", - "location_id": "NYCNY55", - "location_type": "azure", - "latitude": "40.7128", - "longitude": "-74.0060", - "city": "New York", - "state": "NY", - "country": "USA", - "region": "US", - "complex_name": "ny_one", - "cloud_owner": "att-aic", - "cloud_region_version": "1.1", - "physical_location_id": "NYCNY55", - "flavors": { - "flavor":[ - { - "flavor-id":"9cf8220b-4d96-4c30-a426-2e9382f3fff2", - "flavor-name":"flavor-numa-cpu-topology-instruction-set", - "flavor-vcpus":64, - "flavor-ram":65536, - "flavor-disk":1048576, - "flavor-ephemeral":128, - "flavor-swap":"0", - "flavor-is-public":false, - "flavor-selflink":"pXtX", - "flavor-disabled":false, - "hpa-capabilities":{ - "hpa-capability":[ - { - "hpa-capability-id":"01a4bfe1-1993-4fda-bd1c-ef333b4f76a9", - "hpa-feature":"cpuInstructionSetExtensions", - "hpa-version":"v1", - "architecture":"Intel64", - "resource-version":"1521306560982", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"instructionSetExtensions", - "hpa-attribute-value":"{\"value\":{['AAA', 'BBB', 'CCC', 'DDD']}}", - "resource-version":"1521306560989" - } - ] - }, - { - "hpa-capability-id":"167ad6a2-7d9c-4bf2-9a1b-30e5311b8c66", - "hpa-feature":"numa", - "hpa-version":"v1", - "architecture":"generic", - "resource-version":"1521306561020", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"numaCpu-1", - "hpa-attribute-value":"{\"value\":4}", - "resource-version":"1521306561060" - }, - { - "hpa-attribute-key":"numaNodes", - "hpa-attribute-value":"{\"value\":2}", - "resource-version":"1521306561088" - }, - { - "hpa-attribute-key":"numaCpu-0", - "hpa-attribute-value":"{\"value\":2}", - "resource-version":"1521306561028" - }, - { - "hpa-attribute-key":"numaMem-0", - "hpa-attribute-value":"{\"value\":2, \"unit\":\"GB\" }", - "resource-version":"1521306561044" - }, - { - "hpa-attribute-key":"numaMem-1", - "hpa-attribute-value":"{\"value\":4, \"unit\":\"GB\" }", - "resource-version":"1521306561074" - } - ] - }, - { - "hpa-capability-id":"13ec6d4d-7fee-48d8-9e4a-c598feb101ed", - "hpa-feature":"basicCapabilities", - "hpa-version":"v1", - "architecture":"generic", - "resource-version":"1521306560909", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"numVirtualCpu", - "hpa-attribute-value":"{\"value\":64}", - "resource-version":"1521306560932" - }, - { - "hpa-attribute-key":"virtualMemSize", - "hpa-attribute-value":"{\"value\":65536, \"unit\":\"MB\" }", - "resource-version":"1521306560954" - } - ] - }, - { - "hpa-capability-id":"8fa22e64-41b4-471f-96ad-6c4708635e4c", - "hpa-feature":"cpuTopology", - "hpa-version":"v1", - "architecture":"generic", - "resource-version":"1521306561109", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"numCpuCores", - "hpa-attribute-value":"{\"value\":8}", - "resource-version":"1521306561114" - }, - { - "hpa-attribute-key":"numCpuThreads", - "hpa-attribute-value":"{\"value\":8}", - "resource-version":"1521306561138" - }, - { - "hpa-attribute-key":"numCpuSockets", - "hpa-attribute-value":"{\"value\":6}", - "resource-version":"1521306561126" - } - ] - } - ] - }, - "resource-version":"1521306560203" - }, - { - "flavor-id":"f5aa2b2e-3206-41b6-80d5-cf041b098c43", - "flavor-name":"flavor-cpu-pinning-ovsdpdk-instruction-set", - "flavor-vcpus":32, - "flavor-ram":131072, - "flavor-disk":2097152, - "flavor-ephemeral":128, - "flavor-swap":"0", - "flavor-is-public":false, - "flavor-selflink":"pXtX", - "flavor-disabled":false, - "hpa-capabilities":{ - "hpa-capability":[ - { - "hpa-capability-id":"4d04f4d8-e257-4442-8417-19a525e56096", - "hpa-feature":"cpuInstructionSetExtensions", - "hpa-version":"v1", - "architecture":"generic", - "resource-version":"1521306561223", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"instructionSetExtensions", - "hpa-attribute-value":"{\"value\":{['A11', 'B22']}}", - "resource-version":"1521306561228" - } - ] - }, - { - "hpa-capability-id":"8d36a8fe-bfee-446a-bbcb-881ee66c8f78", - "hpa-feature":"ovsDpdk", - "hpa-version":"v1", - "architecture":"generic", - "resource-version":"1521306561170", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"dataProcessingAccelerationLibrary", - "hpa-attribute-value":"{\"value\":\"v18.02\"}", - "resource-version":"1521306561175" - } - ] - }, - { - "hpa-capability-id":"c140c945-1532-4908-86c9-d7f71416f1dd", - "hpa-feature":"cpuPinning", - "hpa-version":"v1", - "architecture":"generic", - "resource-version":"1521306561191", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"logicalCpuPinningPolicy", - "hpa-attribute-value":"{\"value\":\"dedicated\"}", - "resource-version":"1521306561196" - }, - { - "hpa-attribute-key":"logicalCpuThreadPinningPolicy", - "hpa-attribute-value":"{value:\"prefer\"}", - "resource-version":"1521306561206" - } - ] - }, - { - "hpa-capability-id":"4565615b-1077-4bb5-a340-c5be48db2aaa", - "hpa-feature":"basicCapabilities", - "hpa-version":"v1", - "architecture":"generic", - "resource-version":"1521306561244", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"numVirtualCpu", - "hpa-attribute-value":"{\"value\":32}", - "resource-version":"1521306561259" - }, - { - "hpa-attribute-key":"virtualMemSize", - "hpa-attribute-value":"{\"value\":131072, \"unit\":\"MB\" }", - "resource-version":"1521306561248" - } - ] - } - ] - }, - "resource-version":"1521306561164" - } - ] - } -} -``` -**Questions** -* Currently, candidates are either service instances or cloud regions. As new services are on-boarded, this can be evolved to represent different types of resources. - -**Examples** - -The following examples illustrate two demands: - -* ``vGMuxInfra``: A vGMuxInfra service, drawing candidates of type *service* from the inventory. Only candidates that match the customer_id and orchestration-status will be included in the search space. -* ``vG``: A vG, drawing candidates of type *service* and *cloud* from the inventory. Only candidates that match the customer_id and provisioning-status will be included in the search space. - - -```yaml -demands: - vGMuxInfra: - - inventory_provider: aai - inventory_type: service - attributes: - equipment_type: vG_Mux - customer_id: some_company - orchestration-status: Activated - model-id: 174e371e-f514-4913-a93d-ed7e7f8fbdca - model-version: 2.0 - vG: - - inventory_provider: aai - inventory_type: service - attributes: - equipment_type: vG - customer_id: some_company - provisioning-status: provisioned - - inventory_provider: aai - inventory_type: cloud -``` - -**Questions** -* Do we need to support cost as a function ? - -## Constraints - -A **Constraint** is used to *eliminate* inventory candidates from one or more demands that do not meet the requirements specified by the constraint. Since reusability is one of the cornerstones of HAS, Constraints are designed to be service-agnostic, and is parameterized such that it can be reused across a wide range of services. Further, HAS is designed with a plug-in architecture that facilitates easy addition of new constraint types. - -Constraints are denoted by a ``constraints`` key. Each constraint is uniquely named and set to a dictionary containing a constraint type, a list of demands to apply the constraint to, and a dictionary of constraint properties. - -**Considerations while using multiple constraints** -* Constraints should be treated as a unordered list, and no assumptions should be made as regards to the order in which the constraints are evaluated for any given demand. -* All constraints are effectively AND-ed together. Constructs such as "Constraint X OR Y" are unsupported. -* Constraints are reducing in nature, and does not increase the available candidates at any point during the constraint evaluations. - - -**Schema** - -| Key | Value | -|---------------------|-------------| -| ``CONSTRAINT_NAME`` | Key is a unique name. | -| ``type`` | The type of constraint. See **Constraint Types** for a list of currently supported values. | -| ``demands`` | One or more previously declared demands. If only one demand is specified, it may appear without list markers (``[]``). | -| ``properties`` (Optional) | Properties particular to the specified constraint type. Use if required by the constraint. | - -```yaml -constraints: - CONSTRAINT_NAME_1: - type: CONSTRAINT_TYPE - demands: DEMAND_NAME | [DEMAND_NAME_1, DEMAND_NAME_2, ...] - properties: PROPERTY_DICT - - CONSTRAINT_NAME_2: - type: CONSTRAINT_TYPE - demands: DEMAND_NAME | [DEMAND_NAME_1, DEMAND_NAME_2, ...] - properties: PROPERTY_DICT - - ... -``` - -#### Constraint Types - -| Type | Description | -|---------------------|-------------| -| ``attribute`` | Constraint that matches the specified list of Attributes. | -| ``distance_between_demands`` | Geographic distance constraint between each pair of a list of demands. | -| ``distance_to_location`` | Geographic distance constraint between each of a list of demands and a specific location. | -| ``instance_fit`` | Constraint that ensures available capacity in an existing service instance for an incoming demand. | -| ``inventory_group`` | Constraint that enforces two or more demands are satisfied using candidates from a pre-established group in the inventory. | -| ``region_fit`` | Constraint that ensures available capacity in an existing cloud region for an incoming demand. | -| ``zone`` | Constraint that enforces co-location/diversity at the granularities of clouds/regions/availability-zones. | -| ``hpa`` | Constraint that recommends cloud region with an optimal flavor based on required HPA capabilities for an incoming demand. | -| ``vim_fit`` | Constraint that checks if the incoming demand fits the VIM instance. | -| ``license`` (Deferred) | License availability constraint. | -| ``network_between_demands`` (Deferred) | Network constraint between each pair of a list of demands. | -| ``network_to_location`` (Deferred) | Network constraint between each of a list of demands and a specific location/address. | - -*Note: Constraint names marked "Deferred" **will not** be supported in the initial release of HAS.* - -#### Threshold Values - -Constraint property values representing a threshold may be an integer or floating point number, optionally prefixed with a comparison operator: ``=``, ``<``, ``>``, ``<=``, or ``>=``. The default is ``=`` and optionally suffixed with a unit. - -Whitespace may appear between the comparison operator and value, and between the value and units. When a range values is specified (e.g., ``10-20 km``), the comparison operator is omitted. - -Each property is documented with a default unit. The following units are supported: - -| Unit | Values | Default | -|------------|------------------------------|----------| -| Currency | ``USD`` | ``USD`` | -| Time | ``ms``, ``sec`` | ``ms`` | -| Distance | ``km``, ``mi`` | ``km`` | -| Throughput | ``Kbps``, ``Mbps``, ``Gbps`` | ``Mbps`` | - -### Attribute - -Constrain one or more demands by one or more attributes, expressed as properties. Attributes are mapped to the **inventory provider** specified properties, referenced by the demands. For example, properties could be hardware capabilities provided by the platform (flavor, CPU-Pinning, NUMA), features supported by the services, etc. - -**Schema** - -| Property | Value | -|--------------|-------------------------------------------------------------| -| ``evaluate`` | Opaque dictionary of attribute name and value pairs. Values must be strings or numbers. Encoded and sent to the service provider via a plugin. | - -*Note: Attribute values are not detected/parsed as thresholds by the Homing framework. Such interpretations and evaluations are inventory provider-specific and delegated to the corresponding plugin* - -```yaml -constraints: - sriov_nj: - type: attribute - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - evaluate: - cloud_version: 1.1 - flavor: SRIOV - subdivision: US-TX - vcpu_pinning: True - numa_topology: numa_spanning -``` - -#### Proposal: Evaluation Operators - -To assist in evaluating attributes, the following operators and notation are proposed: - -| Operator | Name | Operand | -|--------------|-----------|------------------------------------------------| -| ``eq`` | ``==`` | Any object (string, number, list, dict) | -| ``ne`` | ``!=`` | | -| ``lt`` | ``<`` | A number (strings are converted to float) | -| ``gt`` | ``>`` | | -| ``lte`` | ``<=`` | | -| ``gte`` | ``>=`` | | -| ``any`` | ``Any`` | A list of objects (string, number, list, dict) | -| ``all`` | ``All`` | | -| ``regex`` | ``RegEx`` | A regular expression pattern | - -Example usage: - -```yaml -constraints: - sriov_nj: - type: attribute - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - evaluate: - cloud_version: {gt: 1.0} - flavor: {regex: /^SRIOV$/i} - subdivision: {any: [US-TX, US-NY, US-CA]} -``` - -### Distance Between Demands - -Constrain each pairwise combination of two or more demands by distance requirements. - -**Schema** - -| Name | Value | -|--------------|-------------------------------------------------------------| -| ``distance`` | Distance between demands, measured by the geographic path. | - -The constraint is applied between each pairwise combination of demands. For this reason, at least two demands must be specified, implicitly or explicitly. - -```yaml -constraints: - distance_vnf1_vnf2: - type: distance_between_demands - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - distance: < 250 km -``` - -### Distance To Location - -Constrain one or more demands by distance requirements relative to a specific location. - -**Schema** - -| Property | Value | -|--------------|------------------------------------------------------------| -| ``distance`` | Distance between demands, measured by the geographic path. | -| ``location`` | A previously declared location. | - -The constraint is applied between each demand and the referenced location, not across all pairwise combinations of Demands. - -```yaml -constraints: - distance_vnf1_loc: - type: distance_to_location - demands: [my_vnf_demand, my_other_vnf_demand, another_vnf_demand] - properties: - distance: < 250 km - location: LOCATION_ID -``` - -### Instance Fit - -Constrain each demand by its service requirements. - -Requirements are sent as a request to a **service controller**. Service controllers are defined by plugins in Homing (e.g., ``sdn-c``). - -A service controller plugin knows how to communicate with a particular endpoint (via HTTP/REST, DMaaP, etc.), obtain necessary information, and make a decision. The endpoint and credentials can be configured through plugin settings. - -**Schema** - -| Property | Description | -|----------------|-----------------------------------| -| ``controller`` | Name of a service controller. | -| ``request`` | Opaque dictionary of key/value pairs. Values must be strings or numbers. Encoded and sent to the service provider via a plugin. | - -```yaml -constraints: - check_for_availability: - type: instance_fit - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - controller: sdn-c - request: REQUEST_DICT -``` - -### Region Fit - -Constrain each demand's inventory candidates based on inventory provider membership. - -Requirements are sent as a request to a **service controller**. Service controllers are defined by plugins in Homing (e.g., ``sdn-c``). - -A service controller plugin knows how to communicate with a particular endpoint (via HTTP/REST, DMaaP, etc.), obtain necessary information, and make a decision. The endpoint and credentials can be configured through plugin settings. - -**Schema** - -| Property | Description | -|----------------|-----------------------------------| -| ``controller`` | Name of a service controller. | -| ``request`` | Opaque dictionary of key/value pairs. Values must be strings or numbers. Encoded and sent to the service provider via a plugin. | - -```yaml -constraints: - check_for_membership: - type: region_fit - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - controller: sdn-c - request: REQUEST_DICT -``` -### Zone - -Constrain two or more demands such that each is located in the same or different zone category. - -Zone categories are inventory provider-defined, based on the demands being constrained. - -**Schema** - -| Property | Value | -|---------------|-------------------------------------------------------------| -| ``qualifier`` | Zone qualifier. One of ``same`` or ``different``. | -| ``category`` | Zone category. One of ``disaster``, ``region``, ``complex``, ``time``, or ``maintenance``. | - -For example, to place two demands in different disaster zones: - -```yaml -constraints: - vnf_diversity: - type: zone - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - qualifier: different - category: disaster -``` - -Or, to place two demands in the same region: - -```yaml -constraints: - vnf_affinity: - type: zone - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - qualifier: same - category: region -``` - -**Notes** - -* These categories could be any of the following: ``disaster_zone``, ``region``, ``complex``, ``time_zone``, and ``maintenance_zone``. Really, we are talking affinity/anti-affinity at the level of DCs, but these terms may cause confusion with affinity/anti-affinity in OpenStack. - -### HPA - -Constrain each demand's inventory candidates based on cloud regions' Hardware platform capabilities (HPA) - -Requirements mapped to the inventory provider specified properties, referenced by the demands. For example, properties could be hardware capabilities provided by the platform through flavors or cloud-region eg:(CPU-Pinning, NUMA), features supported by the services, etc. - -**Schema** - -| Property | Value | -|---------------|-------------------------------------------------------------| -| ``evaluate`` | List of flavorLabel, flavorProperties of each VM of the VNF demand. | - -```yaml -constraints: - hpa_constraint: - type: hpa - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - evaluate: - - [ List of {flavorLabel : {flavor label name}, - flavorProperties: HPACapability DICT} ] -HPACapability DICT : - hpa-feature: basicCapabilities - hpa-version: v1 - architecture: generic - hpa-feature-attributes: - - HPAFEATUREATTRIBUTES LIST - -HPAFEATUREATTRIBUTES LIST: - hpa-attribute-key: String - hpa-attribute-value: String - operator: One of OPERATOR - unit: String -OPERATOR : ['=', '<', '>', '<=', '>=', 'ALL'] -``` - -**Example** -```json -{ - "hpa_constraint":{ - "type":"hpa", - "demands":[ - "vG" - ], - "properties":{ - "evaluate":[ - { - "flavorLabel":"flavor_label_1", - "flavorProperties":[ - { - "hpa-feature":"basicCapabilities", - "hpa-version":"v1", - "architecture":"generic", - "mandatory": "True", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"numVirtualCpu", - "hpa-attribute-value":"32", - "operator":"=" - }, - { - "hpa-attribute-key":"virtualMemSize", - "hpa-attribute-value":"64", - "operator":"=", - "unit":"GB" - } - ] - }, - { - "hpa-feature":"ovsDpdk", - "hpa-version":"v1", - "architecture":"generic", - "mandatory": "False", - "score": "10", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"dataProcessingAccelerationLibrary", - "hpa-attribute-value":"v18.02", - "operator":"=" - } - ] - } - ] - }, - { - "flavorLabel":"flavor_label_2", - "flavorProperties":[ - { - "hpa-feature":"basicCapabilities", - "hpa-version":"v1", - "architecture":"generic", - "mandatory": "False", - "score": "5", - "hpa-feature-attributes":[ - { - "hpa-attribute-key":"numVirtualCpu", - "hpa-attribute-value":"8", - "operator":">=" - }, - { - "hpa-attribute-key":"virtualMemSize", - "hpa-attribute-value":"16", - "operator":">=", - "unit":"GB" - } - ] - } - ] - } - ] - } - } -} -``` - -### VIM Fit - -Constrain each demand's inventory candidates based on capacity check for available capacity at the VIM instances. - -Requirements are sent as an opaque request object understood by the VIM controllers or MultiCloud. Each controller is defined and implemented as a plugin in Conductor. - -A vim controller plugin knows how to communicate with a particular endpoint (via HTTP/REST, DMaaP, etc.), obtain necessary information, and make a decision. The endpoint and credentials can be configured through plugin settings. - -**Schema** - -| Property | Value | -|---------------|-------------------------------------------------------------| -| ``controller``| Name of a vim controller. (e.g., multicloud) | -| ``request`` | Opaque dictionary of key/value pairs. Values must be strings or numbers. Encoded and sent to the vim controller via a plugin. | - -For example, to place two demands in different disaster zones: - -```yaml -constraints: - check_cloud_capacity: - type: vim_fit - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - controller: multicloud - request: REQUEST_DICT -``` - -**Notes** - -* For ONAP Beijing release the REQUEST_DICT is of the following format as defined by the policy for vim_fit. The REQUEST_DICT is an opaque request object defined through policy, so it is not restricted to this format. In ONAP Beijing release MultiCloud supports the check_vim_capacity using the following grammar. - ```json - { - "request":{ - "vCPU":10, - "Memory":{ - "quantity":{ - "get_param":"REQUIRED_MEM" - }, - "unit":"GB" - }, - "Storage":{ - "quantity":{ - "get_param":"REQUIRED_DISK" - }, - "unit":"GB" - } - } - } - ``` - -### Inventory Group - -Constrain demands such that inventory items are grouped across two demands. - -This constraint has no properties. - -```yaml -constraints: - my_group: - type: inventory_group - demands: [demand_1, demand_2] -``` - -*Note: Only pair-wise groups are supported at this time. If three or more demands are specified, only the first two will be used.* - -### License - -Constrain demands according to license availability. - -*Support for this constraint is deferred.* - -**Schema** - -| Property | Value | -|----------|----------------------------------------------------------| -| ``id`` | Unique license identifier | -| ``key`` | Opaque license key, particular to the license identifier | - -```yaml -constraints: - my_software: - type: license - demands: [demand_1, demand_2, ...] - properties: - id: SOFTWARE_ID - key: LICENSE_KEY -``` - -### Network Between Demands - -Constrain each pairwise combination of two or more demands by network requirements. - -*Support for this constraint is deferred.* - -**Schema** - -| Property | Value | -|--------------------------|-----------------------------------------------------------------| -| ``bandwidth`` (Optional) | Desired network bandwidth. | -| ``distance`` (Optional) | Desired distance between demands, measured by the network path. | -| ``latency`` (Optional) | Desired network latency. | - -Any combination of ``bandwidth``, ``distance``, or ``latency`` must be specified. If none of these properties are used, it is treated as a malformed request. - -The constraint is applied between each pairwise combination of demands. For this reason, at least two demands must be specified, implicitly or explicitly. - -```yaml -constraints: - network_requirements: - type: network_between_demands - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - bandwidth: >= 1000 Mbps - distance: < 250 km - latency: < 50 ms -``` - -### Network To Location - -Constrain one or more demands by network requirements relative to a specific location. - -*Support for this constraint is deferred.* - -**Schema** - -| Property | Value | -|---------------|-----------------------------------------------------------------| -| ``bandwidth`` | Desired network bandwidth. | -| ``distance`` | Desired distance between demands, measured by the network path. | -| ``latency`` | Desired network latency. | -| ``location`` | A previously declared location. | - -Any combination of ``bandwidth``, ``distance``, or ``latency`` must be specified. If none of these properties are used, it is treated as a malformed request. - -The constraint is applied between each demand and the referenced location, not across all pairwise combinations of Demands. - -```yaml -constraints: - my_access_network_constraint: - type: network_to_location - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - bandwidth: >= 1000 Mbps - distance: < 250 km - latency: < 50 ms - location: LOCATION_ID -``` -### Capabilities - -Constrain each demand by its cluster capability requirements. For example, as described by an OpenStack Heat template and operational environment. - -*Support for this constraint is deferred.* - -**Schema** - -| Property | Value | -|--------------|-------------------------------------------------------------| -| ``specification`` | Indicates the kind of specification being provided in the properties. Must be ``heat``. Future values may include ``tosca``, ``Homing``, etc. | -| ``template`` | For specifications of type ``heat``, a single stack in OpenStack Heat Orchestration Template (HOT) format. Stacks may be expressed as a URI reference or a string of well-formed YAML/JSON. Templates are validated by the Heat service configured for use by HAS. Nested stack references are unsupported. | -| ``environment`` (Optional) | For specifications of type ``heat``, an optional Heat environment. Environments may be expressed as a URI reference or a string of well-formed YAML/JSON. Environments are validated by the Heat service configured for use by Homing. | - -```yaml -constraints: - check_for_fit: - type: capability - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - specification: heat - template: http://repository/my/stack_template - environment: http://repository/my/stack_environment -``` - - -## Reservations - -A **Reservation** allows reservation of resources associated with candidate that satisfies one or more demands. - -Similar to the *instance_fit* constraint, requirements are sent as a request to a **service controller** that handles the reservation. Service controllers are defined by plugins in Homing (e.g., ``sdn-c``). - -The service controller plugin knows how to make a reservation (and initiate rollback on a failure) with a particular endpoint (via HTTP/REST, DMaaP, etc.) of the service controller. The endpoint and credentials can be configured through plugin settings. - -**Schema** - -| Property | Description | -|----------------|-----------------------------------| -| ``controller`` | Name of a service controller. | -| ``request`` | Opaque dictionary of key/value pairs. Values must be strings or numbers. Encoded and sent to the service provider via a plugin. | - - -```yaml -resource_reservation: - type: instance_reservation - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - controller: sdn-c - request: REQUEST_DICT -``` - -## Optimizations - -An **Optimization** allows specification of a objective function, which aims to maximize or minimize a certain value that varies based on the choice of candidates for one or more demands that are a part of the objective function. For example, an objective function may be to find the *closest* cloud-region to a customer to home a demand. - -### Optimization Components - -Optimization definitions can be broken down into three components: - -| Component | Key | Value | -|-----------|----------------------|---------------------------------------------------------| -| Goal | ``minimize`` | A single Operand (usually ``sum``) or Function | -| Operator | ``sum``, ``product`` | Two or more Operands (Numbers, Operators, Functions) | -| Function | ``distance_between`` | A two-element list consisting of a location and demand. | - - -### Example - -Given a customer location ``cl``, two demands ``vG1`` and ``vG2``, and weights ``w1`` and ``w2``, the optimization criteria can be expressed as: - -``minimize(weight1 * distance_between(cl, vG1) + weight2 * distance_between(cl, vG2))`` - -This can be read as: "Minimize the sum of weighted distances from cl to vG1 and from cl to vG2." - -Such optimizations may be expressed in a template as follows: - -```yaml -parameters: - w1: 10 - w2: 20 - -optimization: - minimize: - sum: - - product: - - {get_param: w1} - - {distance_between: [cl, vG1]} - - product: - - {get_param: w2} - - {distance_between: [cl, vG2]} -``` - -Or without the weights as: - -```yaml -optimization: - minimize: - sum: - - {distance_between: [cl, vG1]} - - {distance_between: [cl, vG2]} -``` - -**Template Restriction** - -While the template format supports any number of arrangements of numbers, operators, and functions, HAS's solver presently expects a very specific arrangement. - -Until further notice: - -* Optimizations must conform to a single goal of ``minimize`` followed by a ``sum`` operator. -* The sum can consist of two ``distance_between`` function calls, or two ``product`` operators. -* If a ``product`` operator is present, it must contain at least a ``distance_between`` function call, plus one optional number to be used for weighting. -* Numbers may be referenced via ``get_param``. -* The objective function has to be written in the sum-of-product format. In the future, HAS can convert product-of-sum into sum-of-product automatically. - -The first two examples in this section illustrate both of these use cases. - -**Inline Operations** - -If desired, operations can be rewritten inline. For example, the two ``product`` operations from the previous example can also be expressed as: - -```yaml -parameters: - w1: 10 - w2: 20 - -optimization: - minimize: - sum: - - {product: [{get_param: w1}, {distance_between: [cl, vG1]}]} - - {product: [{get_param: w2}, {distance_between: [cl, vG2]}]} -``` - -In turn, even the ``sum`` operation can be rewritten inline, however there is a point of diminishing returns in terms of readability! - -**Notes** - -* In the first version, we do not support more than one dimension in the optimization (e.g., Minimize distance and cost). For supporting multiple dimensions we would need a function the normalize the unit across dimensions. - -## Intrinsic Functions - -Homing provides a set of intrinsic functions that can be used inside templates to perform specific tasks. The following section describes the role and syntax of the intrinsic functions. - -Functions are written as a dictionary with one key/value pair. The key is the function name. The value is a list of arguments. If only one argument is provided, a string may be used instead. - -```yaml -a_property: {FUNCTION_NAME: [ARGUMENT_LIST]} - -a_property: {FUNCTION_NAME: ARGUMENT_STRING} -``` - -*Note: These functions can only be used within "properties" sections.* - -### get_file - -The ``get_file`` function inserts the content of a file into the template. It is generally used as a file inclusion mechanism for files containing templates from other services (e.g., Heat). - -The syntax of the ``get_file`` function is: - -```yaml -{get_file: <content key>} -``` - -The ``content`` key is used to look up the ``files`` dictionary that is provided in the REST API call. The Homing client command (``Homing``) is ``get_file`` aware and populates the ``files`` dictionary with the actual content of fetched paths and URLs. The Homing client command supports relative paths and transforms these to the absolute URLs required by the Homing API. - -**Note**: The ``get_file`` argument must be a static path or URL and not rely on intrinsic functions like ``get_param``. The Homing client does not process intrinsic functions. They are only processed by the Homing engine. - -The example below demonstrates the ``get_file`` function usage with both relative and absolute URLs: - -```yaml -constraints: - check_for_fit: - type: capacity - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - template: {get_file: stack_template.yaml} - environment: {get_file: http://hostname/environment.yaml} -``` - -The ``files`` dictionary generated by the Homing client during instantiation of the plan would contain the following keys. Each value would be of that file's contents. - -* ``file:///path/to/stack_template.yaml`` -* ``http://hostname/environment.yaml`` - -**Questions** - -* If Homing will only be accessed over DMaaP, files will need to be embedded using the Homing API request format. - -### get_param - -The ``get_param`` function references an input parameter of a template. It resolves to the value provided for this input parameter at runtime. - -The syntax of the ``get_param`` function is: - -```yaml -{get_param: <parameter name>} - -{get_param: [<parameter name>, <key/index1> (optional), <key/index2> (optional), ...]} -``` - -**parameter name** is the parameter name to be resolved. If the parameters returns a complex data structure such as a list or a dict, then subsequent keys or indices can be specified. These additional parameters are used to navigate the data structure to return the desired value. Indices are zero-based. - -The following example demonstrates how the ``get_param`` function is used: - -```yaml -parameters: - software_id: SOFTWARE_ID - license_key: LICENSE_KEY - service_info: - provider: dmaap:///full.topic.name - costs: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] - -constraints: - my_software: - type: license - demands: [demand_1, demand_2, ...] - properties: - id: {get_param: software_id} - key: {get_param: license_key} - - check_for_availability: - type: service - demands: [my_vnf_demand, my_other_vnf_demand] - properties: - provider_url: {get_param: [service_info, provider]} - request: REQUEST_DICT - cost: {get_param: [service_info, costs, 4]} -``` - -In this example, properties would be set as follows: - -| Key | Value | -|------------------|--------------------------| -| ``id`` | SOFTWARE_ID | -| ``key`` | LICENSE_KEY | -| ``provider_url`` | dmaap:///full.topic.name | -| ``cost`` | 50 | - -## Contact ## - -Shankar Narayanan <shankarpnsn@gmail.com> diff --git a/conductor/setup.cfg b/conductor/setup.cfg index 5c87a2c..af691c7 100644 --- a/conductor/setup.cfg +++ b/conductor/setup.cfg @@ -20,7 +20,6 @@ [metadata] name = of-has summary = ONAP Homing Service -description-file = README.rst author = AT&T author-email = ikram@research.att.com home-page = https://wiki.onap.org/pages/viewpage.action?pageId=16005528 |