From 3c91aeea6ef932527eb3743675bb28f393c7c1ee Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Tue, 4 Sep 2018 23:11:42 -0400 Subject: SDNC Blueprints Processor Model Service Creating SDN Controller Blueprints Processor Model Service JUnit Tests - 2 Change-Id: I871401fc661a671beaec8319cb40d10b71a4093c Issue-ID: CCSDK-516 Signed-off-by: Singal, Kapil (ks220y) --- .../src/test/resources/componentnode/default.json | 100 ++++ .../resources/dictionary/dictionary_schema.json | 261 +++++++++ .../src/test/resources/properties/convert.json | 33 ++ .../src/test/resources/properties/default.json | 16 + .../test/resources/service_templates/default.json | 622 +++++++++++++++++++++ .../ra-content-with-mising-value.json | 265 +++++++++ .../service_templates/resource_assignment.json | 407 ++++++++++++++ .../velocity/base-config-template.vtl | 1 + .../velocity/licence-template.vtl | 0 .../resources/service_templates/vrr_config.json | 171 ++++++ 10 files changed, 1876 insertions(+) create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl create mode 100644 blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json new file mode 100644 index 000000000..0129195c2 --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json @@ -0,0 +1,100 @@ +{ + "metadata": { + "author": "ks220y@att.com", + "vendor": "Juniper", + "os": "XXX", + "service-type": "AVPN", + "vnf-type": "VRR", + "action": "Base Configuration", + "sub-action": "Generate Configuration", + "service-template-name": "VRR-baseconfiguration", + "service-template-version": "1.0.0" + }, + "topology_template": { + "inputs": { + "service-instance-id": { + "required": true, + "type": "string" + }, + "vnf-id": { + "required": true, + "type": "string" + }, + "service": { + "required": true, + "type": "string" + }, + "region": { + "required": true, + "type": "string" + }, + "bundle-id": { + "required": true, + "type": "string" + }, + "bundle-mac": { + "required": true, + "type": "string" + } + }, + "node_templates": { + "generate-configuration": { + "type": "mock-component-generateConfig", + "interfaces": { + "org-onap-ccsdk-config-params-service-MockComponentNode": { + "operations": { + "process": { + "inputs": { + "entity-type": "vnf-type", + "template-content": "sample-template", + "entity-id": "{ \"get_input\" : \"vnf-id\" }" + }, + "outputs": { + "mergedData": "merged Data", + "status": "status" + } + } + } + } + } + } + } + }, + "node_types": { + "mock-component-generateConfig": { + "interfaces": { + "org-onap-ccsdk-config-params-service-MockComponentNode": { + "operations": { + "process": { + "inputs": { + "entity-type": { + "required": false, + "type": "string" + }, + "template-content": { + "required": false, + "type": "string" + }, + "entity-id": { + "required": true, + "type": "string" + } + }, + "outputs": { + "generated-config": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + } + } +} diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json b/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json new file mode 100644 index 000000000..dd297ab87 --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json @@ -0,0 +1,261 @@ +{ + "type": "object", + "properties": { + "resource-path": { + "type": "string", + "required": true + }, + "description": { + "type": "string" + }, + "updated-by": { + "type": "string" + }, + "data-type": { + "type": "string", + "required": true + }, + "sources": { + "type": "object", + "required": true, + "properties": { + "input": { + "type": "object", + "properties": { + "key": { + "type": "string" + } + } + }, + "component": { + "type": "object", + "properties": { + "name": { + "type": "string", + "required": true + }, + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "default": { + "type": "any" + }, + "aai": { + "type": "any" + }, + "mdsal": { + "type": "object", + "properties": { + "path": { + "type": "string", + "required": true + }, + "url-path": { + "type": "string", + "required": true + }, + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "type": { + "type": "string", + "required": true + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "base": { + "type": "string", + "required": true + } + } + }, + "network-resource-discovery": { + "type": "object", + "properties": { + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "db": { + "type": "object", + "properties": { + "query": { + "type": "string", + "required": true + }, + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "type": { + "type": "string", + "required": true + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "base": { + "type": "string", + "required": true + } + } + }, + "policy": { + "type": "object", + "properties": { + "input-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "output-key-mapping": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "candidate-dependency": { + "type": "object", + "properties": { + "input": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "component": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "aai": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "mdsal": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "network-resource-discovery": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "db": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "policy": { + "type": "object", + "properties": { + "names": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + }, + "tags": { + "type": "string" + }, + "default": { + "type": "any" + }, + "name": { + "type": "string", + "required": true + }, + "valid-values": { + "type": "string" + }, + "resource-type": { + "type": "string", + "required": true + }, + "sample-value": { + "type": "string" + }, + "entry-schema": { + "type": "string" + } + } +} diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json b/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json new file mode 100644 index 000000000..cb7d08e44 --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json @@ -0,0 +1,33 @@ +{ + "type": "sdnc-component-getResourceAssignment", + "interfaces": { + "ResourceAssignmentService": { + "operations": { + "getResourceAssignment": { + "inputs": { + "assignment-mappings": [ + { + "name": "service-name", + "mapping-field": "service", + "mapping-category": "SDN", + "required": true + }, + { + "name": "region-name", + "mapping-field": "region", + "mapping-category": "SDN", + "required": true + } + ], + "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }", + "prifix": "get-resource-assignment" + }, + "outputs": { + "resource-assignment-status": "success", + "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }" + } + } + } + } + } +} diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json new file mode 100644 index 000000000..335a68759 --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json @@ -0,0 +1,16 @@ +{ + "default": "{ \"get_input\" : \"loopback-default\" }", + "domain": "ethernet", + "criteria": [ + { + "value": "dummy301me1", + "type": "complex", + "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name" + }, + { + "value": "{ \"get_input\" : \"host-ip-address\" }", + "type": "simple", + "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name" + } + ] +} diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json new file mode 100644 index 000000000..a2fc77541 --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json @@ -0,0 +1,622 @@ +{ + "tosca_definitions_version": "sdn_config_1_0_0", + "metadata": { + "author": "ks220y@att.com", + "service-template-name": "VRR-baseconfiguration", + "service-template-version": "1.0.0", + "release": "1802", + "service-type": "AVPN", + "vnf-type": "VRR" + }, + "topology_template": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "node_templates": { + "base-config-template": { + "type": "artifact-config-template", + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "capabilities": { + "content": { + "properties": { + "content": "db://base-config-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input" + }, + { + "name": "group-name", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "group-name", + "dictionary-source": "input" + } + ] + } + } + } + }, + "licence-template": { + "type": "artifact-config-template", + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "capabilities": { + "content": { + "properties": { + "content": "db://licence-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "bundle-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "bundle-id", + "dictionary-source": "input" + }, + { + "name": "bundle-mac", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "bundle-mac", + "dictionary-source": "input" + } + ] + } + } + } + }, + "resource-assignment-action": { + "type": "dg-resource-assignment", + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + + } + } + } + }, + "capabilities": { + "dg-node": { + + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "resource-assignment", + "relationship": "tosca.relationships.DependsOn" + } + } + }, + "config-generator-action": { + "type": "dg-config-generator", + "interfaces": { + "CONFIG": { + "operations": { + "GenerateConfiguration": { + + } + } + } + }, + "capabilities": { + "dg-node": { + + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "generate-configuration", + "relationship": "tosca.relationships.DependsOn" + } + } + }, + "resource-assignment": { + "type": "component-resource-assignment", + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "action-name": "{ \"get_input\" : \"action-name\" }", + "resource-type": "vnf-type", + "template-names": [ + "base-config-template", + "licence-template" + ], + "request-id": "{ \"get_input\" : \"request-id\" }", + "resource-id": "{ \"get_input\" : \"vnf-id\" }" + }, + "outputs": { + "resource-assignment-params": "", + "status": "" + } + } + } + } + }, + "capabilities": { + "component-node": { + + } + } + }, + "generate-configuration": { + "type": "component-config-generator", + "interfaces": { + "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": { + "operations": { + "process": { + "inputs": { + "action-name": "{ \"get_input\" : \"action-name\" }", + "resource-type": "vnf-type", + "request-id": "{ \"get_input\" : \"request-id\" }", + "resource-id": "{ \"get_input\" : \"vnf-id\" }", + "template-name": "base-config-template" + }, + "outputs": { + "generated-config": "", + "status": "" + } + } + } + } + }, + "capabilities": { + "component-node": { + + } + } + } + } + }, + "artifact_types": { + "artifact-template-velocity": { + "description": " Velocity Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "vtl" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-mapping-resource": { + "description": " Velocity Template Resource Mapping File used along with Configuration template", + "version": "1.0.0", + "file_ext": [ + "json" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-script-python": { + "description": " Python Script Template used for Configuration", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" + } + }, + "node_types": { + "dg-resource-assignment": { + "description": "This is Resource Assignment Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": "false" + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + }, + "content": { + "type": "tosca.capability.Content", + "properties": { + "type": { + "required": false, + "type": "string", + "default": "json" + }, + "content": { + "required": true, + "type": "string" + } + } + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "component-resource-assignment", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + "derived_from": "tosca.nodes.DG" + }, + "dg-config-generator": { + "description": "This is Activate DG for Config Generator Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": "false" + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + }, + "content": { + "type": "tosca.capability.Content", + "properties": { + "type": { + "required": false, + "type": "string", + "default": "json" + }, + "content": { + "required": true, + "type": "string" + } + } + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "component-config-generator", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "GenerateConfiguration": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + "derived_from": "tosca.nodes.DG" + }, + "artifact-config-template": { + "description": "This is Configuration Velocity Template", + "version": "1.0.0", + "properties": { + "action-names": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "content": { + "required": false, + "type": "string" + }, + "mapping": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-resource-assignment" + } + } + }, + "capabilities": { + "content": { + "type": "tosca.capability.Content", + "properties": { + "content": { + "required": true, + "type": "string" + } + } + }, + "mapping": { + "type": "tosca.capability.Mapping", + "properties": { + "mapping": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-resource-assignment" + } + } + } + } + }, + "derived_from": "tosca.nodes.Artifact" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "handler-name": { + "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.", + "required": true, + "type": "string" + }, + "resource-type": { + "required": false, + "type": "string" + }, + "template-names": { + "description": "Name of the Artifact Node Templates, to get the template Content.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-config-generator": { + "description": "This is Generate Configuration Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": { + "operations": { + "process": { + "inputs": { + "template-data": { + "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present", + "required": false, + "type": "string" + }, + "action-name": { + "description": "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "template-content": { + "description": "Conditional : Dynamic Template used to generate Configuration.", + "required": false, + "type": "string" + }, + "resource-type": { + "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present", + "required": false, + "type": "string" + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present", + "required": false, + "type": "string" + }, + "template-name": { + "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.", + "required": true, + "type": "string" + } + }, + "outputs": { + "generated-config": { + "description": "Generated Configuration for the Template adn Resource Data", + "required": true, + "type": "string" + }, + "mask-info": { + "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.config.model.data.custom.MaskInfo ", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + } + }, + "data_types": { + "datatype-resource-assignment": { + "version": "1.0.0", + "description": "This is Resource Assignment Data Type", + "properties": { + "property": { + "required": true, + "type": "datatype-property" + }, + "input-param": { + "required": true, + "type": "boolean" + }, + "dictionary-name": { + "required": false, + "type": "string" + }, + "dictionary-source": { + "required": false, + "type": "string" + }, + "dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.datatypes.Root" + }, + "datatype-property": { + "version": "1.0.0", + "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs", + "properties": { + "type": { + "required": true, + "type": "string" + }, + "description": { + "required": false, + "type": "string" + }, + "required": { + "required": false, + "type": "boolean" + }, + "default": { + "required": false, + "type": "string" + }, + "entry_schema": { + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" + } + } +} diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json new file mode 100644 index 000000000..72332d1b3 --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json @@ -0,0 +1,265 @@ +[ + { + "name": "security-manager-resource-key", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "security-manager-resource-key", + "dictionary-source": "input" + }, + { + "name": "security-manager-resource-name", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "security-manager-resource-name", + "dictionary-source": "input" + }, + { + "name": "snmp-server-ipv4-addresses", + "input-param": true, + "property": { + "type": "list", + "required": true, + "entry_schema": { + "type": "string" + } + }, + "dictionary-name": "snmp-server-ipv4-addresses", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "asn-region", + "complex-code" + ] + }, + { + "name": "snmp-community", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "snmp-community", + "dictionary-source": "nsm", + "dependencies": [ + "security-manager-resource-name", + "security-manager-resource-key" + ], + "version": 0 + }, + { + "name": "lo0-local-ipv4-address", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "value": { + + }, + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "lo0-local-ipv4-address", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "adig-urlb-route-reflectors", + "property": { + "description": "", + "required": true, + "type": "list", + "status": "", + "constraints": [ + { + + } + ], + "value": { + + }, + "entry_schema": { + "type": "dt-adig-urlb-route-reflectors" + } + }, + "input-param": false, + "dictionary-name": "adig-urlb-route-reflectors", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "region" + ], + "version": 0 + }, + { + "name": "bundle-id", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "value": { + + }, + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "bundle-id", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "uplink-1-unit", + "property": { + "description": "", + "required": true, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "value": { + + }, + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "uplink-1-unit", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "uplink-2-unit", + "property": { + "description": "", + "required": true, + "type": "integer", + "status": "", + "constraints": [ + { + + } + ], + "value": { + + }, + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "uplink-2-unit", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "lo10-local-ipv4-address", + "property": { + "description": "", + "required": true, + "type": "string", + "status": "", + "constraints": [ + { + + } + ], + "value": { + + }, + "entry_schema": { + "type": "" + } + }, + "input-param": false, + "dictionary-name": "lo10-local-ipv4-address", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "complex-code", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "complex-code", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "country-code", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "country-code", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + }, + { + "name": "hostname", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "hostname", + "dictionary-source": "input", + "version": 0 + }, + { + "name": "region", + "property": { + "required": true, + "type": "string" + }, + "dictionary-name": "region", + "dictionary-source": "network-resource-discovery", + "dependencies": [ + "hostname" + ], + "version": 0 + } +] \ No newline at end of file diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json new file mode 100644 index 000000000..030af7b4f --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json @@ -0,0 +1,407 @@ +{ + "metadata": { + "author": "ks220y@att.com", + "service-template-name": "VRR-baseconfiguration", + "service-template-version": "1.0.0", + "release": "1802", + "service-type": "AVPN", + "vnf-type": "VRR" + }, + "topology_template": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "node_templates": { + "base-config-template": { + "type": "artifact-config-template", + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "capabilities": { + "content": { + "properties": { + "content": "db://base-config-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input" + }, + { + "name": "group-name", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "group-name", + "dictionary-source": "input" + } + ] + } + } + } + }, + "resource-assignment-action": { + "type": "dg-resource-assignment", + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + + } + } + } + }, + "capabilities": { + "dg-node": { + + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "resource-assignment", + "relationship": "tosca.relationships.DependsOn" + } + } + }, + "licence-template": { + "type": "artifact-config-template", + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "capabilities": { + "content": { + "properties": { + "content": "db://licence-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "bundle-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "bundle-id", + "dictionary-source": "input" + }, + { + "name": "bundle-mac", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "bundle-mac", + "dictionary-source": "input" + } + ] + } + } + } + }, + "resource-assignment": { + "type": "component-resource-assignment", + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "action-name": "{ \"get_input\" : \"action-name\" }", + "resource-type": "vnf-type", + "template-names": [ + "base-config-template", + "licence-template" + ], + "request-id": "{ \"get_input\" : \"request-id\" }", + "resource-id": "{ \"get_input\" : \"vnf-id\" }" + }, + "outputs": { + "resource-assignment-params": "", + "status": "" + } + } + } + } + }, + "capabilities": { + "component-node": { + + } + } + } + } + }, + "node_types": { + "dg-resource-assignment": { + "description": "This is Resource Assignment Directed Graph", + "version": "1.0.0", + "properties": { + "mode": { + "required": false, + "type": "string", + "default": "sync" + }, + "version": { + "required": false, + "type": "string", + "default": "LATEST" + }, + "is-start-flow": { + "required": false, + "type": "boolean", + "default": "false" + } + }, + "capabilities": { + "dg-node": { + "type": "tosca.capabilities.Node" + }, + "content": { + "type": "tosca.capability.Content", + "properties": { + "type": { + "required": false, + "type": "string", + "default": "json" + }, + "content": { + "required": true, + "type": "string" + } + } + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "component-resource-assignment", + "relationship": "tosca.relationships.DependsOn" + } + }, + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + "inputs": { + "params": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-property" + } + } + } + } + } + } + }, + "derived_from": "tosca.nodes.DG" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "action-name": { + "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", + "required": false, + "type": "string" + }, + "handler-name": { + "description": "Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.", + "required": true, + "type": "string" + }, + "resource-type": { + "required": false, + "type": "string" + }, + "template-names": { + "description": "Name of the Artifact Node Templates, to get the template Content.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "request-id": { + "description": "Request Id used to store the generated configuration, in the database along with the template-name", + "required": true, + "type": "string" + }, + "resource-id": { + "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", + "required": true, + "type": "string" + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "artifact-config-template": { + "description": "This is Configuration Velocity Template", + "version": "1.0.0", + "properties": { + "action-names": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "content": { + "required": false, + "type": "string" + }, + "mapping": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-resource-assignment" + } + } + }, + "capabilities": { + "content": { + "type": "tosca.capability.Content", + "properties": { + "content": { + "required": true, + "type": "string" + } + } + }, + "mapping": { + "type": "tosca.capability.Mapping", + "properties": { + "mapping": { + "required": false, + "type": "list", + "entry_schema": { + "type": "datatype-resource-assignment" + } + } + } + } + }, + "derived_from": "tosca.nodes.Artifact" + } + }, + "data_types": { + "datatype-resource-assignment": { + "version": "1.0.0", + "description": "This is Resource Assignment Data Type", + "properties": { + "property": { + "required": true, + "type": "datatype-property" + }, + "input-param": { + "required": true, + "type": "boolean" + }, + "dictionary-name": { + "required": false, + "type": "string" + }, + "dictionary-source": { + "required": false, + "type": "string" + }, + "dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.datatypes.Root" + }, + "datatype-property": { + "version": "1.0.0", + "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs", + "properties": { + "type": { + "required": true, + "type": "string" + }, + "description": { + "required": false, + "type": "string" + }, + "required": { + "required": false, + "type": "boolean" + }, + "default": { + "required": false, + "type": "string" + }, + "entry_schema": { + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Root" + } + } +} diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl new file mode 100644 index 000000000..ce7745bb7 --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl @@ -0,0 +1 @@ +This is sample Base Configuration for ${bundle-id} for ${bundle-mac} \ No newline at end of file diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl new file mode 100644 index 000000000..e69de29bb diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json new file mode 100644 index 000000000..525136f6d --- /dev/null +++ b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json @@ -0,0 +1,171 @@ +{ + "metadata": { + "author": "ks220y@att.com", + "service-template-name": "VRR-baseconfiguration", + "service-template-version": "1.0.0", + "release": "1802", + "service-type": "AVPN", + "vnf-type": "VRR" + }, + "topology_template": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "node_templates": { + "base-config-template": { + "type": "artifact-config-template", + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "capabilities": { + "content": { + "properties": { + "content": "db://base-config-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input" + }, + { + "name": "group-name", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "group-name", + "dictionary-source": "input" + } + ] + } + } + } + }, + "resource-assignment-action": { + "type": "dg-resource-assignment", + "interfaces": { + "CONFIG": { + "operations": { + "ResourceAssignment": { + + } + } + } + }, + "capabilities": { + "dg-node": { + + } + }, + "requirements": { + "component-dependency": { + "capability": "component-node", + "node": "resource-assignment", + "relationship": "tosca.relationships.DependsOn" + } + } + }, + "licence-template": { + "type": "artifact-config-template", + "properties": { + "action-names": [ + "resource-assignment-action" + ] + }, + "capabilities": { + "content": { + "properties": { + "content": "db://licence-template" + } + }, + "mapping": { + "properties": { + "mapping": [ + { + "name": "bundle-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "bundle-id", + "dictionary-source": "input" + }, + { + "name": "bundle-mac", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "bundle-mac", + "dictionary-source": "input" + } + ] + } + } + } + }, + "resource-assignment": { + "type": "component-resource-assignment", + "interfaces": { + "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": { + "operations": { + "process": { + "inputs": { + "action-name": "{ \"get_input\" : \"action-name\" }", + "resource-type": "vnf-type", + "template-names": [ + "base-config-template", + "licence-template" + ], + "request-id": "{ \"get_input\" : \"request-id\" }", + "resource-id": "{ \"get_input\" : \"vnf-id\" }" + }, + "outputs": { + "resource-assignment-params": "", + "status": "" + } + } + } + } + }, + "capabilities": { + "component-node": { + + } + } + } + } + } +} -- cgit 1.2.3-korg