From b9a6531c7a5cfc5a9a544a21fe8c47914be9699b Mon Sep 17 00:00:00 2001 From: sebdet Date: Tue, 28 Jan 2020 16:28:21 +0100 Subject: Change the Csar installer Change the csar installer so that it installs a loop template instead of a loop object Issue-ID: CLAMP-592 Change-Id: I757f6411ce959573fcb3a82e48359a1a44f87410 Signed-off-by: sebdet --- extra/sql/bulkload/create-tables.sql | 5 +- extra/sql/dump/test-data.sql | 23 +++--- .../java/org/onap/clamp/loop/CsarInstaller.java | 94 +++++++++------------- src/main/java/org/onap/clamp/loop/Loop.java | 16 +--- .../clamp/loop/deploy/DcaeDeployParameters.java | 25 +++--- .../java/org/onap/clamp/loop/service/Service.java | 14 ++++ .../onap/clamp/loop/template/LoopElementModel.java | 24 +++++- .../org/onap/clamp/loop/template/LoopTemplate.java | 52 ++++++++++++ .../org/onap/clamp/loop/CsarInstallerItCase.java | 75 +++++++++-------- .../org/onap/clamp/loop/DcaeComponentTest.java | 2 +- .../org/onap/clamp/loop/DeployFlowTestItCase.java | 76 ++++++++--------- .../onap/clamp/loop/LoopControllerTestItCase.java | 2 +- .../onap/clamp/loop/LoopLogServiceTestItCase.java | 4 +- .../onap/clamp/loop/LoopRepositoriesItCase.java | 4 +- .../org/onap/clamp/loop/LoopServiceTestItCase.java | 3 +- .../java/org/onap/clamp/loop/LoopToJsonTest.java | 3 +- .../onap/clamp/loop/PolicyModelServiceItCase.java | 9 +-- 17 files changed, 245 insertions(+), 186 deletions(-) diff --git a/extra/sql/bulkload/create-tables.sql b/extra/sql/bulkload/create-tables.sql index 352b66175..92e36f075 100644 --- a/extra/sql/bulkload/create-tables.sql +++ b/extra/sql/bulkload/create-tables.sql @@ -36,7 +36,8 @@ created_timestamp datetime(6) not null, updated_by varchar(255), updated_timestamp datetime(6) not null, - blueprint_yaml varchar(255) not null, + blueprint_yaml MEDIUMTEXT not null, + dcae_blueprint_id varchar(255), loop_element_type varchar(255) not null, primary key (name) ) engine=InnoDB; @@ -58,6 +59,7 @@ updated_by varchar(255), updated_timestamp datetime(6) not null, blueprint_yaml MEDIUMTEXT, + dcae_blueprint_id varchar(255), maximum_instances_allowed integer, svg_representation MEDIUMTEXT, service_uuid varchar(255), @@ -77,7 +79,6 @@ created_timestamp datetime(6) not null, updated_by varchar(255), updated_timestamp datetime(6) not null, - blueprint_yaml MEDIUMTEXT not null, dcae_blueprint_id varchar(255), dcae_deployment_id varchar(255), dcae_deployment_status_url varchar(255), diff --git a/extra/sql/dump/test-data.sql b/extra/sql/dump/test-data.sql index 32ec9c3b9..db96154fd 100644 --- a/extra/sql/dump/test-data.sql +++ b/extra/sql/dump/test-data.sql @@ -54,6 +54,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-01-28 15:54:29.921692','','2020-01-28 15:54:30.237701','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',NULL,'CONFIG_POLICY'); /*!40000 ALTER TABLE `loop_element_models` ENABLE KEYS */; UNLOCK TABLES; @@ -72,6 +73,9 @@ UNLOCK TABLES; LOCK TABLES `loop_templates` WRITE; /*!40000 ALTER TABLE `loop_templates` DISABLE KEYS */; +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_fDDwI_v1_0_ResourceInstanceName1_tca','','2020-01-28 15:54:30.197906','','2020-01-28 15:54:30.197906','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-69bf32c5-ebb3-4faa-b7e4-671617efb3d3',0,'VESTCAOperationalPolicy','63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_fDDwI_v1_0_ResourceInstanceName1_tca_3','','2020-01-28 15:54:30.099520','','2020-01-28 15:54:30.099520','tosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap.svc.cluster.local\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest\"\n consul_host:\n type: string\n default: consul-server.onap.svc.cluster.local\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service.dcae.svc.cluster.local\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"none\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n tca_policy: \'\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: dcae.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \n get_input: policy_model_id\n','typeId-d71093a2-73e4-4227-99f7-92e7069f5a10',0,'VEStca_k8sOperationalPolicy','63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_fDDwI_v1_0_ResourceInstanceName2_tca_2','','2020-01-28 15:54:29.895679','','2020-01-28 15:54:29.895679','#\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-4bbbe73d-28b0-4204-aa8c-d4d814a6d08b',0,'VEStca_k8sOperationalPolicy','63cac700-ab9a-4115-a74f-7eac85e3fce0'); /*!40000 ALTER TABLE `loop_templates` ENABLE KEYS */; UNLOCK TABLES; @@ -81,6 +85,7 @@ UNLOCK TABLES; LOCK TABLES `loopelementmodels_to_policymodels` WRITE; /*!40000 ALTER TABLE `loopelementmodels_to_policymodels` DISABLE KEYS */; +INSERT INTO `loopelementmodels_to_policymodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','onap.policies.monitoring.cdap.tca.hi.lo.app','1.0'); /*!40000 ALTER TABLE `loopelementmodels_to_policymodels` ENABLE KEYS */; UNLOCK TABLES; @@ -90,9 +95,6 @@ UNLOCK TABLES; LOCK TABLES `loops` WRITE; /*!40000 ALTER TABLE `loops` DISABLE KEYS */; -INSERT INTO `loops` VALUES ('LOOP_Neavs_v1_0_ResourceInstanceName1_tca','','2020-01-23 09:42:15.427507','','2020-01-23 09:42:15.427507','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-32e402b4-8d90-4ace-ba3b-ecef5918d71a',NULL,NULL,'{\n \"dcaeDeployParameters\": {\n \"TCA_Neavs_v1_0_ResourceInstanceName1_tca\": {\n \"location_id\": \"\",\n \"service_id\": \"\",\n \"policy_id\": \"TCA_Neavs_v1_0_ResourceInstanceName1_tca\"\n }\n }\n}','DESIGN','VESTCAOperationalPolicy',NULL,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loops` VALUES ('LOOP_Neavs_v1_0_ResourceInstanceName1_tca_3','','2020-01-23 09:42:15.302231','','2020-01-23 09:42:15.302231','tosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap.svc.cluster.local\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest\"\n consul_host:\n type: string\n default: consul-server.onap.svc.cluster.local\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service.dcae.svc.cluster.local\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"none\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n tca_policy: \'\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: dcae.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \n get_input: policy_model_id\n','typeId-de0f1827-bc0b-47e6-b96c-b9045702881f',NULL,NULL,'{\n \"dcaeDeployParameters\": {\n \"tca_k8s_Neavs_v1_0_ResourceInstanceName1_tca_3\": {\n \"aaiEnrichmentHost\": \"aai.onap.svc.cluster.local\",\n \"aaiEnrichmentPort\": \"8443\",\n \"enableAAIEnrichment\": true,\n \"dmaap_host\": \"message-router.onap.svc.cluster.local\",\n \"dmaap_port\": \"3904\",\n \"enableRedisCaching\": false,\n \"redisHosts\": \"dcae-redis.onap.svc.cluster.local:6379\",\n \"tag_version\": \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest\",\n \"consul_host\": \"consul-server.onap.svc.cluster.local\",\n \"consul_port\": \"8500\",\n \"cbs_host\": \"config-binding-service.dcae.svc.cluster.local\",\n \"cbs_port\": \"10000\",\n \"external_port\": \"32012\",\n \"policy_model_id\": \"onap.policies.monitoring.cdap.tca.hi.lo.app\",\n \"policy_id\": \"tca_k8s_Neavs_v1_0_ResourceInstanceName1_tca_3\"\n }\n }\n}','DESIGN','VEStca_k8sOperationalPolicy',NULL,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loops` VALUES ('LOOP_Neavs_v1_0_ResourceInstanceName2_tca_2','','2020-01-23 09:42:15.164411','','2020-01-23 09:42:15.164411','#\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-cb9f23e5-4d16-42ec-b65d-f421bd118244',NULL,NULL,'{\n \"dcaeDeployParameters\": {\n \"tca_k8s_Neavs_v1_0_ResourceInstanceName2_tca_2\": {\n \"aaiEnrichmentHost\": \"aai.onap.svc.cluster.local\",\n \"aaiEnrichmentPort\": \"8443\",\n \"enableAAIEnrichment\": true,\n \"dmaap_host\": \"message-router.onap\",\n \"dmaap_port\": \"3904\",\n \"enableRedisCaching\": false,\n \"redisHosts\": \"dcae-redis.onap.svc.cluster.local:6379\",\n \"tag_version\": \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1\",\n \"consul_host\": \"consul-server.onap\",\n \"consul_port\": \"8500\",\n \"cbs_host\": \"config-binding-servicel\",\n \"cbs_port\": \"10000\",\n \"external_port\": \"32012\",\n \"policy_model_id\": \"onap.policies.monitoring.cdap.tca.hi.lo.app\",\n \"policy_id\": \"tca_k8s_Neavs_v1_0_ResourceInstanceName2_tca_2\"\n }\n }\n}','DESIGN','VEStca_k8sOperationalPolicy',NULL,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); /*!40000 ALTER TABLE `loops` ENABLE KEYS */; UNLOCK TABLES; @@ -102,9 +104,6 @@ UNLOCK TABLES; LOCK TABLES `loops_to_microservicepolicies` WRITE; /*!40000 ALTER TABLE `loops_to_microservicepolicies` DISABLE KEYS */; -INSERT INTO `loops_to_microservicepolicies` VALUES ('LOOP_Neavs_v1_0_ResourceInstanceName1_tca','TCA_Neavs_v1_0_ResourceInstanceName1_tca'); -INSERT INTO `loops_to_microservicepolicies` VALUES ('LOOP_Neavs_v1_0_ResourceInstanceName1_tca_3','tca_k8s_Neavs_v1_0_ResourceInstanceName1_tca_3'); -INSERT INTO `loops_to_microservicepolicies` VALUES ('LOOP_Neavs_v1_0_ResourceInstanceName2_tca_2','tca_k8s_Neavs_v1_0_ResourceInstanceName2_tca_2'); /*!40000 ALTER TABLE `loops_to_microservicepolicies` ENABLE KEYS */; UNLOCK TABLES; @@ -114,6 +113,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_fDDwI_v1_0_ResourceInstanceName1_tca',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_fDDwI_v1_0_ResourceInstanceName1_tca_3',0); +INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_fDDwI_v1_0_ResourceInstanceName2_tca_2',0); /*!40000 ALTER TABLE `looptemplates_to_loopelementmodels` ENABLE KEYS */; UNLOCK TABLES; @@ -123,9 +125,6 @@ UNLOCK TABLES; LOCK TABLES `micro_service_policies` WRITE; /*!40000 ALTER TABLE `micro_service_policies` DISABLE KEYS */; -INSERT INTO `micro_service_policies` VALUES ('tca_k8s_Neavs_v1_0_ResourceInstanceName1_tca_3','','2020-01-23 09:42:15.305928','','2020-01-23 09:42:15.305928',NULL,'{\n \"schema\": {\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"type\": \"array\",\n \"title\": \"TCA Policy JSON\",\n \"items\": {\n \"type\": \"object\",\n \"title\": \"TCA Policy JSON\",\n \"required\": [\n \"domain\",\n \"metricsPerEventName\"\n ],\n \"properties\": {\n \"domain\": {\n \"propertyOrder\": 1001,\n \"default\": \"measurementsForVfScaling\",\n \"title\": \"Domain name to which TCA needs to be applied\",\n \"type\": \"string\"\n },\n \"metricsPerEventName\": {\n \"propertyOrder\": 1002,\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"title\": \"Contains eventName and threshold details that need to be applied to given eventName\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"controlLoopSchemaType\",\n \"eventName\",\n \"policyName\",\n \"policyScope\",\n \"policyVersion\",\n \"thresholds\"\n ],\n \"properties\": {\n \"policyVersion\": {\n \"propertyOrder\": 1007,\n \"title\": \"TCA Policy Scope Version\",\n \"type\": \"string\"\n },\n \"thresholds\": {\n \"propertyOrder\": 1008,\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"title\": \"Thresholds associated with eventName\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"closedLoopControlName\",\n \"closedLoopEventStatus\",\n \"direction\",\n \"fieldPath\",\n \"severity\",\n \"thresholdValue\",\n \"version\"\n ],\n \"properties\": {\n \"severity\": {\n \"propertyOrder\": 1013,\n \"title\": \"Threshold Event Severity\",\n \"type\": \"string\",\n \"enum\": [\n \"CRITICAL\",\n \"MAJOR\",\n \"MINOR\",\n \"WARNING\",\n \"NORMAL\"\n ]\n },\n \"fieldPath\": {\n \"propertyOrder\": 1012,\n \"title\": \"Json field Path as per CEF message which needs to be analyzed for TCA\",\n \"type\": \"string\",\n \"enum\": [\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 ]\n },\n \"thresholdValue\": {\n \"propertyOrder\": 1014,\n \"title\": \"Threshold value for the field Path inside CEF message\",\n \"type\": \"integer\"\n },\n \"closedLoopEventStatus\": {\n \"propertyOrder\": 1010,\n \"title\": \"Closed Loop Event Status of the threshold\",\n \"type\": \"string\",\n \"enum\": [\n \"ONSET\",\n \"ABATED\"\n ]\n },\n \"closedLoopControlName\": {\n \"propertyOrder\": 1009,\n \"title\": \"Closed Loop Control Name associated with the threshold\",\n \"type\": \"string\"\n },\n \"version\": {\n \"propertyOrder\": 1015,\n \"title\": \"Version number associated with the threshold\",\n \"type\": \"string\"\n },\n \"direction\": {\n \"propertyOrder\": 1011,\n \"title\": \"Direction of the threshold\",\n \"type\": \"string\",\n \"enum\": [\n \"LESS\",\n \"LESS_OR_EQUAL\",\n \"GREATER\",\n \"GREATER_OR_EQUAL\",\n \"EQUAL\"\n ]\n }\n }\n }\n },\n \"policyName\": {\n \"propertyOrder\": 1005,\n \"title\": \"TCA Policy Scope Name\",\n \"type\": \"string\"\n },\n \"controlLoopSchemaType\": {\n \"propertyOrder\": 1003,\n \"title\": \"Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\",\n \"type\": \"string\",\n \"enum\": [\n \"VM\",\n \"VNF\"\n ]\n },\n \"policyScope\": {\n \"propertyOrder\": 1006,\n \"title\": \"TCA Policy Scope\",\n \"type\": \"string\"\n },\n \"eventName\": {\n \"propertyOrder\": 1004,\n \"title\": \"Event name to which thresholds need to be applied\",\n \"type\": \"string\"\n }\n }\n }\n }\n }\n }\n }\n}',NULL,NULL,NULL,NULL,NULL,'onap.policies.monitoring.cdap.tca.hi.lo.app','tosca_definitions_version: tosca_simple_yaml_1_0_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that governs monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: map\n description: TCA Policy JSON\n entry_schema:\n type: onap.datatypes.monitoring.tca_policy\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n','\0',NULL); -INSERT INTO `micro_service_policies` VALUES ('tca_k8s_Neavs_v1_0_ResourceInstanceName2_tca_2','','2020-01-23 09:42:15.177166','','2020-01-23 09:42:15.177166',NULL,'{\n \"schema\": {\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"type\": \"array\",\n \"title\": \"TCA Policy JSON\",\n \"items\": {\n \"type\": \"object\",\n \"title\": \"TCA Policy JSON\",\n \"required\": [\n \"domain\",\n \"metricsPerEventName\"\n ],\n \"properties\": {\n \"domain\": {\n \"propertyOrder\": 1001,\n \"default\": \"measurementsForVfScaling\",\n \"title\": \"Domain name to which TCA needs to be applied\",\n \"type\": \"string\"\n },\n \"metricsPerEventName\": {\n \"propertyOrder\": 1002,\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"title\": \"Contains eventName and threshold details that need to be applied to given eventName\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"controlLoopSchemaType\",\n \"eventName\",\n \"policyName\",\n \"policyScope\",\n \"policyVersion\",\n \"thresholds\"\n ],\n \"properties\": {\n \"policyVersion\": {\n \"propertyOrder\": 1007,\n \"title\": \"TCA Policy Scope Version\",\n \"type\": \"string\"\n },\n \"thresholds\": {\n \"propertyOrder\": 1008,\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"title\": \"Thresholds associated with eventName\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"closedLoopControlName\",\n \"closedLoopEventStatus\",\n \"direction\",\n \"fieldPath\",\n \"severity\",\n \"thresholdValue\",\n \"version\"\n ],\n \"properties\": {\n \"severity\": {\n \"propertyOrder\": 1013,\n \"title\": \"Threshold Event Severity\",\n \"type\": \"string\",\n \"enum\": [\n \"CRITICAL\",\n \"MAJOR\",\n \"MINOR\",\n \"WARNING\",\n \"NORMAL\"\n ]\n },\n \"fieldPath\": {\n \"propertyOrder\": 1012,\n \"title\": \"Json field Path as per CEF message which needs to be analyzed for TCA\",\n \"type\": \"string\",\n \"enum\": [\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 ]\n },\n \"thresholdValue\": {\n \"propertyOrder\": 1014,\n \"title\": \"Threshold value for the field Path inside CEF message\",\n \"type\": \"integer\"\n },\n \"closedLoopEventStatus\": {\n \"propertyOrder\": 1010,\n \"title\": \"Closed Loop Event Status of the threshold\",\n \"type\": \"string\",\n \"enum\": [\n \"ONSET\",\n \"ABATED\"\n ]\n },\n \"closedLoopControlName\": {\n \"propertyOrder\": 1009,\n \"title\": \"Closed Loop Control Name associated with the threshold\",\n \"type\": \"string\"\n },\n \"version\": {\n \"propertyOrder\": 1015,\n \"title\": \"Version number associated with the threshold\",\n \"type\": \"string\"\n },\n \"direction\": {\n \"propertyOrder\": 1011,\n \"title\": \"Direction of the threshold\",\n \"type\": \"string\",\n \"enum\": [\n \"LESS\",\n \"LESS_OR_EQUAL\",\n \"GREATER\",\n \"GREATER_OR_EQUAL\",\n \"EQUAL\"\n ]\n }\n }\n }\n },\n \"policyName\": {\n \"propertyOrder\": 1005,\n \"title\": \"TCA Policy Scope Name\",\n \"type\": \"string\"\n },\n \"controlLoopSchemaType\": {\n \"propertyOrder\": 1003,\n \"title\": \"Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\",\n \"type\": \"string\",\n \"enum\": [\n \"VM\",\n \"VNF\"\n ]\n },\n \"policyScope\": {\n \"propertyOrder\": 1006,\n \"title\": \"TCA Policy Scope\",\n \"type\": \"string\"\n },\n \"eventName\": {\n \"propertyOrder\": 1004,\n \"title\": \"Event name to which thresholds need to be applied\",\n \"type\": \"string\"\n }\n }\n }\n }\n }\n }\n }\n}',NULL,NULL,NULL,NULL,NULL,'onap.policies.monitoring.cdap.tca.hi.lo.app','tosca_definitions_version: tosca_simple_yaml_1_0_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that governs monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: map\n description: TCA Policy JSON\n entry_schema:\n type: onap.datatypes.monitoring.tca_policy\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n','\0',NULL); -INSERT INTO `micro_service_policies` VALUES ('TCA_Neavs_v1_0_ResourceInstanceName1_tca','','2020-01-23 09:42:15.430589','','2020-01-23 09:42:15.430589',NULL,'{\n \"schema\": {\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"type\": \"array\",\n \"title\": \"TCA Policy JSON\",\n \"items\": {\n \"type\": \"object\",\n \"title\": \"TCA Policy JSON\",\n \"required\": [\n \"domain\",\n \"metricsPerEventName\"\n ],\n \"properties\": {\n \"domain\": {\n \"propertyOrder\": 1001,\n \"default\": \"measurementsForVfScaling\",\n \"title\": \"Domain name to which TCA needs to be applied\",\n \"type\": \"string\"\n },\n \"metricsPerEventName\": {\n \"propertyOrder\": 1002,\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"title\": \"Contains eventName and threshold details that need to be applied to given eventName\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"controlLoopSchemaType\",\n \"eventName\",\n \"policyName\",\n \"policyScope\",\n \"policyVersion\",\n \"thresholds\"\n ],\n \"properties\": {\n \"policyVersion\": {\n \"propertyOrder\": 1007,\n \"title\": \"TCA Policy Scope Version\",\n \"type\": \"string\"\n },\n \"thresholds\": {\n \"propertyOrder\": 1008,\n \"uniqueItems\": \"true\",\n \"format\": \"tabs-top\",\n \"title\": \"Thresholds associated with eventName\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"closedLoopControlName\",\n \"closedLoopEventStatus\",\n \"direction\",\n \"fieldPath\",\n \"severity\",\n \"thresholdValue\",\n \"version\"\n ],\n \"properties\": {\n \"severity\": {\n \"propertyOrder\": 1013,\n \"title\": \"Threshold Event Severity\",\n \"type\": \"string\",\n \"enum\": [\n \"CRITICAL\",\n \"MAJOR\",\n \"MINOR\",\n \"WARNING\",\n \"NORMAL\"\n ]\n },\n \"fieldPath\": {\n \"propertyOrder\": 1012,\n \"title\": \"Json field Path as per CEF message which needs to be analyzed for TCA\",\n \"type\": \"string\",\n \"enum\": [\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 ]\n },\n \"thresholdValue\": {\n \"propertyOrder\": 1014,\n \"title\": \"Threshold value for the field Path inside CEF message\",\n \"type\": \"integer\"\n },\n \"closedLoopEventStatus\": {\n \"propertyOrder\": 1010,\n \"title\": \"Closed Loop Event Status of the threshold\",\n \"type\": \"string\",\n \"enum\": [\n \"ONSET\",\n \"ABATED\"\n ]\n },\n \"closedLoopControlName\": {\n \"propertyOrder\": 1009,\n \"title\": \"Closed Loop Control Name associated with the threshold\",\n \"type\": \"string\"\n },\n \"version\": {\n \"propertyOrder\": 1015,\n \"title\": \"Version number associated with the threshold\",\n \"type\": \"string\"\n },\n \"direction\": {\n \"propertyOrder\": 1011,\n \"title\": \"Direction of the threshold\",\n \"type\": \"string\",\n \"enum\": [\n \"LESS\",\n \"LESS_OR_EQUAL\",\n \"GREATER\",\n \"GREATER_OR_EQUAL\",\n \"EQUAL\"\n ]\n }\n }\n }\n },\n \"policyName\": {\n \"propertyOrder\": 1005,\n \"title\": \"TCA Policy Scope Name\",\n \"type\": \"string\"\n },\n \"controlLoopSchemaType\": {\n \"propertyOrder\": 1003,\n \"title\": \"Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\",\n \"type\": \"string\",\n \"enum\": [\n \"VM\",\n \"VNF\"\n ]\n },\n \"policyScope\": {\n \"propertyOrder\": 1006,\n \"title\": \"TCA Policy Scope\",\n \"type\": \"string\"\n },\n \"eventName\": {\n \"propertyOrder\": 1004,\n \"title\": \"Event name to which thresholds need to be applied\",\n \"type\": \"string\"\n }\n }\n }\n }\n }\n }\n }\n}',NULL,NULL,NULL,NULL,NULL,'onap.policies.monitoring.cdap.tca.hi.lo.app','tosca_definitions_version: tosca_simple_yaml_1_0_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that governs monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: map\n description: TCA Policy JSON\n entry_schema:\n type: onap.datatypes.monitoring.tca_policy\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n','\0',NULL); /*!40000 ALTER TABLE `micro_service_policies` ENABLE KEYS */; UNLOCK TABLES; @@ -135,9 +134,6 @@ UNLOCK TABLES; LOCK TABLES `operational_policies` WRITE; /*!40000 ALTER TABLE `operational_policies` DISABLE KEYS */; -INSERT INTO `operational_policies` VALUES ('OPERATIONAL_Neavs_v1_0_ResourceInstanceName1_tca','','2020-01-23 09:42:15.434613','','2020-01-23 09:42:15.434613','{\n \"operational_policy\": {\n \"controlLoop\": {\n \"controlLoopName\": \"LOOP_Neavs_v1_0_ResourceInstanceName1_tca\"\n }\n }\n}','{\n \"schema\": {\n \"uniqueItems\": \"true\",\n \"format\": \"tabs\",\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 1,\n \"title\": \"Operational policies\",\n \"items\": {\n \"type\": \"object\",\n \"title\": \"Operational Policy Item\",\n \"id\": \"operational_policy_item\",\n \"headerTemplate\": \"{{self.name}}\",\n \"required\": [\n \"name\",\n \"configurationsJson\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"title\": \"Operational policy name\",\n \"readOnly\": \"True\"\n },\n \"configurationsJson\": {\n \"type\": \"object\",\n \"title\": \"Configuration\",\n \"required\": [\n \"operational_policy\",\n \"guard_policies\"\n ],\n \"properties\": {\n \"operational_policy\": {\n \"type\": \"object\",\n \"title\": \"Related Parameters\",\n \"required\": [\n \"controlLoop\",\n \"policies\"\n ],\n \"properties\": {\n \"controlLoop\": {\n \"type\": \"object\",\n \"title\": \"Control Loop details\",\n \"required\": [\n \"timeout\",\n \"abatement\",\n \"trigger_policy\",\n \"controlLoopName\"\n ],\n \"properties\": {\n \"timeout\": {\n \"type\": \"string\",\n \"title\": \"Overall Time Limit\",\n \"default\": \"0\",\n \"format\": \"number\"\n },\n \"abatement\": {\n \"type\": \"string\",\n \"title\": \"Abatement\",\n \"enum\": [\n \"True\",\n \"False\"\n ]\n },\n \"trigger_policy\": {\n \"type\": \"string\",\n \"title\": \"Policy Decision Entry\"\n },\n \"controlLoopName\": {\n \"type\": \"string\",\n \"title\": \"Control loop name\",\n \"readOnly\": \"True\"\n }\n }\n },\n \"policies\": {\n \"uniqueItems\": \"true\",\n \"id\": \"policies_array\",\n \"type\": \"array\",\n \"title\": \"Policy Decision Tree\",\n \"format\": \"tabs-top\",\n \"items\": {\n \"title\": \"Policy Decision\",\n \"type\": \"object\",\n \"id\": \"policy_item\",\n \"headerTemplate\": \"{{self.id}} - {{self.recipe}}\",\n \"format\": \"categories\",\n \"basicCategoryTitle\": \"recipe\",\n \"required\": [\n \"id\",\n \"recipe\",\n \"retry\",\n \"timeout\",\n \"actor\",\n \"success\",\n \"failure\",\n \"failure_timeout\",\n \"failure_retries\",\n \"failure_exception\",\n \"failure_guard\",\n \"target\"\n ],\n \"properties\": {\n \"id\": {\n \"default\": \"Policy 1\",\n \"title\": \"Policy ID\",\n \"type\": \"string\"\n },\n \"recipe\": {\n \"title\": \"Recipe\",\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"retry\": {\n \"default\": \"0\",\n \"title\": \"Number of Retry\",\n \"type\": \"string\",\n \"format\": \"number\"\n },\n \"timeout\": {\n \"default\": \"0\",\n \"title\": \"Timeout\",\n \"type\": \"string\",\n \"format\": \"number\"\n },\n \"actor\": {\n \"title\": \"Actor\",\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"payload\": {\n \"title\": \"Payload (YAML)\",\n \"type\": \"string\",\n \"format\": \"textarea\"\n },\n \"success\": {\n \"default\": \"final_success\",\n \"title\": \"When Success\",\n \"type\": \"string\"\n },\n \"failure\": {\n \"default\": \"final_failure\",\n \"title\": \"When Failure\",\n \"type\": \"string\"\n },\n \"failure_timeout\": {\n \"default\": \"final_failure_timeout\",\n \"title\": \"When Failure Timeout\",\n \"type\": \"string\"\n },\n \"failure_retries\": {\n \"default\": \"final_failure_retries\",\n \"title\": \"When Failure Retries\",\n \"type\": \"string\"\n },\n \"failure_exception\": {\n \"default\": \"final_failure_exception\",\n \"title\": \"When Failure Exception\",\n \"type\": \"string\"\n },\n \"failure_guard\": {\n \"default\": \"final_failure_guard\",\n \"title\": \"When Failure Guard\",\n \"type\": \"string\"\n },\n \"target\": {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \"resourceID\"\n ],\n \"anyOf\": [\n {\n \"title\": \"User Defined\",\n \"additionalProperties\": \"True\",\n \"properties\": {\n \"type\": {\n \"title\": \"Target type\",\n \"type\": \"string\",\n \"default\": \"\",\n \"enum\": [\n \"VNF\",\n \"VFMODULE\",\n \"VM\"\n ]\n },\n \"resourceID\": {\n \"title\": \"Target type\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n }\n },\n {\n \"title\": \"VNF-vLoadBalancerMS 0\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VNF\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"vLoadBalancerMS\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vpkg..module-1\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vpkg..module-1\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"ca052563-eb92-4b5b-ad41-9111768ce043\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"1e725ccc-b823-4f67-82b9-4f4367070dbc\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vpkg..module-1\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"1bffdc31-a37d-4dee-b65c-dde623a76e52\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vdns..module-3\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vdns..module-3\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"4c10ba9b-f88f-415e-9de3-5d33336047fa\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"4fa73b49-8a6c-493e-816b-eb401567b720\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vdns..module-3\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"bafcdab0-801d-4d81-9ead-f464640a38b1\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..base_template..module-0\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..base_template..module-0\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"921f7c96-ebdd-42e6-81b9-1cfc0c9796f3\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"63734409-f745-4e4d-a38b-131638a0edce\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..base_template..module-0\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"86baddea-c730-4fb8-9410-cd2e17fd7f27\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vlb..module-2\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vlb..module-2\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"a772a1f4-0064-412c-833d-4749b15828dd\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"0f5c3f6a-650a-4303-abb6-fff3e573a07a\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vlb..module-2\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"96a78aad-4ffb-4ef0-9c4f-deb03bf1d806\",\n \"readOnly\": \"True\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n },\n \"guard_policies\": {\n \"type\": \"array\",\n \"format\": \"tabs-top\",\n \"title\": \"Associated Guard policies\",\n \"items\": {\n \"headerTemplate\": \"{{self.policy-id}} - {{self.content.recipe}}\",\n \"anyOf\": [\n {\n \"title\": \"Guard MinMax\",\n \"type\": \"object\",\n \"properties\": {\n \"policy-id\": {\n \"type\": \"string\",\n \"default\": \"guard.minmax.new\",\n \"pattern\": \"^(guard.minmax\\\\..*)$\"\n },\n \"content\": {\n \"properties\": {\n \"actor\": {\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"recipe\": {\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"targets\": {\n \"type\": \"string\",\n \"default\": \".*\"\n },\n \"clname\": {\n \"type\": \"string\",\n \"template\": \"{{loopName}}\",\n \"watch\": {\n \"loopName\": \"operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName\"\n }\n },\n \"guardActiveStart\": {\n \"type\": \"string\",\n \"default\": \"00:00:00Z\"\n },\n \"guardActiveEnd\": {\n \"type\": \"string\",\n \"default\": \"10:00:00Z\"\n },\n \"min\": {\n \"type\": \"string\",\n \"default\": \"0\"\n },\n \"max\": {\n \"type\": \"string\",\n \"default\": \"1\"\n }\n }\n }\n }\n },\n {\n \"title\": \"Guard Frequency\",\n \"type\": \"object\",\n \"properties\": {\n \"policy-id\": {\n \"type\": \"string\",\n \"default\": \"guard.frequency.new\",\n \"pattern\": \"^(guard.frequency\\\\..*)$\"\n },\n \"content\": {\n \"properties\": {\n \"actor\": {\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"recipe\": {\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"targets\": {\n \"type\": \"string\",\n \"default\": \".*\"\n },\n \"clname\": {\n \"type\": \"string\",\n \"template\": \"{{loopName}}\",\n \"watch\": {\n \"loopName\": \"operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName\"\n }\n },\n \"guardActiveStart\": {\n \"type\": \"string\",\n \"default\": \"00:00:00Z\"\n },\n \"guardActiveEnd\": {\n \"type\": \"string\",\n \"default\": \"10:00:00Z\"\n },\n \"limit\": {\n \"type\": \"string\"\n },\n \"timeWindow\": {\n \"type\": \"string\"\n },\n \"timeUnits\": {\n \"type\": \"string\",\n \"enum\": [\n \"minute\",\n \"hour\",\n \"day\",\n \"week\",\n \"month\",\n \"year\"\n ]\n }\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n }\n }\n}',NULL,NULL,'LOOP_Neavs_v1_0_ResourceInstanceName1_tca',NULL,NULL); -INSERT INTO `operational_policies` VALUES ('OPERATIONAL_Neavs_v1_0_ResourceInstanceName1_tca_3','','2020-01-23 09:42:15.308546','','2020-01-23 09:42:15.308546','{\n \"operational_policy\": {\n \"controlLoop\": {\n \"controlLoopName\": \"LOOP_Neavs_v1_0_ResourceInstanceName1_tca_3\"\n }\n }\n}','{\n \"schema\": {\n \"uniqueItems\": \"true\",\n \"format\": \"tabs\",\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 1,\n \"title\": \"Operational policies\",\n \"items\": {\n \"type\": \"object\",\n \"title\": \"Operational Policy Item\",\n \"id\": \"operational_policy_item\",\n \"headerTemplate\": \"{{self.name}}\",\n \"required\": [\n \"name\",\n \"configurationsJson\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"title\": \"Operational policy name\",\n \"readOnly\": \"True\"\n },\n \"configurationsJson\": {\n \"type\": \"object\",\n \"title\": \"Configuration\",\n \"required\": [\n \"operational_policy\",\n \"guard_policies\"\n ],\n \"properties\": {\n \"operational_policy\": {\n \"type\": \"object\",\n \"title\": \"Related Parameters\",\n \"required\": [\n \"controlLoop\",\n \"policies\"\n ],\n \"properties\": {\n \"controlLoop\": {\n \"type\": \"object\",\n \"title\": \"Control Loop details\",\n \"required\": [\n \"timeout\",\n \"abatement\",\n \"trigger_policy\",\n \"controlLoopName\"\n ],\n \"properties\": {\n \"timeout\": {\n \"type\": \"string\",\n \"title\": \"Overall Time Limit\",\n \"default\": \"0\",\n \"format\": \"number\"\n },\n \"abatement\": {\n \"type\": \"string\",\n \"title\": \"Abatement\",\n \"enum\": [\n \"True\",\n \"False\"\n ]\n },\n \"trigger_policy\": {\n \"type\": \"string\",\n \"title\": \"Policy Decision Entry\"\n },\n \"controlLoopName\": {\n \"type\": \"string\",\n \"title\": \"Control loop name\",\n \"readOnly\": \"True\"\n }\n }\n },\n \"policies\": {\n \"uniqueItems\": \"true\",\n \"id\": \"policies_array\",\n \"type\": \"array\",\n \"title\": \"Policy Decision Tree\",\n \"format\": \"tabs-top\",\n \"items\": {\n \"title\": \"Policy Decision\",\n \"type\": \"object\",\n \"id\": \"policy_item\",\n \"headerTemplate\": \"{{self.id}} - {{self.recipe}}\",\n \"format\": \"categories\",\n \"basicCategoryTitle\": \"recipe\",\n \"required\": [\n \"id\",\n \"recipe\",\n \"retry\",\n \"timeout\",\n \"actor\",\n \"success\",\n \"failure\",\n \"failure_timeout\",\n \"failure_retries\",\n \"failure_exception\",\n \"failure_guard\",\n \"target\"\n ],\n \"properties\": {\n \"id\": {\n \"default\": \"Policy 1\",\n \"title\": \"Policy ID\",\n \"type\": \"string\"\n },\n \"recipe\": {\n \"title\": \"Recipe\",\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"retry\": {\n \"default\": \"0\",\n \"title\": \"Number of Retry\",\n \"type\": \"string\",\n \"format\": \"number\"\n },\n \"timeout\": {\n \"default\": \"0\",\n \"title\": \"Timeout\",\n \"type\": \"string\",\n \"format\": \"number\"\n },\n \"actor\": {\n \"title\": \"Actor\",\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"payload\": {\n \"title\": \"Payload (YAML)\",\n \"type\": \"string\",\n \"format\": \"textarea\"\n },\n \"success\": {\n \"default\": \"final_success\",\n \"title\": \"When Success\",\n \"type\": \"string\"\n },\n \"failure\": {\n \"default\": \"final_failure\",\n \"title\": \"When Failure\",\n \"type\": \"string\"\n },\n \"failure_timeout\": {\n \"default\": \"final_failure_timeout\",\n \"title\": \"When Failure Timeout\",\n \"type\": \"string\"\n },\n \"failure_retries\": {\n \"default\": \"final_failure_retries\",\n \"title\": \"When Failure Retries\",\n \"type\": \"string\"\n },\n \"failure_exception\": {\n \"default\": \"final_failure_exception\",\n \"title\": \"When Failure Exception\",\n \"type\": \"string\"\n },\n \"failure_guard\": {\n \"default\": \"final_failure_guard\",\n \"title\": \"When Failure Guard\",\n \"type\": \"string\"\n },\n \"target\": {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \"resourceID\"\n ],\n \"anyOf\": [\n {\n \"title\": \"User Defined\",\n \"additionalProperties\": \"True\",\n \"properties\": {\n \"type\": {\n \"title\": \"Target type\",\n \"type\": \"string\",\n \"default\": \"\",\n \"enum\": [\n \"VNF\",\n \"VFMODULE\",\n \"VM\"\n ]\n },\n \"resourceID\": {\n \"title\": \"Target type\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n }\n },\n {\n \"title\": \"VNF-vLoadBalancerMS 0\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VNF\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"vLoadBalancerMS\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vpkg..module-1\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vpkg..module-1\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"ca052563-eb92-4b5b-ad41-9111768ce043\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"1e725ccc-b823-4f67-82b9-4f4367070dbc\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vpkg..module-1\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"1bffdc31-a37d-4dee-b65c-dde623a76e52\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vdns..module-3\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vdns..module-3\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"4c10ba9b-f88f-415e-9de3-5d33336047fa\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"4fa73b49-8a6c-493e-816b-eb401567b720\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vdns..module-3\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"bafcdab0-801d-4d81-9ead-f464640a38b1\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..base_template..module-0\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..base_template..module-0\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"921f7c96-ebdd-42e6-81b9-1cfc0c9796f3\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"63734409-f745-4e4d-a38b-131638a0edce\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..base_template..module-0\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"86baddea-c730-4fb8-9410-cd2e17fd7f27\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vlb..module-2\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vlb..module-2\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"a772a1f4-0064-412c-833d-4749b15828dd\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"0f5c3f6a-650a-4303-abb6-fff3e573a07a\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vlb..module-2\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"96a78aad-4ffb-4ef0-9c4f-deb03bf1d806\",\n \"readOnly\": \"True\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n },\n \"guard_policies\": {\n \"type\": \"array\",\n \"format\": \"tabs-top\",\n \"title\": \"Associated Guard policies\",\n \"items\": {\n \"headerTemplate\": \"{{self.policy-id}} - {{self.content.recipe}}\",\n \"anyOf\": [\n {\n \"title\": \"Guard MinMax\",\n \"type\": \"object\",\n \"properties\": {\n \"policy-id\": {\n \"type\": \"string\",\n \"default\": \"guard.minmax.new\",\n \"pattern\": \"^(guard.minmax\\\\..*)$\"\n },\n \"content\": {\n \"properties\": {\n \"actor\": {\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"recipe\": {\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"targets\": {\n \"type\": \"string\",\n \"default\": \".*\"\n },\n \"clname\": {\n \"type\": \"string\",\n \"template\": \"{{loopName}}\",\n \"watch\": {\n \"loopName\": \"operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName\"\n }\n },\n \"guardActiveStart\": {\n \"type\": \"string\",\n \"default\": \"00:00:00Z\"\n },\n \"guardActiveEnd\": {\n \"type\": \"string\",\n \"default\": \"10:00:00Z\"\n },\n \"min\": {\n \"type\": \"string\",\n \"default\": \"0\"\n },\n \"max\": {\n \"type\": \"string\",\n \"default\": \"1\"\n }\n }\n }\n }\n },\n {\n \"title\": \"Guard Frequency\",\n \"type\": \"object\",\n \"properties\": {\n \"policy-id\": {\n \"type\": \"string\",\n \"default\": \"guard.frequency.new\",\n \"pattern\": \"^(guard.frequency\\\\..*)$\"\n },\n \"content\": {\n \"properties\": {\n \"actor\": {\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"recipe\": {\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"targets\": {\n \"type\": \"string\",\n \"default\": \".*\"\n },\n \"clname\": {\n \"type\": \"string\",\n \"template\": \"{{loopName}}\",\n \"watch\": {\n \"loopName\": \"operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName\"\n }\n },\n \"guardActiveStart\": {\n \"type\": \"string\",\n \"default\": \"00:00:00Z\"\n },\n \"guardActiveEnd\": {\n \"type\": \"string\",\n \"default\": \"10:00:00Z\"\n },\n \"limit\": {\n \"type\": \"string\"\n },\n \"timeWindow\": {\n \"type\": \"string\"\n },\n \"timeUnits\": {\n \"type\": \"string\",\n \"enum\": [\n \"minute\",\n \"hour\",\n \"day\",\n \"week\",\n \"month\",\n \"year\"\n ]\n }\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n }\n }\n}',NULL,NULL,'LOOP_Neavs_v1_0_ResourceInstanceName1_tca_3',NULL,NULL); -INSERT INTO `operational_policies` VALUES ('OPERATIONAL_Neavs_v1_0_ResourceInstanceName2_tca_2','','2020-01-23 09:42:15.187766','','2020-01-23 09:42:15.187766','{\n \"operational_policy\": {\n \"controlLoop\": {\n \"controlLoopName\": \"LOOP_Neavs_v1_0_ResourceInstanceName2_tca_2\"\n }\n }\n}','{\n \"schema\": {\n \"uniqueItems\": \"true\",\n \"format\": \"tabs\",\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 1,\n \"title\": \"Operational policies\",\n \"items\": {\n \"type\": \"object\",\n \"title\": \"Operational Policy Item\",\n \"id\": \"operational_policy_item\",\n \"headerTemplate\": \"{{self.name}}\",\n \"required\": [\n \"name\",\n \"configurationsJson\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"title\": \"Operational policy name\",\n \"readOnly\": \"True\"\n },\n \"configurationsJson\": {\n \"type\": \"object\",\n \"title\": \"Configuration\",\n \"required\": [\n \"operational_policy\",\n \"guard_policies\"\n ],\n \"properties\": {\n \"operational_policy\": {\n \"type\": \"object\",\n \"title\": \"Related Parameters\",\n \"required\": [\n \"controlLoop\",\n \"policies\"\n ],\n \"properties\": {\n \"controlLoop\": {\n \"type\": \"object\",\n \"title\": \"Control Loop details\",\n \"required\": [\n \"timeout\",\n \"abatement\",\n \"trigger_policy\",\n \"controlLoopName\"\n ],\n \"properties\": {\n \"timeout\": {\n \"type\": \"string\",\n \"title\": \"Overall Time Limit\",\n \"default\": \"0\",\n \"format\": \"number\"\n },\n \"abatement\": {\n \"type\": \"string\",\n \"title\": \"Abatement\",\n \"enum\": [\n \"True\",\n \"False\"\n ]\n },\n \"trigger_policy\": {\n \"type\": \"string\",\n \"title\": \"Policy Decision Entry\"\n },\n \"controlLoopName\": {\n \"type\": \"string\",\n \"title\": \"Control loop name\",\n \"readOnly\": \"True\"\n }\n }\n },\n \"policies\": {\n \"uniqueItems\": \"true\",\n \"id\": \"policies_array\",\n \"type\": \"array\",\n \"title\": \"Policy Decision Tree\",\n \"format\": \"tabs-top\",\n \"items\": {\n \"title\": \"Policy Decision\",\n \"type\": \"object\",\n \"id\": \"policy_item\",\n \"headerTemplate\": \"{{self.id}} - {{self.recipe}}\",\n \"format\": \"categories\",\n \"basicCategoryTitle\": \"recipe\",\n \"required\": [\n \"id\",\n \"recipe\",\n \"retry\",\n \"timeout\",\n \"actor\",\n \"success\",\n \"failure\",\n \"failure_timeout\",\n \"failure_retries\",\n \"failure_exception\",\n \"failure_guard\",\n \"target\"\n ],\n \"properties\": {\n \"id\": {\n \"default\": \"Policy 1\",\n \"title\": \"Policy ID\",\n \"type\": \"string\"\n },\n \"recipe\": {\n \"title\": \"Recipe\",\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"retry\": {\n \"default\": \"0\",\n \"title\": \"Number of Retry\",\n \"type\": \"string\",\n \"format\": \"number\"\n },\n \"timeout\": {\n \"default\": \"0\",\n \"title\": \"Timeout\",\n \"type\": \"string\",\n \"format\": \"number\"\n },\n \"actor\": {\n \"title\": \"Actor\",\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"payload\": {\n \"title\": \"Payload (YAML)\",\n \"type\": \"string\",\n \"format\": \"textarea\"\n },\n \"success\": {\n \"default\": \"final_success\",\n \"title\": \"When Success\",\n \"type\": \"string\"\n },\n \"failure\": {\n \"default\": \"final_failure\",\n \"title\": \"When Failure\",\n \"type\": \"string\"\n },\n \"failure_timeout\": {\n \"default\": \"final_failure_timeout\",\n \"title\": \"When Failure Timeout\",\n \"type\": \"string\"\n },\n \"failure_retries\": {\n \"default\": \"final_failure_retries\",\n \"title\": \"When Failure Retries\",\n \"type\": \"string\"\n },\n \"failure_exception\": {\n \"default\": \"final_failure_exception\",\n \"title\": \"When Failure Exception\",\n \"type\": \"string\"\n },\n \"failure_guard\": {\n \"default\": \"final_failure_guard\",\n \"title\": \"When Failure Guard\",\n \"type\": \"string\"\n },\n \"target\": {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n \"resourceID\"\n ],\n \"anyOf\": [\n {\n \"title\": \"User Defined\",\n \"additionalProperties\": \"True\",\n \"properties\": {\n \"type\": {\n \"title\": \"Target type\",\n \"type\": \"string\",\n \"default\": \"\",\n \"enum\": [\n \"VNF\",\n \"VFMODULE\",\n \"VM\"\n ]\n },\n \"resourceID\": {\n \"title\": \"Target type\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n }\n },\n {\n \"title\": \"VNF-vLoadBalancerMS 0\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VNF\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"vLoadBalancerMS\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vpkg..module-1\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vpkg..module-1\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"ca052563-eb92-4b5b-ad41-9111768ce043\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"1e725ccc-b823-4f67-82b9-4f4367070dbc\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vpkg..module-1\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"1bffdc31-a37d-4dee-b65c-dde623a76e52\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vdns..module-3\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vdns..module-3\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"4c10ba9b-f88f-415e-9de3-5d33336047fa\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"4fa73b49-8a6c-493e-816b-eb401567b720\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vdns..module-3\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"bafcdab0-801d-4d81-9ead-f464640a38b1\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..base_template..module-0\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..base_template..module-0\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"921f7c96-ebdd-42e6-81b9-1cfc0c9796f3\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"63734409-f745-4e4d-a38b-131638a0edce\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..base_template..module-0\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"86baddea-c730-4fb8-9410-cd2e17fd7f27\",\n \"readOnly\": \"True\"\n }\n }\n },\n {\n \"title\": \"VFMODULE-Vloadbalancerms..vlb..module-2\",\n \"properties\": {\n \"type\": {\n \"title\": \"Type\",\n \"type\": \"string\",\n \"default\": \"VFMODULE\",\n \"readOnly\": \"True\"\n },\n \"resourceID\": {\n \"title\": \"Resource ID\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vlb..module-2\",\n \"readOnly\": \"True\"\n },\n \"modelInvariantId\": {\n \"title\": \"Model Invariant Id (ModelInvariantUUID)\",\n \"type\": \"string\",\n \"default\": \"a772a1f4-0064-412c-833d-4749b15828dd\",\n \"readOnly\": \"True\"\n },\n \"modelVersionId\": {\n \"title\": \"Model Version Id (ModelUUID)\",\n \"type\": \"string\",\n \"default\": \"0f5c3f6a-650a-4303-abb6-fff3e573a07a\",\n \"readOnly\": \"True\"\n },\n \"modelName\": {\n \"title\": \"Model Name\",\n \"type\": \"string\",\n \"default\": \"Vloadbalancerms..vlb..module-2\",\n \"readOnly\": \"True\"\n },\n \"modelVersion\": {\n \"title\": \"Model Version\",\n \"type\": \"string\",\n \"default\": \"1\",\n \"readOnly\": \"True\"\n },\n \"modelCustomizationId\": {\n \"title\": \"Customization ID\",\n \"type\": \"string\",\n \"default\": \"96a78aad-4ffb-4ef0-9c4f-deb03bf1d806\",\n \"readOnly\": \"True\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n },\n \"guard_policies\": {\n \"type\": \"array\",\n \"format\": \"tabs-top\",\n \"title\": \"Associated Guard policies\",\n \"items\": {\n \"headerTemplate\": \"{{self.policy-id}} - {{self.content.recipe}}\",\n \"anyOf\": [\n {\n \"title\": \"Guard MinMax\",\n \"type\": \"object\",\n \"properties\": {\n \"policy-id\": {\n \"type\": \"string\",\n \"default\": \"guard.minmax.new\",\n \"pattern\": \"^(guard.minmax\\\\..*)$\"\n },\n \"content\": {\n \"properties\": {\n \"actor\": {\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"recipe\": {\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"targets\": {\n \"type\": \"string\",\n \"default\": \".*\"\n },\n \"clname\": {\n \"type\": \"string\",\n \"template\": \"{{loopName}}\",\n \"watch\": {\n \"loopName\": \"operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName\"\n }\n },\n \"guardActiveStart\": {\n \"type\": \"string\",\n \"default\": \"00:00:00Z\"\n },\n \"guardActiveEnd\": {\n \"type\": \"string\",\n \"default\": \"10:00:00Z\"\n },\n \"min\": {\n \"type\": \"string\",\n \"default\": \"0\"\n },\n \"max\": {\n \"type\": \"string\",\n \"default\": \"1\"\n }\n }\n }\n }\n },\n {\n \"title\": \"Guard Frequency\",\n \"type\": \"object\",\n \"properties\": {\n \"policy-id\": {\n \"type\": \"string\",\n \"default\": \"guard.frequency.new\",\n \"pattern\": \"^(guard.frequency\\\\..*)$\"\n },\n \"content\": {\n \"properties\": {\n \"actor\": {\n \"type\": \"string\",\n \"enum\": [\n \"APPC\",\n \"SO\",\n \"VFC\",\n \"SDNC\",\n \"SDNR\"\n ]\n },\n \"recipe\": {\n \"type\": \"string\",\n \"enum\": [\n \"Restart\",\n \"Rebuild\",\n \"Migrate\",\n \"Health-Check\",\n \"ModifyConfig\",\n \"VF Module Create\",\n \"VF Module Delete\",\n \"Reroute\"\n ]\n },\n \"targets\": {\n \"type\": \"string\",\n \"default\": \".*\"\n },\n \"clname\": {\n \"type\": \"string\",\n \"template\": \"{{loopName}}\",\n \"watch\": {\n \"loopName\": \"operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName\"\n }\n },\n \"guardActiveStart\": {\n \"type\": \"string\",\n \"default\": \"00:00:00Z\"\n },\n \"guardActiveEnd\": {\n \"type\": \"string\",\n \"default\": \"10:00:00Z\"\n },\n \"limit\": {\n \"type\": \"string\"\n },\n \"timeWindow\": {\n \"type\": \"string\"\n },\n \"timeUnits\": {\n \"type\": \"string\",\n \"enum\": [\n \"minute\",\n \"hour\",\n \"day\",\n \"week\",\n \"month\",\n \"year\"\n ]\n }\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n }\n }\n}',NULL,NULL,'LOOP_Neavs_v1_0_ResourceInstanceName2_tca_2',NULL,NULL); /*!40000 ALTER TABLE `operational_policies` ENABLE KEYS */; UNLOCK TABLES; @@ -147,6 +143,7 @@ UNLOCK TABLES; LOCK TABLES `policy_models` WRITE; /*!40000 ALTER TABLE `policy_models` DISABLE KEYS */; +INSERT INTO `policy_models` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','1.0',NULL,'2020-01-28 15:54:29.936770','','2020-01-28 15:54:30.238732','app','tosca_definitions_version: tosca_simple_yaml_1_0_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that governs monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: map\n description: TCA Policy JSON\n entry_schema:\n type: onap.datatypes.monitoring.tca_policy\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n'); /*!40000 ALTER TABLE `policy_models` ENABLE KEYS */; UNLOCK TABLES; @@ -168,4 +165,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-01-23 8:43:45 +-- Dump completed on 2020-01-28 14:55:53 diff --git a/src/main/java/org/onap/clamp/loop/CsarInstaller.java b/src/main/java/org/onap/clamp/loop/CsarInstaller.java index ab8069f37..013d3419d 100644 --- a/src/main/java/org/onap/clamp/loop/CsarInstaller.java +++ b/src/main/java/org/onap/clamp/loop/CsarInstaller.java @@ -25,10 +25,8 @@ package org.onap.clamp.loop; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.google.gson.JsonObject; import java.io.IOException; -import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; @@ -43,12 +41,12 @@ import org.onap.clamp.clds.sdc.controller.installer.ChainGenerator; import org.onap.clamp.clds.sdc.controller.installer.CsarHandler; import org.onap.clamp.clds.sdc.controller.installer.MicroService; import org.onap.clamp.clds.util.drawing.SvgFacade; -import org.onap.clamp.loop.deploy.DcaeDeployParameters; import org.onap.clamp.loop.service.CsarServiceInstaller; import org.onap.clamp.loop.service.Service; -import org.onap.clamp.policy.Policy; -import org.onap.clamp.policy.microservice.MicroServicePolicy; -import org.onap.clamp.policy.operational.OperationalPolicy; +import org.onap.clamp.loop.template.LoopElementModel; +import org.onap.clamp.loop.template.LoopTemplate; +import org.onap.clamp.loop.template.LoopTemplatesRepository; +import org.onap.clamp.loop.template.PolicyModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @@ -71,6 +69,9 @@ public class CsarInstaller { @Autowired LoopsRepository loopRepository; + @Autowired + LoopTemplatesRepository loopTemplatesRepository; + @Autowired BlueprintParser blueprintParser; @@ -98,8 +99,8 @@ public class CsarInstaller { for (Entry blueprint : csar.getMapOfBlueprints().entrySet()) { alreadyInstalled = alreadyInstalled - && loopRepository.existsById(Loop.generateLoopName(csar.getSdcNotification().getServiceName(), - csar.getSdcNotification().getServiceVersion(), + && loopTemplatesRepository.existsById(LoopTemplate.generateLoopTemplateName( + csar.getSdcNotification().getServiceName(), csar.getSdcNotification().getServiceVersion(), blueprint.getValue().getResourceAttached().getResourceInstanceName(), blueprint.getValue().getBlueprintArtifactName())); } @@ -107,7 +108,7 @@ public class CsarInstaller { } /** - * Install the service and loops from the csar. + * Install the service and loop templates from the csar. * * @param csar The Csar Handler * @throws SdcArtifactInstallerException The SdcArtifactInstallerException @@ -115,25 +116,25 @@ public class CsarInstaller { */ public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException, InterruptedException { logger.info("Installing the CSAR " + csar.getFilePath()); - installTheLoop(csar, csarServiceInstaller.installTheService(csar)); + installTheLoopTemplates(csar, csarServiceInstaller.installTheService(csar)); logger.info("Successfully installed the CSAR " + csar.getFilePath()); } /** - * Install the Loop from the csar. + * Install the loop templates from the csar. * * @param csar The Csar Handler * @param service The service object that is related to the loop * @throws SdcArtifactInstallerException The SdcArtifactInstallerException * @throws InterruptedException The InterruptedException */ - public void installTheLoop(CsarHandler csar, Service service) + public void installTheLoopTemplates(CsarHandler csar, Service service) throws SdcArtifactInstallerException, InterruptedException { try { logger.info("Installing the Loops"); for (Entry blueprint : csar.getMapOfBlueprints().entrySet()) { logger.info("Processing blueprint " + blueprint.getValue().getBlueprintArtifactName()); - loopRepository.save(createLoopFromBlueprint(csar, blueprint.getValue(), service)); + loopTemplatesRepository.save(createLoopTemplateFromBlueprint(csar, blueprint.getValue(), service)); } logger.info("Successfully installed the Loops "); } catch (IOException e) { @@ -143,63 +144,48 @@ public class CsarInstaller { } } - private Loop createLoopFromBlueprint(CsarHandler csar, BlueprintArtifact blueprintArtifact, Service service) - throws IOException, ParseException, InterruptedException { - Loop newLoop = new Loop(); - newLoop.setBlueprint(blueprintArtifact.getDcaeBlueprint()); - newLoop.setName(Loop.generateLoopName(csar.getSdcNotification().getServiceName(), + private LoopTemplate createLoopTemplateFromBlueprint(CsarHandler csar, BlueprintArtifact blueprintArtifact, + Service service) throws IOException, ParseException, InterruptedException { + LoopTemplate newLoopTemplate = new LoopTemplate(); + newLoopTemplate.setBlueprint(blueprintArtifact.getDcaeBlueprint()); + newLoopTemplate.setName(LoopTemplate.generateLoopTemplateName(csar.getSdcNotification().getServiceName(), csar.getSdcNotification().getServiceVersion(), blueprintArtifact.getResourceAttached().getResourceInstanceName(), blueprintArtifact.getBlueprintArtifactName())); - newLoop.setLastComputedState(LoopState.DESIGN); - List microServicesChain = chainGenerator .getChainOfMicroServices(blueprintParser.getMicroServices(blueprintArtifact.getDcaeBlueprint())); if (microServicesChain.isEmpty()) { microServicesChain = blueprintParser.fallbackToOneMicroService(blueprintArtifact.getDcaeBlueprint()); } - newLoop.setModelService(service); - newLoop.setMicroServicePolicies( - createMicroServicePolicies(microServicesChain, csar, blueprintArtifact, newLoop)); - newLoop.setOperationalPolicies(createOperationalPolicies(csar, blueprintArtifact, newLoop)); - - newLoop.setSvgRepresentation(svgFacade.getSvgImage(microServicesChain)); - newLoop.setGlobalPropertiesJson(createGlobalPropertiesJson(blueprintArtifact, newLoop)); - + newLoopTemplate.setModelService(service); + newLoopTemplate.addLoopElementModels(createMicroServiceModels(microServicesChain, csar, blueprintArtifact)); + newLoopTemplate.setMaximumInstancesAllowed(0); + newLoopTemplate.setSvgRepresentation(svgFacade.getSvgImage(microServicesChain)); DcaeInventoryResponse dcaeResponse = queryDcaeToGetServiceTypeId(blueprintArtifact); - newLoop.setDcaeBlueprintId(dcaeResponse.getTypeId()); - return newLoop; + newLoopTemplate.setDcaeBlueprintId(dcaeResponse.getTypeId()); + return newLoopTemplate; } - private HashSet createOperationalPolicies(CsarHandler csar, BlueprintArtifact blueprintArtifact, - Loop newLoop) { - return new HashSet<>(Arrays.asList(new OperationalPolicy(Policy.generatePolicyName("OPERATIONAL", - csar.getSdcNotification().getServiceName(), csar.getSdcNotification().getServiceVersion(), - blueprintArtifact.getResourceAttached().getResourceInstanceName(), - blueprintArtifact.getBlueprintArtifactName()), newLoop, new JsonObject()))); - } - - private HashSet createMicroServicePolicies(List microServicesChain, - CsarHandler csar, BlueprintArtifact blueprintArtifact, Loop newLoop) throws IOException { - HashSet newSet = new HashSet<>(); - + private HashSet createMicroServiceModels(List microServicesChain, CsarHandler csar, + BlueprintArtifact blueprintArtifact) throws IOException { + HashSet newSet = new HashSet<>(); for (MicroService microService : microServicesChain) { - MicroServicePolicy microServicePolicy = new MicroServicePolicy( - Policy.generatePolicyName(microService.getName(), csar.getSdcNotification().getServiceName(), - csar.getSdcNotification().getServiceVersion(), - blueprintArtifact.getResourceAttached().getResourceInstanceName(), - blueprintArtifact.getBlueprintArtifactName()), - microService.getModelType(), csar.getPolicyModelYaml().orElse(""), false, - new HashSet<>(Arrays.asList(newLoop))); - - newSet.add(microServicePolicy); - microService.setMappedNameJpa(microServicePolicy.getName()); + LoopElementModel loopElementModel = new LoopElementModel(microService.getModelType(), "CONFIG_POLICY", + blueprintArtifact.getDcaeBlueprint()); + newSet.add(loopElementModel); + loopElementModel.addPolicyModel(createPolicyModel(microService, csar)); } return newSet; } - private JsonObject createGlobalPropertiesJson(BlueprintArtifact blueprintArtifact, Loop newLoop) { - return DcaeDeployParameters.getDcaeDeploymentParametersInJson(blueprintArtifact, newLoop); + private static String createPolicyAcronym(String policyType) { + String[] policyNameArray = policyType.split("\\."); + return policyNameArray[policyNameArray.length - 1]; + } + + private PolicyModel createPolicyModel(MicroService microService, CsarHandler csar) throws IOException { + return new PolicyModel(microService.getModelType(), csar.getPolicyModelYaml().orElse(""), "1.0", + createPolicyAcronym(microService.getModelType())); } /** diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java index 6b9a924bf..66fd56579 100644 --- a/src/main/java/org/onap/clamp/loop/Loop.java +++ b/src/main/java/org/onap/clamp/loop/Loop.java @@ -109,9 +109,6 @@ public class Loop extends AuditEntity implements Serializable { @JoinColumn(name = "service_uuid") private Service modelService; - @Column(columnDefinition = "MEDIUMTEXT", nullable = false, name = "blueprint_yaml") - private String blueprint; - @Expose @Column(nullable = false, name = "last_computed_state") @Enumerated(EnumType.STRING) @@ -156,10 +153,9 @@ public class Loop extends AuditEntity implements Serializable { /** * Constructor. */ - public Loop(String name, String blueprint, String svgRepresentation) { + public Loop(String name, String svgRepresentation) { this.name = name; this.svgRepresentation = svgRepresentation; - this.blueprint = blueprint; this.lastComputedState = LoopState.DESIGN; this.globalPropertiesJson = new JsonObject(); initializeExternalComponents(); @@ -197,14 +193,6 @@ public class Loop extends AuditEntity implements Serializable { this.svgRepresentation = svgRepresentation; } - public String getBlueprint() { - return blueprint; - } - - void setBlueprint(String blueprint) { - this.blueprint = blueprint; - } - public LoopState getLastComputedState() { return lastComputedState; } @@ -305,7 +293,7 @@ public class Loop extends AuditEntity implements Serializable { * @param blueprintFileName The blueprint file name * @return The generated loop name */ - static String generateLoopName(String serviceName, String serviceVersion, String resourceName, + public static String generateLoopName(String serviceName, String serviceVersion, String resourceName, String blueprintFilename) { StringBuilder buffer = new StringBuilder("LOOP_").append(serviceName).append("_v").append(serviceVersion) .append("_").append(resourceName).append("_").append(blueprintFilename.replaceAll(".yaml", "")); diff --git a/src/main/java/org/onap/clamp/loop/deploy/DcaeDeployParameters.java b/src/main/java/org/onap/clamp/loop/deploy/DcaeDeployParameters.java index 1a75f71e6..48349e791 100644 --- a/src/main/java/org/onap/clamp/loop/deploy/DcaeDeployParameters.java +++ b/src/main/java/org/onap/clamp/loop/deploy/DcaeDeployParameters.java @@ -28,6 +28,7 @@ import com.google.gson.JsonObject; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; +import java.util.Set; import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact; import org.onap.clamp.clds.util.JsonUtils; @@ -38,21 +39,21 @@ import org.yaml.snakeyaml.Yaml; /** * To decode the bluprint input parameters. */ -public class DcaeDeployParameters { +public class DcaeDeployParameters { - private static LinkedHashMap init(LinkedHashSet blueprintArtifactList, - Loop loop) { - LinkedHashMap deploymentParamMap = new LinkedHashMap(); + private static LinkedHashMap init(Set blueprintArtifactList, Loop loop) { + LinkedHashMap deploymentParamMap = new LinkedHashMap<>(); String microServiceName = ((MicroServicePolicy) loop.getMicroServicePolicies().toArray()[0]).getName(); // Add index to the microservice name from the 2nd blueprint artifact for now. - // Update the microservice names, when able to link the microserivce <-> blueprint in the future + // Update the microservice names, when able to link the microserivce <-> + // blueprint in the future int index = 0; - for (BlueprintArtifact blueprintArtifact: blueprintArtifactList) { + for (BlueprintArtifact blueprintArtifact : blueprintArtifactList) { if (index > 0) { - deploymentParamMap.put(microServiceName + index, + deploymentParamMap.put(microServiceName + index, generateDcaeDeployParameter(blueprintArtifact, microServiceName)); } else { - deploymentParamMap.put(microServiceName, + deploymentParamMap.put(microServiceName, generateDcaeDeployParameter(blueprintArtifact, microServiceName)); } index++; @@ -65,7 +66,7 @@ public class DcaeDeployParameters { JsonObject deployJsonBody = new JsonObject(); Yaml yaml = new Yaml(); Map inputsNodes = ((Map) ((Map) yaml - .load(blueprintArtifact.getDcaeBlueprint())).get("inputs")); + .load(blueprintArtifact.getDcaeBlueprint())).get("inputs")); inputsNodes.entrySet().stream().filter(e -> !e.getKey().contains("policy_id")).forEach(elem -> { Object defaultValue = ((Map) elem.getValue()).get("default"); if (defaultValue != null) { @@ -98,13 +99,13 @@ public class DcaeDeployParameters { * * @return The deploymentParameters in Json */ - public static JsonObject getDcaeDeploymentParametersInJson(LinkedHashSet blueprintArtifactList, + public static JsonObject getDcaeDeploymentParametersInJson(Set blueprintArtifactList, Loop loop) { LinkedHashMap deploymentParamMap = init(blueprintArtifactList, loop); JsonObject globalProperties = new JsonObject(); JsonObject deployParamJson = new JsonObject(); - for (Map.Entry mapElement: deploymentParamMap.entrySet()) { + for (Map.Entry mapElement : deploymentParamMap.entrySet()) { deployParamJson.add(mapElement.getKey(), mapElement.getValue()); } globalProperties.add("dcaeDeployParameters", deployParamJson); @@ -117,7 +118,7 @@ public class DcaeDeployParameters { * @return The deploymentParameters in Json */ public static JsonObject getDcaeDeploymentParametersInJson(BlueprintArtifact blueprintArtifact, Loop loop) { - LinkedHashSet blueprintArtifactList = new LinkedHashSet(); + LinkedHashSet blueprintArtifactList = new LinkedHashSet<>(); blueprintArtifactList.add(blueprintArtifact); return getDcaeDeploymentParametersInJson(blueprintArtifactList, loop); } diff --git a/src/main/java/org/onap/clamp/loop/service/Service.java b/src/main/java/org/onap/clamp/loop/service/Service.java index 33b8e02da..89c0b2d42 100644 --- a/src/main/java/org/onap/clamp/loop/service/Service.java +++ b/src/main/java/org/onap/clamp/loop/service/Service.java @@ -119,6 +119,20 @@ public class Service implements Serializable { return (JsonObject) resourceDetails.get(type); } + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the version + */ + public String getVersion() { + return version; + } + @Override public int hashCode() { final int prime = 31; diff --git a/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java b/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java index 7f00c42ea..e3f05a01d 100644 --- a/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java +++ b/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java @@ -63,10 +63,14 @@ public class LoopElementModel extends AuditEntity implements Serializable { @Column(nullable = false, name = "name", unique = true) private String name; + @Expose + @Column(name = "dcae_blueprint_id") + private String dcaeBlueprintId; + /** * Here we store the blueprint coming from DCAE. */ - @Column(nullable = false, name = "blueprint_yaml") + @Column(columnDefinition = "MEDIUMTEXT", nullable = false, name = "blueprint_yaml") private String blueprint; /** @@ -149,6 +153,24 @@ public class LoopElementModel extends AuditEntity implements Serializable { /** * loopElementType getter. * + * dcaeBlueprintId getter. + * + * @return the dcaeBlueprintId + */ + public String getDcaeBlueprintId() { + return dcaeBlueprintId; + } + + /** + * dcaeBlueprintId setter. + * + * @param dcaeBlueprintId the dcaeBlueprintId to set + */ + public void setDcaeBlueprintId(String dcaeBlueprintId) { + this.dcaeBlueprintId = dcaeBlueprintId; + } + + /** * @return the loopElementType */ public String getLoopElementType() { diff --git a/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java b/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java index 7c059e19a..b8adebae9 100644 --- a/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java +++ b/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java @@ -26,6 +26,7 @@ package org.onap.clamp.loop.template; import com.google.gson.annotations.Expose; import java.io.Serializable; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -57,6 +58,10 @@ public class LoopTemplate extends AuditEntity implements Serializable { @Column(nullable = false, name = "name", unique = true) private String name; + @Expose + @Column(name = "dcae_blueprint_id") + private String dcaeBlueprintId; + /** * This field is used when we have a blueprint defining all microservices. The * other option would be to have independent blueprint for each microservices. @@ -110,6 +115,24 @@ public class LoopTemplate extends AuditEntity implements Serializable { return blueprint; } + /** + * dcaeBlueprintId getter. + * + * @return the dcaeBlueprintId + */ + public String getDcaeBlueprintId() { + return dcaeBlueprintId; + } + + /** + * dcaeBlueprintId setter. + * + * @param dcaeBlueprintId the dcaeBlueprintId to set + */ + public void setDcaeBlueprintId(String dcaeBlueprintId) { + this.dcaeBlueprintId = dcaeBlueprintId; + } + /** * blueprint setter. * @@ -164,6 +187,18 @@ public class LoopTemplate extends AuditEntity implements Serializable { this.maximumInstancesAllowed = maximumInstancesAllowed; } + /** + * Add list of loopElements to the current template, each loopElementModel is + * added at the end of the list so the flowOrder is computed automatically. + * + * @param loopElementModels The loopElementModel set to add + */ + public void addLoopElementModels(Set loopElementModels) { + for (LoopElementModel loopElementModel : loopElementModels) { + addLoopElementModel(loopElementModel); + } + } + /** * Add a loopElement to the current template, the loopElementModel is added at * the end of the list so the flowOrder is computed automatically. @@ -266,4 +301,21 @@ public class LoopTemplate extends AuditEntity implements Serializable { } return true; } + + /** + * Generate the loop template name. + * + * @param serviceName The service name + * @param serviceVersion The service version + * @param resourceName The resource name + * @param blueprintFileName The blueprint file name + * @return The generated loop template name + */ + public static String generateLoopTemplateName(String serviceName, String serviceVersion, String resourceName, + String blueprintFilename) { + StringBuilder buffer = new StringBuilder("LOOP_TEMPLATE_").append(serviceName).append("_v") + .append(serviceVersion).append("_").append(resourceName).append("_") + .append(blueprintFilename.replaceAll(".yaml", "")); + return buffer.toString().replace('.', '_').replaceAll(" ", ""); + } } diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java index 2ebea7b17..70adf3eef 100644 --- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java +++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java @@ -51,7 +51,11 @@ import org.onap.clamp.clds.sdc.controller.installer.CsarHandler; import org.onap.clamp.clds.util.JsonUtils; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.clamp.loop.service.ServiceRepository; -import org.onap.clamp.policy.microservice.MicroServicePolicy; +import org.onap.clamp.loop.template.LoopTemplate; +import org.onap.clamp.loop.template.LoopTemplateLoopElementModel; +import org.onap.clamp.loop.template.LoopTemplatesRepository; +import org.onap.clamp.loop.template.PolicyModelId; +import org.onap.clamp.loop.template.PolicyModelsRepository; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; @@ -80,11 +84,14 @@ public class CsarInstallerItCase { private static final String RESOURCE_INSTANCE_NAME_RESOURCE2 = "ResourceInstanceName2"; @Autowired - private LoopsRepository loopsRepo; + private LoopTemplatesRepository loopTemplatesRepo; @Autowired ServiceRepository serviceRepository; + @Autowired + PolicyModelsRepository policyModelsRepository; + @Autowired @Qualifier("csarInstaller") private CsarInstaller csarInstaller; @@ -189,42 +196,44 @@ public class CsarInstallerItCase { String generatedName = RandomStringUtils.randomAlphanumeric(5); CsarHandler csar = buildFakeCsarHandler(generatedName); csarInstaller.installTheCsar(csar); - assertThat(serviceRepository - .existsById("63cac700-ab9a-4115-a74f-7eac85e3fce0")).isTrue(); - assertThat(loopsRepo - .existsById(Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml"))) - .isTrue(); - assertThat(loopsRepo.existsById( - Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca_3.yaml"))).isTrue(); - assertThat(loopsRepo.existsById( - Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE2, "tca_2.yaml"))).isTrue(); + assertThat(serviceRepository.existsById("63cac700-ab9a-4115-a74f-7eac85e3fce0")).isTrue(); + assertThat(loopTemplatesRepo.existsById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0", + RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml"))).isTrue(); + assertThat(loopTemplatesRepo.existsById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0", + RESOURCE_INSTANCE_NAME_RESOURCE1, "tca_3.yaml"))).isTrue(); + assertThat(loopTemplatesRepo.existsById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0", + RESOURCE_INSTANCE_NAME_RESOURCE2, "tca_2.yaml"))).isTrue(); // Verify now that policy and json representation, global properties are well // set - Loop loop = loopsRepo - .findById(Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml")) - .get(); - assertThat(loop.getSvgRepresentation()).startsWith(""); + Loop loopTest = new Loop("ControlLoopTest", ""); loopTest.setGlobalPropertiesJson( new Gson().fromJson("{\"dcaeDeployParameters\":" + "{\"policy_id\": \"name\"}}", JsonObject.class)); loopTest.setLastComputedState(LoopState.DESIGN); diff --git a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java index d7c2edadc..e23dcf186 100644 --- a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java +++ b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java @@ -47,7 +47,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; - @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) public class DeployFlowTestItCase { @@ -63,7 +62,7 @@ public class DeployFlowTestItCase { @Transactional public void deployWithSingleBlueprintTest() throws JsonSyntaxException, IOException { Loop loopTest = createLoop("ControlLoopTest", "", "yamlcontent", "{\"testname\":\"testvalue\"}", - "UUID-blueprint"); + "UUID-blueprint"); LoopTemplate template = new LoopTemplate(); template.setName("templateName"); template.setBlueprint("yamlcontent"); @@ -73,11 +72,10 @@ public class DeployFlowTestItCase { "{\"param1\":\"value1\"}", true); loopTest.addMicroServicePolicy(microServicePolicy); loopService.saveOrUpdateLoop(loopTest); - Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext) - .withProperty("loopObject", loopTest).build(); + Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext).withProperty("loopObject", loopTest) + .build(); - camelContext.createProducerTemplate() - .send("direct:deploy-loop", myCamelExchange); + camelContext.createProducerTemplate().send("direct:deploy-loop", myCamelExchange); Loop loopAfterTest = loopService.getLoop("ControlLoopTest"); assertThat(loopAfterTest.getDcaeDeploymentStatusUrl()).isNotNull(); @@ -88,26 +86,23 @@ public class DeployFlowTestItCase { @Transactional public void deployWithMultipleBlueprintTest() throws JsonSyntaxException, IOException { Loop loopTest2 = createLoop("ControlLoopTest2", "", "yamlcontent", "{\"dcaeDeployParameters\": {" - + "\"microService1\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName1_tca\"}," - + "\"microService2\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName2_tca\"}" - + "}}", "UUID-blueprint"); + + "\"microService1\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName1_tca\"}," + + "\"microService2\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName2_tca\"}" + + "}}", "UUID-blueprint"); LoopTemplate template = new LoopTemplate(); template.setName("templateName"); loopTest2.setLoopTemplate(template); - MicroServicePolicy microServicePolicy1 = getMicroServicePolicy("microService1", "", - "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0", - "{\"param1\":\"value1\"}", true); - MicroServicePolicy microServicePolicy2 = getMicroServicePolicy("microService2", "", - "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0", - "{\"param1\":\"value1\"}", true); + MicroServicePolicy microServicePolicy1 = getMicroServicePolicy("microService1", "", "{\"configtype\":\"json\"}", + "tosca_definitions_version: tosca_simple_yaml_1_0_0", "{\"param1\":\"value1\"}", true); + MicroServicePolicy microServicePolicy2 = getMicroServicePolicy("microService2", "", "{\"configtype\":\"json\"}", + "tosca_definitions_version: tosca_simple_yaml_1_0_0", "{\"param1\":\"value1\"}", true); loopTest2.addMicroServicePolicy(microServicePolicy1); loopTest2.addMicroServicePolicy(microServicePolicy2); loopService.saveOrUpdateLoop(loopTest2); - Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext) - .withProperty("loopObject", loopTest2).build(); + Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext).withProperty("loopObject", loopTest2) + .build(); - camelContext.createProducerTemplate() - .send("direct:deploy-loop", myCamelExchange); + camelContext.createProducerTemplate().send("direct:deploy-loop", myCamelExchange); Loop loopAfterTest = loopService.getLoop("ControlLoopTest2"); Set policyList = loopAfterTest.getMicroServicePolicies(); @@ -123,7 +118,7 @@ public class DeployFlowTestItCase { @Transactional public void undeployWithSingleBlueprintTest() throws JsonSyntaxException, IOException { Loop loopTest = createLoop("ControlLoopTest", "", "yamlcontent", "{\"testname\":\"testvalue\"}", - "UUID-blueprint"); + "UUID-blueprint"); LoopTemplate template = new LoopTemplate(); template.setName("templateName"); template.setBlueprint("yamlcontent"); @@ -135,11 +130,10 @@ public class DeployFlowTestItCase { "{\"param1\":\"value1\"}", true); loopTest.addMicroServicePolicy(microServicePolicy); loopService.saveOrUpdateLoop(loopTest); - Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext) - .withProperty("loopObject", loopTest).build(); + Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext).withProperty("loopObject", loopTest) + .build(); - camelContext.createProducerTemplate() - .send("direct:undeploy-loop", myCamelExchange); + camelContext.createProducerTemplate().send("direct:undeploy-loop", myCamelExchange); Loop loopAfterTest = loopService.getLoop("ControlLoopTest"); assertThat(loopAfterTest.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue(); @@ -149,26 +143,25 @@ public class DeployFlowTestItCase { @Transactional public void undeployWithMultipleBlueprintTest() throws JsonSyntaxException, IOException { Loop loopTest2 = createLoop("ControlLoopTest2", "", "yamlcontent", "{\"dcaeDeployParameters\": {" - + "\"microService1\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName1_tca\"}," - + "\"microService2\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName2_tca\"}" - + "}}", "UUID-blueprint"); + + "\"microService1\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName1_tca\"}," + + "\"microService2\": {\"location_id\": \"\", \"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName2_tca\"}" + + "}}", "UUID-blueprint"); LoopTemplate template = new LoopTemplate(); template.setName("templateName"); loopTest2.setLoopTemplate(template); - MicroServicePolicy microServicePolicy1 = getMicroServicePolicy("microService1", "", - "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0", - "{\"param1\":\"value1\"}", true, "testDeploymentId1", "testDeploymentStatusUrl1"); - MicroServicePolicy microServicePolicy2 = getMicroServicePolicy("microService2", "", - "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0", - "{\"param1\":\"value1\"}", true, "testDeploymentId2", "testDeploymentStatusUrl2"); + MicroServicePolicy microServicePolicy1 = getMicroServicePolicy("microService1", "", "{\"configtype\":\"json\"}", + "tosca_definitions_version: tosca_simple_yaml_1_0_0", "{\"param1\":\"value1\"}", true, + "testDeploymentId1", "testDeploymentStatusUrl1"); + MicroServicePolicy microServicePolicy2 = getMicroServicePolicy("microService2", "", "{\"configtype\":\"json\"}", + "tosca_definitions_version: tosca_simple_yaml_1_0_0", "{\"param1\":\"value1\"}", true, + "testDeploymentId2", "testDeploymentStatusUrl2"); loopTest2.addMicroServicePolicy(microServicePolicy1); loopTest2.addMicroServicePolicy(microServicePolicy2); loopService.saveOrUpdateLoop(loopTest2); - Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext) - .withProperty("loopObject", loopTest2).build(); + Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext).withProperty("loopObject", loopTest2) + .build(); - camelContext.createProducerTemplate() - .send("direct:undeploy-loop", myCamelExchange); + camelContext.createProducerTemplate().send("direct:undeploy-loop", myCamelExchange); Loop loopAfterTest = loopService.getLoop("ControlLoopTest2"); Set policyList = loopAfterTest.getMicroServicePolicies(); @@ -181,7 +174,7 @@ public class DeployFlowTestItCase { private Loop createLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson, String dcaeBlueprintId) throws JsonSyntaxException, IOException { - Loop loop = new Loop(name, blueprint, svgRepresentation); + Loop loop = new Loop(name, svgRepresentation); loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class)); loop.setLastComputedState(LoopState.DESIGN); loop.setDcaeBlueprintId(dcaeBlueprintId); @@ -197,9 +190,10 @@ public class DeployFlowTestItCase { } private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation, - String policyTosca, String jsonProperties, boolean shared, String deploymengId, String deploymentStatusUrl) { - MicroServicePolicy microService = getMicroServicePolicy(name, modelType, jsonRepresentation, - policyTosca, jsonProperties, shared); + String policyTosca, String jsonProperties, boolean shared, String deploymengId, + String deploymentStatusUrl) { + MicroServicePolicy microService = getMicroServicePolicy(name, modelType, jsonRepresentation, policyTosca, + jsonProperties, shared); microService.setDcaeDeploymentId(deploymengId); microService.setDcaeDeploymentStatusUrl(deploymentStatusUrl); diff --git a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java index a41b5c251..ad37bcc88 100644 --- a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java +++ b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java @@ -72,7 +72,7 @@ public class LoopControllerTestItCase { } private Loop createTestLoop(String loopName, String loopBlueprint, String loopSvg) { - return new Loop(loopName, loopBlueprint, loopSvg); + return new Loop(loopName, loopSvg); } @Test diff --git a/src/test/java/org/onap/clamp/loop/LoopLogServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopLogServiceTestItCase.java index c172a9a07..15b9cb43a 100644 --- a/src/test/java/org/onap/clamp/loop/LoopLogServiceTestItCase.java +++ b/src/test/java/org/onap/clamp/loop/LoopLogServiceTestItCase.java @@ -62,7 +62,7 @@ public class LoopLogServiceTestItCase { LoopLogService loopLogService; private void saveTestLoopToDb() { - Loop testLoop = new Loop(EXAMPLE_LOOP_NAME, BLUEPRINT, SVG_REPRESENTATION); + Loop testLoop = new Loop(EXAMPLE_LOOP_NAME, SVG_REPRESENTATION); testLoop.setGlobalPropertiesJson(JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class)); loopService.saveOrUpdateLoop(testLoop); } @@ -88,7 +88,7 @@ public class LoopLogServiceTestItCase { log.setLogComponent(CLAMP_COMPONENT); log.setLogType(LogType.INFO); log.setMessage(SAMPLE_LOG_MESSAGE); - Loop testLoop = new Loop(EXAMPLE_LOOP_NAME, BLUEPRINT, SVG_REPRESENTATION); + Loop testLoop = new Loop(EXAMPLE_LOOP_NAME, SVG_REPRESENTATION); log.setLoop(testLoop); assertThat(log.getMessage()).isEqualTo(SAMPLE_LOG_MESSAGE); assertThat(log.getLogType()).isEqualTo(LogType.INFO); diff --git a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java index e0c112cb5..891d23b46 100644 --- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java +++ b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java @@ -121,7 +121,6 @@ public class LoopRepositoriesItCase { Loop loop = new Loop(); loop.setName(name); loop.setSvgRepresentation(svgRepresentation); - loop.setBlueprint(blueprint); loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class)); loop.setLastComputedState(LoopState.DESIGN); loop.setDcaeDeploymentId(dcaeId); @@ -215,11 +214,10 @@ public class LoopRepositoriesItCase { // Attempt an update ((LoopLog) loopInDbRetrieved.getLoopLogs().toArray()[0]).setLogInstant(Instant.now()); - loopInDbRetrieved.setBlueprint("yaml2"); + loopInDbRetrieved.setSvgRepresentation(""); Loop loopInDbRetrievedUpdated = loopRepository.saveAndFlush(loopInDbRetrieved); // Loop loopInDbRetrievedUpdated = // loopRepository.findById(loopTest.getName()).get(); - assertThat(loopInDbRetrievedUpdated.getBlueprint()).isEqualTo("yaml2"); assertThat((LoopLog) loopInDbRetrievedUpdated.getLoopLogs().toArray()[0]) .isEqualToComparingFieldByField(loopInDbRetrieved.getLoopLogs().toArray()[0]); // UpdatedDate should have been changed diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java index 338aaa3eb..615826eda 100644 --- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java +++ b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java @@ -87,7 +87,6 @@ public class LoopServiceTestItCase { assertThat(actualLoop).isNotNull(); assertThat(actualLoop).isEqualTo(loopsRepository.findById(actualLoop.getName()).get()); assertThat(actualLoop.getName()).isEqualTo(EXAMPLE_LOOP_NAME); - assertThat(actualLoop.getBlueprint()).isEqualTo(loopBlueprint); assertThat(actualLoop.getSvgRepresentation()).isEqualTo(loopSvg); assertThat(actualLoop.getGlobalPropertiesJson().getAsJsonPrimitive("testName").getAsString()) .isEqualTo("testValue"); @@ -354,6 +353,6 @@ public class LoopServiceTestItCase { } private Loop createTestLoop(String loopName, String loopBlueprint, String loopSvg) { - return new Loop(loopName, loopBlueprint, loopSvg); + return new Loop(loopName, loopSvg); } } \ No newline at end of file diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java index af8f2271b..052b97124 100644 --- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java +++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java @@ -61,7 +61,7 @@ public class LoopToJsonTest { private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson, String dcaeId, String dcaeUrl, String dcaeBlueprintId) throws JsonSyntaxException, IOException { - Loop loop = new Loop(name, blueprint, svgRepresentation); + Loop loop = new Loop(name, svgRepresentation); loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class)); loop.setLastComputedState(LoopState.DESIGN); loop.setDcaeDeploymentId(dcaeId); @@ -134,7 +134,6 @@ public class LoopToJsonTest { assertThat(loopTestDeserialized.getComponent("POLICY").getState()).isEqualToComparingOnlyGivenFields( loopTest.getComponent("POLICY").getState(), "stateName", "description"); // svg and blueprint not exposed so wont be deserialized - assertThat(loopTestDeserialized.getBlueprint()).isEqualTo(null); assertThat(loopTestDeserialized.getSvgRepresentation()).isEqualTo(null); assertThat(loopTestDeserialized.getOperationalPolicies()).containsExactly(opPolicy); diff --git a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java index 39468a1c7..f8c1d8662 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java +++ b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java @@ -111,8 +111,7 @@ public class PolicyModelServiceItCase { policyModelsService.saveOrUpdatePolicyModel(policyModel2); List policyModelTypesList = policyModelsService.getAllPolicyModelTypes(); - assertThat(policyModelTypesList).containsOnly(policyModel1.getPolicyModelType(), - policyModel2.getPolicyModelType()); + assertThat(policyModelTypesList).contains(policyModel1.getPolicyModelType(), policyModel2.getPolicyModelType()); } @Test @@ -125,7 +124,7 @@ public class PolicyModelServiceItCase { "VARIANT", "user"); policyModelsService.saveOrUpdatePolicyModel(policyModel2); - assertThat(policyModelsService.getAllPolicyModels()).containsOnly(policyModel1, policyModel2); + assertThat(policyModelsService.getAllPolicyModels()).contains(policyModel1, policyModel2); } @Test @@ -138,7 +137,7 @@ public class PolicyModelServiceItCase { "VARIANT", "user"); policyModelsService.saveOrUpdatePolicyModel(policyModel2); - assertThat(policyModelsService.getAllPolicyModelsByType(POLICY_MODEL_TYPE_2)).containsOnly(policyModel1, + assertThat(policyModelsService.getAllPolicyModelsByType(POLICY_MODEL_TYPE_2)).contains(policyModel1, policyModel2); } @@ -154,6 +153,6 @@ public class PolicyModelServiceItCase { SortedSet sortedSet = new TreeSet<>(); policyModelsService.getAllPolicyModels().forEach(sortedSet::add); - assertThat(sortedSet).containsExactly(policyModel2, policyModel1); + assertThat(sortedSet).contains(policyModel2, policyModel1); } } -- cgit 1.2.3-korg