Blueprint for configuring a PNF
authorottero <rodrigo.ottero@est.tech>
Mon, 11 Mar 2019 14:03:09 +0000 (14:03 +0000)
committerottero <rodrigo.ottero@est.tech>
Mon, 11 Mar 2019 14:03:09 +0000 (14:03 +0000)
This is the first version of a blueprint, intended to be used to
configure PNFs.

The design considers that a blueprint will be created for each possible
PNF.

Change-Id: I4994149441257eb417b6d5f611e12cd81595177f
Issue-ID: CCSDK-1107
Signed-off-by: ottero <rodrigo.ottero@est.tech>
15 files changed:
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/activation-blueprint.json
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/data_types.json
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/node_types.json
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/relationship_types.json
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Definitions/resources_definition_types.json
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configAssign.xml
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Plans/CONFIG_configure.xml
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts [deleted file]
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts [deleted file]
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py [new file with mode: 0644]
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py [new file with mode: 0644]
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metadata/TOSCA.meta [moved from components/model-catalog/blueprint-model/test-blueprint/capability_restconf/TOSCA-Metada/TOSCA.meta with 100% similarity]
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/config-assign-pnf-mapping.json
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-pnf-mapping.json
components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Templates/configure-restconf-mount-template.vtl

index 96ae88e..90b2e3a 100644 (file)
@@ -1,16 +1,10 @@
-<!-- QUESTION
-     lines 74-78 and 157-161: if I have to resolve the variables I need based on
-     the pnf id, do I need to specify a restconf-connection? Another point, the
-     connection is aimed to ODL, not to the PNF, so I am not sure what to fill
-     for this model (lines 122-137)
--->
 {
   "tosca_definitions_version" : "controller_blueprint_1_0_0",
   "metadata" : {
     "template_author" : "Rodrigo Ottero",
     "author-email" : "rodrigo.ottero@est.tech",
     "user-groups" : "ADMIN, OPERATION",
-    "template_name" : "pnf restconf",
+    "template_name" : "configuration_over_restconf",
     "template_version" : "1.0.0",
     "template_tags" : "pnf, restconf, config, configuration"
   },
           }
         }
       },
