summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json37
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_ansible/Definitions/node_types.json9
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/README.md70
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta4
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta2
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml5
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json4
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json6
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json6
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json9
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json6
-rw-r--r--components/scripts/python/ccsdk_netconf/common.py1
-rw-r--r--components/scripts/python/ccsdk_netconf/netconf_constant.py2
-rw-r--r--components/scripts/python/ccsdk_netconf/netconfclient.py6
-rw-r--r--components/scripts/python/ccsdk_restconf/restconf_client.py4
-rw-r--r--components/scripts/python/ccsdk_restconf/restconf_constant.py1
16 files changed, 159 insertions, 13 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index 112014b88..70c1bc3c6 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -462,6 +462,43 @@
]
}
}
+ },
+ "imperative-test-wf": {
+ "steps": {
+ "activate-step1": {
+ "description": "Activate CLI flow 1",
+ "target": "activate-cli",
+ "activities": [
+ {
+ "call_operation": "ComponentScriptExecutor.process"
+ }
+ ],
+ "on_success": [
+ "activate-step2"
+ ]
+ },
+ "activate-step2": {
+ "description": "Activate CLI flow 2",
+ "target": "activate-cli",
+ "activities": [
+ {
+ "call_operation": "ComponentScriptExecutor.process"
+ }
+ ],
+ "on_success": [
+ "activate-step3"
+ ]
+ },
+ "activate-step3": {
+ "description": "Activate CLI flow 3",
+ "target": "activate-cli",
+ "activities": [
+ {
+ "call_operation": "ComponentScriptExecutor.process"
+ }
+ ]
+ }
+ }
}
}
}
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/Definitions/node_types.json
index 5f0deeb98..cb9614eed 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_ansible/Definitions/node_types.json
@@ -24,8 +24,13 @@
"process" : {
"inputs" : {
"job-template-name" : {
- "description" : "Job template to execute in AWX",
- "required" : true,
+ "description" : "Primary key or name of the job template to launch new job.",
+ "required" : false,
+ "type" : "string"
+ },
+ "workflow-job-template-id" : {
+ "description" : "Primary key (name not supported) of the workflow job template to launch new job.",
+ "required" : false,
"type" : "string"
},
"limit" : {
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/README.md b/components/model-catalog/blueprint-model/uat-blueprints/README.md
index d6a335273..56cb32989 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/README.md
+++ b/components/model-catalog/blueprint-model/uat-blueprints/README.md
@@ -7,7 +7,7 @@ The BPP runs in an almost production-like configuration with some minor exceptio
- It uses an embedded, in-memory, and initially empty H2 database, running in MySQL/MariaDB compatibility mode;
- All external services are mocked.
-
+
## How it works?
The UATs are declarative, data-driven tests implemented in YAML 1.1 documents.
@@ -33,6 +33,62 @@ CDS project's `components/model-catalog/blueprint-model/uat-blueprints` director
## `uat.yaml` reference
+The structure of an UAT YAML file could be documented using the Protobuf language as follows:
+
+```proto
+message Uat {
+ message Path {}
+ message Json {}
+
+ message Process {
+ required string name = 1;
+ required Json request = 2;
+ required Json expectedResponse = 3;
+ optional Json responseNormalizerSpec = 4;
+ }
+
+ message Request {
+ required string method = 1;
+ required Path path = 2;
+ optional string contentType = 3 [default = None];
+ optional Json body = 4;
+ }
+
+ message Response {
+ optional int32 status = 1 [default = 200];
+ optional Json body = 2;
+ }
+
+ message Expectation {
+ required Request request = 1;
+ required Response response = 2;
+ }
+
+ message ExternalService {
+ required string selector = 1;
+ repeated Expectation expectations = 2; // min cardinality = 1
+ }
+
+ repeated Process processes = 1; // min cardinality = 1
+ repeated ExternalService externalServices = 2; // min cardinality = 0
+}
+
+```
+
+The optional `responseNormalizerSpec` specifies transformations that may be needed to apply to the response
+returned by BPP to get a full JSON representation. For example, it's possible to convert an string field "outer.inner"
+into JSON using the following specification:
+
+```yaml
+ responseNormalizerSpec:
+ outer:
+ inner: ?from-json(.outer.inner)
+
+```
+
+The "?" must prefix every expression that is NOT a literal string. The `from-json()` function and
+many others are documented [here](https://github.com/schibsted/jslt/blob/0.1.8/functions.md).
+
### Skeleton of a basic `uat.yaml`
```yaml
@@ -93,16 +149,16 @@ external-services:
### Composite URI paths
-In case your YAML document contains many URI path definitions, you'd better keep the duplications
+In case your YAML document contains many URI path definitions, it's recommended to keep the duplications
as low as possible in order to ease the document maintenance, and avoid inconsistencies.
-
+
Since YAML doesn't provide a standard mechanism to concatenate strings,
the UAT engine implements an ad-hoc mechanism based on multi-level lists.
Please note that currently this mechanism is only applied to URI paths.
To exemplify how it works, let's take the case of eliminating duplications when defining multiple OpenDaylight URLs.
-You might starting using the following definitions:
+You might start using the following definitions:
```yaml
nodeId: &nodeId "new-netconf-device"
# ...
@@ -127,7 +183,7 @@ The UAT engine will expand the above multi-level lists, resulting on the followi
# ...
- request:
path: restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/mynetconf:netconflist
-```
+```
## License
@@ -135,9 +191,7 @@ Copyright (C) 2019 Nordix Foundation.
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
+You may obtain a copy of the License at https://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,
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta
index 769d46474..83fffa440 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/uat-blueprints/echo/TOSCA-Metadata/TOSCA.meta
@@ -2,4 +2,6 @@ TOSCA-Meta-File-Version: 1.0.0
CSAR-Version: 1.0
Created-By: Rodrigo Ottero
Entry-Definitions: Definitions/echo-test.json
-Template-Tags: activation-blueprint
+Template-Name: echo-test
+Template-Version: 1.0.0
+Template-Tags: echo-test
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta
index 6ac9caf57..ca0637328 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/TOSCA-Metadata/TOSCA.meta
@@ -2,4 +2,6 @@ TOSCA-Meta-File-Version: 1.0.0
CSAR-Version: 1.0
Created-By: Rodrigo Ottero
Entry-Definitions: Definitions/activation-blueprint.json
+Template-Name: activation-blueprint
+Template-Version: 1.0.0
Template-Tags: activation-blueprint
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
index 37029e181..789659eb2 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
@@ -52,6 +52,11 @@ processes:
target: /
value: { netconflist: { netconf: [ { netconf-id: "30", netconf-param: "3000" }]}}
status: success
+ responseNormalizerSpec:
+ stepData:
+ properties:
+ resource-assignment-params:
+ config-assign: ?from-json(.stepData.properties.resource-assignment-params.config-assign)
- name: config-deploy
request:
commonHeader: *commonHeader
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json
index 1cc366637..caae68eef 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json
@@ -13,6 +13,10 @@
"config-snapshot-value": {
"required": false,
"type": "string"
+ },
+ "response-data": {
+ "required": false,
+ "type": "json"
}
},
"capabilities": {
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json
index b78a7c63a..ae674f3ec 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json
@@ -1,6 +1,12 @@
{
"description": "This is Jython Execution Component.",
"version": "1.0.0",
+ "attributes": {
+ "response-data": {
+ "required": false,
+ "type": "json"
+ }
+ },
"capabilities": {
"component-node": {
"type": "tosca.capabilities.Node"
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json
index 3233d2121..e72cf951b 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json
@@ -1,6 +1,12 @@
{
"description": "This is Netconf Transaction Configuration Component API",
"version": "1.0.0",
+ "attributes": {
+ "response-data": {
+ "required": false,
+ "type": "json"
+ }
+ },
"capabilities": {
"component-node": {
"type": "tosca.capabilities.Node"
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json
index 498db8246..f5d9d3f7a 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json
@@ -9,6 +9,10 @@
"ansible-command-logs": {
"required": true,
"type": "string"
+ },
+ "response-data": {
+ "required": false,
+ "type": "json"
}
},
"capabilities": {
@@ -26,6 +30,11 @@
"required": true,
"type": "string"
},
+ "workflow-job-template-id": {
+ "description": "Primary key (name not supported) of the workflow job template to launch new job.",
+ "required": false,
+ "type": "string"
+ },
"limit": {
"description": "Specify host limit for job template to run.",
"required": false,
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json
index b241aa36f..22596020f 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json
@@ -1,6 +1,12 @@
{
"description": "This is CLI Transaction Configuration Component API",
"version": "1.0.0",
+ "attributes": {
+ "response-data": {
+ "required": false,
+ "type": "json"
+ }
+ },
"capabilities": {
"component-node": {
"type": "tosca.capabilities.Node"
diff --git a/components/scripts/python/ccsdk_netconf/common.py b/components/scripts/python/ccsdk_netconf/common.py
index f7ac1ac35..66c7a98b5 100644
--- a/components/scripts/python/ccsdk_netconf/common.py
+++ b/components/scripts/python/ccsdk_netconf/common.py
@@ -26,3 +26,4 @@ class ResolutionHelper:
def retrieve_resolved_template_from_database(self, key, artifact_template):
return ResourceResolutionExtensionsKt.storedContentFromResolvedArtifact(self.component_function, key,
artifact_template)
+
diff --git a/components/scripts/python/ccsdk_netconf/netconf_constant.py b/components/scripts/python/ccsdk_netconf/netconf_constant.py
index 534ca9e13..52ac0ae5a 100644
--- a/components/scripts/python/ccsdk_netconf/netconf_constant.py
+++ b/components/scripts/python/ccsdk_netconf/netconf_constant.py
@@ -8,6 +8,8 @@ PARAM_ACTION = "action"
STATUS_SUCCESS = "success"
STATUS_FAILURE = "failure"
+ATTRIBUTE_RESPONSE_DATA = "response-data"
+
CONFIG_TARGET_RUNNING = "running"
CONFIG_TARGET_CANDIDATE = "candidate"
CONFIG_DEFAULT_OPERATION_MERGE = "merge"
diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py
index a942845b9..b3aef11f4 100644
--- a/components/scripts/python/ccsdk_netconf/netconfclient.py
+++ b/components/scripts/python/ccsdk_netconf/netconfclient.py
@@ -1,5 +1,4 @@
-from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \
- CONFIG_DEFAULT_OPERATION_REPLACE
+from netconf_constant import *
from org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor import NetconfExecutorExtensionsKt
@@ -60,3 +59,6 @@ class NetconfClient:
def discard_change(self):
device_response = self.netconf_rpc_client.discardConfig()
return device_response
+
+ def set_execution_attribute_response_data(self, response_data):
+ self.setAttribute(ATTRIBUTE_RESPONSE_DATA, response_data)
diff --git a/components/scripts/python/ccsdk_restconf/restconf_client.py b/components/scripts/python/ccsdk_restconf/restconf_client.py
index 927c1fedd..6e53dcf93 100644
--- a/components/scripts/python/ccsdk_restconf/restconf_client.py
+++ b/components/scripts/python/ccsdk_restconf/restconf_client.py
@@ -18,6 +18,7 @@
# ============LICENSE_END=========================================================
#
from time import sleep
+from restconf_constant import *
from org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor import RestconfExecutorExtensionsKt
from org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution import ResourceResolutionExtensionsKt
@@ -92,3 +93,6 @@ class RestconfClient:
url = self.__base_odl_url + nf_id
self.__log.debug("sending unmount request, url: {}", url)
web_client_service.exchangeResource("DELETE", url, "")
+
+ def set_execution_attribute_response_data(self, response_data):
+ self.setAttribute(ATTRIBUTE_RESPONSE_DATA, response_data)
diff --git a/components/scripts/python/ccsdk_restconf/restconf_constant.py b/components/scripts/python/ccsdk_restconf/restconf_constant.py
new file mode 100644
index 000000000..2e1c58312
--- /dev/null
+++ b/components/scripts/python/ccsdk_restconf/restconf_constant.py
@@ -0,0 +1 @@
+ATTRIBUTE_RESPONSE_DATA = "response-data" \ No newline at end of file