From 2dd4e997c1ccf5dab4dfb7665ce74c0fd1f13e49 Mon Sep 17 00:00:00 2001 From: sebdet Date: Wed, 4 Mar 2020 15:47:39 -0800 Subject: [PATCH] Rework tosca converter New code to convert the Policy Tosca Yaml to Json Schema for the Clamp UI Issue-ID: CLAMP-647 Signed-off-by: sebdet Change-Id: Id15ddedc1910f6a40bf6e407b34e343e00135571 --- docs/swagger/swagger.json | 380 ++++++++++----------- docs/swagger/swagger.pdf | 106 +++--- extra/sql/dump/test-data.sql | 30 +- pom.xml | 1 + .../onap/clamp/clds/tosca/update/Extractor.java | 18 +- .../onap/clamp/clds/tosca/update/ParserToJson.java | 72 +++- .../clds/tosca/update/TemplateManagement.java | 7 +- src/main/java/org/onap/clamp/policy/Policy.java | 23 +- .../policy/microservice/MicroServicePolicy.java | 19 +- .../policy/operational/OperationalPolicy.java | 16 +- src/main/resources/META-INF/resources/swagger.html | 94 ++--- .../clds/tosca_update/defaultToscaTypes.yaml | 87 +++++ .../clamp/clds/tosca/update/ArrayFieldTest.java | 3 +- .../clamp/clds/tosca/update/ComponentTest.java | 1 + .../clamp/clds/tosca/update/ConstraintTest.java | 3 +- .../onap/clamp/clds/tosca/update/PropertyTest.java | 2 + .../clds/tosca/update/TemplateManagementTest.java | 85 +++++ .../PolicyEngineControllerTestItCase.java | 14 +- .../.file | 10 +- .../1.0.0?connectionTimeToLive=5000/.file | 40 --- .../1.0.0?connectionTimeToLive=5000/.file | 50 --- .../1.0.0?connectionTimeToLive=5000/.file | 44 --- .../1.0.0?connectionTimeToLive=5000/.file | 38 +++ .../1.0.0?connectionTimeToLive=5000/.header | 0 .../1.0.0?connectionTimeToLive=5000/.file | 47 +++ .../1.0.0?connectionTimeToLive=5000/.header | 0 .../2.0.0?connectionTimeToLive=5000/.file | 40 +++ .../2.0.0?connectionTimeToLive=5000}/.header | 0 .../1.0.0?connectionTimeToLive=5000/.file | 158 +++++++++ .../1.0.0?connectionTimeToLive=5000/.header | 1 + .../1.0.0?connectionTimeToLive=5000/.file | 146 ++++++++ .../1.0.0?connectionTimeToLive=5000/.header | 1 + .../1.0.0?connectionTimeToLive=5000/.file | 7 +- .../v1/pdps?connectionTimeToLive=5000/.file | 6 +- .../resources/tosca/new-converter/tca-schema.json | 175 ++++++++++ src/test/resources/tosca/templates.properties | 7 - ui-react/src/api/LoopCache.js | 16 +- .../ConfigurationPolicyModal.js | 23 +- .../ConfigurationPolicyModal.test.js | 1 - .../OperationalPolicy/OperationalPolicyModal.js | 30 +- .../src/components/dialogs/Policy/PolicyModal.js | 83 +++-- 41 files changed, 1307 insertions(+), 577 deletions(-) create mode 100644 src/main/resources/clds/tosca_update/defaultToscaTypes.yaml delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file delete mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file rename src/test/resources/http-cache/example/policy/api/v1/policytypes/{onap.policies.controlloop.guard.Blacklist => onap.policies.controlloop.guard.common.Blacklist}/versions/1.0.0?connectionTimeToLive=5000/.header (100%) create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file rename src/test/resources/http-cache/example/policy/api/v1/policytypes/{onap.policies.controlloop.guard.FrequencyLimiter => onap.policies.controlloop.guard.common.FrequencyLimiter}/versions/1.0.0?connectionTimeToLive=5000/.header (100%) create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file rename src/test/resources/http-cache/example/policy/api/v1/policytypes/{onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000 => onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000}/.header (100%) create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header create mode 100644 src/test/resources/tosca/new-converter/tca-schema.json delete mode 100644 src/test/resources/tosca/templates.properties diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index d9a0b827..e35fba27 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -4,13 +4,13 @@ "version" : "5.0.0-SNAPSHOT", "title" : "Clamp Rest API" }, - "host" : "localhost:39099", + "host" : "localhost:40597", "basePath" : "/restservices/clds/", "schemes" : [ "http" ], "paths" : { "/v2/dictionary" : { "get" : { - "operationId" : "route49", + "operationId" : "route80", "produces" : [ "application/json" ], "responses" : { "200" : { @@ -20,11 +20,11 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route49" + "x-camelContextId" : "camel-3", + "x-routeId" : "route80" }, "put" : { - "operationId" : "route51", + "operationId" : "route82", "consumes" : [ "application/json" ], "produces" : [ "application/json" ], "parameters" : [ { @@ -43,8 +43,8 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route51" + "x-camelContextId" : "camel-3", + "x-routeId" : "route82" } }, "/v2/dictionary/{dictionaryName}" : { @@ -64,7 +64,7 @@ } } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null } }, @@ -93,11 +93,11 @@ } } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null }, "delete" : { - "operationId" : "route53", + "operationId" : "route84", "produces" : [ "application/json" ], "parameters" : [ { "name" : "name", @@ -108,8 +108,8 @@ "responses" : { "200" : { } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route53" + "x-camelContextId" : "camel-3", + "x-routeId" : "route84" } }, "/v2/dictionary/{name}/elements/{shortName}" : { @@ -129,7 +129,7 @@ "responses" : { "200" : { } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null } }, @@ -147,13 +147,13 @@ } } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null } }, "/v2/loop/{loopName}" : { "get" : { - "operationId" : "route34", + "operationId" : "route65", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -169,13 +169,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route34" + "x-camelContextId" : "camel-3", + "x-routeId" : "route65" } }, "/v2/loop/delete/{loopName}" : { "put" : { - "operationId" : "route45", + "operationId" : "route76", "parameters" : [ { "name" : "loopName", "in" : "path", @@ -185,13 +185,13 @@ "responses" : { "200" : { } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route45" + "x-camelContextId" : "camel-3", + "x-routeId" : "route76" } }, "/v2/loop/deploy/{loopName}" : { "put" : { - "operationId" : "route39", + "operationId" : "route70", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -207,13 +207,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route39" + "x-camelContextId" : "camel-3", + "x-routeId" : "route70" } }, "/v2/loop/getAllNames" : { "get" : { - "operationId" : "route33", + "operationId" : "route64", "produces" : [ "application/json" ], "responses" : { "200" : { @@ -226,13 +226,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route33" + "x-camelContextId" : "camel-3", + "x-routeId" : "route64" } }, "/v2/loop/getstatus/{loopName}" : { "get" : { - "operationId" : "route46", + "operationId" : "route77", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -248,13 +248,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route46" + "x-camelContextId" : "camel-3", + "x-routeId" : "route77" } }, "/v2/loop/refreshOpPolicyJsonSchema/{loopName}" : { "put" : { - "operationId" : "route40", + "operationId" : "route71", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -270,13 +270,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route40" + "x-camelContextId" : "camel-3", + "x-routeId" : "route71" } }, "/v2/loop/restart/{loopName}" : { "put" : { - "operationId" : "route43", + "operationId" : "route74", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -292,13 +292,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route43" + "x-camelContextId" : "camel-3", + "x-routeId" : "route74" } }, "/v2/loop/stop/{loopName}" : { "put" : { - "operationId" : "route42", + "operationId" : "route73", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -314,13 +314,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route42" + "x-camelContextId" : "camel-3", + "x-routeId" : "route73" } }, "/v2/loop/submit/{loopName}" : { "put" : { - "operationId" : "route44", + "operationId" : "route75", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -336,13 +336,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route44" + "x-camelContextId" : "camel-3", + "x-routeId" : "route75" } }, "/v2/loop/svgRepresentation/{loopName}" : { "get" : { - "operationId" : "route35", + "operationId" : "route66", "produces" : [ "application/xml" ], "parameters" : [ { "name" : "loopName", @@ -358,13 +358,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route35" + "x-camelContextId" : "camel-3", + "x-routeId" : "route66" } }, "/v2/loop/undeploy/{loopName}" : { "put" : { - "operationId" : "route41", + "operationId" : "route72", "produces" : [ "application/json" ], "parameters" : [ { "name" : "loopName", @@ -380,13 +380,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route41" + "x-camelContextId" : "camel-3", + "x-routeId" : "route72" } }, "/v2/loop/updateGlobalProperties/{loopName}" : { "post" : { - "operationId" : "route36", + "operationId" : "route67", "consumes" : [ "application/json" ], "produces" : [ "application/json" ], "parameters" : [ { @@ -410,13 +410,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route36" + "x-camelContextId" : "camel-3", + "x-routeId" : "route67" } }, "/v2/loop/updateMicroservicePolicy/{loopName}" : { "post" : { - "operationId" : "route38", + "operationId" : "route69", "consumes" : [ "application/json" ], "produces" : [ "application/json" ], "parameters" : [ { @@ -440,13 +440,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route38" + "x-camelContextId" : "camel-3", + "x-routeId" : "route69" } }, "/v2/loop/updateOperationalPolicies/{loopName}" : { "post" : { - "operationId" : "route37", + "operationId" : "route68", "consumes" : [ "application/json" ], "produces" : [ "application/json" ], "parameters" : [ { @@ -470,13 +470,13 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route37" + "x-camelContextId" : "camel-3", + "x-routeId" : "route68" } }, "/v2/policyToscaModels" : { "get" : { - "operationId" : "route56", + "operationId" : "route87", "produces" : [ "application/json" ], "responses" : { "200" : { @@ -486,8 +486,8 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route56" + "x-camelContextId" : "camel-3", + "x-routeId" : "route87" } }, "/v2/policyToscaModels/{policyModelType}" : { @@ -507,11 +507,11 @@ } } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null }, "put" : { - "operationId" : "route57", + "operationId" : "route88", "consumes" : [ "plain/text" ], "produces" : [ "application/json" ], "parameters" : [ { @@ -535,8 +535,8 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route57" + "x-camelContextId" : "camel-3", + "x-routeId" : "route88" } }, "/v2/policyToscaModels/yaml/{policyModelType}" : { @@ -556,13 +556,13 @@ } } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null } }, "/v2/templates" : { "get" : { - "operationId" : "route60", + "operationId" : "route91", "produces" : [ "application/json" ], "responses" : { "200" : { @@ -572,8 +572,8 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route60" + "x-camelContextId" : "camel-3", + "x-routeId" : "route91" } }, "/v2/templates/{templateName}" : { @@ -593,7 +593,7 @@ } } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null } }, @@ -611,13 +611,13 @@ } } }, - "x-camelContextId" : "camel-2", + "x-camelContextId" : "camel-3", "x-routeId" : null } }, "/v1/healthcheck" : { "get" : { - "operationId" : "route61", + "operationId" : "route92", "produces" : [ "application/json" ], "responses" : { "200" : { @@ -627,19 +627,19 @@ } } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route61" + "x-camelContextId" : "camel-3", + "x-routeId" : "route92" } }, "/v1/user/getUser" : { "get" : { - "operationId" : "route62", + "operationId" : "route93", "produces" : [ "text/plain" ], "responses" : { "200" : { } }, - "x-camelContextId" : "camel-2", - "x-routeId" : "route62" + "x-camelContextId" : "camel-3", + "x-routeId" : "route93" } } }, @@ -803,31 +803,34 @@ "JsonPrimitive" : { "type" : "object", "properties" : { - "asInt" : { - "type" : "integer", - "format" : "int32" - }, - "asDouble" : { - "type" : "number", - "format" : "double" - }, - "asLong" : { - "type" : "integer", - "format" : "int64" - }, - "boolean" : { + "asBoolean" : { "type" : "boolean" }, - "asBoolean" : { + "number" : { "type" : "boolean" }, + "asString" : { + "type" : "string" + }, "asNumber" : { "$ref" : "#/definitions/Number" }, + "asDouble" : { + "type" : "number", + "format" : "double" + }, "asFloat" : { "type" : "number", "format" : "float" }, + "asLong" : { + "type" : "integer", + "format" : "int64" + }, + "asInt" : { + "type" : "integer", + "format" : "int32" + }, "asByte" : { "type" : "string", "format" : "byte" @@ -845,27 +848,21 @@ "type" : "integer", "format" : "int32" }, - "number" : { + "boolean" : { "type" : "boolean" }, - "asString" : { - "type" : "string" - }, "string" : { "type" : "boolean" }, - "asJsonNull" : { - "$ref" : "#/definitions/JsonNull" - }, "jsonObject" : { "type" : "boolean" }, - "asJsonObject" : { - "$ref" : "#/definitions/JsonObject" - }, "asJsonArray" : { "$ref" : "#/definitions/JsonArray" }, + "asJsonObject" : { + "$ref" : "#/definitions/JsonObject" + }, "jsonArray" : { "type" : "boolean" }, @@ -877,6 +874,9 @@ }, "asJsonPrimitive" : { "$ref" : "#/definitions/JsonPrimitive" + }, + "asJsonNull" : { + "$ref" : "#/definitions/JsonNull" } } }, @@ -909,7 +909,7 @@ "pdpGroup" : { "type" : "string" }, - "pdpSubGroup" : { + "pdpSubgroup" : { "type" : "string" }, "policyModel" : { @@ -952,31 +952,55 @@ "JsonObject" : { "type" : "object", "properties" : { - "asInt" : { - "type" : "integer", - "format" : "int32" + "asBoolean" : { + "type" : "boolean" }, - "asDouble" : { - "type" : "number", - "format" : "double" + "jsonObject" : { + "type" : "boolean" }, - "asLong" : { - "type" : "integer", - "format" : "int64" + "asJsonArray" : { + "$ref" : "#/definitions/JsonArray" }, - "asBoolean" : { + "asJsonObject" : { + "$ref" : "#/definitions/JsonObject" + }, + "asString" : { + "type" : "string" + }, + "jsonArray" : { "type" : "boolean" }, + "jsonPrimitive" : { + "type" : "boolean" + }, + "jsonNull" : { + "type" : "boolean" + }, + "asJsonPrimitive" : { + "$ref" : "#/definitions/JsonPrimitive" + }, "asJsonNull" : { "$ref" : "#/definitions/JsonNull" }, "asNumber" : { "$ref" : "#/definitions/Number" }, + "asDouble" : { + "type" : "number", + "format" : "double" + }, "asFloat" : { "type" : "number", "format" : "float" }, + "asLong" : { + "type" : "integer", + "format" : "int64" + }, + "asInt" : { + "type" : "integer", + "format" : "int32" + }, "asByte" : { "type" : "string", "format" : "byte" @@ -993,30 +1017,6 @@ "asShort" : { "type" : "integer", "format" : "int32" - }, - "jsonObject" : { - "type" : "boolean" - }, - "asJsonObject" : { - "$ref" : "#/definitions/JsonObject" - }, - "asString" : { - "type" : "string" - }, - "asJsonArray" : { - "$ref" : "#/definitions/JsonArray" - }, - "jsonArray" : { - "type" : "boolean" - }, - "jsonPrimitive" : { - "type" : "boolean" - }, - "jsonNull" : { - "type" : "boolean" - }, - "asJsonPrimitive" : { - "$ref" : "#/definitions/JsonPrimitive" } }, "x-className" : { @@ -1133,7 +1133,7 @@ "pdpGroup" : { "type" : "string" }, - "pdpSubGroup" : { + "pdpSubgroup" : { "type" : "string" }, "policyModel" : { @@ -1153,31 +1153,55 @@ "JsonNull" : { "type" : "object", "properties" : { - "asInt" : { - "type" : "integer", - "format" : "int32" + "asBoolean" : { + "type" : "boolean" }, - "asDouble" : { - "type" : "number", - "format" : "double" + "jsonObject" : { + "type" : "boolean" }, - "asLong" : { - "type" : "integer", - "format" : "int64" + "asJsonArray" : { + "$ref" : "#/definitions/JsonArray" }, - "asBoolean" : { + "asJsonObject" : { + "$ref" : "#/definitions/JsonObject" + }, + "asString" : { + "type" : "string" + }, + "jsonArray" : { + "type" : "boolean" + }, + "jsonPrimitive" : { "type" : "boolean" }, + "jsonNull" : { + "type" : "boolean" + }, + "asJsonPrimitive" : { + "$ref" : "#/definitions/JsonPrimitive" + }, "asJsonNull" : { "$ref" : "#/definitions/JsonNull" }, "asNumber" : { "$ref" : "#/definitions/Number" }, + "asDouble" : { + "type" : "number", + "format" : "double" + }, "asFloat" : { "type" : "number", "format" : "float" }, + "asLong" : { + "type" : "integer", + "format" : "int64" + }, + "asInt" : { + "type" : "integer", + "format" : "int32" + }, "asByte" : { "type" : "string", "format" : "byte" @@ -1194,58 +1218,37 @@ "asShort" : { "type" : "integer", "format" : "int32" - }, - "jsonObject" : { - "type" : "boolean" - }, - "asJsonObject" : { - "$ref" : "#/definitions/JsonObject" - }, - "asString" : { - "type" : "string" - }, - "asJsonArray" : { - "$ref" : "#/definitions/JsonArray" - }, - "jsonArray" : { - "type" : "boolean" - }, - "jsonPrimitive" : { - "type" : "boolean" - }, - "jsonNull" : { - "type" : "boolean" - }, - "asJsonPrimitive" : { - "$ref" : "#/definitions/JsonPrimitive" } } }, "JsonArray" : { "type" : "object", "properties" : { - "asInt" : { - "type" : "integer", - "format" : "int32" - }, - "asDouble" : { - "type" : "number", - "format" : "double" - }, - "asLong" : { - "type" : "integer", - "format" : "int64" - }, "asBoolean" : { "type" : "boolean" }, + "asString" : { + "type" : "string" + }, "asNumber" : { "$ref" : "#/definitions/Number" }, + "asDouble" : { + "type" : "number", + "format" : "double" + }, "asFloat" : { "type" : "number", "format" : "float" }, + "asLong" : { + "type" : "integer", + "format" : "int64" + }, + "asInt" : { + "type" : "integer", + "format" : "int32" + }, "asByte" : { "type" : "string", "format" : "byte" @@ -1263,21 +1266,15 @@ "type" : "integer", "format" : "int32" }, - "asString" : { - "type" : "string" - }, - "asJsonNull" : { - "$ref" : "#/definitions/JsonNull" - }, "jsonObject" : { "type" : "boolean" }, - "asJsonObject" : { - "$ref" : "#/definitions/JsonObject" - }, "asJsonArray" : { "$ref" : "#/definitions/JsonArray" }, + "asJsonObject" : { + "$ref" : "#/definitions/JsonObject" + }, "jsonArray" : { "type" : "boolean" }, @@ -1289,6 +1286,9 @@ }, "asJsonPrimitive" : { "$ref" : "#/definitions/JsonPrimitive" + }, + "asJsonNull" : { + "$ref" : "#/definitions/JsonNull" } }, "x-className" : { diff --git a/docs/swagger/swagger.pdf b/docs/swagger/swagger.pdf index d992107e..b97c2cfd 100644 --- a/docs/swagger/swagger.pdf +++ b/docs/swagger/swagger.pdf @@ -4,8 +4,8 @@ << /Title (Clamp Rest API) /Creator (Asciidoctor PDF 1.5.0.alpha.10, based on Prawn 1.3.0) /Producer (Asciidoctor PDF 1.5.0.alpha.10, based on Prawn 1.3.0) -/CreationDate (D:20200302132601-08'00') -/ModDate (D:20200302132601-08'00') +/CreationDate (D:20200309090008-07'00') +/ModDate (D:20200309090008-07'00') >> endobj 2 0 obj @@ -5910,7 +5910,7 @@ ET BT 71.30850000000001 592.176 Td /F1.0 10.5 Tf -<203a206c6f63616c686f73743a3339303939> Tj +<203a206c6f63616c686f73743a3430353937> Tj ET 0.000 0.000 0.000 SCN @@ -10857,8 +10857,8 @@ endobj [72 0 R /XYZ 0 108.12000000000052 null] endobj 82 0 obj -<< /Limits [(_route46) (_version_information)] -/Names [(_route46) 94 0 R (_route49) 37 0 R (_route51) 41 0 R (_route53) 69 0 R (_route56) 169 0 R (_route57) 184 0 R (_route60) 193 0 R (_route61) 29 0 R (_route62) 34 0 R (_service) 303 0 R (_uri_scheme) 25 0 R (_v2_dictionary_dictionaryname_get) 55 0 R (_v2_dictionary_name_elements_shortname_delete) 75 0 R (_v2_dictionary_name_put) 62 0 R (_v2_dictionary_secondary_names_get) 50 0 R (_v2_policytoscamodels_policymodeltype_get) 179 0 R (_v2_policytoscamodels_yaml_policymodeltype_get) 173 0 R (_v2_templates_names_get) 198 0 R (_v2_templates_templatename_get) 201 0 R (_version_information) 23 0 R] +<< /Limits [(_route77) (_version_information)] +/Names [(_route77) 94 0 R (_route80) 37 0 R (_route82) 41 0 R (_route84) 69 0 R (_route87) 169 0 R (_route88) 184 0 R (_route91) 193 0 R (_route92) 29 0 R (_route93) 34 0 R (_service) 303 0 R (_uri_scheme) 25 0 R (_v2_dictionary_dictionaryname_get) 55 0 R (_v2_dictionary_name_elements_shortname_delete) 75 0 R (_v2_dictionary_name_put) 62 0 R (_v2_dictionary_secondary_names_get) 50 0 R (_v2_policytoscamodels_policymodeltype_get) 179 0 R (_v2_policytoscamodels_yaml_policymodeltype_get) 173 0 R (_v2_templates_names_get) 198 0 R (_v2_templates_templatename_get) 201 0 R (_version_information) 23 0 R] >> endobj 83 0 obj @@ -14929,8 +14929,8 @@ endobj [110 0 R /XYZ 0 481.68000000000046 null] endobj 116 0 obj -<< /Limits [(_responses_5) (_route45)] -/Names [(_responses_5) 51 0 R (_responses_6) 59 0 R (_responses_7) 65 0 R (_responses_8) 73 0 R (_responses_9) 77 0 R (_route33) 91 0 R (_route34) 162 0 R (_route35) 126 0 R (_route36) 138 0 R (_route37) 154 0 R (_route38) 145 0 R (_route39) 85 0 R (_route40) 101 0 R (_route41) 131 0 R (_route42) 113 0 R (_route43) 106 0 R (_route44) 119 0 R (_route45) 79 0 R] +<< /Limits [(_responses_5) (_route76)] +/Names [(_responses_5) 51 0 R (_responses_6) 59 0 R (_responses_7) 65 0 R (_responses_8) 73 0 R (_responses_9) 77 0 R (_route64) 91 0 R (_route65) 162 0 R (_route66) 126 0 R (_route67) 138 0 R (_route68) 154 0 R (_route69) 145 0 R (_route70) 85 0 R (_route71) 101 0 R (_route72) 131 0 R (_route73) 113 0 R (_route74) 106 0 R (_route75) 119 0 R (_route76) 79 0 R] >> endobj 117 0 obj @@ -41690,7 +41690,7 @@ S BT 51.24 603.7930000000001 Td /F2.0 10.5 Tf -<70647053756247726f7570> Tj +<70647053756267726f7570> Tj ET @@ -43379,7 +43379,7 @@ S BT 51.24 566.233 Td /F2.0 10.5 Tf -<70647053756247726f7570> Tj +<70647053756267726f7570> Tj ET @@ -45551,7 +45551,7 @@ endobj endobj 314 0 obj << /Border [0 0 0] -/Dest (_route61) +/Dest (_route92) /Subtype /Link /Rect [60.24000000000001 621.7799999999997 181.64100000000002 636.0599999999998] /Type /Annot @@ -45559,7 +45559,7 @@ endobj endobj 315 0 obj << /Border [0 0 0] -/Dest (_route61) +/Dest (_route92) /Subtype /Link /Rect [557.8905 621.7799999999997 563.76 636.0599999999998] /Type /Annot @@ -45599,7 +45599,7 @@ endobj endobj 320 0 obj << /Border [0 0 0] -/Dest (_route62) +/Dest (_route93) /Subtype /Link /Rect [60.24000000000001 566.3399999999997 183.8775 580.6199999999998] /Type /Annot @@ -45607,7 +45607,7 @@ endobj endobj 321 0 obj << /Border [0 0 0] -/Dest (_route62) +/Dest (_route93) /Subtype /Link /Rect [557.8905 566.3399999999997 563.76 580.6199999999998] /Type /Annot @@ -45647,7 +45647,7 @@ endobj endobj 326 0 obj << /Border [0 0 0] -/Dest (_route49) +/Dest (_route80) /Subtype /Link /Rect [60.24000000000001 510.89999999999975 172.716 525.1799999999997] /Type /Annot @@ -45655,7 +45655,7 @@ endobj endobj 327 0 obj << /Border [0 0 0] -/Dest (_route49) +/Dest (_route80) /Subtype /Link /Rect [557.8905 510.89999999999975 563.76 525.1799999999997] /Type /Annot @@ -45695,7 +45695,7 @@ endobj endobj 332 0 obj << /Border [0 0 0] -/Dest (_route51) +/Dest (_route82) /Subtype /Link /Rect [60.24000000000001 455.4599999999997 172.548 469.73999999999967] /Type /Annot @@ -45703,7 +45703,7 @@ endobj endobj 333 0 obj << /Border [0 0 0] -/Dest (_route51) +/Dest (_route82) /Subtype /Link /Rect [557.8905 455.4599999999997 563.76 469.73999999999967] /Type /Annot @@ -45967,7 +45967,7 @@ endobj endobj 366 0 obj << /Border [0 0 0] -/Dest (_route53) +/Dest (_route84) /Subtype /Link /Rect [60.24000000000001 141.29999999999953 232.70250000000001 155.57999999999953] /Type /Annot @@ -45975,7 +45975,7 @@ endobj endobj 367 0 obj << /Border [0 0 0] -/Dest (_route53) +/Dest (_route84) /Subtype /Link /Rect [557.8905 141.29999999999953 563.76 155.57999999999953] /Type /Annot @@ -46095,7 +46095,7 @@ endobj endobj 382 0 obj << /Border [0 0 0] -/Dest (_route45) +/Dest (_route76) /Subtype /Link /Rect [60.24000000000001 704.7599999999999 245.15550000000002 719.04] /Type /Annot @@ -46103,7 +46103,7 @@ endobj endobj 383 0 obj << /Border [0 0 0] -/Dest (_route45) +/Dest (_route76) /Subtype /Link /Rect [557.8905 704.7599999999999 563.76 719.04] /Type /Annot @@ -46143,7 +46143,7 @@ endobj endobj 388 0 obj << /Border [0 0 0] -/Dest (_route39) +/Dest (_route70) /Subtype /Link /Rect [60.24000000000001 649.3199999999998 248.431294921875 663.5999999999999] /Type /Annot @@ -46151,7 +46151,7 @@ endobj endobj 389 0 obj << /Border [0 0 0] -/Dest (_route39) +/Dest (_route70) /Subtype /Link /Rect [557.8905 649.3199999999998 563.76 663.5999999999999] /Type /Annot @@ -46207,7 +46207,7 @@ endobj endobj 396 0 obj << /Border [0 0 0] -/Dest (_route33) +/Dest (_route64) /Subtype /Link /Rect [60.24000000000001 575.3999999999997 214.8735 589.6799999999998] /Type /Annot @@ -46215,7 +46215,7 @@ endobj endobj 397 0 obj << /Border [0 0 0] -/Dest (_route33) +/Dest (_route64) /Subtype /Link /Rect [557.8905 575.3999999999997 563.76 589.6799999999998] /Type /Annot @@ -46255,7 +46255,7 @@ endobj endobj 402 0 obj << /Border [0 0 0] -/Dest (_route46) +/Dest (_route77) /Subtype /Link /Rect [60.24000000000001 519.9599999999998 259.467 534.2399999999998] /Type /Annot @@ -46263,7 +46263,7 @@ endobj endobj 403 0 obj << /Border [0 0 0] -/Dest (_route46) +/Dest (_route77) /Subtype /Link /Rect [557.8905 519.9599999999998 563.76 534.2399999999998] /Type /Annot @@ -46319,7 +46319,7 @@ endobj endobj 410 0 obj << /Border [0 0 0] -/Dest (_route40) +/Dest (_route71) /Subtype /Link /Rect [60.24000000000001 446.03999999999974 355.8885 460.3199999999997] /Type /Annot @@ -46327,7 +46327,7 @@ endobj endobj 411 0 obj << /Border [0 0 0] -/Dest (_route40) +/Dest (_route71) /Subtype /Link /Rect [557.8905 446.03999999999974 563.76 460.3199999999997] /Type /Annot @@ -46383,7 +46383,7 @@ endobj endobj 418 0 obj << /Border [0 0 0] -/Dest (_route43) +/Dest (_route74) /Subtype /Link /Rect [60.24000000000001 372.11999999999966 248.45250000000001 386.39999999999964] /Type /Annot @@ -46391,7 +46391,7 @@ endobj endobj 419 0 obj << /Border [0 0 0] -/Dest (_route43) +/Dest (_route74) /Subtype /Link /Rect [557.8905 372.11999999999966 563.76 386.39999999999964] /Type /Annot @@ -46447,7 +46447,7 @@ endobj endobj 426 0 obj << /Border [0 0 0] -/Dest (_route42) +/Dest (_route73) /Subtype /Link /Rect [60.24000000000001 298.1999999999996 235.842 312.47999999999956] /Type /Annot @@ -46455,7 +46455,7 @@ endobj endobj 427 0 obj << /Border [0 0 0] -/Dest (_route42) +/Dest (_route73) /Subtype /Link /Rect [557.8905 298.1999999999996 563.76 312.47999999999956] /Type /Annot @@ -46511,7 +46511,7 @@ endobj endobj 434 0 obj << /Border [0 0 0] -/Dest (_route44) +/Dest (_route75) /Subtype /Link /Rect [60.24000000000001 224.27999999999952 249.70200000000003 238.55999999999952] /Type /Annot @@ -46519,7 +46519,7 @@ endobj endobj 435 0 obj << /Border [0 0 0] -/Dest (_route44) +/Dest (_route75) /Subtype /Link /Rect [557.8905 224.27999999999952 563.76 238.55999999999952] /Type /Annot @@ -46575,7 +46575,7 @@ endobj endobj 442 0 obj << /Border [0 0 0] -/Dest (_route35) +/Dest (_route66) /Subtype /Link /Rect [60.24000000000001 150.35999999999956 307.641 164.63999999999956] /Type /Annot @@ -46583,7 +46583,7 @@ endobj endobj 443 0 obj << /Border [0 0 0] -/Dest (_route35) +/Dest (_route66) /Subtype /Link /Rect [557.8905 150.35999999999956 563.76 164.63999999999956] /Type /Annot @@ -46639,7 +46639,7 @@ endobj endobj 450 0 obj << /Border [0 0 0] -/Dest (_route41) +/Dest (_route72) /Subtype /Link /Rect [60.24000000000001 76.4399999999996 261.860794921875 90.7199999999996] /Type /Annot @@ -46647,7 +46647,7 @@ endobj endobj 451 0 obj << /Border [0 0 0] -/Dest (_route41) +/Dest (_route72) /Subtype /Link /Rect [557.8905 76.4399999999996 563.76 90.7199999999996] /Type /Annot @@ -46703,7 +46703,7 @@ endobj endobj 458 0 obj << /Border [0 0 0] -/Dest (_route36) +/Dest (_route67) /Subtype /Link /Rect [60.24000000000001 704.7599999999999 339.560794921875 719.04] /Type /Annot @@ -46711,7 +46711,7 @@ endobj endobj 459 0 obj << /Border [0 0 0] -/Dest (_route36) +/Dest (_route67) /Subtype /Link /Rect [552.021 704.7599999999999 563.76 719.04] /Type /Annot @@ -46783,7 +46783,7 @@ endobj endobj 468 0 obj << /Border [0 0 0] -/Dest (_route38) +/Dest (_route69) /Subtype /Link /Rect [60.24000000000001 612.3599999999998 350.38629492187505 626.6399999999999] /Type /Annot @@ -46791,7 +46791,7 @@ endobj endobj 469 0 obj << /Border [0 0 0] -/Dest (_route38) +/Dest (_route69) /Subtype /Link /Rect [552.021 612.3599999999998 563.76 626.6399999999999] /Type /Annot @@ -46863,7 +46863,7 @@ endobj endobj 478 0 obj << /Border [0 0 0] -/Dest (_route37) +/Dest (_route68) /Subtype /Link /Rect [60.24000000000001 519.9599999999998 352.81158984375 534.2399999999998] /Type /Annot @@ -46871,7 +46871,7 @@ endobj endobj 479 0 obj << /Border [0 0 0] -/Dest (_route37) +/Dest (_route68) /Subtype /Link /Rect [552.021 519.9599999999998 563.76 534.2399999999998] /Type /Annot @@ -46943,7 +46943,7 @@ endobj endobj 488 0 obj << /Border [0 0 0] -/Dest (_route34) +/Dest (_route65) /Subtype /Link /Rect [60.24000000000001 427.5599999999997 212.0595 441.8399999999997] /Type /Annot @@ -46951,7 +46951,7 @@ endobj endobj 489 0 obj << /Border [0 0 0] -/Dest (_route34) +/Dest (_route65) /Subtype /Link /Rect [552.021 427.5599999999997 563.76 441.8399999999997] /Type /Annot @@ -47007,7 +47007,7 @@ endobj endobj 496 0 obj << /Border [0 0 0] -/Dest (_route56) +/Dest (_route87) /Subtype /Link /Rect [60.24000000000001 353.63999999999965 221.091755859375 367.9199999999996] /Type /Annot @@ -47015,7 +47015,7 @@ endobj endobj 497 0 obj << /Border [0 0 0] -/Dest (_route56) +/Dest (_route87) /Subtype /Link /Rect [552.021 353.63999999999965 563.76 367.9199999999996] /Type /Annot @@ -47183,7 +47183,7 @@ endobj endobj 518 0 obj << /Border [0 0 0] -/Dest (_route57) +/Dest (_route88) /Subtype /Link /Rect [60.24000000000001 150.35999999999956 318.73125585937504 164.63999999999956] /Type /Annot @@ -47191,7 +47191,7 @@ endobj endobj 519 0 obj << /Border [0 0 0] -/Dest (_route57) +/Dest (_route88) /Subtype /Link /Rect [552.021 150.35999999999956 563.76 164.63999999999956] /Type /Annot @@ -47263,7 +47263,7 @@ endobj endobj 528 0 obj << /Border [0 0 0] -/Dest (_route60) +/Dest (_route91) /Subtype /Link /Rect [60.24000000000001 57.95999999999961 175.8555 72.23999999999961] /Type /Annot @@ -47271,7 +47271,7 @@ endobj endobj 529 0 obj << /Border [0 0 0] -/Dest (_route60) +/Dest (_route91) /Subtype /Link /Rect [552.021 57.95999999999961 563.76 72.23999999999961] /Type /Annot diff --git a/extra/sql/dump/test-data.sql b/extra/sql/dump/test-data.sql index 1dfa208a..e85d9379 100644 --- a/extra/sql/dump/test-data.sql +++ b/extra/sql/dump/test-data.sql @@ -63,7 +63,7 @@ UNLOCK TABLES; LOCK TABLES `loop_element_models` WRITE; /*!40000 ALTER TABLE `loop_element_models` DISABLE KEYS */; -INSERT INTO `loop_element_models` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app',NULL,'2020-03-02 13:24:51.453602','Not found','2020-03-02 13:24:52.167202',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); +INSERT INTO `loop_element_models` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app',NULL,'2020-03-09 08:58:58.510214','Not found','2020-03-09 08:58:59.405979',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); /*!40000 ALTER TABLE `loop_element_models` ENABLE KEYS */; UNLOCK TABLES; @@ -82,9 +82,9 @@ UNLOCK TABLES; LOCK TABLES `loop_templates` WRITE; /*!40000 ALTER TABLE `loop_templates` DISABLE KEYS */; -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_OlECc_v1_0_ResourceInstanceName1_tca','Not found','2020-03-02 13:24:52.069749','Not found','2020-03-02 13:24:52.069749','CLOSED','tosca_definitions_version: cloudify_dsl_1_3\nimports:\n- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/docker/2.2.0/node-type.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml\n- http://onap.org:8081/repository/solutioning01-mte2-raw/type_files/dmaap/dmaap_mr.yaml\ninputs:\n location_id:\n type: string\n service_id:\n type: string\n policy_id:\n type: string\nnode_templates:\n policy_0:\n type: dcae.nodes.policy\n properties:\n policy_id: \n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n cdap_host_host:\n type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure\n properties:\n location_id:\n get_input: location_id\n scn_override: cdap_broker.solutioning-central.dcae.onap.org\n interfaces:\n cloudify.interfaces.lifecycle: {\n }\n tca_tca:\n type: dcae.nodes.MicroService.cdap\n properties:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n publisherContentType: application/json\n publisherHostName: mrlocal-mtnjftle01.onap.org\n publisherHostPort: \'3905\'\n publisherMaxBatchSize: \'10\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: https\n publisherTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESPub\n publisherUserName: test@tca.af.dcae.onap.org\n publisherUserPassword: password\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName: mrlocal-mtnjftle01.onap.org\n subscriberHostPort: \'3905\'\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'20000\'\n subscriberProtocol: https\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub\n subscriberUserName: test@tca.af.dcae.onap.org\n subscriberUserPassword: password\n tca_policy: null\n artifact_name: dcae-analytics-tca\n artifact_version: 1.0.0\n connections:\n streams_publishes: [\n ]\n streams_subscribes: [\n ]\n jar_url: http://somejar\n location_id:\n get_input: location_id\n namespace: cdap_tca_hi_lo\n programs:\n - program_id: TCAVESCollectorFlow\n program_type: flows\n - program_id: TCADMaaPMRSubscriberWorker\n program_type: workers\n - program_id: TCADMaaPMRPublisherWorker\n program_type: workers\n service_component_type: cdap_app_tca\n service_id:\n get_input: service_id\n streamname: TCASubscriberOutputStream\n relationships:\n - target: topic0\n type: dcae.relationships.subscribe_to_events\n - target: topic1\n type: dcae.relationships.publish_events\n - target: cdap_host_host\n type: dcae.relationships.component_contained_in\n - target: policy_0\n type: dcae.relationships.depends_on\n topic0:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n topic1:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n \n','typeId-7f559db8-bce7-4ae8-af3a-a0601330ef61',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_OlECc_v1_0_ResourceInstanceName1_tca_3','Not found','2020-03-02 13:24:51.821227','Not found','2020-03-02 13:24:51.821227','CLOSED','tosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap.svc.cluster.local\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest\"\n consul_host:\n type: string\n default: consul-server.onap.svc.cluster.local\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service.dcae.svc.cluster.local\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"none\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n tca_policy: \'\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: dcae.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \n get_input: policy_model_id\n','typeId-4ccd66a3-88f2-4882-97bd-867590f69092',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_OlECc_v1_0_ResourceInstanceName2_tca_2','Not found','2020-03-02 13:24:51.431617','Not found','2020-03-02 13:24:51.431617','CLOSED','#\n# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\n# =============================================================================\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ============LICENSE_END======================================================\n\ntosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n# - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/clamppolicyplugin/1.0.0/clamppolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1\"\n consul_host:\n type: string\n default: consul-server.onap\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-servicel\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-clamp\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n# tca_policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n','typeId-4d04b1b1-9331-47c5-88ad-9ae89c231b97',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_CNV61_v1_0_ResourceInstanceName1_tca','Not found','2020-03-09 08:58:59.283217','Not found','2020-03-09 08:58:59.283217','CLOSED','tosca_definitions_version: cloudify_dsl_1_3\nimports:\n- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/docker/2.2.0/node-type.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml\n- http://onap.org:8081/repository/solutioning01-mte2-raw/type_files/dmaap/dmaap_mr.yaml\ninputs:\n location_id:\n type: string\n service_id:\n type: string\n policy_id:\n type: string\nnode_templates:\n policy_0:\n type: dcae.nodes.policy\n properties:\n policy_id: \n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n cdap_host_host:\n type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure\n properties:\n location_id:\n get_input: location_id\n scn_override: cdap_broker.solutioning-central.dcae.onap.org\n interfaces:\n cloudify.interfaces.lifecycle: {\n }\n tca_tca:\n type: dcae.nodes.MicroService.cdap\n properties:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n publisherContentType: application/json\n publisherHostName: mrlocal-mtnjftle01.onap.org\n publisherHostPort: \'3905\'\n publisherMaxBatchSize: \'10\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: https\n publisherTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESPub\n publisherUserName: test@tca.af.dcae.onap.org\n publisherUserPassword: password\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName: mrlocal-mtnjftle01.onap.org\n subscriberHostPort: \'3905\'\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'20000\'\n subscriberProtocol: https\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub\n subscriberUserName: test@tca.af.dcae.onap.org\n subscriberUserPassword: password\n tca_policy: null\n artifact_name: dcae-analytics-tca\n artifact_version: 1.0.0\n connections:\n streams_publishes: [\n ]\n streams_subscribes: [\n ]\n jar_url: http://somejar\n location_id:\n get_input: location_id\n namespace: cdap_tca_hi_lo\n programs:\n - program_id: TCAVESCollectorFlow\n program_type: flows\n - program_id: TCADMaaPMRSubscriberWorker\n program_type: workers\n - program_id: TCADMaaPMRPublisherWorker\n program_type: workers\n service_component_type: cdap_app_tca\n service_id:\n get_input: service_id\n streamname: TCASubscriberOutputStream\n relationships:\n - target: topic0\n type: dcae.relationships.subscribe_to_events\n - target: topic1\n type: dcae.relationships.publish_events\n - target: cdap_host_host\n type: dcae.relationships.component_contained_in\n - target: policy_0\n type: dcae.relationships.depends_on\n topic0:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n topic1:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n \n','typeId-c6394acf-9604-4766-bab5-3c282683742c',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_CNV61_v1_0_ResourceInstanceName1_tca_3','Not found','2020-03-09 08:58:58.973526','Not found','2020-03-09 08:58:58.973526','CLOSED','tosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap.svc.cluster.local\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest\"\n consul_host:\n type: string\n default: consul-server.onap.svc.cluster.local\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service.dcae.svc.cluster.local\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"none\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n tca_policy: \'\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: dcae.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \n get_input: policy_model_id\n','typeId-1999c0ba-00a3-4121-8fa3-5332a231a56b',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_CNV61_v1_0_ResourceInstanceName2_tca_2','Not found','2020-03-09 08:58:58.462343','Not found','2020-03-09 08:58:58.462343','CLOSED','#\n# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\n# =============================================================================\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ============LICENSE_END======================================================\n\ntosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n# - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/clamppolicyplugin/1.0.0/clamppolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1\"\n consul_host:\n type: string\n default: consul-server.onap\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-servicel\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-clamp\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n# tca_policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n','typeId-7d0946d1-cd25-4aea-aca1-e9189029c8aa',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); /*!40000 ALTER TABLE `loop_templates` ENABLE KEYS */; UNLOCK TABLES; @@ -122,9 +122,9 @@ UNLOCK TABLES; LOCK TABLES `looptemplates_to_loopelementmodels` WRITE; /*!40000 ALTER TABLE `looptemplates_to_loopelementmodels` DISABLE KEYS */; -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_OlECc_v1_0_ResourceInstanceName1_tca',0); -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_OlECc_v1_0_ResourceInstanceName1_tca_3',0); -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_OlECc_v1_0_ResourceInstanceName2_tca_2',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_CNV61_v1_0_ResourceInstanceName1_tca',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_CNV61_v1_0_ResourceInstanceName1_tca_3',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_CNV61_v1_0_ResourceInstanceName2_tca_2',0); /*!40000 ALTER TABLE `looptemplates_to_loopelementmodels` ENABLE KEYS */; UNLOCK TABLES; @@ -152,13 +152,13 @@ UNLOCK TABLES; LOCK TABLES `policy_models` WRITE; /*!40000 ALTER TABLE `policy_models` DISABLE KEYS */; -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.Blacklist','1.0.0','Not found','2020-03-02 13:25:10.047752','Not found','2020-03-02 13:25:10.047752','Blacklist','tosca_definitions_version: tosca_simple_yaml_1_0_0\npolicy_types:\n onap.policies.controlloop.Guard:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: Guard Policies for Control Loop Operational Policies\n onap.policies.controlloop.guard.Blacklist:\n derived_from: onap.policies.controlloop.Guard\n version: 1.0.0\n description: Supports blacklist of VNF\'s from performing control loop actions on.\n properties:\n blacklist_policy:\n type: map\n description: null\n entry_schema:\n type: onap.datatypes.guard.Blacklist\ndata_types:\n onap.datatypes.guard.Blacklist:\n derived_from: tosca.datatypes.Root\n properties:\n actor:\n type: string\n description: Specifies the Actor\n required: true\n recipe:\n type: string\n description: Specified the Recipe\n required: true\n time_range:\n type: tosca.datatypes.TimeInterval\n description: An optional range of time during the day the blacklist is valid for.\n required: false\n controlLoopName:\n type: string\n description: An optional specific control loop to apply this guard to.\n required: false\n blacklist:\n type: list\n description: List of VNF\'s\n required: true',NULL); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.FrequencyLimiter','1.0.0','Not found','2020-03-02 13:25:09.987158','Not found','2020-03-02 13:25:09.987158','FrequencyLimiter','tosca_definitions_version: tosca_simple_yaml_1_0_0\npolicy_types:\n onap.policies.controlloop.Guard:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: Guard Policies for Control Loop Operational Policies\n onap.policies.controlloop.guard.FrequencyLimiter:\n derived_from: onap.policies.controlloop.Guard\n version: 1.0.0\n description: Supports limiting the frequency of actions being taken by a Actor.\n properties:\n frequency_policy:\n type: map\n description: null\n entry_schema:\n type: onap.datatypes.guard.FrequencyLimiter\ndata_types:\n onap.datatypes.guard.FrequencyLimiter:\n derived_from: tosca.datatypes.Root\n properties:\n actor:\n type: string\n description: Specifies the Actor\n required: true\n recipe:\n type: string\n description: Specified the Recipe\n required: true\n time_window:\n type: scalar-unit.time\n description: The time window to count the actions against.\n required: true\n limit:\n type: integer\n description: The limit\n required: true\n constraints:\n - greater_than: 0\n time_range:\n type: tosca.datatypes.TimeInterval\n description: An optional range of time during the day the frequency is valid for.\n required: false\n controlLoopName:\n type: string\n description: An optional specific control loop to apply this guard to.\n required: false\n target:\n type: string\n description: An optional specific VNF to apply this guard to.\n required: false',NULL); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.MinMax','2.0.0','Not found','2020-03-02 13:25:09.987757','Not found','2020-03-02 13:25:09.987757','MinMax','',NULL); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.Apex','1.0.0','Not found','2020-03-02 13:25:09.987152','Not found','2020-03-02 13:25:09.987152','Apex','',NULL); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.Drools','1.0.0','Not found','2020-03-02 13:25:09.992687','Not found','2020-03-02 13:25:09.992687','Drools','',NULL); -INSERT INTO `policy_models` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','1.0.0','Not found','2020-03-02 13:24:51.467136','Not found','2020-03-02 13:25:10.569587','app','tosca_definitions_version: tosca_simple_yaml_1_0_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: a base policy type for all policies that govern monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: map\n description: TCA Policy JSON\n entry_schema:\n type: onap.datatypes.monitoring.tca_policy\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); -INSERT INTO `policy_models` VALUES ('onap.policies.operational.legacy','1.0.0','Not found','2020-03-02 13:24:26.818795','Not found','2020-03-02 13:24:26.818795','OperationalPolicyLegacy','',NULL); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.Blacklist','1.0.0','Not found','2020-03-09 08:59:10.073127','Not found','2020-03-09 08:59:10.390629','Blacklist','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.Blacklist:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports blacklist of entity id\'s from performing control loop actions on.\n properties:\n blacklist:\n type: list\n description: List of entity id\'s\n required: true\n entry_schema:\n type: string','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.FrequencyLimiter','1.0.0','Not found','2020-03-09 08:59:10.071862','Not found','2020-03-09 08:59:10.403262','FrequencyLimiter','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.FrequencyLimiter:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports limiting the frequency of actions being taken by a Actor.\n properties:\n timeWindow:\n type: integer\n description: The time window to count the actions against.\n required: true\n timeUnits:\n type: string\n description: The units of time the window is counting.\n constraints:\n - valid_values: [\"second\", \"minute\", \"hour\", \"day\", \"week\", \"month\", \"year\"]\n limit:\n type: integer\n description: The limit\n required: true\n constraints:\n - greater_than: 0','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.MinMax','2.0.0','Not found','2020-03-09 08:59:10.074684','Not found','2020-03-09 08:59:10.074684','MinMax','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.MinMax:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports Min/Max number of entity for scaling operations\n properties:\n min:\n type: integer\n required: true\n description: The minimum instances of this entity\n max:\n type: integer\n required: false\n description: The maximum instances of this entity',NULL); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.common.Apex','1.0.0','Not found','2020-03-09 08:59:10.073775','Not found','2020-03-09 08:59:10.413855','Apex','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.common.Apex:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Operational policies for Apex PDP\n properties:\n engineServiceParameters:\n type: string\n description: The engine parameters like name, instanceCount, policy implementation, parameters etc.\n required: true\n eventInputParameters:\n type: string\n description: The event input parameters.\n required: true\n eventOutputParameters:\n type: string\n description: The event output parameters.\n required: true\n javaProperties:\n type: string\n description: Name/value pairs of properties to be set for APEX if needed.\n required: false\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\ndata_types:\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values: [VNF, VM, VFMODULE, PNF]\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n operation:\n type: string\n description: The operation the actor is performing.\n required: true\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n metadata:\n clamp_possible_values: \n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy to the actor\n required: false\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n metadata:\n clamp_possible_values: \n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"drools\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.common.Drools','1.0.0','Not found','2020-03-09 08:59:10.138733','Not found','2020-03-09 08:59:10.429203','Drools','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.common.Drools:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Operational policies for Drools PDP\n properties:\n controllerName:\n type: string\n description: Drools controller properties\n required: false\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\ndata_types:\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values: [VNF, VM, VFMODULE, PNF]\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n operation:\n type: string\n description: The operation the actor is performing.\n required: true\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n metadata:\n clamp_possible_values: \n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy to the actor\n required: false\n entry_schema:\n type: string\n\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n metadata:\n clamp_possible_values: \n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"drools\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','1.0.0','Not found','2020-03-09 08:58:58.533621','Not found','2020-03-09 08:59:10.447184','app','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: a base policy type for all policies that govern monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: onap.datatypes.monitoring.tca_policy\n description: TCA Policy JSON\n required: true\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` VALUES ('onap.policies.operational.legacy','1.0.0','Not found','2020-03-09 08:58:07.743663','Not found','2020-03-09 08:58:07.743663','OperationalPolicyLegacy','',NULL); /*!40000 ALTER TABLE `policy_models` ENABLE KEYS */; UNLOCK TABLES; @@ -180,4 +180,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-03-02 21:26:34 +-- Dump completed on 2020-03-09 16:00:40 diff --git a/pom.xml b/pom.xml index 8acdb498..633109bc 100644 --- a/pom.xml +++ b/pom.xml @@ -1191,6 +1191,7 @@ test + ${maven.test.skip} run-script test:coverage ${project.build.directory}/${ui.react.src} diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java b/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java index 032edbaa..b0bf8278 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/Extractor.java @@ -23,19 +23,24 @@ package org.onap.clamp.clds.tosca.update; +import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map.Entry; import org.yaml.snakeyaml.Yaml; public class Extractor { - - private LinkedHashMap allItems = new LinkedHashMap<>(); + private LinkedHashMap allItems; private String source; + private String nativeComponent; @SuppressWarnings("unchecked") - public Extractor(String toParse) { + public Extractor(String toParse, String nativeComponent) throws IOException { + this.source = toParse; + this.nativeComponent = nativeComponent; + allItems = new LinkedHashMap(); getAllAsMaps(); + } public LinkedHashMap getAllItems() { @@ -60,10 +65,17 @@ public class Extractor { (LinkedHashMap>) contentFile; // Get DataTypes LinkedHashMap dataTypes = file.get("data_types"); + dataTypes = (dataTypes == null) ? (new LinkedHashMap<>()) : dataTypes; // Get Policies : first, get topology and after extract policies from it LinkedHashMap policyTypes = file.get("policy_types"); // Put the policies and datatypes in the same collection dataTypes.putAll(policyTypes); + + Object contentNativeFile = yaml.load(nativeComponent); + LinkedHashMap dataTypesEmbedded = + ((LinkedHashMap>) contentNativeFile).get("data_types"); + dataTypes.putAll(dataTypesEmbedded); + parseInComponent(dataTypes); return dataTypes; } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java b/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java index 6da55eae..7bf629d6 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/ParserToJson.java @@ -45,14 +45,16 @@ public class ParserToJson { * @param nameComponent name components * @return return */ - public JsonObject getJsonProcess(String nameComponent) { - JsonObject glob = this.getGeneralField(matchComponent(nameComponent)); - if (templates.get("object").hasFields("required")) { - glob.add("required", this.getRequirements(nameComponent)); + public JsonObject getJsonProcess(String nameComponent, String typeComponent) { + JsonObject glob = new JsonObject(); + + if (typeComponent.equals("object")) { + glob = this.getFieldAsObject(matchComponent(nameComponent)); } - if (templates.get("object").hasFields("properties")) { - glob.add("properties", this.deploy(nameComponent)); + else { + /*glob = this.getFieldAsArray(matchComponent(nameComponent));*/ } + return glob; } @@ -62,7 +64,7 @@ public class ParserToJson { * @param component the compo * @return a json object */ - public JsonObject getGeneralField(Component component) { + public JsonObject getFieldAsObject(Component component) { JsonObject globalFields = new JsonObject(); if (templates.get("object").hasFields("title")) { @@ -76,6 +78,12 @@ public class ParserToJson { globalFields.addProperty("description", component.getDescription()); } } + if (templates.get("object").hasFields("required")) { + globalFields.add("required", this.getRequirements(component.getName())); + } + if (templates.get("object").hasFields("properties")) { + globalFields.add("properties", this.deploy(component.getName())); + } return globalFields; } @@ -124,7 +132,7 @@ public class ParserToJson { for (Entry property : toParse.getProperties().entrySet()) { if (matchComponent((String) property.getValue().getItems().get("type")) != null) { jsonSchema.add(property.getValue().getName(), - this.getJsonProcess((String) property.getValue().getItems().get("type"))); + this.getJsonProcess((String) property.getValue().getItems().get("type"), "object")); } else { jsonSchema.add(property.getValue().getName(), this.complexParse(property.getValue())); @@ -166,8 +174,11 @@ public class ParserToJson { switch (propertyField) { case "type": if (currentPropertyTemplate.hasFields(propertyField)) { - switch ((String) property.getItems().get(propertyField)) { + String fieldtype = (String) property.getItems().get(propertyField); + switch (fieldtype.toLowerCase()) { case "list": + propertiesInJson.addProperty("type", "array"); + break; case "map": propertiesInJson.addProperty("type", "object"); break; @@ -180,6 +191,9 @@ public class ParserToJson { propertiesInJson.addProperty("type", "string"); propertiesInJson.addProperty("format", "date-time"); break; + case "float": + propertiesInJson.addProperty("type", "number"); + break; case "range": propertiesInJson.addProperty("type", "integer"); if (!checkConstraintPresence(property, "greater_than") @@ -205,16 +219,38 @@ public class ParserToJson { currentPropertyTemplate); break; case "entry_schema": + //Here, a way to check if entry is a component (datatype) or a simple string if (matchComponent(this.extractSpecificFieldFromMap(property, "entry_schema")) != null) { + String nameComponent = this.extractSpecificFieldFromMap(property, "entry_schema"); ParserToJson child = new ParserToJson(components, templates); - JsonObject componentAsProperty = - child.getJsonProcess(this.extractSpecificFieldFromMap(property, "entry_schema")); JsonObject propertiesContainer = new JsonObject(); - propertiesContainer - .add(this.extractSpecificFieldFromMap(property, "entry_schema"), componentAsProperty); - if (currentPropertyTemplate.hasFields("properties")) { - propertiesInJson.add("properties", propertiesContainer); + + switch ((String) property.getItems().get("type")) { + case "map": // Get it as an object + JsonObject componentAsProperty = child.getJsonProcess(nameComponent,"object"); + propertiesContainer.add(nameComponent, componentAsProperty); + if (currentPropertyTemplate.hasFields("properties")) { + propertiesInJson.add("properties", propertiesContainer); + } + break; + default://list : get it as an Array + JsonObject componentAsItem = child.getJsonProcess(nameComponent, "object"); + if (currentPropertyTemplate.hasFields("properties")) { + propertiesInJson.add("items", componentAsItem); + } + break; } + + } + // Native cases + else if (property.getItems().get("type").equals("list")) { + JsonObject itemContainer = new JsonObject(); + String valueInEntrySchema = this.extractSpecificFieldFromMap(property, "entry_schema"); + itemContainer.addProperty("type", valueInEntrySchema); + propertiesInJson.add("items", itemContainer); + } + else {//map + // propertiesInJson.add("key?", valueInEntrySchema); } break; default://Each classical field : type, description, default.. @@ -236,8 +272,10 @@ public class ParserToJson { */ public Component matchComponent(String name) { Component correspondingComponent = null; - Collection listofComponent = components.values(); - for (Component component : listofComponent) { + if (components == null) { + return null; + } + for (Component component : components.values()) { if (component.getName().equals(name)) { correspondingComponent = component; } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java b/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java index 4b510cb7..ce5cdb81 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/TemplateManagement.java @@ -46,9 +46,10 @@ public class TemplateManagement { * @param templateProperties template properties as string * @throws IOException in case of failure */ - public TemplateManagement(String yamlContent, String templateProperties) throws IOException { + public TemplateManagement(String yamlContent, String nativeComponent, String templateProperties) + throws IOException { if (yamlContent != null && !yamlContent.isEmpty()) { - this.extractor = new Extractor(yamlContent); + this.extractor = new Extractor(yamlContent, nativeComponent); this.components = extractor.getAllItems(); this.templates = initializeTemplates(templateProperties); } @@ -155,7 +156,7 @@ public class TemplateManagement { if (parserToJson.matchComponent(componentName) == null) { throw new UnknownComponentException(componentName); } - return parserToJson.getJsonProcess(componentName); + return parserToJson.getJsonProcess(componentName, "object"); } /** diff --git a/src/main/java/org/onap/clamp/policy/Policy.java b/src/main/java/org/onap/clamp/policy/Policy.java index ebeb84fd..004c450a 100644 --- a/src/main/java/org/onap/clamp/policy/Policy.java +++ b/src/main/java/org/onap/clamp/policy/Policy.java @@ -30,7 +30,7 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; - +import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.Map; import javax.persistence.Column; @@ -44,6 +44,9 @@ import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; import org.json.JSONObject; +import org.onap.clamp.clds.tosca.update.TemplateManagement; +import org.onap.clamp.clds.tosca.update.UnknownComponentException; +import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.common.AuditEntity; import org.onap.clamp.loop.template.LoopElementModel; @@ -284,4 +287,22 @@ public abstract class Policy extends AuditEntity { return buffer.toString().replace('.', '_').replaceAll(" ", ""); } + /** + * This method can be used to generate the json Schema used by the UI. + * + * @param policyToscaModel The tosca model as String that must be converted + * @param policyModelType The tosca model type (the policy_type entry in the tosca) that will used to create the + * json schema + * @return THe Json Schema as JsonObject + * @throws IOException In case of failure when opening the templates.properties file + * @throws UnknownComponentException If the policyModelType is not found in the tosca model + */ + public static JsonObject generateJsonRepresentationFromToscaModel(String policyToscaModel, + String policyModelType) + throws IOException, UnknownComponentException { + return new TemplateManagement(policyToscaModel,ResourceFileUtil.getResourceAsString( + "clds/tosca_update/defaultToscaTypes.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")) + .launchTranslation(policyModelType); + } } diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java index c4037ffb..96b3a09b 100644 --- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java +++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java @@ -27,6 +27,7 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; +import java.io.IOException; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @@ -39,8 +40,7 @@ import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; -import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor; -import org.onap.clamp.clds.util.JsonUtils; +import org.onap.clamp.clds.tosca.update.UnknownComponentException; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.Loop; import org.onap.clamp.loop.template.LoopElementModel; @@ -104,9 +104,16 @@ public class MicroServicePolicy extends Policy implements Serializable { * @param shared The flag indicate whether the MicroService is shared */ public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared, LoopElementModel loopElementModel) { - this(name, policyModel, shared, JsonUtils.GSON_JPA_MODEL - .fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(), - policyModel.getPolicyModelType()), JsonObject.class), loopElementModel,null,null); + this.name = name; + this.setPolicyModel(policyModel); + this.shared = shared; + try { + this.setJsonRepresentation(Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(),policyModel.getPolicyModelType())); + } catch (UnknownComponentException | NullPointerException | IOException e) { + logger.error("Unable to generate the microservice policy Schema ... ", e); + this.setJsonRepresentation(new JsonObject()); + } + this.setLoopElementModel(loopElementModel); } /** @@ -116,7 +123,7 @@ public class MicroServicePolicy extends Policy implements Serializable { * @param name The name of the MicroService * @param policyModel The policy model type of the MicroService * @param shared The flag indicate whether the MicroService is - * shared + * shared * @param jsonRepresentation The UI representation in json format * @param loopElementModel The loop element model from which this instance should be created * @param pdpGroup The Pdp Group info diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java index 82cfcf4e..97567426 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java @@ -44,14 +44,12 @@ import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; -import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor; -import org.onap.clamp.clds.util.JsonUtils; +import org.onap.clamp.clds.tosca.update.UnknownComponentException; import org.onap.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.clamp.loop.Loop; import org.onap.clamp.loop.template.LoopElementModel; @@ -119,17 +117,15 @@ public class OperationalPolicy extends Policy implements Serializable { if (isLegacy()) { // Op policy Legacy case LegacyOperationalPolicy.preloadConfiguration(jsonReturned, loop); - this.setJsonRepresentation( - OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService())); + jsonReturned = + OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService()); } else { // Generic Case - this.setJsonRepresentation(JsonUtils.GSON - .fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(), - policyModel.getPolicyModelType()), JsonObject.class)); + jsonReturned = Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(), + policyModel.getPolicyModelType()); } - } catch (JsonSyntaxException | IOException | NullPointerException e) { + } catch (UnknownComponentException | IOException | NullPointerException e) { logger.error("Unable to generate the operational policy Schema ... ", e); - this.setJsonRepresentation(new JsonObject()); } return jsonReturned; } diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 9c4c9fff..62f30005 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -444,25 +444,25 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • 2. Paths
      -
    • 2.1. GET /v1/healthcheck +
    • 2.1. GET /v1/healthcheck
    • -
    • 2.2. GET /v1/user/getUser +
    • 2.2. GET /v1/user/getUser
    • -
    • 2.3. GET /v2/dictionary +
    • 2.3. GET /v2/dictionary
    • -
    • 2.4. PUT /v2/dictionary +
    • 2.4. PUT /v2/dictionary
    • -
    • 2.8. DELETE /v2/dictionary/{name} +
    • 2.8. DELETE /v2/dictionary/{name}
    • -
    • 2.10. PUT /v2/loop/delete/{loopName} +
    • 2.10. PUT /v2/loop/delete/{loopName}
    • -
    • 2.11. PUT /v2/loop/deploy/{loopName} +
    • 2.11. PUT /v2/loop/deploy/{loopName}
    • -
    • 2.12. GET /v2/loop/getAllNames +
    • 2.12. GET /v2/loop/getAllNames
    • -
    • 2.13. GET /v2/loop/getstatus/{loopName} +
    • 2.13. GET /v2/loop/getstatus/{loopName}
    • -
    • 2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName} +
    • 2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}
    • -
    • 2.15. PUT /v2/loop/restart/{loopName} +
    • 2.15. PUT /v2/loop/restart/{loopName}
    • -
    • 2.16. PUT /v2/loop/stop/{loopName} +
    • 2.16. PUT /v2/loop/stop/{loopName}
    • -
    • 2.17. PUT /v2/loop/submit/{loopName} +
    • 2.17. PUT /v2/loop/submit/{loopName}
    • -
    • 2.18. GET /v2/loop/svgRepresentation/{loopName} +
    • 2.18. GET /v2/loop/svgRepresentation/{loopName}
    • -
    • 2.19. PUT /v2/loop/undeploy/{loopName} +
    • 2.19. PUT /v2/loop/undeploy/{loopName}
    • -
    • 2.20. POST /v2/loop/updateGlobalProperties/{loopName} +
    • 2.20. POST /v2/loop/updateGlobalProperties/{loopName}
    • -
    • 2.21. POST /v2/loop/updateMicroservicePolicy/{loopName} +
    • 2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}
    • -
    • 2.22. POST /v2/loop/updateOperationalPolicies/{loopName} +
    • 2.22. POST /v2/loop/updateOperationalPolicies/{loopName}
    • -
    • 2.23. GET /v2/loop/{loopName} +
    • 2.23. GET /v2/loop/{loopName}
    • -
    • 2.24. GET /v2/policyToscaModels +
    • 2.24. GET /v2/policyToscaModels
    • -
    • 2.27. PUT /v2/policyToscaModels/{policyModelType} +
    • 2.27. PUT /v2/policyToscaModels/{policyModelType}
    • -
    • 2.28. GET /v2/templates +
    • 2.28. GET /v2/templates
      • 2.28.1. Responses
      • 2.28.2. Produces
      • @@ -692,7 +692,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b

        1.2. URI scheme

        -

        Host : localhost:39099
        +

        Host : localhost:40597
        BasePath : /restservices/clds/
        Schemes : HTTP

        @@ -703,7 +703,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b

        2. Paths

        -

        2.1. GET /v1/healthcheck

        +

        2.1. GET /v1/healthcheck

        2.1.1. Responses

        @@ -740,7 +740,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -774,7 +774,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -811,7 +811,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1060,7 +1060,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1184,7 +1184,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1233,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1295,7 +1295,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1332,7 +1332,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1394,7 +1394,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1456,7 +1456,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1518,7 +1518,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1580,7 +1580,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1642,7 +1642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1704,7 +1704,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1766,7 +1766,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1844,7 +1844,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -1922,7 +1922,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -2000,7 +2000,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -2062,7 +2062,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -2223,7 +2223,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -2301,7 +2301,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
        @@ -3544,7 +3544,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b - @@ -3642,7 +3642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b - diff --git a/src/main/resources/clds/tosca_update/defaultToscaTypes.yaml b/src/main/resources/clds/tosca_update/defaultToscaTypes.yaml new file mode 100644 index 00000000..a11a7369 --- /dev/null +++ b/src/main/resources/clds/tosca_update/defaultToscaTypes.yaml @@ -0,0 +1,87 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +data_types: + tosca.datatypes.Root: + description: The TOSCA root Data Type all other TOSCA base Data Types derive from + tosca.datatypes.Credential: + derived_from: tosca.datatypes.Root + properties: + protocol: + type: string + required: false + token_type: + type: string + default: password + token: + type: string + keys: + type: map + required: false + entry_schema: + type: string + user: + type: string + required: false + tosca.datatypes.TimeInterval: + derived_from: tosca.datatypes.Root + properties: + start_time: + type: timestamp + required: true + end_time: + type: timestamp + required: true + tosca.datatypes.network.NetworkInfo: + derived_from: tosca.datatypes.Root + properties: + network_name: + type: string + network_id: + type: string + addresses: + type: list + entry_schema: + type: string + tosca.datatypes.network.PortInfo: + derived_from: tosca.datatypes.Root + properties: + port_name: + type: string + port_id: + type: string + network_id: + type: string + mac_address: + type: string + addresses: + type: list + entry_schema: + type: string + # tosca.datatypes.network.PortDef: + # derived_from: integer + # constraints: + # - in_range: [ 1, 65535 ] + # tosca.datatypes.network.PortSpec: + # derived_from: tosca.datatypes.Root + # properties: + # protocol: + # type: string + # required: true + # default: tcp + # constraints: + # - valid_values: [ udp, tcp, igmp ] + # target: + # type: PortDef + # required: false + # target_range: + # type: range + # required: false + # constraints: + # - in_range: [ 1, 65535 ] + # source: + # type: PortDef + # required: false + # source_range: + # type: range + # required: false + # constraints: + # - in_range: [ 1, 65535 ] \ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java index abf65c36..c65c84a4 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java @@ -38,7 +38,8 @@ public class ArrayFieldTest extends TestCase { */ public void testDeploy() throws IOException { TemplateManagement templateManagement = new TemplateManagement(ResourceFileUtil.getResourceAsString( - "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"), + "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),ResourceFileUtil.getResourceAsString( + "clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor"); Property property = component.getProperties().get("actor"); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java index 0494ee11..f5d2fe6e 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java @@ -41,6 +41,7 @@ public class ComponentTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor"); assertEquals(reference, component.propertiesNames()); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java index a71ea8ac..6f1046ea 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java @@ -33,6 +33,7 @@ public class ConstraintTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/constraints.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Operation"); @@ -41,7 +42,7 @@ public class ConstraintTest extends TestCase { } /** - * Test get value array. + * Test get value array. */ public void testGetValuesArray() { Property property = component.getProperties().get("timeout"); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java index cf183af8..5a995599 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java @@ -42,6 +42,7 @@ public class PropertyTest extends TestCase { public void testParseArray() throws IOException { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor"); Property property = component.getProperties().get("actor"); @@ -57,6 +58,7 @@ public class PropertyTest extends TestCase { public void testAddConstraintsAsJson() throws IOException { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); Component component = templateManagement.getComponents().get("onap.datatype.controlloop.operation.Failure"); Property property = component.getProperties().get("category"); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java index 8e411069..4447a98c 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java +++ b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java @@ -31,6 +31,86 @@ import org.onap.clamp.clds.util.ResourceFileUtil; public class TemplateManagementTest extends TestCase { + /** + * Test the launch translation wit operational policies. + * + * @throws IOException In case of failure + * @throws UnknownComponentException In case of failure + */ + public void testLaunchTranslationTca() throws IOException, UnknownComponentException { + TemplateManagement templateManagement = + new TemplateManagement( + ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + + ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?" + + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( + "clds/tosca_update/defaultToscaTypes.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + assertNull(templateManagement.getParseToJson()); + String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app"; + templateManagement.launchTranslation(componentName); + assertNotNull(templateManagement.getParseToJson()); + } + + /** + * Test the launch translation wit operational policies. + * + * @throws IOException In case of failure + * @throws UnknownComponentException In case of failure + */ + public void testLaunchTranslationFrequencyLimiter() throws IOException, UnknownComponentException { + TemplateManagement templateManagement = + new TemplateManagement( + ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + + ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?" + + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( + "clds/tosca_update/defaultToscaTypes.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + assertNull(templateManagement.getParseToJson()); + String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter"; + templateManagement.launchTranslation(componentName); + assertNotNull(templateManagement.getParseToJson()); + } + + /** + * Test the launch translation wit operational policies. + * + * @throws IOException In case of failure + * @throws UnknownComponentException In case of failure + */ + public void testLaunchTranslationApex() throws IOException, UnknownComponentException { + TemplateManagement templateManagement = + new TemplateManagement( + ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + + ".policies.controlloop.operational.common.Apex/versions/1.0.0?" + + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( + "clds/tosca_update/defaultToscaTypes.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + assertNull(templateManagement.getParseToJson()); + String componentName = "onap.policies.controlloop.operational.common.Apex"; + templateManagement.launchTranslation(componentName); + assertNotNull(templateManagement.getParseToJson()); + } + + /** + * Test the launch translation wit operational policies. + * + * @throws IOException In case of failure + * @throws UnknownComponentException In case of failure + */ + public void testLaunchTranslationDrools() throws IOException, UnknownComponentException { + TemplateManagement templateManagement = + new TemplateManagement( + ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" + + ".policies.controlloop.operational.common.Drools/versions/1.0.0?" + + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString( + "clds/tosca_update/defaultToscaTypes.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); + assertNull(templateManagement.getParseToJson()); + String componentName = "onap.policies.controlloop.operational.common.Drools"; + templateManagement.launchTranslation(componentName); + assertNotNull(templateManagement.getParseToJson()); + } + /** * Test the launch translation. * @@ -41,6 +121,7 @@ public class TemplateManagementTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); assertNull(templateManagement.getParseToJson()); String componentName = "onap.policies.controlloop.operational.common.Drools"; @@ -57,6 +138,7 @@ public class TemplateManagementTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); int count = templateManagement.getTemplates().size(); ArrayList templateFields = @@ -74,6 +156,7 @@ public class TemplateManagementTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); int count = templateManagement.getTemplates().size(); templateManagement.removeTemplate("string"); @@ -89,6 +172,7 @@ public class TemplateManagementTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); int count = templateManagement.getTemplates().get("integer").getFields().size(); templateManagement.updateTemplate("integer", "type", false); @@ -104,6 +188,7 @@ public class TemplateManagementTest extends TestCase { TemplateManagement templateManagement = new TemplateManagement( ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), + ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"), ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties")); boolean has = true; ArrayList templateFieldsString = diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java index 2cd30185..f08e86e8 100644 --- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java +++ b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java @@ -69,11 +69,15 @@ public class PolicyEngineControllerTestItCase { assertThat(firstExecution).isNotNull(); List policyModelsList = policyModelsRepository.findAll(); assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(5); - assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.Drools", null, "1.0.0")); - assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.Apex", null, "1.0.0")); - assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.FrequencyLimiter", null, "1.0.0")); - assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.Blacklist", null, "1.0.0")); - assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.MinMax", null, "2.0.0")); + assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Drools", + null, "1.0.0")); + assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Apex", + null, "1.0.0")); + assertThat(policyModelsList) + .contains(new PolicyModel("onap.policies.controlloop.guard.common.FrequencyLimiter", null, "1.0.0")); + assertThat(policyModelsList) + .contains(new PolicyModel("onap.policies.controlloop.guard.common.Blacklist", null, "1.0.0")); + assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.common.MinMax", null, "2.0.0")); // Re-do it to check that there is no issue with duplicate key policyController.synchronizeAllPolicies(); diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file index 4b27438c..0cce9c3d 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file @@ -1,34 +1,34 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - onap.policies.controlloop.operational.Drools: + - onap.policies.controlloop.operational.common.Drools: version: 1.0.0 description: Operational Policy for Control Loops using the Drools PDP derived_from: onapy.policies.controlloop.Operational properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.operational.Apex: + - onap.policies.controlloop.operational.common.Apex: version: 1.0.0 description: Operational Policy for Control Loops using the APEX PDP derived_from: onap.policies.controlloop.Operational properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.guard.FrequencyLimiter: + - onap.policies.controlloop.guard.common.FrequencyLimiter: version: 1.0.0 description: Supports limiting the frequency of actions being taken by a Actor. derived_from: onap.policies.controlloop.Guard properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.guard.Blacklist: + - onap.policies.controlloop.guard.common.Blacklist: version: 1.0.0 description: Supports blacklist of VNF's from performing control loop actions on. derived_from: onap.policies.controlloop.Guard properties: # Omitted for brevity, see Section 1 - - onap.policies.controlloop.guard.MinMax: + - onap.policies.controlloop.guard.common.MinMax: version: 2.0.0 description: Supports Min/Max number of VF Modules derived_from: onap.policies.controlloop.Guard diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file deleted file mode 100644 index 91a82521..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file +++ /dev/null @@ -1,40 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - description: Guard Policies for Control Loop Operational Policies - onap.policies.controlloop.guard.Blacklist: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - description: Supports blacklist of VNF's from performing control loop actions on. - properties: - blacklist_policy: - type: map - description: null - entry_schema: - type: onap.datatypes.guard.Blacklist -data_types: - onap.datatypes.guard.Blacklist: - derived_from: tosca.datatypes.Root - properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the blacklist is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - blacklist: - type: list - description: List of VNF's - required: true \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file deleted file mode 100644 index 45e5471f..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file +++ /dev/null @@ -1,50 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - description: Guard Policies for Control Loop Operational Policies - onap.policies.controlloop.guard.FrequencyLimiter: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - description: Supports limiting the frequency of actions being taken by a Actor. - properties: - frequency_policy: - type: map - description: null - entry_schema: - type: onap.datatypes.guard.FrequencyLimiter -data_types: - onap.datatypes.guard.FrequencyLimiter: - derived_from: tosca.datatypes.Root - properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_window: - type: scalar-unit.time - description: The time window to count the actions against. - required: true - limit: - type: integer - description: The limit - required: true - constraints: - - greater_than: 0 - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the frequency is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - target: - type: string - description: An optional specific VNF to apply this guard to. - required: false \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file deleted file mode 100644 index 54c4204e..00000000 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.file +++ /dev/null @@ -1,44 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - description: Guard Policies for Control Loop Operational Policies - onap.policies.controlloop.guard.MinMax: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - description: Supports Min/Max number of VF Modules - properties: - minmax_policy: - type: map - description: null - entry_schema: - type: onap.datatypes.guard.MinMax -data_types: - onap.datatypes.guard.MinMax: - derived_from: tosca.datatypes.Root - properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the Min/Max limit is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - min_vf_module_instances: - type: integer - required: true - description: The minimum instances of this VF-Module - max_vf_module_instances: - type: integer - required: false - description: The maximum instances of this VF-Module \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..79e79f0f --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,38 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.guard.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + This is the base Policy Type for Guard policies that guard the execution of Operational + Policies. + properties: + actor: + type: string + description: Specifies the Actor the guard applies to. + required: true + operation: + type: string + description: Specified the operation that the actor is performing the guard applies to. + required: true + timeRange: + type: tosca.datatypes.TimeInterval + description: | + An optional range of time during the day the guard policy is valid for. + required: false + id: + type: string + description: The Control Loop id this applies to. + required: false + onap.policies.controlloop.guard.common.Blacklist: + derived_from: onap.policies.controlloop.guard.Common + type_version: 1.0.0 + version: 1.0.0 + description: Supports blacklist of entity id's from performing control loop actions on. + properties: + blacklist: + type: list + description: List of entity id's + required: true + entry_schema: + type: string \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header similarity index 100% rename from src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header rename to src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0?connectionTimeToLive=5000/.header diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..163027e4 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,47 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.guard.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + This is the base Policy Type for Guard policies that guard the execution of Operational + Policies. + properties: + actor: + type: string + description: Specifies the Actor the guard applies to. + required: true + operation: + type: string + description: Specified the operation that the actor is performing the guard applies to. + required: true + timeRange: + type: tosca.datatypes.TimeInterval + description: | + An optional range of time during the day the guard policy is valid for. + required: false + id: + type: string + description: The Control Loop id this applies to. + required: false + onap.policies.controlloop.guard.common.FrequencyLimiter: + derived_from: onap.policies.controlloop.guard.Common + type_version: 1.0.0 + version: 1.0.0 + description: Supports limiting the frequency of actions being taken by a Actor. + properties: + timeWindow: + type: integer + description: The time window to count the actions against. + required: true + timeUnits: + type: string + description: The units of time the window is counting. + constraints: + - valid_values: ["second", "minute", "hour", "day", "week", "month", "year"] + limit: + type: integer + description: The limit + required: true + constraints: + - greater_than: 0 \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header similarity index 100% rename from src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header rename to src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?connectionTimeToLive=5000/.header diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..78bdde74 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,40 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.guard.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + This is the base Policy Type for Guard policies that guard the execution of Operational + Policies. + properties: + actor: + type: string + description: Specifies the Actor the guard applies to. + required: true + operation: + type: string + description: Specified the operation that the actor is performing the guard applies to. + required: true + timeRange: + type: tosca.datatypes.TimeInterval + description: | + An optional range of time during the day the guard policy is valid for. + required: false + id: + type: string + description: The Control Loop id this applies to. + required: false + onap.policies.controlloop.guard.common.MinMax: + derived_from: onap.policies.controlloop.guard.Common + type_version: 1.0.0 + version: 1.0.0 + description: Supports Min/Max number of entity for scaling operations + properties: + min: + type: integer + required: true + description: The minimum instances of this entity + max: + type: integer + required: false + description: The maximum instances of this entity \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.header similarity index 100% rename from src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0?connectionTimeToLive=5000/.header rename to src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0?connectionTimeToLive=5000/.header diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..44f55879 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,158 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.operational.common.Apex: + derived_from: onap.policies.controlloop.operational.Common + type_version: 1.0.0 + version: 1.0.0 + description: Operational policies for Apex PDP + properties: + engineServiceParameters: + type: string + description: The engine parameters like name, instanceCount, policy implementation, parameters etc. + required: true + eventInputParameters: + type: string + description: The event input parameters. + required: true + eventOutputParameters: + type: string + description: The event output parameters. + required: true + javaProperties: + type: string + description: Name/value pairs of properties to be set for APEX if needed. + required: false + onap.policies.controlloop.operational.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant + Policy Types. This does NOT support the legacy Policy YAML policy type. + properties: + id: + type: string + description: The unique control loop id. + required: true + timeout: + type: integer + description: | + Overall timeout for executing all the operations. This timeout should equal or exceed the total + timeout for each operation listed. + required: true + abatement: + type: boolean + description: Whether an abatement event message will be expected for the control loop from DCAE. + required: true + default: false + trigger: + type: string + description: Initial operation to execute upon receiving an Onset event message for the Control Loop. + required: true + operations: + type: list + description: List of operations to be performed when Control Loop is triggered. + required: true + entry_schema: + type: onap.datatype.controlloop.Operation +data_types: + onap.datatype.controlloop.Target: + derived_from: tosca.datatypes.Root + description: Definition for a entity in A&AI to perform a control loop operation on + properties: + targetType: + type: string + description: Category for the target type + required: true + constraints: + - valid_values: [VNF, VM, VFMODULE, PNF] + entityIds: + type: map + description: | + Map of values that identify the resource. If none are provided, it is assumed that the + entity that generated the ONSET event will be the target. + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Actor: + derived_from: tosca.datatypes.Root + description: An actor/operation/target definition + properties: + actor: + type: string + description: The actor performing the operation. + required: true + operation: + type: string + description: The operation the actor is performing. + required: true + target: + type: onap.datatype.controlloop.Target + description: The resource the operation should be performed on. + required: true + metadata: + clamp_possible_values: + payload: + type: map + description: Name/value pairs of payload information passed by Policy to the actor + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Operation: + derived_from: tosca.datatypes.Root + description: An operation supported by an actor + properties: + id: + type: string + description: Unique identifier for the operation + required: true + description: + type: string + description: A user-friendly description of the intent for the operation + required: false + operation: + type: onap.datatype.controlloop.Actor + description: The definition of the operation to be performed. + required: true + metadata: + clamp_possible_values: + timeout: + type: integer + description: The amount of time for the actor to perform the operation. + required: true + retries: + type: integer + description: The number of retries the actor should attempt to perform the operation. + required: true + default: 0 + success: + type: string + description: Points to the operation to invoke on success. A value of "final_success" indicates and end to the operation. + required: false + default: final_success + failure: + type: string + description: Points to the operation to invoke on Actor operation failure. + required: false + default: final_failure + failure_timeout: + type: string + description: Points to the operation to invoke when the time out for the operation occurs. + required: false + default: final_failure_timeout + failure_retries: + type: string + description: Points to the operation to invoke when the current operation has exceeded its max retries. + required: false + default: final_failure_retries + failure_exception: + type: string + description: Points to the operation to invoke when the current operation causes an exception. + required: false + default: final_failure_exception + failure_guard: + type: string + description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement. + required: false + default: final_failure_guard \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header new file mode 100644 index 00000000..6a280d97 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0?connectionTimeToLive=5000/.header @@ -0,0 +1 @@ +{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file new file mode 100644 index 00000000..72897be0 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.file @@ -0,0 +1,146 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +policy_types: + onap.policies.controlloop.operational.common.Drools: + derived_from: onap.policies.controlloop.operational.Common + type_version: 1.0.0 + version: 1.0.0 + description: Operational policies for Drools PDP + properties: + controllerName: + type: string + description: Drools controller properties + required: false + onap.policies.controlloop.operational.Common: + derived_from: tosca.policies.Root + version: 1.0.0 + description: | + Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant + Policy Types. This does NOT support the legacy Policy YAML policy type. + properties: + id: + type: string + description: The unique control loop id. + required: true + timeout: + type: integer + description: | + Overall timeout for executing all the operations. This timeout should equal or exceed the total + timeout for each operation listed. + required: true + abatement: + type: boolean + description: Whether an abatement event message will be expected for the control loop from DCAE. + required: true + default: false + trigger: + type: string + description: Initial operation to execute upon receiving an Onset event message for the Control Loop. + required: true + operations: + type: list + description: List of operations to be performed when Control Loop is triggered. + required: true + entry_schema: + type: onap.datatype.controlloop.Operation +data_types: + onap.datatype.controlloop.Target: + derived_from: tosca.datatypes.Root + description: Definition for a entity in A&AI to perform a control loop operation on + properties: + targetType: + type: string + description: Category for the target type + required: true + constraints: + - valid_values: [VNF, VM, VFMODULE, PNF] + entityIds: + type: map + description: | + Map of values that identify the resource. If none are provided, it is assumed that the + entity that generated the ONSET event will be the target. + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Actor: + derived_from: tosca.datatypes.Root + description: An actor/operation/target definition + properties: + actor: + type: string + description: The actor performing the operation. + required: true + operation: + type: string + description: The operation the actor is performing. + required: true + target: + type: onap.datatype.controlloop.Target + description: The resource the operation should be performed on. + required: true + metadata: + clamp_possible_values: + payload: + type: map + description: Name/value pairs of payload information passed by Policy to the actor + required: false + entry_schema: + type: string + + onap.datatype.controlloop.Operation: + derived_from: tosca.datatypes.Root + description: An operation supported by an actor + properties: + id: + type: string + description: Unique identifier for the operation + required: true + description: + type: string + description: A user-friendly description of the intent for the operation + required: false + operation: + type: onap.datatype.controlloop.Actor + description: The definition of the operation to be performed. + required: true + metadata: + clamp_possible_values: + timeout: + type: integer + description: The amount of time for the actor to perform the operation. + required: true + retries: + type: integer + description: The number of retries the actor should attempt to perform the operation. + required: true + default: 0 + success: + type: string + description: Points to the operation to invoke on success. A value of "final_success" indicates and end to the operation. + required: false + default: final_success + failure: + type: string + description: Points to the operation to invoke on Actor operation failure. + required: false + default: final_failure + failure_timeout: + type: string + description: Points to the operation to invoke when the time out for the operation occurs. + required: false + default: final_failure_timeout + failure_retries: + type: string + description: Points to the operation to invoke when the current operation has exceeded its max retries. + required: false + default: final_failure_retries + failure_exception: + type: string + description: Points to the operation to invoke when the current operation causes an exception. + required: false + default: final_failure_exception + failure_guard: + type: string + description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement. + required: false + default: final_failure_guard \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header new file mode 100644 index 00000000..6a280d97 --- /dev/null +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0?connectionTimeToLive=5000/.header @@ -0,0 +1 @@ +{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file index 5fa4308d..3c17c900 100644 --- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?connectionTimeToLive=5000/.file @@ -1,4 +1,4 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 +tosca_definitions_version: tosca_simple_yaml_1_1_0 policy_types: onap.policies.Monitoring: derived_from: tosca.policies.Root @@ -9,10 +9,9 @@ policy_types: version: 1.0.0 properties: tca_policy: - type: map + type: onap.datatypes.monitoring.tca_policy description: TCA Policy JSON - entry_schema: - type: onap.datatypes.monitoring.tca_policy + required: true data_types: onap.datatypes.monitoring.metricsPerEventName: derived_from: tosca.datatypes.Root diff --git a/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file index 6b6b372c..f16f4e89 100644 --- a/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file +++ b/src/test/resources/http-cache/example/policy/pap/v1/pdps?connectionTimeToLive=5000/.file @@ -27,6 +27,10 @@ "policies": [], "properties": {}, "supportedPolicyTypes": [ + { + "name": "onap.policies.controlloop.operational.common.*", + "version": "1.0.0" + }, { "name": "onap.policies.controlloop.Operational", "version": "1.0.0" @@ -42,7 +46,7 @@ "properties": {}, "supportedPolicyTypes": [ { - "name": "onap.policies.controlloop.Guard", + "name": "onap.policies.controlloop.guard.common.*", "version": "1.0.0" } ] diff --git a/src/test/resources/tosca/new-converter/tca-schema.json b/src/test/resources/tosca/new-converter/tca-schema.json new file mode 100644 index 00000000..3f444aa9 --- /dev/null +++ b/src/test/resources/tosca/new-converter/tca-schema.json @@ -0,0 +1,175 @@ +{ + "title": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "type": "object", + "required": [], + "properties": { + "tca_policy": { + "title": "onap.datatypes.monitoring.tca_policy", + "type": "object", + "required": [ + "domain", + "metricsPerEventName" + ], + "properties": { + "domain": { + "type": "string", + "description": "Domain name to which TCA needs to be applied", + "default": "measurementsForVfScaling", + "const": "measurementsForVfScaling" + }, + "metricsPerEventName": { + "type": "array", + "description": "Contains eventName and threshold details that need to be applied to given eventName", + "items": { + "title": "onap.datatypes.monitoring.metricsPerEventName", + "type": "object", + "required": [ + "controlLoopSchemaType", + "eventName", + "policyName", + "policyScope", + "policyVersion", + "thresholds" + ], + "properties": { + "controlLoopSchemaType": { + "type": "string", + "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", + "enum": [ + "VM", + "VNF" + ] + }, + "eventName": { + "type": "string", + "description": "Event name to which thresholds need to be applied" + }, + "policyName": { + "type": "string", + "description": "TCA Policy Scope Name" + }, + "policyScope": { + "type": "string", + "description": "TCA Policy Scope" + }, + "policyVersion": { + "type": "string", + "description": "TCA Policy Scope Version" + }, + "thresholds": { + "type": "array", + "description": "Thresholds associated with eventName", + "items": { + "title": "onap.datatypes.monitoring.thresholds", + "type": "object", + "required": [ + "closedLoopControlName", + "closedLoopEventStatus", + "direction", + "fieldPath", + "severity", + "thresholdValue", + "version" + ], + "properties": { + "closedLoopControlName": { + "type": "string", + "description": "Closed Loop Control Name associated with the threshold" + }, + "closedLoopEventStatus": { + "type": "string", + "description": "Closed Loop Event Status of the threshold", + "enum": [ + "ONSET", + "ABATED" + ] + }, + "direction": { + "type": "string", + "description": "Direction of the threshold", + "enum": [ + "LESS", + "LESS_OR_EQUAL", + "GREATER", + "GREATER_OR_EQUAL", + "EQUAL" + ] + }, + "fieldPath": { + "type": "string", + "description": "Json field Path as per CEF message which needs to be analyzed for TCA", + "enum": [ + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage", + "$.event.measurementsForVfScalingFields.meanRequestLatency", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed", + "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value" + ] + }, + "severity": { + "type": "string", + "description": "Threshold Event Severity", + "enum": [ + "CRITICAL", + "MAJOR", + "MINOR", + "WARNING", + "NORMAL" + ] + }, + "thresholdValue": { + "type": "integer", + "description": "Threshold value for the field Path inside CEF message" + }, + "version": { + "type": "string", + "description": "Version number associated with the threshold" + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/tosca/templates.properties b/src/test/resources/tosca/templates.properties deleted file mode 100644 index 792238bd..00000000 --- a/src/test/resources/tosca/templates.properties +++ /dev/null @@ -1,7 +0,0 @@ -Integer=type,description,required -Boolean=description,required -String=type,description,required,metadata,constraints -Number=description,required -Map=type,description,required,entry_schema -List=type,required,entry_schema -onap.datatype.controlloop.Actor=type,description,required,metadata \ No newline at end of file diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js index c8ecca2f..5eaa79a6 100644 --- a/ui-react/src/api/LoopCache.js +++ b/ui-react/src/api/LoopCache.js @@ -126,12 +126,14 @@ export default class LoopCache { return null; } - getOperationalPolicySupportedPdpgroup(name) { + getOperationalPolicySupportedPdpGroup(name) { var opConfig=this.getOperationalPolicyForName(name); if (opConfig !== null) { - return opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"]; + if (opConfig["policyModel"]["policyPdpGroup"] !== undefined && opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) { + return opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"]; + } } - return null; + return []; } getOperationalPolicyPdpGroup(name) { @@ -150,12 +152,14 @@ export default class LoopCache { return null; } - getMicroServiceSupportedPdpgroup(name) { + getMicroServiceSupportedPdpGroup(name) { var microService=this.getMicroServiceForName(name); if (microService !== null) { - return microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"]; + if (microService["policyModel"]["policyPdpGroup"] !== undefined && microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) { + return microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"]; + } } - return null; + return []; } getMicroServicePdpGroup(name) { diff --git a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js index 3fa0c0ca..da65ac9f 100644 --- a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js +++ b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js @@ -85,19 +85,20 @@ export default class ConfigurationPolicyModal extends React.Component { } var editorData = this.state.loopCache.getMicroServicePropertiesForName(this.state.policyName); - JSONEditor.defaults.options.theme = 'bootstrap4'; - //JSONEditor.defaults.options.iconlib = 'bootstrap2'; - JSONEditor.defaults.options.object_layout = 'grid'; - JSONEditor.defaults.options.disable_properties = true; - JSONEditor.defaults.options.disable_edit_json = false; - JSONEditor.defaults.options.disable_array_reorder = true; - JSONEditor.defaults.options.disable_array_delete_last_row = true; - JSONEditor.defaults.options.disable_array_delete_all_rows = false; - JSONEditor.defaults.options.show_errors = 'always'; - this.setState({ jsonEditor: new JSONEditor(document.getElementById("editor"), - { schema: toscaModel.schema, startval: editorData }) + { + schema: toscaModel, + startval: editorData, + theme: 'bootstrap4', + object_layout: 'grid', + disable_properties: true, + disable_edit_json: false, + disable_array_reorder: true, + disable_array_delete_last_row: true, + disable_array_delete_all_rows: false, + show_errors: 'always' + }) }) } diff --git a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js index 4d527b71..a19c18c9 100644 --- a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js +++ b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js @@ -25,7 +25,6 @@ import { mount } from 'enzyme'; import ConfigurationPolicyModal from './ConfigurationPolicyModal'; import LoopCache from '../../../api/LoopCache'; - describe('Verify ConfigurationPolicyModal', () => { beforeEach(() => { fetch.resetMocks(); diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js index dc7c0a48..7ed8ba6f 100644 --- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js +++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js @@ -94,20 +94,8 @@ export default class OperationalPolicyModal extends React.Component { return liel; } }); - JSONEditor.defaults.options.theme = 'myBootstrap4'; - JSONEditor.defaults.options.object_layout = 'grid'; - JSONEditor.defaults.options.disable_properties = true; - JSONEditor.defaults.options.disable_edit_json = false; - JSONEditor.defaults.options.disable_array_reorder = true; - JSONEditor.defaults.options.disable_array_delete_last_row = true; - JSONEditor.defaults.options.disable_array_delete_all_rows = false; - JSONEditor.defaults.options.array_controls_top=true; - JSONEditor.defaults.options.show_errors = 'always'; - JSONEditor.defaults.options.keep_oneof_values=false; - JSONEditor.defaults.options.collapsed=true; - //JSONEditor.defaults.options.template = 'default'; } - + renderJsonEditor() { console.debug("Rendering OperationalPolicyModal"); var schema_json = this.state.loopCache.getOperationalPolicyJsonSchema(); @@ -120,7 +108,21 @@ export default class OperationalPolicyModal extends React.Component { this.setState({ jsonEditor: new JSONEditor(document.getElementById("editor"), - { schema: schema_json.schema, startval: operationalPoliciesData }) + { + schema: schema_json.schema, + startval: operationalPoliciesData, + theme: 'myBootstrap4', + object_layout: 'grid', + disable_properties: true, + disable_edit_json: false, + disable_array_reorder: true, + disable_array_delete_last_row: true, + disable_array_delete_all_rows: false, + array_controls_top: true, + show_errors: 'always', + keep_oneof_values: false, + collapsed:true + }) }) } diff --git a/ui-react/src/components/dialogs/Policy/PolicyModal.js b/ui-react/src/components/dialogs/Policy/PolicyModal.js index caae70ef..634c5ac5 100644 --- a/ui-react/src/components/dialogs/Policy/PolicyModal.js +++ b/ui-react/src/components/dialogs/Policy/PolicyModal.js @@ -59,6 +59,7 @@ export default class PolicyModal extends React.Component { this.renderJsonEditor = this.renderJsonEditor.bind(this); this.handlePdpGroupChange = this.handlePdpGroupChange.bind(this); this.handlePdpSubgroupChange = this.handlePdpSubgroupChange.bind(this); + this.createJsonEditor = this.createJsonEditor.bind(this); } handleSave() { @@ -67,13 +68,12 @@ export default class PolicyModal extends React.Component { if (errors.length !== 0) { console.error("Errors detected during policy data validation ", errors); - this.setState({ show: false }); - this.props.history.push('/'); + return; } else { console.info("NO validation errors found in policy data"); if (this.state.policyInstanceType === 'MICRO-SERVICE-POLICY') { - this.state.loopCache.updateMicroServiceProperties(this.state.policyName, editorData[0]); + this.state.loopCache.updateMicroServiceProperties(this.state.policyName, editorData); this.state.loopCache.updateMicroServicePdpGroup(this.state.policyName, this.state.chosenPdpGroup, this.state.chosenPdpSubgroup); LoopService.setMicroServiceProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getMicroServiceForName(this.state.policyName)).then(resp => { this.setState({ show: false }); @@ -81,7 +81,7 @@ export default class PolicyModal extends React.Component { this.props.loadLoopFunction(this.state.loopCache.getLoopName()); }); } else if (this.state.policyInstanceType === 'OPERATIONAL-POLICY') { - this.state.loopCache.updateOperationalPolicyProperties(this.state.policyName, editorData[0]); + this.state.loopCache.updateOperationalPolicyProperties(this.state.policyName, editorData); this.state.loopCache.updateOperationalPolicyPdpGroup(this.state.policyName, this.state.chosenPdpGroup, this.state.chosenPdpSubgroup); LoopService.setOperationalPolicyProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getOperationalPolicies()).then(resp => { this.setState({ show: false }); @@ -101,6 +101,26 @@ export default class PolicyModal extends React.Component { this.renderJsonEditor(); } + createJsonEditor(toscaModel, editorData) { + return new JSONEditor(document.getElementById("editor"), + { schema: toscaModel, + startval: editorData, + theme: 'bootstrap4', + object_layout: 'grid', + disable_properties: true, + disable_edit_json: false, + disable_array_reorder: true, + disable_array_delete_last_row: true, + disable_array_delete_all_rows: false, + no_additional_properties: true, + show_errors: 'always', + display_required_only: false, + show_opt_in: true, + prompt_before_delete: true, + required_by_default: true + }) + } + renderJsonEditor() { console.debug("Rendering PolicyModal ", this.state.policyName); var toscaModel = {}; @@ -110,13 +130,13 @@ export default class PolicyModal extends React.Component { if (this.state.policyInstanceType === 'MICRO-SERVICE-POLICY') { toscaModel = this.state.loopCache.getMicroServiceJsonRepresentationForName(this.state.policyName); editorData = this.state.loopCache.getMicroServicePropertiesForName(this.state.policyName); - pdpGroupValues = this.state.loopCache.getMicroServiceSupportedPdpgroup(this.state.policyName); + pdpGroupValues = this.state.loopCache.getMicroServiceSupportedPdpGroup(this.state.policyName); chosenPdpGroupValue = this.state.loopCache.getMicroServicePdpGroup(this.state.policyName); chosenPdpSubgroupValue = this.state.loopCache.getMicroServicePdpSubgroup(this.state.policyName); } else if (this.state.policyInstanceType === 'OPERATIONAL-POLICY') { toscaModel = this.state.loopCache.getOperationalPolicyJsonRepresentationForName(this.state.policyName); editorData = this.state.loopCache.getOperationalPolicyPropertiesForName(this.state.policyName); - pdpGroupValues = this.state.loopCache.getOperationalPolicySupportedPdpgroup(this.state.policyName); + pdpGroupValues = this.state.loopCache.getOperationalPolicySupportedPdpGroup(this.state.policyName); chosenPdpGroupValue = this.state.loopCache.getOperationalPolicyPdpGroup(this.state.policyName); chosenPdpSubgroupValue = this.state.loopCache.getOperationalPolicyPdpSubgroup(this.state.policyName); } @@ -125,49 +145,28 @@ export default class PolicyModal extends React.Component { return; } - JSONEditor.defaults.options.theme = 'bootstrap4'; - //JSONEditor.defaults.options.iconlib = 'bootstrap2'; - JSONEditor.defaults.options.object_layout = 'grid'; - JSONEditor.defaults.options.disable_properties = true; - JSONEditor.defaults.options.disable_edit_json = false; - JSONEditor.defaults.options.disable_array_reorder = true; - JSONEditor.defaults.options.disable_array_delete_last_row = true; - JSONEditor.defaults.options.disable_array_delete_all_rows = false; - JSONEditor.defaults.options.show_errors = 'always'; - - var pdpGroupListValues = pdpGroupValues.map(entry => { - return { label: Object.keys(entry)[0], value: Object.keys(entry)[0] }; - }); - - if (typeof(chosenPdpGroupValue) === "undefined") { - this.setState({ - jsonEditor: new JSONEditor(document.getElementById("editor"), - { schema: toscaModel.schema, startval: editorData }), - pdpGroup: pdpGroupValues, - pdpGroupList: pdpGroupListValues, - chosenPdpGroup: chosenPdpGroupValue, - chosenPdpSubgroup: chosenPdpSubgroupValue - }) - } else { + var pdpSubgroupValues = []; + if (typeof(chosenPdpGroupValue) !== "undefined") { var selectedPdpGroup = pdpGroupValues.filter(entry => (Object.keys(entry)[0] === chosenPdpGroupValue)); - const pdpSubgroupValues = selectedPdpGroup[0][chosenPdpGroupValue].map((pdpSubgroup) => { return { label: pdpSubgroup, value: pdpSubgroup } }); - this.setState({ - jsonEditor: new JSONEditor(document.getElementById("editor"), - { schema: toscaModel.schema, startval: editorData }), - pdpGroup: pdpGroupValues, - pdpGroupList: pdpGroupListValues, - pdpSubgroupList: pdpSubgroupValues, - chosenPdpGroup: chosenPdpGroupValue, - chosenPdpSubgroup: chosenPdpSubgroupValue - }) + pdpSubgroupValues = selectedPdpGroup[0][chosenPdpGroupValue].map((pdpSubgroup) => { return { label: pdpSubgroup, value: pdpSubgroup } }); } + this.setState({ + jsonEditor: this.createJsonEditor(toscaModel,editorData), + pdpGroup: pdpGroupValues, + pdpGroupList: pdpGroupValues.map(entry => { + return { label: Object.keys(entry)[0], value: Object.keys(entry)[0] }; + }), + pdpSubgroupList: pdpSubgroupValues, + chosenPdpGroup: chosenPdpGroupValue, + chosenPdpSubgroup: chosenPdpSubgroupValue + }) } handlePdpGroupChange(e) { var selectedPdpGroup = this.state.pdpGroup.filter(entry => (Object.keys(entry)[0] === e.value)); const pdpSubgroupValues = selectedPdpGroup[0][e.value].map((pdpSubgroup) => { return { label: pdpSubgroup, value: pdpSubgroup } }); if (this.state.chosenPdpGroup !== e.value) { - this.setState({ + this.setState({ chosenPdpGroup: e.value, chosenPdpSubgroup: '', pdpSubgroupList: pdpSubgroupValues @@ -183,7 +182,7 @@ export default class PolicyModal extends React.Component { return ( - Configuration policies + Edit the policy
        -- 2.16.6

        string

        pdpSubGroup
        +

        pdpSubgroup
        optional

        string

        string

        pdpSubGroup
        +

        pdpSubgroup
        optional

        string