From: Sébastien Determe Date: Tue, 21 Apr 2020 12:27:17 +0000 (+0000) Subject: Merge "Prevent adding same type of Op policy" X-Git-Tag: 5.0.5~10 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=8b9918e7e3b1398ece5470f36be1d9dd13e29bee;hp=c65613938d30565d4dc913fbf2d48002390119d3;p=clamp.git Merge "Prevent adding same type of Op policy" --- diff --git a/extra/sql/dump/test-data.sql b/extra/sql/dump/test-data.sql index 1a8f22a6..9ffb95fd 100644 --- a/extra/sql/dump/test-data.sql +++ b/extra/sql/dump/test-data.sql @@ -26,8 +26,8 @@ USE `cldsdb4`; LOCK TABLES `dictionary` WRITE; /*!40000 ALTER TABLE `dictionary` DISABLE KEYS */; -INSERT INTO `dictionary` VALUES ('DefaultActors','Not found','2020-04-03 17:52:03.988191','Not found','2020-04-03 17:52:03.988191',0,''); -INSERT INTO `dictionary` VALUES ('DefaultOperations','Not found','2020-04-03 17:52:04.107748','Not found','2020-04-03 17:52:04.107748',0,''); +INSERT INTO `dictionary` VALUES ('DefaultActors','Not found','2020-04-16 16:49:31.863816','Not found','2020-04-16 16:49:31.863816',0,''); +INSERT INTO `dictionary` VALUES ('DefaultOperations','Not found','2020-04-16 16:49:31.968970','Not found','2020-04-16 16:49:31.968970',0,''); /*!40000 ALTER TABLE `dictionary` ENABLE KEYS */; UNLOCK TABLES; @@ -37,20 +37,20 @@ UNLOCK TABLES; LOCK TABLES `dictionary_elements` WRITE; /*!40000 ALTER TABLE `dictionary_elements` DISABLE KEYS */; -INSERT INTO `dictionary_elements` VALUES ('APPC','Not found','2020-04-03 17:52:04.058749','Not found','2020-04-03 17:52:04.058749','APPC component','APPC',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('BandwidthOnDemand (SDNC operation)','Not found','2020-04-03 17:52:04.116260','Not found','2020-04-03 17:52:04.116260','SDNC operation','BandwidthOnDemand',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Health-Check (APPC operation)','Not found','2020-04-03 17:52:04.208767','Not found','2020-04-03 17:52:04.208767','APPC operation','Health-Check',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Migrate (APPC operation)','Not found','2020-04-03 17:52:04.203123','Not found','2020-04-03 17:52:04.203123','APPC operation','Migrate',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('ModifyConfig (APPC/VFC operation)','Not found','2020-04-03 17:52:04.155195','Not found','2020-04-03 17:52:04.155195','APPC/VFC operation','ModifyConfig',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Rebuild (APPC operation)','Not found','2020-04-03 17:52:04.148530','Not found','2020-04-03 17:52:04.148530','APPC operation','Rebuild',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Reroute (SDNC operation)','Not found','2020-04-03 17:52:04.132537','Not found','2020-04-03 17:52:04.132537','SDNC operation','Reroute',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Restart (APPC operation)','Not found','2020-04-03 17:52:04.160209','Not found','2020-04-03 17:52:04.160209','APPC operation','Restart',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('SDNC','Not found','2020-04-03 17:52:04.044312','Not found','2020-04-03 17:52:04.044312','SDNC component','SDNC',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('SDNR','Not found','2020-04-03 17:52:04.029617','Not found','2020-04-03 17:52:04.029617','SDNR component','SDNR',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('SO','Not found','2020-04-03 17:52:04.054400','Not found','2020-04-03 17:52:04.054400','SO component','SO',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('VF Module Create (SO operation)','Not found','2020-04-03 17:52:04.142814','Not found','2020-04-03 17:52:04.142814','SO operation','VF Module Create',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('VF Module Delete (SO operation)','Not found','2020-04-03 17:52:04.123469','Not found','2020-04-03 17:52:04.123469','SO operation','VF Module Delete',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('VFC','Not found','2020-04-03 17:52:04.048834','Not found','2020-04-03 17:52:04.048834','VFC component','VFC',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('APPC','Not found','2020-04-16 16:49:31.919100','Not found','2020-04-16 16:49:31.919100','APPC component','APPC',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('BandwidthOnDemand (SDNC operation)','Not found','2020-04-16 16:49:31.970942','Not found','2020-04-16 16:49:31.970942','SDNC operation','BandwidthOnDemand',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('Health-Check (APPC operation)','Not found','2020-04-16 16:49:32.001881','Not found','2020-04-16 16:49:32.001881','APPC operation','Health-Check',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('Migrate (APPC operation)','Not found','2020-04-16 16:49:31.991418','Not found','2020-04-16 16:49:31.991418','APPC operation','Migrate',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('ModifyConfig (APPC/VFC operation)','Not found','2020-04-16 16:49:31.986045','Not found','2020-04-16 16:49:31.986045','APPC/VFC operation','ModifyConfig',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('Rebuild (APPC operation)','Not found','2020-04-16 16:49:31.978401','Not found','2020-04-16 16:49:31.978401','APPC operation','Rebuild',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('Reroute (SDNC operation)','Not found','2020-04-16 16:49:31.974718','Not found','2020-04-16 16:49:31.974718','SDNC operation','Reroute',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('Restart (APPC operation)','Not found','2020-04-16 16:49:31.988714','Not found','2020-04-16 16:49:31.988714','APPC operation','Restart',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('SDNC','Not found','2020-04-16 16:49:31.900260','Not found','2020-04-16 16:49:31.900260','SDNC component','SDNC',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('SDNR','Not found','2020-04-16 16:49:31.896525','Not found','2020-04-16 16:49:31.896525','SDNR component','SDNR',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('SO','Not found','2020-04-16 16:49:31.914906','Not found','2020-04-16 16:49:31.914906','SO component','SO',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('VF Module Create (SO operation)','Not found','2020-04-16 16:49:31.976664','Not found','2020-04-16 16:49:31.976664','SO operation','VF Module Create',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('VF Module Delete (SO operation)','Not found','2020-04-16 16:49:31.972818','Not found','2020-04-16 16:49:31.972818','SO operation','VF Module Delete',NULL,'string'); +INSERT INTO `dictionary_elements` VALUES ('VFC','Not found','2020-04-16 16:49:31.904373','Not found','2020-04-16 16:49:31.904373','VFC component','VFC',NULL,'string'); /*!40000 ALTER TABLE `dictionary_elements` ENABLE KEYS */; UNLOCK TABLES; @@ -93,7 +93,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-04-03 17:52:26.241306','Not found','2020-04-03 17:52:26.548731',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); +INSERT INTO `loop_element_models` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app',NULL,'2020-04-16 16:48:51.037499','Not found','2020-04-16 16:48:52.538901',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); /*!40000 ALTER TABLE `loop_element_models` ENABLE KEYS */; UNLOCK TABLES; @@ -112,9 +112,9 @@ UNLOCK TABLES; LOCK TABLES `loop_templates` WRITE; /*!40000 ALTER TABLE `loop_templates` DISABLE KEYS */; -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_AUIuU_v1_0_ResourceInstanceName1_tca','Not found','2020-04-03 17:52:26.520952','Not found','2020-04-03 17:52:26.520952','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-2c8862bd-ac1d-4c1f-be9f-112d7b72724f',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_AUIuU_v1_0_ResourceInstanceName1_tca_3','Not found','2020-04-03 17:52:26.387404','Not found','2020-04-03 17:52:26.387404','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 - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml\"\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/clamppolicyplugin/1.1.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.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.2.2\"\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-service\"\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\":\"VM\",\"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 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: \"3904\"\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT: \"8443\"\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT: \"8500\"\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT: \"10000\"\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:\n get_input: policy_model_id\n','typeId-ada93f5d-9fb9-4f45-b7a0-21c4a7767269',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_AUIuU_v1_0_ResourceInstanceName2_tca_2','Not found','2020-04-03 17:52:26.222413','Not found','2020-04-03 17:52:26.222413','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-5f2fda20-ac6e-49c8-b7c7-09b57be122da',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_klciS_v1_0_ResourceInstanceName1_tca','Not found','2020-04-16 16:48:52.353132','Not found','2020-04-16 16:48:52.353132','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-83c79bbd-0143-47b1-923f-4f393ca7de8f',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_klciS_v1_0_ResourceInstanceName1_tca_3','Not found','2020-04-16 16:48:51.732987','Not found','2020-04-16 16:48:51.732987','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 - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml\"\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/clamppolicyplugin/1.1.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.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.2.2\"\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-service\"\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\":\"VM\",\"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 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: \"3904\"\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT: \"8443\"\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT: \"8500\"\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT: \"10000\"\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:\n get_input: policy_model_id\n','typeId-75023c2f-2850-48b2-b51a-7c8cf3698fe1',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_klciS_v1_0_ResourceInstanceName2_tca_2','Not found','2020-04-16 16:48:50.910670','Not found','2020-04-16 16:48:50.910670','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-7b161f95-fe7e-4e2c-8f32-fd6abd7c2e0b',0,'VESapp',1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); /*!40000 ALTER TABLE `loop_templates` ENABLE KEYS */; UNLOCK TABLES; @@ -152,9 +152,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_AUIuU_v1_0_ResourceInstanceName1_tca',0); -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_AUIuU_v1_0_ResourceInstanceName1_tca_3',0); -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_AUIuU_v1_0_ResourceInstanceName2_tca_2',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_klciS_v1_0_ResourceInstanceName1_tca',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_klciS_v1_0_ResourceInstanceName1_tca_3',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_klciS_v1_0_ResourceInstanceName2_tca_2',0); /*!40000 ALTER TABLE `looptemplates_to_loopelementmodels` ENABLE KEYS */; UNLOCK TABLES; @@ -182,13 +182,13 @@ UNLOCK TABLES; LOCK TABLES `policy_models` WRITE; /*!40000 ALTER TABLE `policy_models` DISABLE KEYS */; -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.Blacklist','1.0.0','Not found','2020-04-03 17:52:44.108022','Not found','2020-04-03 17:52:44.392669','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\n 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\n 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','{\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-04-03 17:52:44.009503','Not found','2020-04-03 17:52:44.411634','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\n 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:\n - second\n - minute\n - hour\n - day\n - week\n - month\n - year\n limit:\n type: integer\n description: The limit\n required: true\n constraints:\n - greater_than: 0\n','{\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-04-03 17:52:44.180103','Not found','2020-04-03 17:52:44.180103','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\n 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\n',NULL); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.Operational','1.0.0','Not found','2020-04-03 17:51:59.157973','Not found','2020-04-03 17:52:44.430346','OperationalPolicyLegacy','','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"apex\",\n \"drools\"\n ]\n }\n ]\n}'); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.common.Apex','1.0.0','Not found','2020-04-03 17:52:43.912851','Not found','2020-04-03 17:52:44.447741','Apex','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.Common:\n properties:\n abatement:\n name: abatement\n type: boolean\n typeVersion: 0.0.0\n description: Whether an abatement event message will be expected for\n the control loop from DCAE.\n default: \'false\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n operations:\n name: operations\n type: list\n typeVersion: 0.0.0\n description: List of operations to be performed when Control Loop\n is triggered.\n required: true\n constraints: [\n ]\n entry_schema:\n type: onap.datatype.controlloop.Operation\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata: {\n }\n trigger:\n name: trigger\n type: string\n typeVersion: 0.0.0\n description: Initial operation to execute upon receiving an Onset\n event message for the Control Loop.\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\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 constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: The unique control loop id.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.Common\n version: 1.0.0\n derived_from: tosca.policies.Root\n metadata: {\n }\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 onap.policies.controlloop.operational.common.Apex:\n properties:\n engineServiceParameters:\n name: engineServiceParameters\n type: string\n typeVersion: 0.0.0\n description: The engine parameters like name, instanceCount, policy\n implementation, parameters etc.\n required: true\n constraints: [\n ]\n metadata: {\n }\n eventOutputParameters:\n name: eventOutputParameters\n type: string\n typeVersion: 0.0.0\n description: The event output parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n javaProperties:\n name: javaProperties\n type: string\n typeVersion: 0.0.0\n description: Name/value pairs of properties to be set for APEX if\n needed.\n required: false\n constraints: [\n ]\n metadata: {\n }\n eventInputParameters:\n name: eventInputParameters\n type: string\n typeVersion: 0.0.0\n description: The event input parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.common.Apex\n version: 1.0.0\n derived_from: onap.policies.controlloop.operational.Common\n metadata: {\n }\n description: Operational policies for Apex PDP\ndata_types:\n onap.datatype.controlloop.Actor:\n constraints: [\n ]\n properties:\n payload:\n name: payload\n type: map\n typeVersion: 0.0.0\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n target:\n name: target\n type: onap.datatype.controlloop.Target\n typeVersion: 0.0.0\n description: The resource the operation should be performed on.\n required: true\n constraints: [\n ]\n metadata: {\n }\n actor:\n name: actor\n type: string\n typeVersion: 0.0.0\n description: The actor performing the operation.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n name: operation\n type: string\n typeVersion: 0.0.0\n description: The operation the actor is performing.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operation\n name: onap.datatype.controlloop.Actor\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An actor/operation/target definition\n onap.datatype.controlloop.Operation:\n constraints: [\n ]\n properties:\n failure_retries:\n name: failure_retries\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n has exceeded its max retries.\n default: final_failure_retries\n required: false\n constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: Unique identifier for the operation\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_timeout:\n name: failure_timeout\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the time out for\n the operation occurs.\n default: final_failure_timeout\n required: false\n constraints: [\n ]\n metadata: {\n }\n failure:\n name: failure\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on Actor operation\n failure.\n default: final_failure\n required: false\n constraints: [\n ]\n metadata: {\n }\n operation:\n name: operation\n type: onap.datatype.controlloop.Actor\n typeVersion: 0.0.0\n description: The definition of the operation to be performed.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_guard:\n name: failure_guard\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n is blocked due to guard policy enforcement.\n default: final_failure_guard\n required: false\n constraints: [\n ]\n metadata: {\n }\n retries:\n name: retries\n type: integer\n typeVersion: 0.0.0\n description: The number of retries the actor should attempt to perform\n the operation.\n default: \'0\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\n description: The amount of time for the actor to perform the operation.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_exception:\n name: failure_exception\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n causes an exception.\n default: final_failure_exception\n required: false\n constraints: [\n ]\n metadata: {\n }\n description:\n name: description\n type: string\n typeVersion: 0.0.0\n description: A user-friendly description of the intent for the operation\n required: false\n constraints: [\n ]\n metadata: {\n }\n success:\n name: success\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on success. A value\n of \"final_success\" indicates and end to the operation.\n default: final_success\n required: false\n constraints: [\n ]\n metadata: {\n }\n name: onap.datatype.controlloop.Operation\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An operation supported by an actor\n onap.datatype.controlloop.Target:\n constraints: [\n ]\n properties:\n entityIds:\n name: entityIds\n type: map\n typeVersion: 0.0.0\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 constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n targetType:\n name: targetType\n type: string\n typeVersion: 0.0.0\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n metadata: {\n }\n name: onap.datatype.controlloop.Target\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: Definition for a entity in A&AI to perform a control loop operation\n on\nname: ToscaServiceTemplateSimple\nversion: 1.0.0\nmetadata: {\n }\n','{\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-04-03 17:52:43.743043','Not found','2020-04-03 17:52:44.470388','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\n 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\n 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\n 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\n on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - 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 metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\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 metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operations\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\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 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\n 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\n 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\n 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\n 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\n 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\n 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\n is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard\n','{\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-04-03 17:52:26.052248','Not found','2020-04-03 17:52:44.501815','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\n 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\n 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\n 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','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.Blacklist','1.0.0','Not found','2020-04-16 16:49:04.887829','Not found','2020-04-16 16:49:05.833609','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\n 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\n 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','{\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-04-16 16:49:04.674370','Not found','2020-04-16 16:49:05.857855','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\n 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:\n - second\n - minute\n - hour\n - day\n - week\n - month\n - year\n limit:\n type: integer\n description: The limit\n required: true\n constraints:\n - greater_than: 0\n','{\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-04-16 16:49:05.330365','Not found','2020-04-16 16:49:05.330365','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\n 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\n',NULL); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.Operational','1.0.0','Not found','2020-04-16 16:47:23.371101','Not found','2020-04-16 16:49:05.907145','OperationalPolicyLegacy','','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"apex\",\n \"drools\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.common.Apex','1.0.0','Not found','2020-04-16 16:49:04.496777','Not found','2020-04-16 16:49:05.960265','Apex','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.Common:\n properties:\n abatement:\n name: abatement\n type: boolean\n typeVersion: 0.0.0\n description: Whether an abatement event message will be expected for\n the control loop from DCAE.\n default: \'false\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n operations:\n name: operations\n type: list\n typeVersion: 0.0.0\n description: List of operations to be performed when Control Loop\n is triggered.\n required: true\n constraints: [\n ]\n entry_schema:\n type: onap.datatype.controlloop.Operation\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata: {\n }\n trigger:\n name: trigger\n type: string\n typeVersion: 0.0.0\n description: Initial operation to execute upon receiving an Onset\n event message for the Control Loop.\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\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 constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: The unique control loop id.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.Common\n version: 1.0.0\n derived_from: tosca.policies.Root\n metadata: {\n }\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 onap.policies.controlloop.operational.common.Apex:\n properties:\n engineServiceParameters:\n name: engineServiceParameters\n type: string\n typeVersion: 0.0.0\n description: The engine parameters like name, instanceCount, policy\n implementation, parameters etc.\n required: true\n constraints: [\n ]\n metadata: {\n }\n eventOutputParameters:\n name: eventOutputParameters\n type: string\n typeVersion: 0.0.0\n description: The event output parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n javaProperties:\n name: javaProperties\n type: string\n typeVersion: 0.0.0\n description: Name/value pairs of properties to be set for APEX if\n needed.\n required: false\n constraints: [\n ]\n metadata: {\n }\n eventInputParameters:\n name: eventInputParameters\n type: string\n typeVersion: 0.0.0\n description: The event input parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.common.Apex\n version: 1.0.0\n derived_from: onap.policies.controlloop.operational.Common\n metadata: {\n }\n description: Operational policies for Apex PDP\ndata_types:\n onap.datatype.controlloop.Actor:\n constraints: [\n ]\n properties:\n payload:\n name: payload\n type: map\n typeVersion: 0.0.0\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n target:\n name: target\n type: onap.datatype.controlloop.Target\n typeVersion: 0.0.0\n description: The resource the operation should be performed on.\n required: true\n constraints: [\n ]\n metadata: {\n }\n actor:\n name: actor\n type: string\n typeVersion: 0.0.0\n description: The actor performing the operation.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n name: operation\n type: string\n typeVersion: 0.0.0\n description: The operation the actor is performing.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operation\n name: onap.datatype.controlloop.Actor\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An actor/operation/target definition\n onap.datatype.controlloop.Operation:\n constraints: [\n ]\n properties:\n failure_retries:\n name: failure_retries\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n has exceeded its max retries.\n default: final_failure_retries\n required: false\n constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: Unique identifier for the operation\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_timeout:\n name: failure_timeout\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the time out for\n the operation occurs.\n default: final_failure_timeout\n required: false\n constraints: [\n ]\n metadata: {\n }\n failure:\n name: failure\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on Actor operation\n failure.\n default: final_failure\n required: false\n constraints: [\n ]\n metadata: {\n }\n operation:\n name: operation\n type: onap.datatype.controlloop.Actor\n typeVersion: 0.0.0\n description: The definition of the operation to be performed.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_guard:\n name: failure_guard\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n is blocked due to guard policy enforcement.\n default: final_failure_guard\n required: false\n constraints: [\n ]\n metadata: {\n }\n retries:\n name: retries\n type: integer\n typeVersion: 0.0.0\n description: The number of retries the actor should attempt to perform\n the operation.\n default: \'0\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\n description: The amount of time for the actor to perform the operation.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_exception:\n name: failure_exception\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n causes an exception.\n default: final_failure_exception\n required: false\n constraints: [\n ]\n metadata: {\n }\n description:\n name: description\n type: string\n typeVersion: 0.0.0\n description: A user-friendly description of the intent for the operation\n required: false\n constraints: [\n ]\n metadata: {\n }\n success:\n name: success\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on success. A value\n of \"final_success\" indicates and end to the operation.\n default: final_success\n required: false\n constraints: [\n ]\n metadata: {\n }\n name: onap.datatype.controlloop.Operation\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An operation supported by an actor\n onap.datatype.controlloop.Target:\n constraints: [\n ]\n properties:\n entityIds:\n name: entityIds\n type: map\n typeVersion: 0.0.0\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 constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n targetType:\n name: targetType\n type: string\n typeVersion: 0.0.0\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n metadata: {\n }\n name: onap.datatype.controlloop.Target\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: Definition for a entity in A&AI to perform a control loop operation\n on\nname: ToscaServiceTemplateSimple\nversion: 1.0.0\nmetadata: {\n }\n','{\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-04-16 16:49:03.958133','Not found','2020-04-16 16:49:06.057670','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\n 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\n 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\n 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\n on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - 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 metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\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 metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operations\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\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 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\n 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\n 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\n 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\n 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\n 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\n 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\n is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard\n','{\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-04-16 16:48:46.645494','Not found','2020-04-16 16:49:06.116687','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\n 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\n 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\n 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','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); /*!40000 ALTER TABLE `policy_models` ENABLE KEYS */; UNLOCK TABLES; @@ -198,7 +198,7 @@ UNLOCK TABLES; LOCK TABLES `services` WRITE; /*!40000 ALTER TABLE `services` DISABLE KEYS */; -INSERT INTO `services` VALUES ('63cac700-ab9a-4115-a74f-7eac85e3fce0','vLoadBalancerMS','{\n \"CP\": {},\n \"VL\": {},\n \"VF\": {\n \"vLoadBalancerMS 0\": {\n \"resourceVendor\": \"Test\",\n \"name\": \"vLoadBalancerMS\",\n \"resourceVendorModelNumber\": \"\",\n \"description\": \"vLBMS\",\n \"invariantUUID\": \"1a31b9f2-e50d-43b7-89b3-a040250cf506\",\n \"UUID\": \"b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6\",\n \"type\": \"VF\",\n \"category\": \"Application L4+\",\n \"subcategory\": \"Load Balancer\",\n \"version\": \"1.0\",\n \"customizationUUID\": \"465246dc-7748-45f4-a013-308d92922552\",\n \"resourceVendorRelease\": \"1.0\",\n \"controllerProperties\": {\n \"sdnc_model_name\": \"baseconfiguration\",\n \"sdnc_model_version\": \"1.0.0\",\n \"workflows\": {\n \"resource-assignment\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": \"\",\n \"service-instance-id\": \"\",\n \"vnf-id\": \"\",\n \"action-name\": \"\",\n \"scope-type\": \"\",\n \"hostname\": \"\",\n \"vnf_name\": \"\"\n }\n }\n },\n \"activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": \"\",\n \"service-instance-id\": \"\",\n \"vnf-id\": \"\",\n \"action-name\": \"\",\n \"scope-type\": \"\",\n \"hostname\": \"\",\n \"vnf_name\": \"\"\n }\n }\n },\n \"activate-restconf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": \"\",\n \"service-instance-id\": \"\",\n \"vnf-id\": \"\",\n \"action-name\": \"\",\n \"scope-type\": \"\",\n \"hostname\": \"\",\n \"vnf_name\": \"\"\n }\n }\n },\n \"activate-cli\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": \"\",\n \"service-instance-id\": \"\",\n \"vnf-id\": \"\",\n \"action-name\": \"\",\n \"scope-type\": \"\",\n \"hostname\": \"\",\n \"vnf_name\": \"\"\n }\n }\n },\n \"assign-activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": \"\",\n \"service-instance-id\": \"\",\n \"vnf-id\": \"\",\n \"action-name\": \"\",\n \"scope-type\": \"\",\n \"hostname\": \"\",\n \"vnf_name\": \"\"\n }\n }\n },\n \"imperative-test-wf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": \"\",\n \"service-instance-id\": \"\",\n \"vnf-id\": \"\",\n \"action-name\": \"\",\n \"scope-type\": \"\",\n \"hostname\": \"\",\n \"vnf_name\": \"\"\n }\n }\n }\n }\n }\n }\n },\n \"CR\": {},\n \"VFC\": {},\n \"PNF\": {},\n \"Service\": {},\n \"CVFC\": {},\n \"Service Proxy\": {},\n \"Configuration\": {},\n \"AllottedResource\": {},\n \"VFModule\": {\n \"Vloadbalancerms..vpkg..module-1\": {\n \"vfModuleModelInvariantUUID\": \"ca052563-eb92-4b5b-ad41-9111768ce043\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vpkg..module-1\",\n \"vfModuleModelUUID\": \"1e725ccc-b823-4f67-82b9-4f4367070dbc\",\n \"vfModuleModelCustomizationUUID\": \"1bffdc31-a37d-4dee-b65c-dde623a76e52\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vpkg\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vdns..module-3\": {\n \"vfModuleModelInvariantUUID\": \"4c10ba9b-f88f-415e-9de3-5d33336047fa\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vdns..module-3\",\n \"vfModuleModelUUID\": \"4fa73b49-8a6c-493e-816b-eb401567b720\",\n \"vfModuleModelCustomizationUUID\": \"bafcdab0-801d-4d81-9ead-f464640a38b1\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vdns\",\n \"max_vf_module_instances\": 50,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..base_template..module-0\": {\n \"vfModuleModelInvariantUUID\": \"921f7c96-ebdd-42e6-81b9-1cfc0c9796f3\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..base_template..module-0\",\n \"vfModuleModelUUID\": \"63734409-f745-4e4d-a38b-131638a0edce\",\n \"vfModuleModelCustomizationUUID\": \"86baddea-c730-4fb8-9410-cd2e17fd7f27\",\n \"min_vf_module_instances\": 1,\n \"vf_module_label\": \"base_template\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Base\",\n \"isBase\": true,\n \"initial_count\": 1,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vlb..module-2\": {\n \"vfModuleModelInvariantUUID\": \"a772a1f4-0064-412c-833d-4749b15828dd\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vlb..module-2\",\n \"vfModuleModelUUID\": \"0f5c3f6a-650a-4303-abb6-fff3e573a07a\",\n \"vfModuleModelCustomizationUUID\": \"96a78aad-4ffb-4ef0-9c4f-deb03bf1d806\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vlb\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n }\n }\n}','{\n \"serviceType\": \"\",\n \"serviceRole\": \"\",\n \"description\": \"vLBMS\",\n \"type\": \"Service\",\n \"instantiationType\": \"A-la-carte\",\n \"namingPolicy\": \"\",\n \"serviceEcompNaming\": \"true\",\n \"environmentContext\": \"General_Revenue-Bearing\",\n \"name\": \"vLoadBalancerMS\",\n \"invariantUUID\": \"30ec5b59-4799-48d8-ac5f-1058a6b0e48f\",\n \"ecompGeneratedNaming\": \"true\",\n \"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fce0\",\n \"category\": \"Network L4+\"\n}','1.0'); +INSERT INTO `services` VALUES ('63cac700-ab9a-4115-a74f-7eac85e3fce0','vLoadBalancerMS','{\n \"CP\": {},\n \"VL\": {},\n \"VF\": {\n \"vLoadBalancerMS 0\": {\n \"resourceVendor\": \"Test\",\n \"name\": \"vLoadBalancerMS\",\n \"resourceVendorModelNumber\": \"\",\n \"description\": \"vLBMS\",\n \"invariantUUID\": \"1a31b9f2-e50d-43b7-89b3-a040250cf506\",\n \"UUID\": \"b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6\",\n \"type\": \"VF\",\n \"category\": \"Application L4+\",\n \"subcategory\": \"Load Balancer\",\n \"version\": \"1.0\",\n \"customizationUUID\": \"465246dc-7748-45f4-a013-308d92922552\",\n \"resourceVendorRelease\": \"1.0\",\n \"controllerProperties\": {\n \"sdnc_model_name\": \"baseconfiguration\",\n \"sdnc_model_version\": \"1.0.0\",\n \"workflows\": {\n \"resource-assignment\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"action-name\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"scope-type\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf_name\": {\n \"required\": true,\n \"type\": \"string\"\n }\n }\n }\n },\n \"activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"action-name\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"scope-type\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf_name\": {\n \"required\": true,\n \"type\": \"string\"\n }\n }\n }\n },\n \"activate-restconf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"action-name\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"scope-type\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf_name\": {\n \"required\": true,\n \"type\": \"string\"\n }\n }\n }\n },\n \"activate-cli\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"action-name\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"scope-type\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf_name\": {\n \"required\": true,\n \"type\": \"string\"\n }\n }\n }\n },\n \"assign-activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"action-name\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"scope-type\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf_name\": {\n \"required\": true,\n \"type\": \"string\"\n }\n }\n }\n },\n \"imperative-test-wf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf-id\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"action-name\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"scope-type\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\"\n },\n \"vnf_name\": {\n \"required\": true,\n \"type\": \"string\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"CR\": {},\n \"VFC\": {},\n \"PNF\": {},\n \"Service\": {},\n \"CVFC\": {},\n \"Service Proxy\": {},\n \"Configuration\": {},\n \"AllottedResource\": {},\n \"VFModule\": {\n \"Vloadbalancerms..vpkg..module-1\": {\n \"vfModuleModelInvariantUUID\": \"ca052563-eb92-4b5b-ad41-9111768ce043\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vpkg..module-1\",\n \"vfModuleModelUUID\": \"1e725ccc-b823-4f67-82b9-4f4367070dbc\",\n \"vfModuleModelCustomizationUUID\": \"1bffdc31-a37d-4dee-b65c-dde623a76e52\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vpkg\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vdns..module-3\": {\n \"vfModuleModelInvariantUUID\": \"4c10ba9b-f88f-415e-9de3-5d33336047fa\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vdns..module-3\",\n \"vfModuleModelUUID\": \"4fa73b49-8a6c-493e-816b-eb401567b720\",\n \"vfModuleModelCustomizationUUID\": \"bafcdab0-801d-4d81-9ead-f464640a38b1\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vdns\",\n \"max_vf_module_instances\": 50,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..base_template..module-0\": {\n \"vfModuleModelInvariantUUID\": \"921f7c96-ebdd-42e6-81b9-1cfc0c9796f3\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..base_template..module-0\",\n \"vfModuleModelUUID\": \"63734409-f745-4e4d-a38b-131638a0edce\",\n \"vfModuleModelCustomizationUUID\": \"86baddea-c730-4fb8-9410-cd2e17fd7f27\",\n \"min_vf_module_instances\": 1,\n \"vf_module_label\": \"base_template\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Base\",\n \"isBase\": true,\n \"initial_count\": 1,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vlb..module-2\": {\n \"vfModuleModelInvariantUUID\": \"a772a1f4-0064-412c-833d-4749b15828dd\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vlb..module-2\",\n \"vfModuleModelUUID\": \"0f5c3f6a-650a-4303-abb6-fff3e573a07a\",\n \"vfModuleModelCustomizationUUID\": \"96a78aad-4ffb-4ef0-9c4f-deb03bf1d806\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vlb\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n }\n }\n}','{\n \"serviceType\": \"\",\n \"serviceRole\": \"\",\n \"description\": \"vLBMS\",\n \"type\": \"Service\",\n \"instantiationType\": \"A-la-carte\",\n \"namingPolicy\": \"\",\n \"serviceEcompNaming\": \"true\",\n \"environmentContext\": \"General_Revenue-Bearing\",\n \"name\": \"vLoadBalancerMS\",\n \"invariantUUID\": \"30ec5b59-4799-48d8-ac5f-1058a6b0e48f\",\n \"ecompGeneratedNaming\": \"true\",\n \"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fce0\",\n \"category\": \"Network L4+\"\n}','1.0'); /*!40000 ALTER TABLE `services` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -210,4 +210,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-04-03 15:54:44 +-- Dump completed on 2020-04-16 14:50:40 diff --git a/pom.xml b/pom.xml index 3a641490..9825d35b 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 4.0.0 org.onap.clamp clds - 5.0.3-SNAPSHOT + 5.0.5-SNAPSHOT clamp @@ -544,6 +544,12 @@ snakeyaml 1.26 + + org.dom4j + dom4j + 2.1.3 + + org.assertj diff --git a/releases/5.0.4-container.yaml b/releases/5.0.4-container.yaml new file mode 100644 index 00000000..94e8afaa --- /dev/null +++ b/releases/5.0.4-container.yaml @@ -0,0 +1,10 @@ +distribution_type: 'container' +container_release_tag: '5.0.4' +project: 'clamp' +log_dir: 'clamp-maven-docker-stage-master/389/' +ref: 9698b59ab5eab72437d8a0f501b21da22b302df3 +containers: + - name: 'clamp-backend' + version: '5.0-STAGING-20200420T122047Z' + - name: 'clamp-frontend' + version: '5.0-STAGING-20200420T122047Z' \ No newline at end of file diff --git a/releases/5.0.4.yaml b/releases/5.0.4.yaml new file mode 100644 index 00000000..335c79c7 --- /dev/null +++ b/releases/5.0.4.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '5.0.4' +project: 'clamp' +log_dir: 'clamp-maven-stage-master/400/' diff --git a/src/main/java/org/onap/clamp/clds/client/CdsServices.java b/src/main/java/org/onap/clamp/clds/client/CdsServices.java index f25e8b80..b8eb4194 100644 --- a/src/main/java/org/onap/clamp/clds/client/CdsServices.java +++ b/src/main/java/org/onap/clamp/clds/client/CdsServices.java @@ -34,6 +34,7 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.builder.ExchangeBuilder; +import org.onap.clamp.clds.exception.cds.CdsParametersException; import org.onap.clamp.clds.model.cds.CdsBpWorkFlowListResponse; import org.onap.clamp.clds.util.JsonUtils; import org.onap.clamp.clds.util.LoggingUtils; @@ -117,7 +118,7 @@ public class CdsServices { return null; } - private JsonObject parseCdsResponse(String response) { + protected JsonObject parseCdsResponse(String response) { JsonObject root = JsonParser.parseString(response).getAsJsonObject(); JsonObject inputs = root.getAsJsonObject("workFlowData").getAsJsonObject("inputs"); JsonObject dataTypes = root.getAsJsonObject("dataTypes"); @@ -135,6 +136,9 @@ public class CdsServices { String type = inputProperty.get("type").getAsString(); if (isComplexType(type, dataTypes)) { inputObject.add(key, handleComplexType(type, dataTypes)); + } else if (type.equalsIgnoreCase("list")) { + inputObject.add(key, handleListType(key, inputProperty, + dataTypes)); } else { inputObject.add(key, entry.getValue()); } @@ -142,6 +146,24 @@ public class CdsServices { return inputObject; } + private JsonObject handleListType(String propertyName, + JsonObject inputProperty, + JsonObject dataTypes) { + if (inputProperty.get("entry_schema") != null) { + String type = inputProperty.get("entry_schema").getAsJsonObject().get( + "type").getAsString(); + if (dataTypes.get(type) != null) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("type", "list"); + jsonObject.add("properties", handleComplexType(type, dataTypes)); + return jsonObject; + } else { + return inputProperty; + } + } + throw new CdsParametersException("Entry schema is null for " + propertyName); + } + private JsonObject handleComplexType(String key, JsonObject dataTypes) { JsonObject properties = dataTypes.get(key).getAsJsonObject().get("properties").getAsJsonObject(); return getInputProperties(properties, dataTypes); diff --git a/src/main/java/org/onap/clamp/clds/exception/cds/CdsParametersException.java b/src/main/java/org/onap/clamp/clds/exception/cds/CdsParametersException.java new file mode 100644 index 00000000..73ce31f8 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/exception/cds/CdsParametersException.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * ================================================================================ + * + */ + +package org.onap.clamp.clds.exception.cds; + +/** + * Exception while parsing CDS response. + */ +public class CdsParametersException extends RuntimeException { + + /** + * serialization id. + */ + private static final long serialVersionUID = 8425657297510362736L; + + /** + * This constructor can be used to create a new CdsParametersException. + * + * @param message The message to dump + */ + public CdsParametersException(final String message) { + super(message); + } + + /** + * This constructor can be used to create a new CdsParametersException. + * + * @param message The message to dump + * @param cause The Throwable cause object + */ + public CdsParametersException(final String message, final Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java b/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java index fdc94231..e3c66169 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java +++ b/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java @@ -28,8 +28,10 @@ public class JsonEditorSchemaConstants { //Data types in JSON Schema public static final String TYPE_OBJECT = "object"; public static final String TYPE_ARRAY = "array"; + public static final String TYPE_MAP = "map"; public static final String TYPE_STRING = "string"; public static final String TYPE_INTEGER = "integer"; + public static final String TYPE_DATE_TIME = "datetime"; //Key elements in JSON Schema public static final String TYPE = "type"; @@ -43,6 +45,9 @@ public class JsonEditorSchemaConstants { public static final String ITEMS = "items"; public static final String PROPERTIES = "properties"; public static final String PROPERTY_ORDER = "propertyOrder"; + public static final String VALUES = "values"; + public static final String HEADER_TEMPLATE = "headerTemplate"; + public static final String HEADER_TEMPLATE_VALUE = "{{self.name}}"; public static final String MINIMUM = "minimum"; public static final String MAXIMUM = "maximum"; @@ -50,9 +55,13 @@ public class JsonEditorSchemaConstants { public static final String MAX_LENGTH = "maxLength"; public static final String EXCLUSIVE_MINIMUM = "exclusiveMinimum"; public static final String EXCLUSIVE_MAXIMUM = "exclusiveMaximum"; + public static final String MINITEMS = "minItems"; + public static final String MAXITEMS = "maxItems"; public static final String CUSTOM_KEY_FORMAT = "format"; public static final String CUSTOM_KEY_FORMAT_TABS_TOP = "tabs-top"; + public static final String CUSTOM_KEY_FORMAT_TABS = "tabs"; + public static final String CUSTOM_KEY_FORMAT_INPUT = "input"; public static final String FORMAT_SELECT = "select"; public static final String UNIQUE_ITEMS = "uniqueItems"; public static final String TRUE = "true"; @@ -67,5 +76,11 @@ public class JsonEditorSchemaConstants { public static final String SCHEMA = "schema"; public static final String CURRENT_VALUES = "currentValues"; + public static final String PLUGIN = "plugin"; + public static final String DATE_TIME_PICKER = "datetimepicker"; + public static final String VALIDATION = "validation"; + public static final String DATE_TIME_FORMAT = "YYYY/MM/DD HH:mm:ss"; + public static final String INPUT_EVENT = "input_event"; + public static final String DP_CHANGE = "dp.change"; } diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java index 9601649c..d00c431c 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java +++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java @@ -30,8 +30,11 @@ public class ToscaSchemaConstants { public static final String TYPE_MAP = "map"; public static final String TYPE_STRING = "string"; public static final String TYPE_INTEGER = "integer"; + public static final String TYPE_NUMBER = "number"; + public static final String TYPE_DATE_TIME = "datetime"; public static final String TYPE_FLOAT = "float"; public static final String TYPE_BOOLEAN = "boolean"; + public static final String TYPE_USER_DEFINED = "userDefined"; // Key elements in Tosca public static final String NODE_TYPES = "policy_types"; @@ -46,6 +49,8 @@ public class ToscaSchemaConstants { public static final String METADATA = "metadata"; public static final String METADATA_POLICY_MODEL_TYPE = "policy_model_type"; public static final String METADATA_ACRONYM = "acronym"; + public static final String METADATA_ELEMENT_NAME = "element_name"; + public static final String METADATA_HEADER_TEMPLATE = "header_template"; public static final String METADATA_CLAMP_POSSIBLE_VALUES = "clamp_possible_values"; // Constraints diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java index 666ca670..45bb87ed 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java +++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java @@ -38,6 +38,7 @@ import java.util.stream.Collectors; import org.json.JSONArray; import org.json.JSONObject; import org.onap.clamp.clds.config.ClampProperties; +import org.onap.clamp.tosca.Dictionary; import org.onap.clamp.tosca.DictionaryElement; import org.onap.clamp.tosca.DictionaryService; import org.springframework.beans.factory.annotation.Autowired; @@ -142,6 +143,13 @@ public class ToscaYamlToJsonConvertor { parseNodeAndDataType(loadedYaml, nodeTypes, dataNodes); populateJsonEditorObject(loadedYaml, nodeTypes, dataNodes, jsonParentObject, jsonTempObject, modelTypeToUse); + + String headerTemplate = getValueFromMetadata(validateAndConvertToJson(yamlString), + ToscaSchemaConstants.METADATA_HEADER_TEMPLATE); + if (headerTemplate != null) { + jsonParentObject.put(JsonEditorSchemaConstants.HEADER_TEMPLATE, + JsonEditorSchemaConstants.HEADER_TEMPLATE_VALUE); + } if (jsonTempObject.length() > 0) { jsonParentObject = jsonTempObject; } @@ -234,7 +242,7 @@ public class ToscaYamlToJsonConvertor { jsonTempObject.put(JsonEditorSchemaConstants.ITEMS, jsonParentObject); jsonTempObject.put(JsonEditorSchemaConstants.FORMAT, - JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT_TABS_TOP); + JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT_TABS); jsonTempObject.put(JsonEditorSchemaConstants.UNIQUE_ITEMS, JsonEditorSchemaConstants.TRUE); } @@ -652,12 +660,43 @@ public class ToscaYamlToJsonConvertor { Optional.ofNullable(cldsDictionaryElements).get().stream().forEach(c -> { JSONObject jsonObject = new JSONObject(); + if (c.getSubDictionary() != null) { + Dictionary subDictionary = + dictionaryService.getDictionary(c.getSubDictionary()); + if (subDictionary != null + && !subDictionary.getDictionaryElements().isEmpty()) { + + jsonObject.put(JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT_INPUT, + JsonEditorSchemaConstants.FORMAT_SELECT); + + List shortNames = new ArrayList<>(); + subDictionary.getDictionaryElements().stream().forEach(c1 -> { + shortNames.add(c1.getShortName()); + }); + jsonObject.put(JsonEditorSchemaConstants.VALUES, shortNames); + } + } jsonObject.put(JsonEditorSchemaConstants.TYPE, getJsonType(c.getType())); + if (c.getType() != null - && c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) { + && (c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING) + || c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_DATE_TIME) + || c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_MAP))) { jsonObject.put(JsonEditorSchemaConstants.MIN_LENGTH, 1); + if (c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_DATE_TIME)) { + jsonObject.put(JsonEditorSchemaConstants.PLUGIN, + JsonEditorSchemaConstants.DATE_TIME_PICKER); + jsonObject.put(JsonEditorSchemaConstants.INPUT_EVENT, + JsonEditorSchemaConstants.DP_CHANGE); + JSONObject formatJsonObject = new JSONObject(); + formatJsonObject.put(JsonEditorSchemaConstants.FORMAT, + JsonEditorSchemaConstants.DATE_TIME_FORMAT); + jsonObject.put(JsonEditorSchemaConstants.VALIDATION, + formatJsonObject); + } } + jsonObject.put(JsonEditorSchemaConstants.ID, c.getName()); jsonObject.put(JsonEditorSchemaConstants.LABEL, c.getShortName()); jsonObject.put(JsonEditorSchemaConstants.OPERATORS, subCldsDictionaryNames); @@ -678,32 +717,44 @@ public class ToscaYamlToJsonConvertor { String dictionaryKey = dictionaryReference.substring( dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11, dictionaryReference.length()); + if (dictionaryKey != null) { - List cldsDictionaryElements = - dictionaryService.getDictionary(dictionaryKey).getDictionaryElements().stream() - .collect(Collectors.toList()); - if (cldsDictionaryElements != null) { - List cldsDictionaryNames = new ArrayList<>(); - List cldsDictionaryFullNames = new ArrayList<>(); - cldsDictionaryElements.stream().forEach(c -> { - // Json type will be translated before Policy creation - if (c.getType() != null && !c.getType().equalsIgnoreCase("json")) { - cldsDictionaryFullNames.add(c.getName()); + if (dictionaryKey.contains(ToscaSchemaConstants.TYPE_USER_DEFINED)) { + childObject.put(JsonEditorSchemaConstants.ENUM, new ArrayList<>()); + // Add Enum titles for generated translated values during + // JSON instance generation + JSONObject enumTitles = new JSONObject(); + enumTitles.put(JsonEditorSchemaConstants.ENUM_TITLES, new ArrayList<>()); + childObject.put(JsonEditorSchemaConstants.OPTIONS, enumTitles); + } else { + List cldsDictionaryElements = + dictionaryService.getDictionary(dictionaryKey).getDictionaryElements() + .stream().collect(Collectors.toList()); + if (cldsDictionaryElements != null) { + List cldsDictionaryNames = new ArrayList<>(); + List cldsDictionaryFullNames = new ArrayList<>(); + cldsDictionaryElements.stream().forEach(c -> { + // Json type will be translated before Policy creation + if (c.getType() != null && !c.getType().equalsIgnoreCase("json")) { + cldsDictionaryFullNames.add(c.getName()); + } + cldsDictionaryNames.add(c.getShortName()); + }); + + if (!cldsDictionaryFullNames.isEmpty()) { + childObject.put(JsonEditorSchemaConstants.ENUM, + cldsDictionaryFullNames); + // Add Enum titles for generated translated values during JSON instance + // generation + JSONObject enumTitles = new JSONObject(); + enumTitles.put(JsonEditorSchemaConstants.ENUM_TITLES, + cldsDictionaryNames); + childObject.put(JsonEditorSchemaConstants.OPTIONS, enumTitles); + } else { + childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryNames); } - cldsDictionaryNames.add(c.getShortName()); - }); - if (!cldsDictionaryFullNames.isEmpty()) { - childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryFullNames); - // Add Enum titles for generated translated values during JSON instance - // generation - JSONObject enumTitles = new JSONObject(); - enumTitles.put(JsonEditorSchemaConstants.ENUM_TITLES, cldsDictionaryNames); - childObject.put(JsonEditorSchemaConstants.OPTIONS, enumTitles); - } else { - childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryNames); } - } } } @@ -711,10 +762,15 @@ public class ToscaYamlToJsonConvertor { private String getJsonType(String toscaType) { String jsonType = null; - if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)) { + if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER) + || toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_NUMBER)) { jsonType = JsonEditorSchemaConstants.TYPE_INTEGER; + } else if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_DATE_TIME)) { + jsonType = JsonEditorSchemaConstants.TYPE_DATE_TIME; } else if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) { jsonType = JsonEditorSchemaConstants.TYPE_ARRAY; + } else if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_MAP)) { + jsonType = JsonEditorSchemaConstants.TYPE_MAP; } else { jsonType = JsonEditorSchemaConstants.TYPE_STRING; } diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java index ce1f9469..c1564141 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java @@ -23,6 +23,10 @@ package org.onap.clamp.clds.tosca.update.execution.cds; +import static org.onap.clamp.clds.tosca.ToscaSchemaConstants.PROPERTIES; +import static org.onap.clamp.clds.tosca.ToscaSchemaConstants.TYPE; +import static org.onap.clamp.clds.tosca.ToscaSchemaConstants.TYPE_LIST; + import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -173,7 +177,7 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { jsonObject.add("artifact_version", createAnyOfJsonProperty( "artifact version", artifactVersion)); jsonObject.add("mode", createCdsInputProperty( - "mode", "string", "async")); + "mode", "string", "async", null)); jsonObject.add("data", createDataProperty(inputs)); return jsonObject; @@ -182,7 +186,7 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { private static JsonObject createDataProperty(JsonObject inputs) { JsonObject data = new JsonObject(); data.addProperty("title", "data"); - data.add("properties", addDataFields(inputs)); + data.add(PROPERTIES, addDataFields(inputs)); return data; } @@ -192,7 +196,7 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { for (Map.Entry entry : entrySet) { String key = entry.getKey(); JsonObject inputProperty = inputs.getAsJsonObject(key); - if (inputProperty.get("type") == null) { + if (inputProperty.get(TYPE) == null) { jsonObject.add(entry.getKey(), createAnyOfJsonObject(key, addDataFields(entry.getValue().getAsJsonObject()))); @@ -200,7 +204,8 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { jsonObject.add(entry.getKey(), createCdsInputProperty(key, inputProperty.get("type").getAsString(), - null)); + null, + entry.getValue().getAsJsonObject())); } } return jsonObject; @@ -208,14 +213,26 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { private static JsonObject createCdsInputProperty(String title, String type, - String defaultValue) { + String defaultValue, + JsonObject cdsProperty) { JsonObject property = new JsonObject(); property.addProperty("title", title); - property.addProperty("type", type); + + if (TYPE_LIST.equalsIgnoreCase(type)) { + property.addProperty(TYPE, "array"); + if (cdsProperty.get(PROPERTIES) != null) { + JsonObject listProperties = new JsonObject(); + listProperties.add(PROPERTIES, + addDataFields(cdsProperty.get(PROPERTIES).getAsJsonObject())); + property.add("items", listProperties); + } + } else { + property.addProperty(TYPE, type); + } + if (defaultValue != null) { property.addProperty("default", defaultValue); } - property.addProperty("format", "textarea"); return property; } } diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java index 19a17dbb..08133133 100644 --- a/src/main/java/org/onap/clamp/loop/Loop.java +++ b/src/main/java/org/onap/clamp/loop/Loop.java @@ -330,6 +330,36 @@ public class Loop extends AuditEntity implements Serializable { } } + /** + * Return the operationalPolicy object with the opPolicyName. + * + * @param opPolicyName The operationalPolicy name + * @return The OperationalPolicy object found in loop object + */ + public OperationalPolicy getOperationalPolicy(String opPolicyName) { + for (OperationalPolicy operationalPolicy : this.getOperationalPolicies()) { + if (operationalPolicy.getName().equals(opPolicyName)) { + return operationalPolicy; + } + } + return null; + } + + /** + * Return the microServicePolicy object with the msPolicyName. + * + * @param msPolicyName The microServicePolicy name + * @return The MicroServicePolicy object found in loop object + */ + public MicroServicePolicy getMicroServicePolicy(String msPolicyName) { + for (MicroServicePolicy microServicePolicy : this.getMicroServicePolicies()) { + if (microServicePolicy.getName().equals(msPolicyName)) { + return microServicePolicy; + } + } + return null; + } + /** * Generate the loop name. * diff --git a/src/main/java/org/onap/clamp/loop/LoopController.java b/src/main/java/org/onap/clamp/loop/LoopController.java index a2a44631..fad93bc7 100644 --- a/src/main/java/org/onap/clamp/loop/LoopController.java +++ b/src/main/java/org/onap/clamp/loop/LoopController.java @@ -137,11 +137,11 @@ public class LoopController { } /** - * This method remove an operational policy to a loop instance. + * This method removes an operational policy from a loop instance. * * @param loopName The loop name * @param policyType The policy model type - * @param policyVersion The policy model version + * @param policyVersion The policy model version * @return The loop modified */ public Loop removeOperationalPolicy(String loopName, String policyType, String policyVersion) { diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java index d14667ea..3f568a33 100644 --- a/src/main/java/org/onap/clamp/loop/LoopService.java +++ b/src/main/java/org/onap/clamp/loop/LoopService.java @@ -137,7 +137,7 @@ public class LoopService { * * @param loopName The loop name * @param policyType The policy model type - * @param policyVersion The policy model version + * @param policyVersion The policy model version * @return The loop modified */ Loop removeOperationalPolicy(String loopName, String policyType, String policyVersion) { diff --git a/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java b/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java index 8270a96e..227f40a7 100644 --- a/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java +++ b/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java @@ -28,7 +28,6 @@ import com.att.eelf.configuration.EELFManager; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -76,25 +75,33 @@ public class PolicyComponent extends ExternalComponent { /** * Generates the Json that must be sent to policy to add all policies to Active * PDP group. - * + * @param loop the loop object + * @param action POST (to add policy to group) or DELETE (to delete policy from group) * @return The json, payload to send */ - public static String createPoliciesPayloadPdpGroup(Loop loop) { + public static String createPoliciesPayloadPdpGroup(Loop loop, String action) { Map>> pdpGroupMap = new HashMap<>(); for (OperationalPolicy opPolicy : loop.getOperationalPolicies()) { updatePdpGroupMap(opPolicy.getPdpGroup(), opPolicy.getPdpSubgroup(), opPolicy.getName(), - opPolicy.getPolicyModel().getVersion(), pdpGroupMap); + "1.0.0", pdpGroupMap); + if (opPolicy.isLegacy()) { + for (String guardName:opPolicy.createGuardPolicyPayloads().keySet()) { + updatePdpGroupMap(opPolicy.getPdpGroup(), opPolicy.getPdpSubgroup(), + guardName, + "1.0.0", pdpGroupMap); + } + } } for (MicroServicePolicy msPolicy : loop.getMicroServicePolicies()) { updatePdpGroupMap(msPolicy.getPdpGroup(), msPolicy.getPdpSubgroup(), msPolicy.getName(), - msPolicy.getPolicyModel().getVersion(), pdpGroupMap); + "1.0.0", pdpGroupMap); } String payload = new GsonBuilder().setPrettyPrinting().create() - .toJson(generateActivatePdpGroupPayload(pdpGroupMap)); + .toJson(generateActivatePdpGroupPayload(pdpGroupMap, action)); logger.info("PdpGroup policy payload: " + payload); return payload; } @@ -102,12 +109,12 @@ public class PolicyComponent extends ExternalComponent { private static void updatePdpGroupMap(String pdpGroup, String pdpSubGroup, String policyName, - String policyModelVersion, + String policyVersion, Map>> pdpGroupMap) { JsonObject policyJson = new JsonObject(); policyJson.addProperty("name", policyName); - policyJson.addProperty("version", policyModelVersion); + policyJson.addProperty("version", policyVersion); Map> pdpSubGroupMap; List policyList; if (pdpGroupMap.get(pdpGroup) == null) { @@ -129,7 +136,7 @@ public class PolicyComponent extends ExternalComponent { } private static JsonObject generateActivatePdpGroupPayload( - Map>> pdpGroupMap) { + Map>> pdpGroupMap, String action) { JsonArray payloadArray = new JsonArray(); for (Entry>> pdpGroupInfo : pdpGroupMap.entrySet()) { JsonObject pdpGroupNode = new JsonObject(); @@ -141,7 +148,7 @@ public class PolicyComponent extends ExternalComponent { JsonObject pdpSubGroupNode = new JsonObject(); subPdpArray.add(pdpSubGroupNode); pdpSubGroupNode.addProperty("pdpType", pdpSubGroupInfo.getKey()); - pdpSubGroupNode.addProperty("action", "POST"); + pdpSubGroupNode.addProperty("action", action); JsonArray policyArray = new JsonArray(); pdpSubGroupNode.add("policies", policyArray); @@ -157,25 +164,6 @@ public class PolicyComponent extends ExternalComponent { return jsonObject; } - /** - * Generates the list of policy names that must be send/remove to/from active - * PDP group. - * - * @return A list of policy names - */ - public static List listPolicyNamesPdpGroup(Loop loop) { - List policyNamesList = new ArrayList<>(); - for (OperationalPolicy opPolicy : loop.getOperationalPolicies()) { - policyNamesList.add(opPolicy.getName()); - policyNamesList.addAll(opPolicy.createGuardPolicyPayloads().keySet()); - } - for (MicroServicePolicy microServicePolicy : loop.getMicroServicePolicies()) { - policyNamesList.add(microServicePolicy.getName()); - } - logger.info("Policies that will be removed from PDP: " + policyNamesList); - return policyNamesList; - } - private static ExternalComponentState findNewState(boolean found, boolean deployed) { ExternalComponentState newState = NOT_SENT; diff --git a/src/main/java/org/onap/clamp/policy/Policy.java b/src/main/java/org/onap/clamp/policy/Policy.java index d84f2c8a..65e88d18 100644 --- a/src/main/java/org/onap/clamp/policy/Policy.java +++ b/src/main/java/org/onap/clamp/policy/Policy.java @@ -284,4 +284,6 @@ public abstract class Policy extends AuditEntity { .append(blueprintFilename.replaceAll(".yaml", "")); return buffer.toString().replace('.', '_').replaceAll(" ", ""); } + + public abstract Boolean isLegacy(); } 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 77627a31..127f495c 100644 --- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java +++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java @@ -157,6 +157,11 @@ public class MicroServicePolicy extends Policy implements Serializable { this.getPolicyModel().getPolicyModelType(), serviceModel)); } + @Override + public Boolean isLegacy() { + return false; + } + public Boolean getShared() { return shared; } diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml index 77062675..879c9b70 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -697,16 +697,14 @@ - - - - + + + - - - java.lang.Exception @@ -718,17 +716,14 @@ message="GET STATUS request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> - - 500 - - - GET STATUS request FAILED - ${exchangeProperty[loopObject]} + + 200 + @@ -770,15 +765,29 @@ - + - + + + ${header.policyName} + + + ${exchangeProperty[loopObject].getOperationalPolicy(header.policyName)} + + + false + + + + false + + + + java.lang.Exception + + true + + + + + ${body.getPolicyModel().getPolicyModelType()} + + ${body.getPolicyModel().getVersion()} + 1.0.0 @@ -61,9 +64,22 @@ ${body.getPolicyModel().getPolicyModelType()} - - 1.0.0 + + ${body.getPolicyModel().getVersion()} + + + ${body.isLegacy()} == true + + 1 + + + + + 1.0.0 + + + ${body} @@ -84,6 +100,9 @@ onap.policies.controlloop.Guard + + 1.0.0 + 1 diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index 80926722..1731308e 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -1,717 +1,601 @@ - - - - - false - - - - ${header.CamelHttpResponseCode} != 200 - - false - - - - - false - - - - ${header.CamelHttpResponseCode} != 200 - - false - - - - - ${exchangeProperty[policyComponent].computeState(*)} - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[policyName]} GET - Policy status - - - - POLICY - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[policyName]} GET Policy deployment - status - - - - POLICY - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - ${exchangeProperty[policy].createPolicyPayload()} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[policy].getName()} creation - status - - - - POLICY - - - - - + + + + false + + + + ${header.CamelHttpResponseCode} != 200 + + false + + + + + false + + + + ${header.CamelHttpResponseCode} != 200 + + false + + + + + ${exchangeProperty[policyComponent].computeState(*)} + + - - - - - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - + + + + + + + GET + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + java.lang.Exception + + true + - - - - - ${exchangeProperty[policy].getName()} removal - status - - - - POLICY - - - - - - - - - - - - ${exchangeProperty[microServicePolicy].createPolicyPayload()} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[microServicePolicy].getName()} creation - status - - - - POLICY - - - - - + + + + + + + + ${exchangeProperty[policyName]} GET + Policy status + + + + POLICY + + + + + - - - - - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - + + + + + + + GET + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + java.lang.Exception + + true + - - - - - ${exchangeProperty[microServicePolicy].getName()} removal - status - - - - POLICY - - - - - + + + + + + + + ${exchangeProperty[policyName]} GET Policy deployment + status + + + + POLICY + + + + + + + + + + + + GET + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + + + + + + + + + + + + + GET + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + + + + + + + + + + + + + ${exchangeProperty[policy].createPolicyPayload()} + + + + POST + + + application/json + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + + + + ${exchangeProperty[policy].getName()} creation + status + + + + POLICY + + + + + - - - - - - - ${exchangeProperty[operationalPolicy].createPolicyPayload()} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[operationalPolicy].getName()} creation - status - - - - POLICY - - - - - + + + + + + + null + + + DELETE + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + ${exchangeProperty[policy].isLegacy()} == true + + 1 + + + + + 1.0.0 + + + + + - - - - - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[operationalPolicy].getName()} removal - status - - - - POLICY - - - - - + + + + + ${exchangeProperty[policy].getName()} removal + status + + + + POLICY + + + + + + + + + + + + ${exchangeProperty[guardPolicy].getValue()} + + + + POST + + + application/json + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + + + + ${exchangeProperty[guardPolicy].getKey()} creation status + + + + POLICY + + + + + - - - - - - - ${exchangeProperty[guardPolicy].getValue()} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[guardPolicy].getKey()} creation status - - - - POLICY - - - - - + + + + + + + null + + + DELETE + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + - - - - - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - + + + + + ${exchangeProperty[guardPolicy].getKey()} removal status + + + + POLICY + + + + + - - - - - ${exchangeProperty[guardPolicy].getKey()} removal status - - - - POLICY - - - - - + + + + + + + + ${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject],"POST")} + + + + POST + + + application/json + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + - - - - - - - ${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - + + + + + PDP Group push ALL status + + + POLICY + + + + + - - - - - PDP Group push ALL status - - - POLICY - - - - - + + + + + + + + ${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject],"DELETE")} + + + + POST + + + application/json + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + - - - - - - - ${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])} - - - ${body} - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - ${exchangeProperty[policyName]} PDP Group removal status - - - - POLICY - - - - - java.lang.Exception - - false - - - PDP Group removal, Error reported: ${exception} - - - POLICY - - - - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - + + + + + PDP Group remove ALL status + + + POLICY + + + + + + + + + + + + GET + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + + + + + + + + + + + + + null + + + DELETE + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + ${exchangeProperty[policyName]} PDP Group removal status + + + + POLICY + + + + java.lang.Exception + + false + + + PDP Group removal, Error reported: ${exception} + + + POLICY + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java new file mode 100644 index 00000000..ec39fc3d --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * ================================================================================ + * + */ + +package org.onap.clamp.clds.client; + +import com.google.gson.JsonObject; + +import java.io.IOException; + +import org.junit.Test; +import org.onap.clamp.clds.util.JsonUtils; +import org.onap.clamp.clds.util.ResourceFileUtil; +import org.skyscreamer.jsonassert.JSONAssert; + +public class CdsServicesTest { + + @Test + public void testParseCdsListTypeProperties() throws IOException { + String cdsResponse = ResourceFileUtil + .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-workflow.json"); + CdsServices services = new CdsServices(); + JsonObject output = services.parseCdsResponse(cdsResponse); + JSONAssert.assertEquals(ResourceFileUtil + .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json"), + JsonUtils.GSON.toJson(output), true); + } + + @Test + public void testParseCdsResponse() throws IOException { + String cdsResponse = ResourceFileUtil + .getResourceAsString("example/cds-response/vFW-CDS-modify-config-workflow.json"); + CdsServices services = new CdsServices(); + JsonObject output = services.parseCdsResponse(cdsResponse); + JSONAssert.assertEquals(ResourceFileUtil + .getResourceAsString("example/cds-response/vFW-CDS-modify-config-wf-expected-result.json"), + JsonUtils.GSON.toJson(output), true); + } + +} \ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java index a32d4995..b26f3ede 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java +++ b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java @@ -57,7 +57,7 @@ public class ToscaYamlToJsonConvertorTestItCase { * Schema. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test public final void testParseToscaYaml() throws IOException { @@ -65,11 +65,11 @@ public class ToscaYamlToJsonConvertorTestItCase { ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app"); + convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app"); assertNotNull(parsedJsonSchema); JSONAssert.assertEquals( - ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"), - parsedJsonSchema, true); + ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"), + parsedJsonSchema, true); } /** @@ -77,20 +77,20 @@ public class ToscaYamlToJsonConvertorTestItCase { * based on JSON Editor Schema. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test public final void testParseToscaYamlWithConstraints() throws IOException { String toscaModelYaml = - ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml"); + ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml"); ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); + convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); assertNotNull(parsedJsonSchema); JSONAssert.assertEquals( - ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"), - parsedJsonSchema, true); + ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"), + parsedJsonSchema, true); } /** @@ -98,20 +98,20 @@ public class ToscaYamlToJsonConvertorTestItCase { * conversion based on JSON Editor Schema. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test public final void testParseToscaYamlWithTypes() throws IOException { String toscaModelYaml = - ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml"); + ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml"); ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); + convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); assertNotNull(parsedJsonSchema); JSONAssert.assertEquals( - ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"), - parsedJsonSchema, true); + ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"), + parsedJsonSchema, true); } /** @@ -119,11 +119,35 @@ public class ToscaYamlToJsonConvertorTestItCase { * parameters which defines the Tosca Policy name and its short name. * * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file + * converted json file */ @Test @Transactional public final void testMetadataClampPossibleValues() throws IOException { + setupDictionary(); + String toscaModelYaml = + ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"); + + JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(toscaModelYaml); + assertNotNull(jsonObject); + String policyModelType = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, + ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE); + String acronym = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, + ToscaSchemaConstants.METADATA_ACRONYM); + String parsedJsonSchema = + toscaYamlToJsonConvertor.parseToscaYaml(toscaModelYaml, policyModelType); + + assertNotNull(parsedJsonSchema); + assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", policyModelType); + assertEquals("tca", acronym); + JSONAssert.assertEquals( + ResourceFileUtil + .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"), + parsedJsonSchema, true); + + } + + private void setupDictionary() { // Set up dictionary elements Dictionary dictionaryTest = new Dictionary(); @@ -150,6 +174,15 @@ public class ToscaYamlToJsonConvertorTestItCase { element1.setDescription("Alarm Condition"); dictionaryTest1.addDictionaryElements(element1); + dictionaryTest1 = dictionaryService.saveOrUpdateDictionary(dictionaryTest1); + + DictionaryElement element3 = new DictionaryElement(); + element3.setName("timeEpoch"); + element3.setShortName("timeEpoch"); + element3.setType("datetime"); + element3.setDescription("Time Epoch"); + dictionaryTest1.addDictionaryElements(element3); + dictionaryService.saveOrUpdateDictionary(dictionaryTest1); Dictionary dictionaryTest2 = new Dictionary(); @@ -159,30 +192,10 @@ public class ToscaYamlToJsonConvertorTestItCase { DictionaryElement element2 = new DictionaryElement(); element2.setName("equals"); element2.setShortName("equals"); - element2.setType("string"); + element2.setType("string|datetime"); element2.setDescription("equals"); dictionaryTest2.addDictionaryElements(element2); dictionaryService.saveOrUpdateDictionary(dictionaryTest2); - - String toscaModelYaml = - ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"); - - JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(toscaModelYaml); - assertNotNull(jsonObject); - String policyModelType = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, - ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE); - String acronym = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, - ToscaSchemaConstants.METADATA_ACRONYM); - String parsedJsonSchema = - toscaYamlToJsonConvertor.parseToscaYaml(toscaModelYaml, policyModelType); - - assertNotNull(parsedJsonSchema); - assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", policyModelType); - assertEquals("tca", acronym); - JSONAssert.assertEquals( - ResourceFileUtil - .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"), - parsedJsonSchema, true); } } diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java index 432de606..6449a896 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java +++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java @@ -24,7 +24,6 @@ package org.onap.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; - import com.google.gson.Gson; import com.google.gson.JsonObject; import java.io.IOException; @@ -32,6 +31,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.junit.Test; import org.mockito.Mockito; +import org.onap.clamp.clds.config.LegacyOperationalPolicyController; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.clamp.loop.components.external.ExternalComponentState; import org.onap.clamp.loop.components.external.PolicyComponent; @@ -267,7 +267,8 @@ public class PolicyComponentTest { new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null, "pdpGroup2", "pdpSubgroup1"); loopTest.addMicroServicePolicy(microServicePolicy2); - PolicyModel policyModel2 = new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0"); + PolicyModel policyModel2 = new PolicyModel(LegacyOperationalPolicyController.OPERATIONAL_POLICY_LEGACY, null, + "1.0.0"); OperationalPolicy opPolicy = new OperationalPolicy("opPolicy", new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), new Gson().fromJson("{\"jsonschema\":\"schema\"}", JsonObject.class), policyModel2, null, @@ -275,16 +276,22 @@ public class PolicyComponentTest { "pdpSubgroup2"); loopTest.addOperationalPolicy(opPolicy); + OperationalPolicy opLegacyPolicy = + new OperationalPolicy("opLegacyPolicy", new Gson().fromJson( + "{\"guard_policies\":[{\"policy-id\":\"guard1\"}]}", JsonObject.class), + new Gson().fromJson("{\"jsonschema\":\"schema\"}", JsonObject.class), policyModel2, null, + "pdpGroup2", + "pdpSubgroup2"); + + loopTest.addOperationalPolicy(opLegacyPolicy); LoopTemplate loopTemplate = new LoopTemplate("test", "yaml", "svg", 1, null); loopTemplate.setDcaeBlueprintId("UUID-blueprint"); loopTest.setLoopTemplate(loopTemplate); - String payload = PolicyComponent.createPoliciesPayloadPdpGroup(loopTest); + String payload = PolicyComponent.createPoliciesPayloadPdpGroup(loopTest, "POST"); String expectedRes = ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json"); assertThat(payload).isEqualTo(expectedRes); - - assertThat(PolicyComponent.listPolicyNamesPdpGroup(loopTest)).containsExactlyInAnyOrder("opPolicy","configPolicyTest","configPolicyTest2"); } } diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java index 4e9b5620..a6a49682 100644 --- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java +++ b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java @@ -50,4 +50,17 @@ public class OperationalPolicyRepresentationBuilderTest { new GsonBuilder().create().toJson(jsonSchema), false); } + @Test + public void testOperationalPolicyPayloadConstructionForCds() throws IOException { + JsonObject jsonModel = new GsonBuilder().create() + .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class); + Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(), + jsonModel.get("resourceDetails").getAsJsonObject(), + "1.0"); + + JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service); + assertThat(jsonSchema).isNotNull(); + JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"), + new GsonBuilder().create().toJson(jsonSchema), false); + } } diff --git a/src/test/resources/example/cds-response/vFW-CDS-modify-config-wf-expected-result.json b/src/test/resources/example/cds-response/vFW-CDS-modify-config-wf-expected-result.json new file mode 100644 index 00000000..7e78bb06 --- /dev/null +++ b/src/test/resources/example/cds-response/vFW-CDS-modify-config-wf-expected-result.json @@ -0,0 +1,58 @@ +{ + "inputs": { + "resolution-key": { + "required": true, + "type": "string" + }, + "modify-config-properties": { + "vpg_onap_private_ip_0": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "service-instance.service-instance-id": { + "type": "string" + }, + "vnf-id": { + "type": "string" + }, + "data": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "dt-data" + } + }, + "service-instance-id": { + "type": "string" + }, + "update-active-streams": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "dt-data" + } + }, + "generic-vnf.vnf-id": { + "type": "string" + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/example/cds-response/vFW-CDS-modify-config-workflow.json b/src/test/resources/example/cds-response/vFW-CDS-modify-config-workflow.json new file mode 100644 index 00000000..e46da676 --- /dev/null +++ b/src/test/resources/example/cds-response/vFW-CDS-modify-config-workflow.json @@ -0,0 +1,75 @@ +{ + "blueprintName": "vFW-CDS", + "version": "1.0.0", + "workFlowData": { + "workFlowName": "modify-config", + "inputs": { + "resolution-key": { + "required": true, + "type": "string" + }, + "modify-config-properties": { + "description": "Dynamic PropertyDefinition for workflow(modify-config).", + "required": true, + "type": "dt-modify-config-properties" + } + } + }, + "dataTypes": { + "dt-modify-config-properties": { + "description": "Dynamic DataType definition for workflow(modify-config).", + "version": "1.0.0", + "properties": { + "vpg_onap_private_ip_0": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + }, + "service-instance.service-instance-id": { + "type": "string" + }, + "vnf-id": { + "type": "string" + }, + "data": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "dt-data" + } + }, + "service-instance-id": { + "type": "string" + }, + "update-active-streams": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "dt-data" + } + }, + "generic-vnf.vnf-id": { + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/src/test/resources/example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json b/src/test/resources/example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json new file mode 100644 index 00000000..5b373a45 --- /dev/null +++ b/src/test/resources/example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json @@ -0,0 +1,42 @@ +{ + "inputs": { + "template-prefix": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "template-prefix-with-complex-type": { + "type": "list", + "properties": { + "prefix-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + } + } + }, + "resource-assignment-properties": { + "private1-prefix-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/example/cds-response/vFW-CDS-resource-assignment-workflow.json b/src/test/resources/example/cds-response/vFW-CDS-resource-assignment-workflow.json new file mode 100644 index 00000000..d0f78cf1 --- /dev/null +++ b/src/test/resources/example/cds-response/vFW-CDS-resource-assignment-workflow.json @@ -0,0 +1,78 @@ +{ + "blueprintName": "vFW-CDS", + "version": "1.0.0", + "workFlowData": { + "workFlowName": "resource-assignment", + "inputs": { + "template-prefix": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "template-prefix-with-complex-type": { + "required": true, + "type": "list", + "entry_schema": { + "type": "dt-template-prefix-properties" + } + }, + "resource-assignment-properties": { + "description": "Dynamic PropertyDefinition for workflow(resource-assignment).", + "required": true, + "type": "dt-resource-assignment-properties" + } + }, + "outputs": { + "meshed-template": { + "type": "json", + "value": { + "get_attribute": [ + "resource-assignment", + "assignment-params" + ] + } + } + } + }, + "dataTypes": { + "dt-resource-assignment-properties": { + "description": "Dynamic DataType definition for workflow(resource-assignment).", + "version": "1.0.0", + "properties": { + "private1-prefix-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + } + }, + "derived_from": "tosca.datatypes.Dynamic" + }, + "dt-template-prefix-properties": { + "description": "Dynamic DataType definition for workflow(template-prefix).", + "version": "1.0.0", + "properties": { + "prefix-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/example/json-editor-schema/tca-policy-json-editor-schema.json b/src/test/resources/example/json-editor-schema/tca-policy-json-editor-schema.json index 11b91dfb..91603972 100644 --- a/src/test/resources/example/json-editor-schema/tca-policy-json-editor-schema.json +++ b/src/test/resources/example/json-editor-schema/tca-policy-json-editor-schema.json @@ -1,7 +1,7 @@ { "schema": { "uniqueItems": "true", - "format": "tabs-top", + "format": "tabs", "type": "array", "title": "Thresholds", "items": { diff --git a/src/test/resources/tosca/model-properties-cds.json b/src/test/resources/tosca/model-properties-cds.json new file mode 100644 index 00000000..591840b4 --- /dev/null +++ b/src/test/resources/tosca/model-properties-cds.json @@ -0,0 +1,151 @@ +{ + "serviceDetails": { + "serviceType": "", + "namingPolicy": "", + "environmentContext": "General_Revenue-Bearing", + "serviceEcompNaming": "true", + "serviceRole": "", + "name": "vLoadBalancerMS", + "description": "vLBMS", + "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f", + "ecompGeneratedNaming": "true", + "category": "Network L4+", + "type": "Service", + "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0", + "instantiationType": "A-la-carte" + }, + "resourceDetails": { + "CP": {}, + "VL": {}, + "VF": { + "vLoadBalancerMS 0": { + "resourceVendor": "Test", + "resourceVendorModelNumber": "", + "name": "vLoadBalancerMS", + "description": "vLBMS", + "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506", + "subcategory": "Load Balancer", + "category": "Application L4+", + "type": "VF", + "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6", + "version": "1.0", + "resourceVendorRelease": "1.0", + "customizationUUID": "465246dc-7748-45f4-a013-308d92922552", + "controllerProperties": { + "sdnc_model_name": "baseconfiguration", + "sdnc_model_version": "1.0.0", + "workflows": { + "resource-assignment": { + "inputs": { + "template-prefix": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "template-prefix-with-complex-type": { + "type": "list", + "properties": { + "prefix-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + } + } + }, + "resource-assignment-properties": { + "private1-prefix-id": { + "description": "", + "required": false, + "type": "string", + "status": "", + "constraints": [ + {} + ], + "entry_schema": { + "type": "" + } + } + } + } + } + } + } + } + }, + "CR": {}, + "VFC": {}, + "PNF": {}, + "Service": {}, + "CVFC": {}, + "Service Proxy": {}, + "Configuration": {}, + "AllottedResource": {}, + "VFModule": { + "Vloadbalancerms..vpkg..module-1": { + "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vpkg..module-1", + "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc", + "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52", + "min_vf_module_instances": 0, + "vf_module_label": "vpkg", + "max_vf_module_instances": 1, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + }, + "Vloadbalancerms..vdns..module-3": { + "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vdns..module-3", + "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720", + "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1", + "min_vf_module_instances": 0, + "vf_module_label": "vdns", + "max_vf_module_instances": 50, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + }, + "Vloadbalancerms..base_template..module-0": { + "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..base_template..module-0", + "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce", + "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27", + "min_vf_module_instances": 1, + "vf_module_label": "base_template", + "max_vf_module_instances": 1, + "vf_module_type": "Base", + "isBase": true, + "initial_count": 1, + "volume_group": false + }, + "Vloadbalancerms..vlb..module-2": { + "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vlb..module-2", + "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a", + "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806", + "min_vf_module_instances": 0, + "vf_module_label": "vlb", + "max_vf_module_instances": 1, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json index 12edd773..793ba5e7 100644 --- a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json +++ b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json @@ -87,8 +87,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -99,38 +98,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -156,8 +148,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -168,38 +159,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -225,8 +209,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -237,38 +220,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -294,8 +270,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -306,38 +281,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -363,8 +331,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -375,38 +342,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -432,8 +392,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -444,38 +403,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } diff --git a/src/test/resources/tosca/operational-policy-cds-payload-with-list.json b/src/test/resources/tosca/operational-policy-cds-payload-with-list.json new file mode 100644 index 00000000..24269ec7 --- /dev/null +++ b/src/test/resources/tosca/operational-policy-cds-payload-with-list.json @@ -0,0 +1,742 @@ +{ + "type": "object", + "title": "Configuration", + "required": [ + "operational_policy", + "guard_policies" + ], + "properties": { + "operational_policy": { + "type": "object", + "title": "Related Parameters", + "required": [ + "controlLoop", + "policies" + ], + "properties": { + "controlLoop": { + "type": "object", + "title": "Control Loop details", + "required": [ + "timeout", + "abatement", + "trigger_policy", + "controlLoopName" + ], + "properties": { + "timeout": { + "type": "string", + "title": "Overall Time Limit", + "default": "0", + "format": "number" + }, + "abatement": { + "type": "string", + "title": "Abatement", + "enum": [ + "True", + "False" + ] + }, + "trigger_policy": { + "type": "string", + "title": "Policy Decision Entry" + }, + "controlLoopName": { + "type": "string", + "title": "Control loop name", + "readOnly": "True" + } + } + }, + "policies": { + "uniqueItems": "true", + "id": "policies_array", + "type": "array", + "title": "Policy Decision Tree", + "format": "tabs-top", + "items": { + "title": "Policy Decision", + "type": "object", + "id": "policy_item", + "headerTemplate": "{{self.id}} - {{self.recipe}}", + "format": "categories", + "basicCategoryTitle": "recipe", + "required": [ + "id", + "retry", + "timeout", + "actor", + "success", + "failure", + "failure_timeout", + "failure_retries", + "failure_exception", + "failure_guard", + "target" + ], + "properties": { + "id": { + "default": "Policy 1", + "title": "Policy ID", + "type": "string" + }, + "retry": { + "default": "0", + "title": "Number of Retry", + "type": "string", + "format": "number" + }, + "timeout": { + "default": "0", + "title": "Timeout", + "type": "string", + "format": "number" + }, + "actor": { + "type": "object", + "title": "Actor", + "anyOf": [ + { + "title": "APPC", + "type": "object", + "properties": { + "actor": { + "title": "actor", + "type": "string", + "default": "APPC", + "options": { + "hidden": true + } + }, + "recipe": { + "title": "recipe", + "type": "string", + "default": "", + "enum": [ + "Restart", + "Rebuild", + "Migrate", + "Health-Check", + "ModifyConfig" + ] + }, + "payload": { + "title": "Payload (YAML)", + "type": "string", + "format": "textarea" + } + } + }, + { + "title": "SO", + "type": "object", + "properties": { + "actor": { + "title": "actor", + "type": "string", + "default": "SO", + "options": { + "hidden": true + } + }, + "recipe": { + "title": "recipe", + "type": "string", + "default": "", + "enum": [ + "VF Module Create", + "VF Module Delete" + ] + }, + "payload": { + "title": "Payload (YAML)", + "type": "string", + "format": "textarea" + } + } + }, + { + "title": "SDNC", + "type": "object", + "properties": { + "actor": { + "title": "actor", + "type": "string", + "default": "SDNC", + "options": { + "hidden": true + } + }, + "recipe": { + "title": "recipe", + "type": "string", + "default": "", + "enum": [ + "Reroute", + "BandwidthOnDemand" + ] + }, + "payload": { + "title": "Payload (YAML)", + "type": "string", + "format": "textarea" + } + } + }, + { + "title": "VFC", + "type": "object", + "properties": { + "actor": { + "title": "actor", + "type": "string", + "default": "VFC", + "options": { + "hidden": true + } + }, + "recipe": { + "title": "recipe", + "type": "string", + "default": "", + "enum": [ + "ModifyConfig" + ] + }, + "payload": { + "title": "Payload (YAML)", + "type": "string", + "format": "textarea" + } + } + }, + { + "title": "CDS", + "type": "object", + "properties": { + "actor": { + "title": "actor", + "type": "string", + "default": "CDS", + "options": { + "hidden": true + } + }, + "recipe": { + "title": "recipe", + "type": "object", + "anyOf": [ + { + "title": "user-defined", + "type": "object", + "properties": { + "recipe": { + "title": "recipe", + "type": "string", + "default": "user-defined", + "format": "textarea" + }, + "payload": { + "title": "Payload (YAML)", + "type": "string", + "default": "", + "format": "textarea" + } + } + }, + { + "title": "resource-assignment", + "type": "object", + "properties": { + "recipe": { + "title": "recipe", + "type": "string", + "default": "resource-assignment", + "options": { + "hidden": true + } + }, + "payload": { + "title": "Payload (YAML)", + "type": "object", + "properties": { + "artifact_name": { + "title": "artifact name", + "type": "string", + "default": "baseconfiguration", + "readOnly": "True" + }, + "artifact_version": { + "title": "artifact version", + "type": "string", + "default": "1.0.0", + "readOnly": "True" + }, + "mode": { + "title": "mode", + "type": "string", + "default": "async" + }, + "data": { + "title": "data", + "properties": { + "template-prefix": { + "title": "template-prefix", + "type": "array" + }, + "template-prefix-with-complex-type": { + "title": "template-prefix-with-complex-type", + "type": "array", + "items": { + "properties": { + "prefix-id": { + "title": "prefix-id", + "type": "string" + } + } + } + }, + "resource-assignment-properties": { + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "private1-prefix-id": { + "title": "private1-prefix-id", + "type": "string" + } + } + } + } + } + } + } + } + } + ] + } + } + } + ] + }, + "success": { + "default": "final_success", + "title": "When Success", + "type": "string" + }, + "failure": { + "default": "final_failure", + "title": "When Failure", + "type": "string" + }, + "failure_timeout": { + "default": "final_failure_timeout", + "title": "When Failure Timeout", + "type": "string" + }, + "failure_retries": { + "default": "final_failure_retries", + "title": "When Failure Retries", + "type": "string" + }, + "failure_exception": { + "default": "final_failure_exception", + "title": "When Failure Exception", + "type": "string" + }, + "failure_guard": { + "default": "final_failure_guard", + "title": "When Failure Guard", + "type": "string" + }, + "target": { + "type": "object", + "required": [ + "type", + "resourceID" + ], + "anyOf": [ + { + "title": "User Defined", + "additionalProperties": "True", + "properties": { + "type": { + "title": "Target type", + "type": "string", + "default": "", + "enum": [ + "VNF", + "VFMODULE", + "VM" + ] + }, + "resourceID": { + "title": "Target type", + "type": "string", + "default": "" + } + } + }, + { + "title": "VNF-vLoadBalancerMS 0", + "properties": { + "type": { + "title": "Type", + "type": "string", + "default": "VNF", + "readOnly": "True" + }, + "resourceID": { + "title": "Resource ID", + "type": "string", + "default": "vLoadBalancerMS", + "readOnly": "True" + } + } + }, + { + "title": "VFMODULE-Vloadbalancerms..vpkg..module-1", + "properties": { + "type": { + "title": "Type", + "type": "string", + "default": "VFMODULE", + "readOnly": "True" + }, + "resourceID": { + "title": "Resource ID", + "type": "string", + "default": "Vloadbalancerms..vpkg..module-1", + "readOnly": "True" + }, + "modelInvariantId": { + "title": "Model Invariant Id (ModelInvariantUUID)", + "type": "string", + "default": "ca052563-eb92-4b5b-ad41-9111768ce043", + "readOnly": "True" + }, + "modelVersionId": { + "title": "Model Version Id (ModelUUID)", + "type": "string", + "default": "1e725ccc-b823-4f67-82b9-4f4367070dbc", + "readOnly": "True" + }, + "modelName": { + "title": "Model Name", + "type": "string", + "default": "Vloadbalancerms..vpkg..module-1", + "readOnly": "True" + }, + "modelVersion": { + "title": "Model Version", + "type": "string", + "default": "1", + "readOnly": "True" + }, + "modelCustomizationId": { + "title": "Customization ID", + "type": "string", + "default": "1bffdc31-a37d-4dee-b65c-dde623a76e52", + "readOnly": "True" + } + } + }, + { + "title": "VFMODULE-Vloadbalancerms..vdns..module-3", + "properties": { + "type": { + "title": "Type", + "type": "string", + "default": "VFMODULE", + "readOnly": "True" + }, + "resourceID": { + "title": "Resource ID", + "type": "string", + "default": "Vloadbalancerms..vdns..module-3", + "readOnly": "True" + }, + "modelInvariantId": { + "title": "Model Invariant Id (ModelInvariantUUID)", + "type": "string", + "default": "4c10ba9b-f88f-415e-9de3-5d33336047fa", + "readOnly": "True" + }, + "modelVersionId": { + "title": "Model Version Id (ModelUUID)", + "type": "string", + "default": "4fa73b49-8a6c-493e-816b-eb401567b720", + "readOnly": "True" + }, + "modelName": { + "title": "Model Name", + "type": "string", + "default": "Vloadbalancerms..vdns..module-3", + "readOnly": "True" + }, + "modelVersion": { + "title": "Model Version", + "type": "string", + "default": "1", + "readOnly": "True" + }, + "modelCustomizationId": { + "title": "Customization ID", + "type": "string", + "default": "bafcdab0-801d-4d81-9ead-f464640a38b1", + "readOnly": "True" + } + } + }, + { + "title": "VFMODULE-Vloadbalancerms..base_template..module-0", + "properties": { + "type": { + "title": "Type", + "type": "string", + "default": "VFMODULE", + "readOnly": "True" + }, + "resourceID": { + "title": "Resource ID", + "type": "string", + "default": "Vloadbalancerms..base_template..module-0", + "readOnly": "True" + }, + "modelInvariantId": { + "title": "Model Invariant Id (ModelInvariantUUID)", + "type": "string", + "default": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3", + "readOnly": "True" + }, + "modelVersionId": { + "title": "Model Version Id (ModelUUID)", + "type": "string", + "default": "63734409-f745-4e4d-a38b-131638a0edce", + "readOnly": "True" + }, + "modelName": { + "title": "Model Name", + "type": "string", + "default": "Vloadbalancerms..base_template..module-0", + "readOnly": "True" + }, + "modelVersion": { + "title": "Model Version", + "type": "string", + "default": "1", + "readOnly": "True" + }, + "modelCustomizationId": { + "title": "Customization ID", + "type": "string", + "default": "86baddea-c730-4fb8-9410-cd2e17fd7f27", + "readOnly": "True" + } + } + }, + { + "title": "VFMODULE-Vloadbalancerms..vlb..module-2", + "properties": { + "type": { + "title": "Type", + "type": "string", + "default": "VFMODULE", + "readOnly": "True" + }, + "resourceID": { + "title": "Resource ID", + "type": "string", + "default": "Vloadbalancerms..vlb..module-2", + "readOnly": "True" + }, + "modelInvariantId": { + "title": "Model Invariant Id (ModelInvariantUUID)", + "type": "string", + "default": "a772a1f4-0064-412c-833d-4749b15828dd", + "readOnly": "True" + }, + "modelVersionId": { + "title": "Model Version Id (ModelUUID)", + "type": "string", + "default": "0f5c3f6a-650a-4303-abb6-fff3e573a07a", + "readOnly": "True" + }, + "modelName": { + "title": "Model Name", + "type": "string", + "default": "Vloadbalancerms..vlb..module-2", + "readOnly": "True" + }, + "modelVersion": { + "title": "Model Version", + "type": "string", + "default": "1", + "readOnly": "True" + }, + "modelCustomizationId": { + "title": "Customization ID", + "type": "string", + "default": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806", + "readOnly": "True" + } + } + } + ] + } + } + } + } + } + }, + "guard_policies": { + "type": "array", + "format": "tabs-top", + "title": "Associated Guard policies", + "items": { + "headerTemplate": "{{self.policy-id}} - {{self.content.recipe}}", + "anyOf": [ + { + "title": "Guard MinMax", + "type": "object", + "properties": { + "policy-id": { + "type": "string", + "default": "guard.minmax.new", + "pattern": "^(guard.minmax\\..*)$" + }, + "content": { + "properties": { + "actor": { + "type": "string", + "enum": [ + "APPC", + "SO", + "VFC", + "SDNC", + "SDNR" + ] + }, + "recipe": { + "type": "string", + "enum": [ + "Restart", + "Rebuild", + "Migrate", + "Health-Check", + "ModifyConfig", + "VF Module Create", + "VF Module Delete", + "Reroute" + ] + }, + "targets": { + "type": "string", + "default": ".*" + }, + "clname": { + "type": "string", + "template": "{{loopName}}", + "watch": { + "loopName": "operational_policy.controlLoop.controlLoopName" + } + }, + "guardActiveStart": { + "type": "string", + "default": "00:00:00Z" + }, + "guardActiveEnd": { + "type": "string", + "default": "10:00:00Z" + }, + "min": { + "type": "string", + "default": "0" + }, + "max": { + "type": "string", + "default": "1" + } + } + } + } + }, + { + "title": "Guard Frequency", + "type": "object", + "properties": { + "policy-id": { + "type": "string", + "default": "guard.frequency.new", + "pattern": "^(guard.frequency\\..*)$" + }, + "content": { + "properties": { + "actor": { + "type": "string", + "enum": [ + "APPC", + "SO", + "VFC", + "SDNC", + "SDNR" + ] + }, + "recipe": { + "type": "string", + "enum": [ + "Restart", + "Rebuild", + "Migrate", + "Health-Check", + "ModifyConfig", + "VF Module Create", + "VF Module Delete", + "Reroute" + ] + }, + "targets": { + "type": "string", + "default": ".*" + }, + "clname": { + "type": "string", + "template": "{{loopName}}", + "watch": { + "loopName": "operational_policy.controlLoop.controlLoopName" + } + }, + "guardActiveStart": { + "type": "string", + "default": "00:00:00Z" + }, + "guardActiveEnd": { + "type": "string", + "default": "10:00:00Z" + }, + "limit": { + "type": "string" + }, + "timeWindow": { + "type": "string" + }, + "timeUnits": { + "type": "string", + "enum": [ + "minute", + "hour", + "day", + "week", + "month", + "year" + ] + } + } + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/tosca/operational-policy-json-schema.json b/src/test/resources/tosca/operational-policy-json-schema.json index ffa88eca..87457f1d 100644 --- a/src/test/resources/tosca/operational-policy-json-schema.json +++ b/src/test/resources/tosca/operational-policy-json-schema.json @@ -276,8 +276,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -288,38 +287,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -360,8 +352,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -372,38 +363,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -444,8 +428,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -456,38 +439,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -528,8 +504,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -540,38 +515,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -612,8 +580,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -624,38 +591,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } @@ -696,8 +656,7 @@ "mode": { "title": "mode", "type": "string", - "default": "async", - "format": "textarea" + "default": "async" }, "data": { "title": "data", @@ -708,38 +667,31 @@ "properties": { "request-id": { "title": "request-id", - "type": "string", - "format": "textarea" + "type": "string" }, "service-instance-id": { "title": "service-instance-id", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf-id": { "title": "vnf-id", - "type": "string", - "format": "textarea" + "type": "string" }, "action-name": { "title": "action-name", - "type": "string", - "format": "textarea" + "type": "string" }, "scope-type": { "title": "scope-type", - "type": "string", - "format": "textarea" + "type": "string" }, "hostname": { "title": "hostname", - "type": "string", - "format": "textarea" + "type": "string" }, "vnf_name": { "title": "vnf_name", - "type": "string", - "format": "textarea" + "type": "string" } } } diff --git a/src/test/resources/tosca/pdp-group-policy-payload.json b/src/test/resources/tosca/pdp-group-policy-payload.json index c81440e7..dce740fc 100644 --- a/src/test/resources/tosca/pdp-group-policy-payload.json +++ b/src/test/resources/tosca/pdp-group-policy-payload.json @@ -22,6 +22,14 @@ "pdpType": "pdpSubgroup2", "action": "POST", "policies": [ + { + "name": "opLegacyPolicy", + "version": "1.0.0" + }, + { + "name": "guard1", + "version": "1.0.0" + }, { "name": "opPolicy", "version": "1.0.0" diff --git a/src/test/resources/tosca/policy-yaml-to-json-with-constraints.json b/src/test/resources/tosca/policy-yaml-to-json-with-constraints.json index b2575486..fe9b84d1 100644 --- a/src/test/resources/tosca/policy-yaml-to-json-with-constraints.json +++ b/src/test/resources/tosca/policy-yaml-to-json-with-constraints.json @@ -1,7 +1,7 @@ { "schema": { "uniqueItems": "true", - "format": "tabs-top", + "format": "tabs", "type": "array", "title": "Properties with constraints", "items": { diff --git a/src/test/resources/tosca/policy-yaml-to-json-with-datatypes.json b/src/test/resources/tosca/policy-yaml-to-json-with-datatypes.json index d470d928..ef9c2c03 100644 --- a/src/test/resources/tosca/policy-yaml-to-json-with-datatypes.json +++ b/src/test/resources/tosca/policy-yaml-to-json-with-datatypes.json @@ -1,7 +1,7 @@ { "schema": { "uniqueItems": "true", - "format": "tabs-top", + "format": "tabs", "type": "array", "title": "Properties with different types", "items": { diff --git a/src/test/resources/tosca/policy-yaml-to-json.json b/src/test/resources/tosca/policy-yaml-to-json.json index dd6a9ff3..b83d3f24 100644 --- a/src/test/resources/tosca/policy-yaml-to-json.json +++ b/src/test/resources/tosca/policy-yaml-to-json.json @@ -1,7 +1,7 @@ { "schema": { "uniqueItems": "true", - "format": "tabs-top", + "format": "tabs", "type": "array", "title": "TCA Policy JSON", "items": { diff --git a/src/test/resources/tosca/tosca_metadata_clamp_possible_values_json_schema.json b/src/test/resources/tosca/tosca_metadata_clamp_possible_values_json_schema.json index af8c1f96..418ee71b 100644 --- a/src/test/resources/tosca/tosca_metadata_clamp_possible_values_json_schema.json +++ b/src/test/resources/tosca/tosca_metadata_clamp_possible_values_json_schema.json @@ -1,7 +1,7 @@ { "schema":{ "uniqueItems":"true", - "format":"tabs-top", + "format":"tabs", "type":"array", "title":"TCA Policy JSON", "items":{ @@ -185,6 +185,20 @@ "id":"alarmCondition", "label":"alarmCondition", "type":"string" + }, + { + "plugin":"datetimepicker", + "operators":[ + "equals" + ], + "minLength":1, + "id":"timeEpoch", + "label":"timeEpoch", + "type":"datetime", + "input_event":"dp.change", + "validation":{ + "format":"YYYY/MM/DD HH:mm:ss" + } } ] }, diff --git a/src/test/resources/tosca/tosca_with_date_time_json_schema.json b/src/test/resources/tosca/tosca_with_date_time_json_schema.json new file mode 100644 index 00000000..e15942cc --- /dev/null +++ b/src/test/resources/tosca/tosca_with_date_time_json_schema.json @@ -0,0 +1,240 @@ +{ + "schema":{ + "uniqueItems":"true", + "format":"tabs", + "type":"array", + "title":"TCA Policy JSON", + "items":{ + "type":"object", + "title":"TCA Policy JSON", + "required":[ + "domain", + "metricsPerEventName" + ], + "properties":{ + "domain":{ + "propertyOrder":1001, + "default":"measurementsForVfScaling", + "title":"Domain name to which TCA needs to be applied", + "type":"string" + }, + "metricsPerEventName":{ + "propertyOrder":1002, + "uniqueItems":"true", + "format":"tabs-top", + "title":"Contains eventName and threshold details that need to be applied to given eventName", + "type":"array", + "items":{ + "type":"object", + "required":[ + "controlLoopSchemaType", + "eventName", + "policyName", + "policyScope", + "policyVersion", + "thresholds", + "context", + "signature" + ], + "properties":{ + "policyVersion":{ + "propertyOrder":1007, + "title":"TCA Policy Scope Version", + "type":"string" + }, + "thresholds":{ + "propertyOrder":1008, + "uniqueItems":"true", + "format":"tabs-top", + "title":"Thresholds associated with eventName", + "type":"array", + "items":{ + "type":"object", + "required":[ + "closedLoopControlName", + "closedLoopEventStatus", + "direction", + "fieldPath", + "severity", + "thresholdValue", + "version" + ], + "properties":{ + "severity":{ + "propertyOrder":1013, + "title":"Threshold Event Severity", + "type":"string", + "enum":[ + "CRITICAL", + "MAJOR", + "MINOR", + "WARNING", + "NORMAL" + ] + }, + "fieldPath":{ + "propertyOrder":1012, + "title":"Json field Path as per CEF message which needs to be analyzed for TCA", + "type":"string", + "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" + ] + }, + "thresholdValue":{ + "propertyOrder":1014, + "title":"Threshold value for the field Path inside CEF message", + "type":"integer" + }, + "closedLoopEventStatus":{ + "propertyOrder":1010, + "title":"Closed Loop Event Status of the threshold", + "type":"string", + "enum":[ + "ONSET", + "ABATED" + ] + }, + "closedLoopControlName":{ + "propertyOrder":1009, + "title":"Closed Loop Control Name associated with the threshold", + "type":"string" + }, + "version":{ + "propertyOrder":1015, + "title":"Version number associated with the threshold", + "type":"string" + }, + "direction":{ + "propertyOrder":1011, + "title":"Direction of the threshold", + "type":"string", + "enum":[ + "LESS", + "LESS_OR_EQUAL", + "GREATER", + "GREATER_OR_EQUAL", + "EQUAL" + ] + } + } + } + }, + "policyName":{ + "propertyOrder":1005, + "title":"TCA Policy Scope Name", + "type":"string" + }, + "signature":{ + "propertyOrder":1017, + "title":"Signature", + "required":[ + "filter_clause" + ], + "properties":{ + "filter_clause":{ + "propertyOrder":30002, + "qschema":{ + "filters":[ + { + "plugin":"datetimepicker", + "operators":[ + "equals" + ], + "minLength":1, + "id":"timeEpoch", + "label":"timeEpoch", + "type":"datetime", + "input_event":"dp.change", + "validation":{ + "format":"YYYY/MM/DD HH:mm:ss" + } + } + ] + }, + "minLength":1, + "title":"Filter Clause", + "type":"qbldr" + } + } + }, + "controlLoopSchemaType":{ + "propertyOrder":1003, + "title":"Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", + "type":"string", + "enum":[ + "VM", + "VNF" + ] + }, + "policyScope":{ + "propertyOrder":1006, + "title":"TCA Policy Scope", + "type":"string" + }, + "context":{ + "propertyOrder":1016, + "options":{ + "enum_titles":[ + "PROD" + ] + }, + "title":"TCA Policy Dummy Context", + "type":"string", + "enum":[ + "PROD" + ] + }, + "eventName":{ + "propertyOrder":1004, + "title":"Event name to which thresholds need to be applied", + "type":"string" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/ui-react-lib/libIndex.js b/ui-react-lib/libIndex.js index fae47e7f..da98df43 100755 --- a/ui-react-lib/libIndex.js +++ b/ui-react-lib/libIndex.js @@ -33,13 +33,19 @@ export { default as LoopService } from './src/api/LoopService'; export { default as LoopStatus } from './src/components/loop_viewer/status/LoopStatus'; export { default as LoopSvg } from './src/components/loop_viewer/svg/LoopSvg'; export { default as LoopUI } from './src/LoopUI'; +export { default as ManageDictionaries } from './src/components/dialogs/ManageDictionaries/ManageDictionaries'; export { default as MenuBar } from './src/components/menu/MenuBar'; +export { default as ModifyLoopModal } from './src/components/dialogs/Loop/ModifyLoopModal'; export { default as NotFound } from './src/NotFound'; export { default as OpenLoopModal } from './src/components/dialogs/Loop/OpenLoopModal'; export { default as CreateLoopModal } from './src/components/dialogs/Loop/CreateLoopModal'; export { default as OperationalPolicyModal } from './src/components/dialogs/OperationalPolicy/OperationalPolicyModal'; export { default as PerformActions } from './src/components/dialogs/PerformActions'; +export { default as PolicyToscaService } from './src/api/PolicyToscaService'; export { default as RefreshStatus } from './src/components/dialogs/RefreshStatus'; +export { default as TemplateService } from './src/api/TemplateService'; export { default as UserInfoModal } from './src/components/dialogs/UserInfoModal'; export { default as UserService } from './src/api/UserService'; +export { default as UploadToscaPolicyModal } from './src/components/dialogs/Tosca/UploadToscaPolicyModal'; +export { default as ViewLoopTemplatesModal } from './src/components/dialogs/Tosca/ViewLoopTemplatesModal'; export { default as ViewToscaPolicyModal } from './src/components/dialogs/Tosca/ViewToscaPolicyModal'; diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js index 5e2da79c..efd02b41 100644 --- a/ui-react/src/LoopUI.js +++ b/ui-react/src/LoopUI.js @@ -195,7 +195,7 @@ export default class LoopUI extends React.Component { renderLoopViewHeader() { return ( - Loop Viewer - {this.state.loopName} + Loop Viewer - {this.state.loopName} - ({this.state.loopCache.getTemplateName()}) ); } diff --git a/ui-react/src/__snapshots__/LoopUI.test.js.snap b/ui-react/src/__snapshots__/LoopUI.test.js.snap index e523de94..ff08f7af 100644 --- a/ui-react/src/__snapshots__/LoopUI.test.js.snap +++ b/ui-react/src/__snapshots__/LoopUI.test.js.snap @@ -176,6 +176,8 @@ exports[`Verify LoopUI Test the render method 1`] = ` Loop Viewer - testLoopName + - ( + ) Loop Viewer - Empty (NO loop loaded yet) + - ( + ) + Configuration policies diff --git a/ui-react/src/components/dialogs/Loop/CreateLoopModal.js b/ui-react/src/components/dialogs/Loop/CreateLoopModal.js index c5762a8d..e98b5956 100644 --- a/ui-react/src/components/dialogs/Loop/CreateLoopModal.js +++ b/ui-react/src/components/dialogs/Loop/CreateLoopModal.js @@ -34,13 +34,20 @@ import TemplateService from '../../../api/TemplateService'; const ModalStyled = styled(Modal)` background-color: transparent; ` -const LoopViewSvgDivStyled = styled.div` - overflow: hidden; +const LoopViewSvgDivStyled = styled.svg` + display: flex; + flex-direction: row; + overflow-x: scroll; background-color: ${props => (props.theme.loopViewerBackgroundColor)}; border-color: ${props => (props.theme.loopViewerHeaderColor)}; + margin-top: 3em; margin-left: auto; margin-right:auto; + margin-bottom: -1em; text-align: center; + align-items: center; + height: 100%; + width: 100%; ` export default class CreateLoopModal extends React.Component { @@ -118,24 +125,28 @@ export default class CreateLoopModal extends React.Component { render() { return ( - + Create Model - Template Name + Template Name: @@ -148,4 +159,4 @@ export default class CreateLoopModal extends React.Component { ); } -} \ No newline at end of file +} diff --git a/ui-react/src/components/dialogs/Loop/DeployLoopModal.js b/ui-react/src/components/dialogs/Loop/DeployLoopModal.js index 6e743703..2155977f 100644 --- a/ui-react/src/components/dialogs/Loop/DeployLoopModal.js +++ b/ui-react/src/components/dialogs/Loop/DeployLoopModal.js @@ -161,7 +161,7 @@ export default class DeployLoopModal extends React.Component { } render() { return ( - + Deployment parameters diff --git a/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js b/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js index 73946f45..c0a2084f 100644 --- a/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js +++ b/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js @@ -102,7 +102,7 @@ export default class LoopPropertiesModal extends React.Component { render() { return ( - + Model Properties diff --git a/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js b/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js index 4c6b6a72..5154a880 100644 --- a/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js +++ b/ui-react/src/components/dialogs/Loop/ModifyLoopModal.js @@ -79,6 +79,10 @@ export default class ModifyLoopModal extends React.Component { cellStyle: cellStyle, headerStyle: headerStyle }, + { title: "Policy Name", field: "policyName", + cellStyle: cellStyle, + headerStyle: headerStyle + }, { title: "Version", field: "version", cellStyle: cellStyle, headerStyle: headerStyle @@ -91,7 +95,7 @@ export default class ModifyLoopModal extends React.Component { cellStyle: cellStyle, headerStyle: headerStyle }, - { title: "Add", field: "updatedDate", editable: 'never', + { title: "Created Date", field: "createdDate", editable: 'never', cellStyle: cellStyle, headerStyle: headerStyle } @@ -129,7 +133,9 @@ export default class ModifyLoopModal extends React.Component { var operationalPolicies = this.state.loopCache.getOperationalPolicies(); var selectedPolicyModels = []; for (var policy in operationalPolicies) { - selectedPolicyModels.push(operationalPolicies[policy]["policyModel"]); + var newRow = operationalPolicies[policy]["policyModel"]; + newRow["policyName"] = operationalPolicies[policy].name; + selectedPolicyModels.push(newRow); } PolicyToscaService.getToscaPolicyModels().then(allToscaModels => { @@ -183,14 +189,14 @@ export default class ModifyLoopModal extends React.Component { } handleRemove() { - LoopService.removeOperationalPolicyType(this.state.loopCache.getLoopName(),this.state.selectedRowData.policyModelType,this.state.selectedRowData.version); + LoopService.removeOperationalPolicyType(this.state.loopCache.getLoopName(),this.state.selectedRowData.policyModelType,this.state.selectedRowData.version,this.state.selectedRowData.policyName); this.props.loadLoopFunction(this.state.loopCache.getLoopName()); this.handleClose(); } render() { return ( - + Modify Loop Operational Policies @@ -220,7 +226,7 @@ export default class ModifyLoopModal extends React.Component { (props.theme.loopViewerBackgroundColor)}; border-color: ${props => (props.theme.loopViewerHeaderColor)}; + margin-top: 2em; margin-left: auto; margin-right:auto; + margin-bottom: -3em; text-align: center; + align-items: center; + height: 100%; + width: 100%; ` export default class OpenLoopModal extends React.Component { @@ -54,6 +61,7 @@ export default class OpenLoopModal extends React.Component { this.handleOpen = this.handleOpen.bind(this); this.handleClose = this.handleClose.bind(this); this.handleDropdownListChange = this.handleDropdownListChange.bind(this); + this.showReadOnly = props.showReadOnly ? props.showReadOnly : true; this.state = { show: true, chosenLoopName: '', @@ -101,28 +109,34 @@ export default class OpenLoopModal extends React.Component { render() { return ( - + Open Model - Model Name + Model Name: this.fileInput = fileInput}/> diff --git a/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js b/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js index cec6722d..7cf02f71 100644 --- a/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js +++ b/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.js @@ -38,16 +38,24 @@ import MaterialTable from "material-table"; const ModalStyled = styled(Modal)` background-color: transparent; ` -const LoopViewSvgDivStyled = styled.div` - overflow: hidden; +const LoopViewSvgDivStyled = styled.svg` + overflow-x: scroll; background-color: ${props => (props.theme.loopViewerBackgroundColor)}; border-color: ${props => (props.theme.loopViewerHeaderColor)}; - margin-left: auto; + margin-top: 3em; + margin-left: 2em; margin-right:auto; text-align: center; - margin-top: 20px; + height: 100%; + width: 100%; + display: flex; + flex-direction: row; + align-items: center; + ` const SvgContainerDivStyled = styled.div` + display: flex; + align-items: center; border: 1px solid; ` @@ -133,7 +141,7 @@ export default class ViewLoopTemplatesModal extends React.Component { render() { return ( - + diff --git a/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js b/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js index 65008052..d49232f2 100644 --- a/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js +++ b/ui-react/src/components/dialogs/Tosca/ViewToscaPolicyModal.js @@ -139,7 +139,7 @@ export default class ViewToscalPolicyModal extends React.Component { render() { return ( - + diff --git a/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap b/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap index 253820f8..3f6dc948 100644 --- a/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap +++ b/ui-react/src/components/dialogs/Tosca/__snapshots__/ViewLoopTemplatesModal.test.js.snap @@ -2,6 +2,8 @@ exports[`Verify ViewLoopTemplatesModal Test the tosca model view render method 1`] = ` - props.theme.loopViewerHeaderBackgroundColor}; + background-color: ${props => props.theme.loopLogsHeaderBackgroundColor}; padding: 10px 10px; - color: ${props => props.theme.loopViewerHeaderFontColor}; + color: ${props => props.theme.loopLogsHeaderFontColor}; ` const TableStyled = styled(Table)` diff --git a/ui-react/src/components/loop_viewer/svg/LoopSvg.js b/ui-react/src/components/loop_viewer/svg/LoopSvg.js index 4bbf608d..048f6304 100644 --- a/ui-react/src/components/loop_viewer/svg/LoopSvg.js +++ b/ui-react/src/components/loop_viewer/svg/LoopSvg.js @@ -27,14 +27,20 @@ import { withRouter } from "react-router-dom"; import LoopService from '../../../api/LoopService'; import LoopComponentConverter from './LoopComponentConverter'; -const LoopViewSvgDivStyled = styled.div` - overflow: hidden; +const LoopViewSvgDivStyled = styled.svg` + display: flex; + flex-direction: row; + overflow-x: scroll; background-color: ${props => (props.theme.loopViewerBackgroundColor)}; border: 1px solid; border-color: ${props => (props.theme.loopViewerHeaderColor)}; + margin-top: 1em; margin-left: auto; margin-right:auto; - text-align: center; + margin-bottom: -3em; + align-items: center; + height: 100%; + width: 100%; ` @@ -101,4 +107,4 @@ class LoopViewSvg extends React.Component { } } -export default withRouter(LoopViewSvg); \ No newline at end of file +export default withRouter(LoopViewSvg); diff --git a/ui-react/src/components/loop_viewer/svg/__snapshots__/LoopSvg.test.js.snap b/ui-react/src/components/loop_viewer/svg/__snapshots__/LoopSvg.test.js.snap index cecfb425..e05f1c79 100644 --- a/ui-react/src/components/loop_viewer/svg/__snapshots__/LoopSvg.test.js.snap +++ b/ui-react/src/components/loop_viewer/svg/__snapshots__/LoopSvg.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Verify LoopSvg Test the render method 1`] = ` -No LOOP (SVG)", @@ -12,7 +12,7 @@ exports[`Verify LoopSvg Test the render method 1`] = ` `; exports[`Verify LoopSvg Test the render method no loopName 1`] = ` -No LOOP (SVG)", @@ -23,7 +23,7 @@ exports[`Verify LoopSvg Test the render method no loopName 1`] = ` `; exports[`Verify LoopSvg Test the render method svg not empty 1`] = ` -", diff --git a/ui-react/src/theme/globalStyle.js b/ui-react/src/theme/globalStyle.js index 3656f9e9..64fd7c5d 100644 --- a/ui-react/src/theme/globalStyle.js +++ b/ui-react/src/theme/globalStyle.js @@ -87,6 +87,9 @@ export const DefaultClampTheme = { loopViewerHeaderBackgroundColor: '#337ab7', loopViewerHeaderFontColor: 'white', + loopLogsHeaderBackgroundColor: 'white', + loopLogsHeaderFontColor: 'black', + menuBackgroundColor: 'white', menuFontColor: 'black', menuHighlightedBackgroundColor: '#337ab7', diff --git a/version.properties b/version.properties index 578d597a..cdbe71c1 100644 --- a/version.properties +++ b/version.properties @@ -27,7 +27,7 @@ major=5 minor=0 -patch=3 +patch=5 base_version=${major}.${minor}.${patch}