CLAMP-CDS integration to display all CDS actions for blueprint in CL

CLAMP-CDS integration to display all CDS actions for blueprint in CL

Change-Id: I18b972b8952e5de9ac8e39d6c9cc4ecba0ec9b02
Issue-ID: CLAMP-491
Signed-off-by: Vidyashree-Huawei <vidyashree.rama@huawei.com>
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 695319d..3abbcd5 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -223,3 +223,8 @@
 
 ## Tosca converter
 clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.properties
+
+# Configuration settings for CDS
+clamp.config.cds.url=http4://blueprints-processor-http:8080
+clamp.config.cds.userName=ccsdkapps
+clamp.config.cds.password=ccsdkapps
\ No newline at end of file
diff --git a/src/main/resources/clds/camel/routes/cds-flows.xml b/src/main/resources/clds/camel/routes/cds-flows.xml
new file mode 100644
index 0000000..5c10a0c
--- /dev/null
+++ b/src/main/resources/clds/camel/routes/cds-flows.xml
@@ -0,0 +1,46 @@
+<routes xmlns="http://camel.apache.org/schema/spring">
+    <route id="get-blueprint-workflow-list">
+        <from uri="direct:get-blueprint-workflow-list"/>
+        <log loggingLevel="INFO"
+             message="Getting blueprint workflow list from CDS"/>
+        <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('CDS', 'Getting workflow list from CDS')"/>
+        <doTry>
+            <setHeader headerName="CamelHttpMethod">
+                <constant>GET</constant>
+            </setHeader>
+            <setHeader headerName="Content-Type">
+                <constant>application/json</constant>
+            </setHeader>
+            <log loggingLevel="INFO"
+                 message="Endpoint to query workflows from CDS : {{clamp.config.cds.url}}/api/v1/blueprint-model/workflows/blueprint-name/${exchangeProperty[blueprintName]}/version/${exchangeProperty[blueprintVersion]}"></log>
+            <toD uri="{{clamp.config.cds.url}}/api/v1/blueprint-model/workflows/blueprint-name/${exchangeProperty[blueprintName]}/version/${exchangeProperty[blueprintVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.cds.userName}}&amp;authPassword={{clamp.config.cds.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+            <convertBodyTo type="java.lang.String"/>
+            <doFinally>
+                <to uri="direct:reset-raise-http-exception-flag"/>
+                <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+            </doFinally>
+        </doTry>
+    </route>
+    <route id="get-blueprint-workflow-input-properties">
+        <from uri="direct:get-blueprint-workflow-input-properties"/>
+        <log loggingLevel="INFO"
+             message="Getting blueprint input properties for workflow"/>
+        <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('CDS', 'Getting input properties for workflow')"/>
+        <doTry>
+            <setHeader headerName="CamelHttpMethod">
+                <constant>POST</constant>
+            </setHeader>
+            <setHeader headerName="Content-Type">
+                <constant>application/json</constant>
+            </setHeader>
+            <log loggingLevel="INFO"
+                 message="Endpoint to query input properties for workflow from CDS : {{clamp.config.cds.url}}/api/v1/blueprint-model/workflow-spec"></log>
+            <toD uri="{{clamp.config.cds.url}}/api/v1/blueprint-model/workflow-spec?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.cds.userName}}&amp;authPassword={{clamp.config.cds.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+            <convertBodyTo type="java.lang.String"/>
+            <doFinally>
+                <to uri="direct:reset-raise-http-exception-flag"/>
+                <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+            </doFinally>
+        </doTry>
+    </route>
+</routes>
\ No newline at end of file
diff --git a/src/main/resources/clds/json-schema/operational_policies/operational_policy.json b/src/main/resources/clds/json-schema/operational_policies/operational_policy.json
index 93738c8..ef22e81 100644
--- a/src/main/resources/clds/json-schema/operational_policies/operational_policy.json
+++ b/src/main/resources/clds/json-schema/operational_policies/operational_policy.json
@@ -87,7 +87,6 @@
                                         "basicCategoryTitle": "recipe",
                                         "required": [
                                             "id",
-                                            "recipe",
                                             "retry",
                                             "timeout",
                                             "actor",
@@ -105,20 +104,6 @@
                                                 "title": "Policy ID",
                                                 "type": "string"
                                             },
-                                            "recipe": {
-                                                "title": "Recipe",
-                                                "type": "string",
-                                                "enum": [
-                                                    "Restart",
-                                                    "Rebuild",
-                                                    "Migrate",
-                                                    "Health-Check",
-                                                    "ModifyConfig",
-                                                    "VF Module Create",
-                                                    "VF Module Delete",
-                                                    "Reroute"
-                                                ]
-                                            },
                                             "retry": {
                                                 "default": "0",
                                                 "title": "Number of Retry",
@@ -132,21 +117,157 @@
                                                 "format": "number"
                                             },
                                             "actor": {
+                                                "type": "object",
                                                 "title": "Actor",
-                                                "type": "string",
-                                                "enum": [
-                                                    "APPC",
-                                                    "SO",
-                                                    "VFC",
-                                                    "SDNC",
-                                                    "SDNR"
+                                                "anyOf": [
+                                                    {
+                                                        "title": "APPC",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "APPC",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "Restart",
+                                                                    "Rebuild",
+                                                                    "Migrate",
+                                                                    "Health-Check",
+                                                                    "ModifyConfig"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "SO",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "SO",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "VF Module Create",
+                                                                    "VF Module Delete"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "SDNC",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "SDNC",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "Reroute",
+                                                                    "BandwidthOnDemand"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "VFC",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "VFC",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "required": [
+                                                                    "payload"
+                                                                ],
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "ModifyConfig"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "CDS",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "CDS",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "object",
+                                                                "required": [
+                                                                    "payload"
+                                                                ],
+                                                                "anyOf": [
+                                                                    {
+                                                                        "title": "user-defined",
+                                                                        "properties": {
+                                                                            "type": {
+                                                                                "title": "Payload (YAML)",
+                                                                                "type": "string",
+                                                                                "default" : "",
+                                                                                "format" : "textarea"
+                                                                            }
+                                                                        }
+                                                                    }
+                                                                ]
+                                                            }
+                                                        }
+                                                    }
                                                 ]
                                             },
-                                            "payload": {
-                                                "title": "Payload (YAML)",
-                                                "type": "string",
-                                                "format": "textarea"
-                                            },
                                             "success": {
                                                 "default": "final_success",
                                                 "title": "When Success",
@@ -186,7 +307,7 @@
                                                 "anyOf": [
                                                     {
                                                         "title": "User Defined",
-                                                        "additionalProperties":"True",
+                                                        "additionalProperties": "True",
                                                         "properties": {
                                                             "type": {
                                                                 "title": "Target type",