From dc0b8a7349225066f0e8e55c8decc0049696b21f Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Fri, 8 Jul 2022 14:52:31 +0000 Subject: CDS blueprint and blueprint's resource template resources Add 2 more resources: - CDS blueprint - CDS blueprint's resource template Both added into 1.1 schema Change the version into 0.7.0 Issue-ID: INT-2134 Signed-off-by: Michal Jagiello Change-Id: I4dfb343f233922a2f8a524dc135f7eec051e69aa --- onap_data_provider/resources/blueprint_resource.py | 42 + .../resources/cds_resource_template.py | 64 ++ onap_data_provider/resources/resource_creator.py | 12 +- onap_data_provider/schemas/infra_1_1.schema | 65 ++ requirements.txt | 2 +- samples/blueprint.yaml | 29 + samples/cba-dd.json | 1210 ++++++++++++++++++++ samples/resource-template-data.json | 4 + setup.py | 4 +- 9 files changed, 1428 insertions(+), 4 deletions(-) create mode 100644 onap_data_provider/resources/blueprint_resource.py create mode 100644 onap_data_provider/resources/cds_resource_template.py create mode 100644 samples/blueprint.yaml create mode 100644 samples/cba-dd.json create mode 100644 samples/resource-template-data.json diff --git a/onap_data_provider/resources/blueprint_resource.py b/onap_data_provider/resources/blueprint_resource.py new file mode 100644 index 0000000..e57694a --- /dev/null +++ b/onap_data_provider/resources/blueprint_resource.py @@ -0,0 +1,42 @@ +"""Blueprint resource module.""" +""" + Copyright 2022 Deutsche Telekom AG + + 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. +""" + +import logging +from typing import Any, Dict +from onapsdk.cds import Blueprint, BlueprintModel # type: ignore + +from onapsdk.exceptions import FileError, ResourceNotFound # type: ignore +from onap_data_provider.resources.resource import Resource + + +class BlueprintResource(Resource): + + def __init__(self, data: Dict[str, Any]) -> None: + super().__init__(data) + + self._blueprint: Blueprint = None + self._blueprint_model: BlueprintModel = None + + def create(self) -> None: + enriched_blueprint: Blueprint = self.blueprint.enrich() + enriched_blueprint.publish() + + @property + def blueprint(self) -> Blueprint: + if not self._blueprint: + self._blueprint = Blueprint.load_from_file(self.data["blueprint-file-path"]) + return self._blueprint diff --git a/onap_data_provider/resources/cds_resource_template.py b/onap_data_provider/resources/cds_resource_template.py new file mode 100644 index 0000000..5233707 --- /dev/null +++ b/onap_data_provider/resources/cds_resource_template.py @@ -0,0 +1,64 @@ +"""Customer resource module.""" +""" + Copyright 2022 Deutsche Telekom AG + + 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. +""" + +import logging +from typing import Any, Dict +from onapsdk.cds import Blueprint, BlueprintModel # type: ignore + +from onapsdk.exceptions import ResourceNotFound # type: ignore +from onap_data_provider.resources.resource import Resource + + +class BlueprintResourceTemplateResource(Resource): + + def __init__(self, data: Dict[str, Any]) -> None: + super().__init__(data) + + self._blueprint: Blueprint = None + self._blueprint_model: BlueprintModel = None + + def create(self) -> None: + if self.blueprint: + if (data_to_store := self.data.get("data")) is None: + with open(self.data["data-file"], "r") as data_file: + data_to_store = data_file.read().encode("utf-8") + self.blueprint.store_resolved_template( + artifact_name=self.data["artifact-name"], + data=data_to_store, + resolution_key=self.data.get("resolution-key"), + resource_type=self.data.get("resource-type"), + resource_id=self.data.get("resource-id") + ) + + @property + def blueprint_model(self) -> BlueprintModel: + if not self._blueprint_model: + try: + self._blueprint_model = BlueprintModel.get_by_name_and_version( + blueprint_name=self.data["blueprint-name"], + blueprint_version=self.data["blueprint-version"] + ) + except ResourceNotFound: + logging.error(f"No blueprint with {self.data['blueprint-name']} name and {self.data['blueprint-version']} version") + return None + return self._blueprint_model + + @property + def blueprint(self) -> Blueprint: + if self.blueprint_model and not self._blueprint: + self._blueprint = self.blueprint_model.get_blueprint() + return self._blueprint diff --git a/onap_data_provider/resources/resource_creator.py b/onap_data_provider/resources/resource_creator.py index de9ee9b..c6ed4d8 100644 --- a/onap_data_provider/resources/resource_creator.py +++ b/onap_data_provider/resources/resource_creator.py @@ -22,9 +22,12 @@ import typing from abc import ABC from .aai_service_resource import AaiServiceResource +from .blueprint_resource import BlueprintResource +from .cds_resource_template import BlueprintResourceTemplateResource from .cloud_region_resource import CloudRegionResource from .complex_resource import ComplexResource from .customer_resource import CustomerResource +from .data_dictionary_resource import DataDictionarySetResource from .line_of_business_resource import LineOfBusinessResource from .msb_k8s_definition import MsbK8SDefinitionResource from .owning_entity_resource import OwningEntityResource @@ -38,7 +41,6 @@ from .service_instance_resource import ( from .vendor_resource import VendorResource from .vnf_resource import VnfResource from .vsp_resource import VspResource -from .data_dictionary_resource import DataDictionarySetResource from ..versions import VersionsEnum if typing.TYPE_CHECKING: @@ -134,6 +136,12 @@ class ResourceCreator(ABC): VersionsEnum.V1_0: DataDictionarySetResource, VersionsEnum.V1_1: DataDictionarySetResource, }, + "blueprint": { + VersionsEnum.V1_1: BlueprintResource, + }, + "blueprint-resource-template": { + VersionsEnum.V1_1: BlueprintResourceTemplateResource, + } } @classmethod @@ -164,6 +172,8 @@ class ResourceCreator(ABC): - owning-entity: OwningEntityResource - msb-k8s-definition: MsbK8SDefinitionResource - data-dictionaries: DataDictionarySetResource + - blueprints: BlueprintResource + - blueprint-resource-template: BlueprintResourceTemplateResource Args: resource_type (str): Resource type to create diff --git a/onap_data_provider/schemas/infra_1_1.schema b/onap_data_provider/schemas/infra_1_1.schema index c5cde66..9135569 100644 --- a/onap_data_provider/schemas/infra_1_1.schema +++ b/onap_data_provider/schemas/infra_1_1.schema @@ -612,3 +612,68 @@ properties: - file-path required: - data-dictionaries + blueprints: + type: array + items: + - type: object + properties: + blueprint: + type: object + properites: + blueprint-file-path: + type: string + required: + - blueprint-file-path + required: + - blueprint + blueprint-resource-templates: + type: array + items: + - type: object + properties: + blueprint-resource-template: + type: object + properties: + blueprint-name: + type: string + blueprint-version: + type: string + artifact-name: + type: string + resolution-key: + type: string + resource-type: + type: string + resource-id: + type: string + data: + type: string + data-file: + type: string + anyOf: + - required: + - blueprint-name + - blueprint-version + - artifact-name + - resolution-key + - data + - required: + - blueprint-name + - blueprint-version + - artifact-name + - resource-type + - resource-id + - data + - required: + - blueprint-name + - blueprint-version + - artifact-name + - resolution-key + - data-file + - required: + - blueprint-name + - blueprint-version + - artifact-name + - resource-type + - resource-id + - data-file diff --git a/requirements.txt b/requirements.txt index 1b75fb7..b06f7c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -onapsdk==10.0.1 +onapsdk==10.1.0 PyYAML~=5.4.1 jsonschema==4.4.0 diff --git a/samples/blueprint.yaml b/samples/blueprint.yaml new file mode 100644 index 0000000..8e0c59f --- /dev/null +++ b/samples/blueprint.yaml @@ -0,0 +1,29 @@ +# Blueprint sample +odpSchemaVersion: 1.1 +resources: + data-dictionaries-sets: + - data-dictionaries: + file-path: cba-dd.json + blueprints: + - blueprint: + blueprint-file-path: BASIC_VM_enriched.zip + blueprint-resource-templates: + - blueprint-resource-template: + blueprint-name: ubuntu20 + blueprint-version: 1.0.0 + artifact-name: test-dp + resolution-key: test-resolution-key + data: "{\"test\": \"me\"}" + - blueprint-resource-template: + blueprint-name: ubuntu20 + blueprint-version: 1.0.0 + artifact-name: test-dp + resource-type: test-resource-type + resource-id: test-resource-id + data: "{\"test\": \"me\"}" + - blueprint-resource-template: + blueprint-name: ubuntu20 + blueprint-version: 1.0.0 + artifact-name: test-dp + resolution-key: test-resolution-key-from-file + data-file: resource-template-data.json diff --git a/samples/cba-dd.json b/samples/cba-dd.json new file mode 100644 index 0000000..e9288ba --- /dev/null +++ b/samples/cba-dd.json @@ -0,0 +1,1210 @@ +[ + { + "name": "active-streams", + "tags": "active-streams", + "data_type": "string", + "description": "active-streams", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "active-streams", + "name": "active-streams", + "property": { + "description": "active-streams", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } + }, + { + "name": "aic-cloud-region", + "tags": "aic-cloud-region", + "data_type": "string", + "description": "aic-cloud-region", + "entry_schema": "string", + "updatedBy": "Singal, Kapil ", + "definition": { + "tags": "aic-cloud-region", + "name": "aic-cloud-region", + "property": { + "description": "aic-cloud-region", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil ", + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + } + }, + { + "name": "dcae_collector_ip", + "tags": "dcae_collector_ip", + "data_type": "string", + "description": "dcae_collector_ip", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "dcae_collector_ip", + "name": "dcae_collector_ip", + "property": { + "description": "dcae_collector_ip", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/dcae_collector_ip", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "dcae_collector_ip": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "dcae_collector_port", + "tags": "dcae_collector_port", + "data_type": "string", + "description": "dcae_collector_port", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "dcae_collector_port", + "name": "dcae_collector_port", + "property": { + "description": "dcae_collector_port", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/dcae_collector_port", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "dcae_collector_port": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "demo_artifacts_version", + "tags": "demo_artifacts_version", + "data_type": "string", + "description": "demo_artifacts_version", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "demo_artifacts_version", + "name": "demo_artifacts_version", + "property": { + "description": "demo_artifacts_version", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/demo_artifacts_version", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "demo_artifacts_version": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "int_private1_net_cidr", + "tags": "int_private1_net_cidr", + "data_type": "string", + "description": "int_private1_net_cidr", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "int_private1_net_cidr", + "name": "int_private1_net_cidr", + "property": { + "description": "int_private1_net_cidr", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/int_private1_net_cidr", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "int_private1_net_cidr": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private1\"", + "input-key-mapping": {}, + "output-key-mapping": { + "int_private1_net_cidr": "prefix" + } + } + } + } + } + }, + { + "name": "int_private2_net_cidr", + "tags": "int_private2_net_cidr", + "data_type": "string", + "description": "int_private2_net_cidr", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "int_private2_net_cidr", + "name": "int_private2_net_cidr", + "property": { + "description": "int_private2_net_cidr", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private2\"", + "output-key-mapping": { + "int_private2_net_cidr": "prefix" + }, + "input-key-mapping": {} + } + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/int_private2_net_cidr", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "int_private2_net_cidr": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "k8s-rb-profile-name", + "tags": "k8s, cnf, profile, k8s-rb-profile-name", + "data_type": "string", + "description": "Profile name used in multicloud/k8s plugin to identify Helm chart(s) where this mapping is providing override values.", + "entry_schema": "string", + "updatedBy": "Samuli, Silvius ", + "definition": { + "tags": "k8s, cnf, profile, k8s-rb-profile-name", + "name": "k8s-rb-profile-name", + "property": { + "description": "Profile name used in multicloud/k8s plugin to identify Helm chart(s) where this mapping is providing override values.", + "type": "string" + }, + "group": "default", + "updated-by": "Samuli, Silvius ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/k8s-rb-profile-name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "k8s-rb-profile-name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "k8s-rb-instance-release-name", + "tags": "k8s, cnf, profile, k8s-rb-instance-release-name", + "data_type": "string", + "description": "Name of the release for the helm package instance in k8s", + "entry_schema": "string", + "updatedBy": "Rajewski, Lukasz ", + "definition": { + "tags": "k8s, cnf, profile, k8s-rb-instance-release-name", + "name": "k8s-rb-instance-release-name", + "property": { + "description": "Name of the release for the helm package instance in k8s", + "type": "string" + }, + "group": "default", + "updated-by": "Rajewski, Lukasz ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } + }, + { + "name": "k8s-rb-profile-namespace", + "tags": "k8s, cnf, profile, namespace, k8s-rb-profile-namespace", + "data_type": "string", + "description": "Profile name used in multicloud/k8s plugin", + "entry_schema": "string", + "updatedBy": "Samuli, Silvius ", + "definition": { + "tags": "k8s, cnf, profile, namespace, k8s-rb-profile-namespace", + "name": "k8s-rb-profile-namespace", + "property": { + "description": "Profile name used in multicloud/k8s plugin", + "type": "string" + }, + "group": "default", + "updated-by": "Samuli, Silvius ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/k8s-rb-profile-namespace", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "k8s-rb-profile-namespace": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "management-prefix-id", + "tags": "management-prefix-id", + "data_type": "string", + "description": "management-prefix-id", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "management-prefix-id", + "name": "management-prefix-id", + "property": { + "description": "management-prefix-id", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/management-prefix-id", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "management-prefix-id": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"management\"", + "input-key-mapping": {}, + "output-key-mapping": { + "management-prefix-id": "prefix_id" + } + } + } + } + } + }, + { + "name": "onap_private_net_cidr", + "tags": "onap_private_net_cidr", + "data_type": "string", + "description": "onap_private_net_cidr", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "onap_private_net_cidr", + "name": "onap_private_net_cidr", + "property": { + "description": "onap_private_net_cidr", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"management\"", + "input-key-mapping": {}, + "output-key-mapping": { + "onap_private_net_cidr": "prefix" + } + } + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/onap_private_net_cidr", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "onap_private_net_cidr": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "private1-prefix-id", + "tags": "private1-prefix-id", + "data_type": "string", + "description": "private1-prefix-id", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "private1-prefix-id", + "name": "private1-prefix-id", + "property": { + "description": "private1-prefix-id", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/private1-prefix-id", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "private1-prefix-id": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private1\"", + "input-key-mapping": {}, + "output-key-mapping": { + "private1-prefix-id": "prefix_id" + } + } + } + } + } + }, + { + "name": "private2-prefix-id", + "tags": "private2-prefix-id", + "data_type": "string", + "description": "private2-prefix-id", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "private2-prefix-id", + "name": "private2-prefix-id", + "property": { + "description": "private2-prefix-id", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/private2-prefix-id", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "private2-prefix-id": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private2\"", + "input-key-mapping": {}, + "output-key-mapping": { + "private2-prefix-id": "prefix_id" + } + } + } + } + } + }, + { + "name": "put-active-streams", + "tags": "put-active-streams", + "data_type": "string", + "description": "put-active-streams", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "put-active-streams", + "name": "put-active-streams", + "property": { + "description": "put-active-streams", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "PUT", + "type": "JSON", + "url-path": "$vpg_onap_private_ip_0:8183/restconf/config/stream-count:stream-count/streams", + "path": "/param/0/value", + "input-key-mapping": { + "vpg_onap_private_ip_0": "vpg_onap_private_ip_0", + "active-streams": "active-streams" + }, + "output-key-mapping": {}, + "key-dependencies": [ + "vpg_onap_private_ip_0", + "active-streams" + ], + "endpoint-selector": "vpkg-rest-api", + "payload": "{\"streams\": {\"active-streams\": $active-streams}}" + } + } + } + } + }, + { + "name": "service-instance-id", + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "data_type": "string", + "description": "To be provided", + "entry_schema": "string", + "updatedBy": "Singal, Kapil ", + "definition": { + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "name": "service-instance-id", + "property": { + "description": "To be provided", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil ", + "sources": { + "input": { + "type": "source-input", + "properties": {} + }, + "any-db": { + "type": "source-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": {}, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": {}, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "capability": { + "type": "source-capability", + "properties": { + "script-type": "jython", + "script-class-reference": "SampleRAProcessor", + "instance-dependencies": [] + } + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id", + "path": "/service/0/service-instance-id", + "input-key-mapping": { + "service-instance-id": "service-instance.service-instance-id" + }, + "output-key-mapping": { + "service-instance-id": "service-instance-id" + }, + "key-dependencies": [ + "service-instance.service-instance-id" + ] + } + } + } + } + }, + { + "name": "vf-module-id", + "tags": "vf-module-id", + "data_type": "string", + "description": "vf-module-id", + "entry_schema": "string", + "updatedBy": "Singal, Kapil ", + "definition": { + "tags": "vf-module-id", + "name": "vf-module-id", + "property": { + "description": "vf-module-id", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil ", + "sources": { + "input": { + "type": "source-input", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vf-modules/vf-module/$vf-module-id", + "path": "/vf-module/0/vf-module-id", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id", + "vf-module-id": "vf-module.vf-module-id" + }, + "output-key-mapping": { + "vf-module-id": "vf-module-id" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id", + "vf-module.vf-module-id" + ] + } + } + } + } + }, + { + "name": "vf-module-label", + "tags": "vf-module-label", + "data_type": "string", + "description": "vf-module-label", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "vf-module-label", + "name": "vf-module-label", + "property": { + "description": "vf-module-label", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", + "input-key-mapping": { + "customizationid": "vf-module-model-customization-uuid" + }, + "output-key-mapping": { + "vf-module-label": "vf_module_label" + }, + "key-dependencies": [ + "vf-module-model-customization-uuid" + ] + } + } + } + } + }, + { + "name": "vf-module-model-customization-uuid", + "tags": "vf-module-model-customization-uuid", + "data_type": "string", + "description": "vf-module-model-customization-uuid", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "vf-module-model-customization-uuid", + "name": "vf-module-model-customization-uuid", + "property": { + "description": "vf-module-model-customization-uuid", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } + }, + { + "name": "vf-module-model-invariant-uuid", + "tags": "vnf, vf-module", + "data_type": "string", + "description": "vf module model invariant uuid", + "entry_schema": "string", + "updatedBy": "Samuli, Silvius ", + "definition": { + "tags": "vnf, vf-module", + "name": "vf-module-model-invariant-uuid", + "property": { + "description": "vf module model invariant uuid", + "type": "string" + }, + "group": "default", + "updated-by": "Samuli, Silvius ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODULE_MODEL.invariant_uuid as vf_module_model_invariant_uuid from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", + "input-key-mapping": { + "customizationid": "vf-module-model-customization-uuid" + }, + "output-key-mapping": { + "vf-module-model-invariant-uuid": "vf_module_model_invariant_uuid" + }, + "key-dependencies": [ + "vf-module-model-customization-uuid" + ] + } + } + } + } + }, + { + "name": "vf-module-model-version", + "tags": "vnf, vf-module", + "data_type": "string", + "description": "vf module model model version", + "entry_schema": "string", + "updatedBy": "Samuli, Silvius ", + "definition": { + "tags": "vnf, vf-module", + "name": "vf-module-model-version", + "property": { + "description": "vf module model model version", + "type": "string" + }, + "group": "default", + "updated-by": "Samuli, Silvius ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODULE_MODEL.uuid as vf_module_model_version from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid", + "input-key-mapping": { + "customizationid": "vf-module-model-customization-uuid" + }, + "output-key-mapping": { + "vf-module-model-version": "vf_module_model_version" + }, + "key-dependencies": [ + "vf-module-model-customization-uuid" + ] + } + } + } + } + }, + { + "name": "vf-naming-policy", + "tags": "vf-naming-policy", + "data_type": "string", + "description": "vf-naming-policy", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "vf-naming-policy", + "name": "vf-naming-policy", + "property": { + "description": "vf-naming-policy", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vf-naming-policy", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vf-naming-policy": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + }, + "processor-db": { + "type": "source-db", + "properties": { + "type": "SQL", + "query": "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid", + "input-key-mapping": { + "vnf_model_customization_uuid": "vnf-model-customization-uuid" + }, + "output-key-mapping": { + "vf-naming-policy": "vf_naming_policy" + }, + "key-dependencies": [ + "vnf-model-customization-uuid" + ] + } + } + } + } + }, + { + "name": "vnf-id", + "tags": "vnf-id", + "data_type": "string", + "description": "vnf-id", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "vnf-id", + "name": "vnf-id", + "property": { + "description": "vnf-id", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/", + "path": "/vnf/0/vnf-id", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "generic-vnf.vnf-id" + }, + "output-key-mapping": { + "vnf-id": "vnf-id" + }, + "key-dependencies": [ + "service-instance-id", + "generic-vnf.vnf-id" + ] + } + } + } + } + }, + { + "name": "vnf_name", + "tags": "vnf_name", + "data_type": "string", + "description": "vnf_name", + "entry_schema": "string", + "updatedBy": "MALAKOV, YURIY ", + "definition": { + "tags": "vnf_name", + "name": "vnf_name", + "property": { + "description": "vnf_name", + "type": "string" + }, + "group": "default", + "updated-by": "MALAKOV, YURIY ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + }, + { + "name": "vpg-management-port", + "tags": "vpg-management-port", + "data_type": "string", + "description": "vpg-management-port", + "entry_schema": "string", + "updatedBy": "Rajewski, Lukasz ", + "definition": { + "tags": "vpg-management-port", + "name": "vpg-management-port", + "property": { + "description": "vpg-management-port", + "type": "string" + }, + "group": "default", + "updated-by": "Rajewski, Lukasz ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + } + }, + { + "name": "vpg_onap_private_ip_0", + "tags": "vpg_onap_private_ip_0", + "data_type": "string", + "description": "vpg_onap_private_ip_0", + "entry_schema": "string", + "updatedBy": "Singal, Kapil ", + "definition": { + "tags": "vpg_onap_private_ip_0", + "name": "vpg_onap_private_ip_0", + "property": { + "description": "vpg_onap_private_ip_0", + "type": "string" + }, + "group": "default", + "updated-by": "Singal, Kapil ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vpg_onap_private_ip_0", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vpg_onap_private_ip_0": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } + } +] diff --git a/samples/resource-template-data.json b/samples/resource-template-data.json new file mode 100644 index 0000000..aa34ddc --- /dev/null +++ b/samples/resource-template-data.json @@ -0,0 +1,4 @@ +{ + "read": "from", + "file": "yolo" +} diff --git a/setup.py b/setup.py index e668ff4..cf5f193 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ with open("README.md", "r", encoding="utf-8") as readme: setuptools.setup( name="onap_data_provider", - version="0.6.0", + version="0.7.0", author="Michal Jagiello , Piotr Stanior ", description="Tool to provide data for ONAP instances", long_description=long_description, @@ -35,7 +35,7 @@ setuptools.setup( "onap-data-provider=onap_data_provider.data_provider:run", ] }, - install_requires=["onapsdk==10.0.1", "PyYAML~=5.4.1", "jsonschema==4.4.0"], + install_requires=["onapsdk==10.1.0", "PyYAML~=5.4.1", "jsonschema==4.4.0"], classifiers=[ "Development Status :: 5 - Production/Stable", "Programming Language :: Python", -- cgit 1.2.3-korg