summaryrefslogtreecommitdiffstats
path: root/components/model-catalog/blueprint-model
diff options
context:
space:
mode:
Diffstat (limited to 'components/model-catalog/blueprint-model')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json13
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json8
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py18
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json13
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl7
5 files changed, 50 insertions, 9 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 07c988b1..162411f8 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
@@ -219,7 +219,10 @@
},
"inputs": {
"instance-dependencies": [
- "json-parser-service"
+
+ ],
+ "artifact-prefix-names": [
+ "hostname"
]
},
"outputs": {
@@ -238,6 +241,14 @@
}
},
"artifacts": {
+ "hostname-template": {
+ "type": "artifact-template-velocity",
+ "file": "Templates/hostname-template.vtl"
+ },
+ "hostname-mapping": {
+ "type": "artifact-mapping-resource",
+ "file": "Templates/hostname-mapping.json"
+ },
"component-script": {
"type": "artifact-script-jython",
"file": "Scripts/python/NetconfRpcExample.py"
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
index 65271838..d3093d9c 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
@@ -71,6 +71,14 @@
"entry_schema": {
"type": "string"
}
+ },
+ "artifact-prefix-names": {
+ "required": false,
+ "description": "Template , Resource Assignment Artifact Prefix names",
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
}
},
"outputs": {
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py
index acdb94aa..26c66b66 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/NetconfRpcExample.py
@@ -13,8 +13,8 @@
# limitations under the License.
import netconf_constant
+from common import ResolutionHelper
from java.lang import Exception as JavaException
-from netconfclient import NetconfClient
from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import \
NetconfComponentFunction
@@ -26,21 +26,23 @@ class NetconfRpcExample(NetconfComponentFunction):
log = globals()[netconf_constant.SERVICE_LOG]
print(globals())
nc = NetconfClient(log, self, "netconf-connection")
- nc.connect()
+ rr = ResolutionHelper(self)
- payload = "<configuration xmlns:junos=\"http://xml.juniper.net/junos/17.4R1/junos\"><system xmlns=\"http://yang.juniper.net/junos-qfx/conf/system\"><host-name operation=\"delete\"/><host-name operation=\"create\">DEMO</host-name></system></configuration>"
+ payload = rr.resolve_and_generate_message_from_template_prefix("hostname")
+ nc.connect()
response = nc.lock(message_id="lock-123")
if not response.isSuccess():
log.error(response.errorMessage)
- # nc.edit_config(message_id="edit-config-1", message_content=payload,edit_default_peration="none")
+ nc.edit_config(message_id="edit-config-1", message_content=payload,
+ edit_default_peration="none")
# nc.validate(message_id="validate-123")
# nc.discard_change(message_id="discard-123")
- # nc.validate(message_id="validate-123")
- # nc.commit(message_id="commit-123")
- # nc.unlock(message_id="unlock-123")
- # nc.disconnect()
+ nc.validate(message_id="validate-123")
+ nc.commit(message_id="commit-123")
+ nc.unlock(message_id="unlock-123")
+ nc.disconnect()
except JavaException, err:
log.error("Java Exception in the script {}", err)
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json
new file mode 100644
index 00000000..1e02d690
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-mapping.json
@@ -0,0 +1,13 @@
+[
+ {
+ "name": "hostname",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "hostname",
+ "dictionary-source": "input",
+ "dependencies": [
+ ]
+ }
+]
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl
new file mode 100644
index 00000000..1e80b6d1
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/hostname-template.vtl
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration xmlns:junos="http://xml.juniper.net/junos/17.4R1/junos">
+ <system xmlns="http://yang.juniper.net/junos-qfx/conf/system">
+ <host-name operation="delete" />
+ <host-name operation="create">$hostname</host-name>
+ </system>
+</configuration>