+
+
       "config-assign" : {
         "type" : "component-restconf-executor",
-        "requirements" : {
-          "restconf-connection" : {
-            "capability" : "restconf",
-            "node" : "sample-restconf-server",
-            "relationship" : "tosca.relationships.ConnectsTo"
-          }
-        },
         "interfaces" : {
           "ComponentRestconfExecutor" : {
             "operations" : {
                   "primary" : "component-script"
                 },
                 "inputs" : {
-                  "script-type" : "kotlin",
-                  "script-class-reference" : "Scripts/kotlin/RestconfAssignConfig.kts",
-                  "instance-dependencies" : [ ],
-                  "artifact-prefix-names": [
-                      "config-assign"
-                  ]
+                  "script-type" : "jython",
+                  "script-class-reference" : "Scripts/python/RestconfAssignConfig.py",
+                  "instance-dependencies" : [ ]
                 },
                 "outputs" : {
                   "response-data" : "",
             "file" : "Templates/config-assign-pnf-mapping.json"
           },
           "component-script" : {
-            "type" : "artifact-script-kotlin",
-            "file" : "Scripts/kotlin/RestconfAssignConfig.py"
+            "type" : "artifact-script-jython",
+            "file" : "Scripts/python/RestconfAssignConfig.py"
           }
         }
       },
+
+
+
       "configure-process" : {
         "type" : "dg-generic",
         "properties" : {
       },
       "configure" : {
         "type" : "component-restconf-executor",
-        "requirements" : {
-          "restconf-connection" : {
-            "capability" : "restconf",
-            "node" : "sample-restconf-server",
-            "relationship" : "tosca.relationships.ConnectsTo"
-          }
-        },
         "interfaces" : {
           "ComponentRestconfExecutor" : {
             "operations" : {
                   "primary" : "component-script"
                 },
                 "inputs" : {
-                  "script-type" : "kotlin",
-                  "script-class-reference" : "Scripts/kotlin/RestconfConfigure.kts",
-                  "instance-dependencies" : [ ],
-                  "artifact-prefix-names": [
-                      "configure-restconf-mount", "configure-restconf-unmount"
-                  ]
+                  "script-type" : "jython",
+                  "script-class-reference" : "Scripts/python/RestconfConfigure.py",
+                  "instance-dependencies" : [ ]
                 },
                 "outputs" : {
                   "response-data" : "",
             "file" : "Templates/configure-pnf-mapping.json"
           },
           "component-script" : {
-            "type" : "artifact-script-kotlin",
-            "file" : "Scripts/kotlin/RestconfConfigure.py"
-          }
-        }
-      },
-      "sample-restconf-device" : {
-        "type" : "pnf-netconf-device",
-        "capabilities" : {
-          "restconf" : {
-            "properties" : {
-              "login-key" : {
-                "get_input" : "password"
-              },
-              "login-account" : {
-                "get_input" : "username"
-              },
-              "target-ip-address" : {
-                "get_input" : "ip"
-              },
-              "port-number" : 830,
-              "connection-time-out" : 5
-            }
+            "type" : "artifact-script-jython",
+            "file" : "Scripts/python/RestconfConfigure.py"
           }
         }
       }
index d9153f3..9f35eef 100644 (file)
@@ -1,22 +1,15 @@
 {
   "data_types" : {
-    "dt-assign-activate-properties" : {
-      "description" : "Dynamic DataType definition for workflow(assign-activate).",
+    "dt-config-assign-properties" : {
+      "description" : "Dynamic DataType definition for workflow(config-assign).",
       "version" : "1.0.0",
-      "properties" : {
-        "hostname" : {
-          "type" : "string"
-        },
-        "ip": {
-          "type": "string"
-        },
-        "username": {
-          "type": "string"
-        },
-        "password": {
-          "type": "string"
-        }
-      },
+      "properties" : { },
+      "derived_from" : "tosca.datatypes.Dynamic"
+    },
+    "dt-configure-properties" : {
+      "description" : "Dynamic DataType definition for workflow(configure).",
+      "version" : "1.0.0",
+      "properties" : { },
       "derived_from" : "tosca.datatypes.Dynamic"
     }
   }
index c8e3e6a..be3bd31 100644 (file)
@@ -1,20 +1,13 @@
 {
   "node_types" : {
     "component-restconf-executor" : {
-      "description" : "This is Restconf Configuration Component API",
+      "description" : "This is Restconf Transaction Configuration Component API",
       "version" : "1.0.0",
       "capabilities" : {
         "component-node" : {
           "type" : "tosca.capabilities.Node"
         }
       },
-      "requirements" : {
-        "restconf-connection" : {
-          "capability" : "restconf",
-          "node" : "pnf-restconf-device",
-          "relationship" : "tosca.relationships.ConnectsTo"
-        }
-      },
       "interfaces" : {
         "ComponentRestconfExecutor" : {
           "operations" : {
       },
       "derived_from" : "tosca.nodes.DG"
     },
-    "source-input" : {
-      "description" : "This is Input Resource Source Node Type",
-      "version" : "1.0.0",
-      "properties" : {
-        "key" : {
-          "required" : false,
-          "type" : "string"
-        },
-        "key-dependencies" : {
-          "required" : true,
-          "type" : "list",
-          "entry_schema" : {
-            "type" : "string"
-          }
-        }
-      },
-      "derived_from" : "tosca.nodes.ResourceSource"
-    },
     "tosca.nodes.Component" : {
       "description" : "This is default Component Node",
       "version" : "1.0.0",
       "description" : "This is Directed Graph Node Type",
       "version" : "1.0.0",
       "derived_from" : "tosca.nodes.Root"
-    },
-    "tosca.nodes.ResourceSource" : {
-      "description" : "TOSCA base type for Resource Sources",
-      "version" : "1.0.0",
-      "derived_from" : "tosca.nodes.Root"
-    },
-    "tosca.nodes.Vnf" : {
-      "description" : "This is VNF Node Type",
-      "version" : "1.0.0",
-      "derived_from" : "tosca.nodes.Root"
-    },
-    "tosca.nodes.Pnf": {
-      "description": "This is the PNF Node Type",
-      "version": "1.0.0",
-      "derived_from": "tosca.nodes.Root"
-    },
-     "pnf-restconf-device" : {
-      "description" : "This is a PNF Device with Restconf Capability",
-      "version" : "1.0.0",
-      "capabilities" : {
-        "netconf" : {
-          "type" : "tosca.capabilities.Restconf",
-          "properties" : {
-            "login-key" : {
-              "required" : true,
-              "type" : "string",
-              "default" : "sdnc"
-            },
-            "login-account" : {
-              "required" : true,
-              "type" : "string",
-              "default" : "sdnc-tacacs"
-            },
-            "source" : {
-              "required" : false,
-              "type" : "string",
-              "default" : "npm"
-            },
-            "target-ip-address" : {
-              "required" : true,
-              "type" : "string"
-            },
-            "port-number" : {
-              "required" : true,
-              "type" : "integer",
-              "default" : 830
-            },
-            "connection-time-out" : {
-              "required" : false,
-              "type" : "integer",
-              "default" : 30
-            }
-          }
-        }
-      },
-      "derived_from" : "tosca.nodes.Pnf"
     }
   }
 }
\ No newline at end of file
index 027bfc0..4ddd7a5 100644 (file)
@@ -1,9 +1,3 @@
 {
-  "relationship_types" : {
-    "tosca.relationships.ConnectsTo" : {
-      "description" : "Relationship tosca.relationships.ConnectsTo",
-      "version" : "1.0.0",
-      "derived_from" : "tosca.relationships.Root"
-    }
-  }
+  "relationship_types" : { }
 }
\ No newline at end of file
index b77f451..6f31cf5 100644 (file)
@@ -1,16 +1 @@
-{
-  "hostname" : {
-    "tags" : "hostname",
-    "name" : "hostname",
-    "property" : {
-      "description" : "hostname",
-      "type" : "string"
-    },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
-    "sources" : {
-      "input" : {
-        "type" : "source-input"
-      }
-    }
-  }
-}
\ No newline at end of file
+{ }
\ No newline at end of file
index 417f72d..220cba9 100644 (file)
@@ -1,7 +1,3 @@
-<!-- QUESTION:
-     is the usage of <method rpc="ResourceAssignAndActivate" mode="sync">
-     correct in the context of CCSDK-926? -->
-     
 <?xml version="1.0" encoding="UTF-8"?>
 <service-logic xmlns="http://www.onap.org/sdnc/svclogic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module="CONFIG" version="1.0.0">
    <method rpc="ResourceAssignAndActivate" mode="sync">
index 94fe6dd..c48ffbe 100644 (file)
@@ -1,7 +1,3 @@
-<!-- QUESTION:
-     is the usage of <method rpc="ResourceAssignAndActivate" mode="sync">
-     correct in the context of CCSDK-926? -->
-     
 <?xml version="1.0" encoding="UTF-8"?>
 <service-logic xmlns="http://www.onap.org/sdnc/svclogic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module="CONFIG" version="1.0.0">
    <method rpc="ResourceAssignAndActivate" mode="sync">
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfAssignConfig.kts
deleted file mode 100644 (file)
index a099036..0000000
+++ /dev/null
@@ -1 +0,0 @@
-TBD
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/RestconfConfigure.kts
deleted file mode 100644 (file)
index a099036..0000000
+++ /dev/null
@@ -1 +0,0 @@
-TBD
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfAssignConfig.py
new file mode 100644 (file)
index 0000000..36dd32f
--- /dev/null
@@ -0,0 +1,38 @@
+# ============LICENSE_START=======================================================
+#  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
+#
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+
+from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \
+    RestconfComponentFunction
+
+
+class RestconfAssignConfig(RestconfComponentFunction):
+
+
+    def process(self, execution_request):
+        # create instances of the needed objects
+        # retrieve any needed information not present on the request, like pnf ip
+        # create the configlet
+        # persist the configlet
+        # end
+        print("process", execution_request)
+
+
+    def recover(self, runtime_exception, execution_request):
+        print("recover")
+        return None
\ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py b/components/model-catalog/blueprint-model/test-blueprint/capability_restconf/Scripts/python/RestconfConfigure.py
new file mode 100644 (file)
index 0000000..c584baa
--- /dev/null
@@ -0,0 +1,38 @@
+# ============LICENSE_START=======================================================
+#  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
+#
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+
+from org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import \
+    RestconfComponentFunction
+
+
+class RestconfConfigure(RestconfComponentFunction):
+
+
+    def process(self, execution_request):
+        # create instances of the needed objects
+        # retrieve any needed information not present on the request, like pnf ip
+        # retrieve the configlet
+        # send the configlet
+        # end
+        print("process", execution_request)
+
+
+    def recover(self, runtime_exception, execution_request):
+        print("recover")
+        return None
index 85533ab..41b42e6 100644 (file)
@@ -1,16 +1,3 @@
-<!-- QUESTION:
-     when using dictionary-source as capability, what else needs to be defined?
-     because odl_host will come from the application.properties entry -->
 [
-  {
-    "name": "odl_host",
-    "input-param": true,
-    "property": {
-      "type": "string"
-    },
-    "dictionary-name": "odl_host",
-    "dictionary-source": "capability",
-    "dependencies": [
-    ]
-  }
+
 ]
index 123680c..41b42e6 100644 (file)
@@ -1,38 +1,3 @@
-<!-- QUESTION:
-     when using dictionary-source as capability, what else needs to be defined?
-     because these variables will be obtained based on the pnf_id -->
 [
-  {
-    "name": "pnf_id",
-    "input-param": true,
-    "property": {
-      "type": "string"
-    },
-    "dictionary-name": "pnf_id",
-    "dictionary-source": "capability",
-    "dependencies": [
-    ]
-  },
-  {
-    "name": "pnf_ip",
-    "input-param": true,
-    "property": {
-      "type": "string"
-    },
-    "dictionary-name": "pnf_ip",
-    "dictionary-source": "capability",
-    "dependencies": [
-    ]
-  },
-  {
-    "name": "pnf_ip_port",
-    "input-param": true,
-    "property": {
-      "type": "string"
-    },
-    "dictionary-name": "pnf_ip_port",
-    "dictionary-source": "capability",
-    "dependencies": [
-    ]
-  }
+
 ]
index 17f7a36..a899aa4 100644 (file)
@@ -1,14 +1,14 @@
 <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
-    <node-id>$pnf_id</node-id>
+    <node-id>$pnf-id</node-id>
     <key-based xmlns="urn:opendaylight:netconf-node-topology">
         <key-id xmlns="urn:opendaylight:netconf-node-topology">ODL-private-key</key-id>
         <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username>
      </key-based>
-    <host xmlns="urn:opendaylight:netconf-node-topology">$pnf_ip</host>
-    <port xmlns="urn:opendaylight:netconf-node-topology">$pnf_ip_port</port>
+    <host xmlns="urn:opendaylight:netconf-node-topology">$pnf-ip</host>
+    <port xmlns="urn:opendaylight:netconf-node-topology">6513</port>
     <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
        <protocol xmlns="urn:opendaylight:netconf-node-topology">
         <name xmlns="urn:opendaylight:netconf-node-topology">TLS</name>
     </protocol>
-    <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">2</max-connection-attempts>
+    <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">5</max-connection-attempts>
 </node>