diff options
-rw-r--r-- | extra/sql/dump/test-data.sql | 105 | ||||
-rw-r--r-- | src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/policy/clamp/policy/Policy.java | 48 | ||||
-rw-r--r-- | src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java | 91 | ||||
-rw-r--r-- | src/main/resources/clds/camel/rest/clamp-api-v2.xml | 25 | ||||
-rw-r--r-- | src/main/resources/clds/camel/routes/policy-flows.xml | 8 | ||||
-rwxr-xr-x | ui-react-lib/libIndex.js | 2 | ||||
-rw-r--r-- | ui-react/package.json | 3 | ||||
-rw-r--r-- | ui-react/src/__snapshots__/OnapClamp.test.js.snap | 4 | ||||
-rw-r--r-- | ui-react/src/api/PolicyService.js | 5 | ||||
-rw-r--r-- | ui-react/src/api/PolicyToscaService.js | 68 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/Policy/PolicyEditor.js | 210 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/Policy/ToscaViewer.js | 67 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/Policy/ViewAllPolicies.js | 302 | ||||
-rw-r--r-- | ui-react/src/theme/globalStyle.js | 7 |
16 files changed, 664 insertions, 287 deletions
diff --git a/extra/sql/dump/test-data.sql b/extra/sql/dump/test-data.sql index af28a77dd..367ddb61d 100644 --- a/extra/sql/dump/test-data.sql +++ b/extra/sql/dump/test-data.sql @@ -26,8 +26,8 @@ USE `cldsdb4`; LOCK TABLES `dictionary` WRITE; /*!40000 ALTER TABLE `dictionary` DISABLE KEYS */; -INSERT INTO `dictionary` VALUES ('DefaultActors','Not found','2021-01-23 23:57:03.183160','Not found','2021-01-23 23:57:03.183160',0,''); -INSERT INTO `dictionary` VALUES ('DefaultOperations','Not found','2021-01-23 23:57:03.205505','Not found','2021-01-23 23:57:03.205505',0,''); +INSERT INTO `dictionary` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `dictionary_second_level`, `dictionary_type`) VALUES ('DefaultActors','Not found','2021-03-05 17:10:52.561538','Not found','2021-03-05 17:10:52.561538',0,''); +INSERT INTO `dictionary` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `dictionary_second_level`, `dictionary_type`) VALUES ('DefaultOperations','Not found','2021-03-05 17:10:52.579372','Not found','2021-03-05 17:10:52.579372',0,''); /*!40000 ALTER TABLE `dictionary` ENABLE KEYS */; UNLOCK TABLES; @@ -37,20 +37,20 @@ UNLOCK TABLES; LOCK TABLES `dictionary_elements` WRITE; /*!40000 ALTER TABLE `dictionary_elements` DISABLE KEYS */; -INSERT INTO `dictionary_elements` VALUES ('APPC','Not found','2021-01-23 23:57:03.192548','Not found','2021-01-23 23:57:03.192548','APPC component','APPC',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('BandwidthOnDemand (SDNC operation)','Not found','2021-01-23 23:57:03.206727','Not found','2021-01-23 23:57:03.206727','SDNC operation','BandwidthOnDemand',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Health-Check (APPC operation)','Not found','2021-01-23 23:57:03.215614','Not found','2021-01-23 23:57:03.215614','APPC operation','Health-Check',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Migrate (APPC operation)','Not found','2021-01-23 23:57:03.214508','Not found','2021-01-23 23:57:03.214508','APPC operation','Migrate',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('ModifyConfig (APPC/VFC operation)','Not found','2021-01-23 23:57:03.212162','Not found','2021-01-23 23:57:03.212162','APPC/VFC operation','ModifyConfig',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Rebuild (APPC operation)','Not found','2021-01-23 23:57:03.211114','Not found','2021-01-23 23:57:03.211114','APPC operation','Rebuild',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Reroute (SDNC operation)','Not found','2021-01-23 23:57:03.209061','Not found','2021-01-23 23:57:03.209061','SDNC operation','Reroute',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('Restart (APPC operation)','Not found','2021-01-23 23:57:03.213338','Not found','2021-01-23 23:57:03.213338','APPC operation','Restart',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('SDNC','Not found','2021-01-23 23:57:03.189717','Not found','2021-01-23 23:57:03.189717','SDNC component','SDNC',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('SDNR','Not found','2021-01-23 23:57:03.188323','Not found','2021-01-23 23:57:03.188323','SDNR component','SDNR',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('SO','Not found','2021-01-23 23:57:03.191576','Not found','2021-01-23 23:57:03.191576','SO component','SO',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('VF Module Create (SO operation)','Not found','2021-01-23 23:57:03.210095','Not found','2021-01-23 23:57:03.210095','SO operation','VF Module Create',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('VF Module Delete (SO operation)','Not found','2021-01-23 23:57:03.207974','Not found','2021-01-23 23:57:03.207974','SO operation','VF Module Delete',NULL,'string'); -INSERT INTO `dictionary_elements` VALUES ('VFC','Not found','2021-01-23 23:57:03.190663','Not found','2021-01-23 23:57:03.190663','VFC component','VFC',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('APPC','Not found','2021-03-05 17:10:52.570617','Not found','2021-03-05 17:10:52.570617','APPC component','APPC',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('BandwidthOnDemand (SDNC operation)','Not found','2021-03-05 17:10:52.580331','Not found','2021-03-05 17:10:52.580331','SDNC operation','BandwidthOnDemand',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('Health-Check (APPC operation)','Not found','2021-03-05 17:10:52.587614','Not found','2021-03-05 17:10:52.587614','APPC operation','Health-Check',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('Migrate (APPC operation)','Not found','2021-03-05 17:10:52.586285','Not found','2021-03-05 17:10:52.586285','APPC operation','Migrate',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('ModifyConfig (APPC/VFC operation)','Not found','2021-03-05 17:10:52.584261','Not found','2021-03-05 17:10:52.584261','APPC/VFC operation','ModifyConfig',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('Rebuild (APPC operation)','Not found','2021-03-05 17:10:52.583480','Not found','2021-03-05 17:10:52.583480','APPC operation','Rebuild',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('Reroute (SDNC operation)','Not found','2021-03-05 17:10:52.581911','Not found','2021-03-05 17:10:52.581911','SDNC operation','Reroute',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('Restart (APPC operation)','Not found','2021-03-05 17:10:52.585115','Not found','2021-03-05 17:10:52.585115','APPC operation','Restart',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('SDNC','Not found','2021-03-05 17:10:52.567645','Not found','2021-03-05 17:10:52.567645','SDNC component','SDNC',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('SDNR','Not found','2021-03-05 17:10:52.566004','Not found','2021-03-05 17:10:52.566004','SDNR component','SDNR',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('SO','Not found','2021-03-05 17:10:52.569719','Not found','2021-03-05 17:10:52.569719','SO component','SO',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('VF Module Create (SO operation)','Not found','2021-03-05 17:10:52.582689','Not found','2021-03-05 17:10:52.582689','SO operation','VF Module Create',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('VF Module Delete (SO operation)','Not found','2021-03-05 17:10:52.581150','Not found','2021-03-05 17:10:52.581150','SO operation','VF Module Delete',NULL,'string'); +INSERT INTO `dictionary_elements` (`short_name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `description`, `name`, `subdictionary_name`, `type`) VALUES ('VFC','Not found','2021-03-05 17:10:52.568756','Not found','2021-03-05 17:10:52.568756','VFC component','VFC',NULL,'string'); /*!40000 ALTER TABLE `dictionary_elements` ENABLE KEYS */; UNLOCK TABLES; @@ -60,20 +60,20 @@ UNLOCK TABLES; LOCK TABLES `dictionary_to_dictionaryelements` WRITE; /*!40000 ALTER TABLE `dictionary_to_dictionaryelements` DISABLE KEYS */; -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultActors','APPC'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultActors','SDNC'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultActors','SDNR'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultActors','SO'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultActors','VFC'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','BandwidthOnDemand (SDNC operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','Health-Check (APPC operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','Migrate (APPC operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','ModifyConfig (APPC/VFC operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','Rebuild (APPC operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','Reroute (SDNC operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','Restart (APPC operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','VF Module Create (SO operation)'); -INSERT INTO `dictionary_to_dictionaryelements` VALUES ('DefaultOperations','VF Module Delete (SO operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultActors','APPC'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultActors','SDNC'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultActors','SDNR'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultActors','SO'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultActors','VFC'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','BandwidthOnDemand (SDNC operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','Health-Check (APPC operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','Migrate (APPC operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','ModifyConfig (APPC/VFC operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','Rebuild (APPC operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','Reroute (SDNC operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','Restart (APPC operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','VF Module Create (SO operation)'); +INSERT INTO `dictionary_to_dictionaryelements` (`dictionary_name`, `dictionary_element_short_name`) VALUES ('DefaultOperations','VF Module Delete (SO operation)'); /*!40000 ALTER TABLE `dictionary_to_dictionaryelements` ENABLE KEYS */; UNLOCK TABLES; @@ -83,7 +83,7 @@ UNLOCK TABLES; LOCK TABLES `hibernate_sequence` WRITE; /*!40000 ALTER TABLE `hibernate_sequence` DISABLE KEYS */; -INSERT INTO `hibernate_sequence` VALUES (11); +INSERT INTO `hibernate_sequence` (`next_val`) VALUES (11); /*!40000 ALTER TABLE `hibernate_sequence` ENABLE KEYS */; UNLOCK TABLES; @@ -93,8 +93,8 @@ 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,'2021-01-23 23:56:25.418026','Not found','2021-01-23 23:56:25.588305',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); -INSERT INTO `loop_element_models` VALUES ('onap.policies.monitoring.tcagen2','Not found','2021-01-23 23:56:25.574847','Not found','2021-01-23 23:56:25.574847',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); +INSERT INTO `loop_element_models` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `blueprint_yaml`, `dcae_blueprint_id`, `loop_element_type`, `short_name`) VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app',NULL,'2021-03-05 17:10:19.722143','Not found','2021-03-05 17:10:19.852676',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); +INSERT INTO `loop_element_models` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `blueprint_yaml`, `dcae_blueprint_id`, `loop_element_type`, `short_name`) VALUES ('onap.policies.monitoring.tcagen2','Not found','2021-03-05 17:10:19.837051','Not found','2021-03-05 17:10:19.837051',NULL,NULL,'MICRO_SERVICE_TYPE',NULL); /*!40000 ALTER TABLE `loop_element_models` ENABLE KEYS */; UNLOCK TABLES; @@ -113,10 +113,10 @@ UNLOCK TABLES; LOCK TABLES `loop_templates` WRITE; /*!40000 ALTER TABLE `loop_templates` DISABLE KEYS */; -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_rwh4R_v1_0_ResourceInstanceName1_tca','Not found','2021-01-23 23:56:25.493848','Not found','2021-01-23 23:56:25.493848','CLOSED','tosca_definitions_version: cloudify_dsl_1_3\nimports:\n- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/docker/2.2.0/node-type.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml\n- http://onap.org:8081/repository/solutioning01-mte2-raw/type_files/dmaap/dmaap_mr.yaml\ninputs:\n location_id:\n type: string\n service_id:\n type: string\n policy_id:\n type: string\nnode_templates:\n policy_0:\n type: dcae.nodes.policy\n properties:\n policy_id: \n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n cdap_host_host:\n type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure\n properties:\n location_id:\n get_input: location_id\n scn_override: cdap_broker.solutioning-central.dcae.onap.org\n interfaces:\n cloudify.interfaces.lifecycle: {\n }\n tca_tca:\n type: dcae.nodes.MicroService.cdap\n properties:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n publisherContentType: application/json\n publisherHostName: mrlocal-mtnjftle01.onap.org\n publisherHostPort: \'3905\'\n publisherMaxBatchSize: \'10\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: https\n publisherTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESPub\n publisherUserName: test@tca.af.dcae.onap.org\n publisherUserPassword: password\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName: mrlocal-mtnjftle01.onap.org\n subscriberHostPort: \'3905\'\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'20000\'\n subscriberProtocol: https\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub\n subscriberUserName: test@tca.af.dcae.onap.org\n subscriberUserPassword: password\n tca_policy: null\n artifact_name: dcae-analytics-tca\n artifact_version: 1.0.0\n connections:\n streams_publishes: [\n ]\n streams_subscribes: [\n ]\n jar_url: http://somejar\n location_id:\n get_input: location_id\n namespace: cdap_tca_hi_lo\n programs:\n - program_id: TCAVESCollectorFlow\n program_type: flows\n - program_id: TCADMaaPMRSubscriberWorker\n program_type: workers\n - program_id: TCADMaaPMRPublisherWorker\n program_type: workers\n service_component_type: cdap_app_tca\n service_id:\n get_input: service_id\n streamname: TCASubscriberOutputStream\n relationships:\n - target: topic0\n type: dcae.relationships.subscribe_to_events\n - target: topic1\n type: dcae.relationships.publish_events\n - target: cdap_host_host\n type: dcae.relationships.component_contained_in\n - target: policy_0\n type: dcae.relationships.depends_on\n topic0:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n topic1:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n \n','typeId-e0183c43-7c8a-4e7f-bb07-835d7481681c',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_rwh4R_v1_0_ResourceInstanceName1_tca-guilin','Not found','2021-01-23 23:56:25.568947','Not found','2021-01-23 23:56:25.568947','CLOSED','# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (C) 2019-2020 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#k8s-tca-gen2-v3.yaml\n\ntosca_definitions_version: cloudify_dsl_1_3\nimports:\n - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - plugin:k8splugin?version=3.4.2\n - plugin:clamppolicyplugin?version=1.1.0\ninputs:\n service_name:\n type: string\n default: \'dcae-tcagen2\'\n log_directory:\n type: string\n default: \"/opt/logs/dcae-analytics-tca\"\n replicas:\n type: integer\n description: number of instances\n default: 1\n spring.data.mongodb.uri:\n type: string\n default: \"mongodb://dcae-mongohost/dcae-tcagen2\"\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.analytics.tca-gen2.dcae-analytics-tca-web:1.2.1\"\n tca.aai.password:\n type: string\n default: \"DCAE\"\n tca.aai.url:\n type: string\n default: \"http://aai.onap.svc.cluster.local\"\n tca.aai.username:\n type: string\n default: \"DCAE\"\n tca_handle_in_subscribe_url:\n type: string\n default: \"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT\"\n tca_handle_out_publish_url:\n type: string\n default: \"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.DCAE_CL_OUTPUT\"\n tca_consumer_group:\n type: string\n default: \"cg1\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.tcagen2\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\nnode_templates:\n docker.tca:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tcagen2_policy\n type: cloudify.relationships.depends_on\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n ports:\n - concat: [\"9091:\", \"0\"]\n properties:\n application_config:\n service_calls: []\n streams_publishes:\n tca_handle_out:\n dmaap_info:\n topic_url:\n get_input: tca_handle_out_publish_url\n type: message_router\n streams_subscribes:\n tca_handle_in:\n dmaap_info:\n topic_url:\n get_input: tca_handle_in_subscribe_url\n type: message_router\n spring.data.mongodb.uri:\n get_input: spring.data.mongodb.uri\n streams_subscribes.tca_handle_in.consumer_group:\n get_input: tca_consumer_group\n streams_subscribes.tca_handle_in.consumer_ids[0]: c0\n streams_subscribes.tca_handle_in.consumer_ids[1]: c1\n streams_subscribes.tca_handle_in.message_limit: 50000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.max: 60000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.min: 30000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.step_down: 30000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.step_up: 10000\n streams_subscribes.tca_handle_in.polling.fixed_rate: 0\n streams_subscribes.tca_handle_in.timeout: -1\n tca.aai.enable_enrichment: true\n tca.aai.generic_vnf_path: aai/v11/network/generic-vnfs/generic-vnf\n tca.aai.node_query_path: aai/v11/search/nodes-query\n tca.aai.password:\n get_input: tca.aai.password\n tca.aai.url:\n get_input: tca.aai.url\n tca.aai.username:\n get_input: tca.aai.username\n tca.policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n tca.processing_batch_size: 10000\n tca.enable_abatement: true\n tca.enable_ecomp_logging: true\n docker_config:\n healthcheck:\n endpoint: /actuator/health\n interval: 30s\n timeout: 10s\n type: http\n image:\n get_input: tag_version\n log_info:\n log_directory:\n get_input: log_directory\n tls_info:\n use_tls: true\n cert_directory: \'/etc/tca-gen2/ssl\'\n replicas:\n get_input: replicas\n service_component_type: { get_input: service_name }\n tcagen2_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id:\n get_input: policy_model_id\n','typeId-1fd4d548-8d7b-4c24-8479-2b0d8d06866e',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_rwh4R_v1_0_ResourceInstanceName1_tca_3','Not found','2021-01-23 23:56:25.456987','Not found','2021-01-23 23:56:25.456987','CLOSED','#\n# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\n# =============================================================================\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ============LICENSE_END======================================================\n\ntosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml\"\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml\"\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: \"true\"\n dmaap_host:\n type: string\n default: \"message-router.onap.svc.cluster.local\"\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: \"false\"\n redisHosts:\n type: string\n default: \"dcae-redis.onap.svc.cluster.local:6379\"\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.2.2\"\n consul_host:\n type: string\n default: \"consul-server.onap\"\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-clamp\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n #tca_policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n tca_policy: \'\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT: \"3904\"\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT: \"8443\"\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT: \"8500\"\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT: \"10000\"\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id:\n get_input: policy_model_id\n','typeId-d9ffc490-9691-4937-86a8-f7062b6e505e',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); -INSERT INTO `loop_templates` VALUES ('LOOP_TEMPLATE_rwh4R_v1_0_ResourceInstanceName2_tca_2','Not found','2021-01-23 23:56:25.410229','Not found','2021-01-23 23:56:25.410229','CLOSED','#\n# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\n# =============================================================================\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ============LICENSE_END======================================================\n\ntosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n# - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/clamppolicyplugin/1.0.0/clamppolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1\"\n consul_host:\n type: string\n default: consul-server.onap\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-servicel\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-clamp\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n# tca_policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n','typeId-e845ddcd-074e-414f-9ed3-3f62b19956a8',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `allowed_loop_type`, `blueprint_yaml`, `dcae_blueprint_id`, `maximum_instances_allowed`, `unique_blueprint`, `service_uuid`) VALUES ('LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName1_tca','Not found','2021-03-05 17:10:19.774034','Not found','2021-03-05 17:10:19.774034','CLOSED','tosca_definitions_version: cloudify_dsl_1_3\nimports:\n- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/docker/2.2.0/node-type.yaml\n- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml\n- http://onap.org:8081/repository/solutioning01-mte2-raw/type_files/dmaap/dmaap_mr.yaml\ninputs:\n location_id:\n type: string\n service_id:\n type: string\n policy_id:\n type: string\nnode_templates:\n policy_0:\n type: dcae.nodes.policy\n properties:\n policy_id: \n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n cdap_host_host:\n type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure\n properties:\n location_id:\n get_input: location_id\n scn_override: cdap_broker.solutioning-central.dcae.onap.org\n interfaces:\n cloudify.interfaces.lifecycle: {\n }\n tca_tca:\n type: dcae.nodes.MicroService.cdap\n properties:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n publisherContentType: application/json\n publisherHostName: mrlocal-mtnjftle01.onap.org\n publisherHostPort: \'3905\'\n publisherMaxBatchSize: \'10\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: https\n publisherTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESPub\n publisherUserName: test@tca.af.dcae.onap.org\n publisherUserPassword: password\n subscriberConsumerGroup: OpenDCAE-c12\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName: mrlocal-mtnjftle01.onap.org\n subscriberHostPort: \'3905\'\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'20000\'\n subscriberProtocol: https\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub\n subscriberUserName: test@tca.af.dcae.onap.org\n subscriberUserPassword: password\n tca_policy: null\n artifact_name: dcae-analytics-tca\n artifact_version: 1.0.0\n connections:\n streams_publishes: [\n ]\n streams_subscribes: [\n ]\n jar_url: http://somejar\n location_id:\n get_input: location_id\n namespace: cdap_tca_hi_lo\n programs:\n - program_id: TCAVESCollectorFlow\n program_type: flows\n - program_id: TCADMaaPMRSubscriberWorker\n program_type: workers\n - program_id: TCADMaaPMRPublisherWorker\n program_type: workers\n service_component_type: cdap_app_tca\n service_id:\n get_input: service_id\n streamname: TCASubscriberOutputStream\n relationships:\n - target: topic0\n type: dcae.relationships.subscribe_to_events\n - target: topic1\n type: dcae.relationships.publish_events\n - target: cdap_host_host\n type: dcae.relationships.component_contained_in\n - target: policy_0\n type: dcae.relationships.depends_on\n topic0:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n topic1:\n type: dcae.nodes.Topic\n properties:\n topic_name: \'\'\n \n','typeId-7e039b4b-8ab4-47f2-9dd4-2cbe584105a6',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `allowed_loop_type`, `blueprint_yaml`, `dcae_blueprint_id`, `maximum_instances_allowed`, `unique_blueprint`, `service_uuid`) VALUES ('LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName1_tca-guilin','Not found','2021-03-05 17:10:19.833813','Not found','2021-03-05 17:10:19.833813','CLOSED','# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (C) 2019-2020 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#k8s-tca-gen2-v3.yaml\n\ntosca_definitions_version: cloudify_dsl_1_3\nimports:\n - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - plugin:k8splugin?version=3.4.2\n - plugin:clamppolicyplugin?version=1.1.0\ninputs:\n service_name:\n type: string\n default: \'dcae-tcagen2\'\n log_directory:\n type: string\n default: \"/opt/logs/dcae-analytics-tca\"\n replicas:\n type: integer\n description: number of instances\n default: 1\n spring.data.mongodb.uri:\n type: string\n default: \"mongodb://dcae-mongohost/dcae-tcagen2\"\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.analytics.tca-gen2.dcae-analytics-tca-web:1.2.1\"\n tca.aai.password:\n type: string\n default: \"DCAE\"\n tca.aai.url:\n type: string\n default: \"http://aai.onap.svc.cluster.local\"\n tca.aai.username:\n type: string\n default: \"DCAE\"\n tca_handle_in_subscribe_url:\n type: string\n default: \"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT\"\n tca_handle_out_publish_url:\n type: string\n default: \"http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.DCAE_CL_OUTPUT\"\n tca_consumer_group:\n type: string\n default: \"cg1\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.tcagen2\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\nnode_templates:\n docker.tca:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tcagen2_policy\n type: cloudify.relationships.depends_on\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n ports:\n - concat: [\"9091:\", \"0\"]\n properties:\n application_config:\n service_calls: []\n streams_publishes:\n tca_handle_out:\n dmaap_info:\n topic_url:\n get_input: tca_handle_out_publish_url\n type: message_router\n streams_subscribes:\n tca_handle_in:\n dmaap_info:\n topic_url:\n get_input: tca_handle_in_subscribe_url\n type: message_router\n spring.data.mongodb.uri:\n get_input: spring.data.mongodb.uri\n streams_subscribes.tca_handle_in.consumer_group:\n get_input: tca_consumer_group\n streams_subscribes.tca_handle_in.consumer_ids[0]: c0\n streams_subscribes.tca_handle_in.consumer_ids[1]: c1\n streams_subscribes.tca_handle_in.message_limit: 50000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.max: 60000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.min: 30000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.step_down: 30000\n streams_subscribes.tca_handle_in.polling.auto_adjusting.step_up: 10000\n streams_subscribes.tca_handle_in.polling.fixed_rate: 0\n streams_subscribes.tca_handle_in.timeout: -1\n tca.aai.enable_enrichment: true\n tca.aai.generic_vnf_path: aai/v11/network/generic-vnfs/generic-vnf\n tca.aai.node_query_path: aai/v11/search/nodes-query\n tca.aai.password:\n get_input: tca.aai.password\n tca.aai.url:\n get_input: tca.aai.url\n tca.aai.username:\n get_input: tca.aai.username\n tca.policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n tca.processing_batch_size: 10000\n tca.enable_abatement: true\n tca.enable_ecomp_logging: true\n docker_config:\n healthcheck:\n endpoint: /actuator/health\n interval: 30s\n timeout: 10s\n type: http\n image:\n get_input: tag_version\n log_info:\n log_directory:\n get_input: log_directory\n tls_info:\n use_tls: true\n cert_directory: \'/etc/tca-gen2/ssl\'\n replicas:\n get_input: replicas\n service_component_type: { get_input: service_name }\n tcagen2_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id:\n get_input: policy_model_id\n','typeId-9355082c-7e22-47aa-963e-3236a0221ac9',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `allowed_loop_type`, `blueprint_yaml`, `dcae_blueprint_id`, `maximum_instances_allowed`, `unique_blueprint`, `service_uuid`) VALUES ('LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName1_tca_3','Not found','2021-03-05 17:10:19.748910','Not found','2021-03-05 17:10:19.748910','CLOSED','#\n# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\n# =============================================================================\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ============LICENSE_END======================================================\n\ntosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml\"\n - \"https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml\"\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: \"true\"\n dmaap_host:\n type: string\n default: \"message-router.onap.svc.cluster.local\"\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: \"false\"\n redisHosts:\n type: string\n default: \"dcae-redis.onap.svc.cluster.local:6379\"\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.2.2\"\n consul_host:\n type: string\n default: \"consul-server.onap\"\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-service\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-clamp\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n #tca_policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n tca_policy: \'\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT: \"3904\"\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT: \"8443\"\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT: \"8500\"\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT: \"10000\"\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id:\n get_input: policy_model_id\n','typeId-239e94d1-f137-42bf-91d4-659e9a7f928e',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); +INSERT INTO `loop_templates` (`name`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `allowed_loop_type`, `blueprint_yaml`, `dcae_blueprint_id`, `maximum_instances_allowed`, `unique_blueprint`, `service_uuid`) VALUES ('LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName2_tca_2','Not found','2021-03-05 17:10:19.715327','Not found','2021-03-05 17:10:19.715327','CLOSED','#\n# ============LICENSE_START====================================================\n# =============================================================================\n# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\n# =============================================================================\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ============LICENSE_END======================================================\n\ntosca_definitions_version: cloudify_dsl_1_3\n\ndescription: >\n This blueprint deploys/manages the TCA module as a Docker container\n\nimports:\n - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml\n# - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml\n - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/clamppolicyplugin/1.0.0/clamppolicyplugin_types.yaml\ninputs:\n aaiEnrichmentHost:\n type: string\n default: \"aai.onap.svc.cluster.local\"\n aaiEnrichmentPort:\n type: string\n default: \"8443\"\n enableAAIEnrichment:\n type: string\n default: true\n dmaap_host:\n type: string\n default: message-router.onap\n dmaap_port:\n type: string\n default: \"3904\"\n enableRedisCaching:\n type: string\n default: false\n redisHosts:\n type: string\n default: dcae-redis.onap.svc.cluster.local:6379\n tag_version:\n type: string\n default: \"nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1\"\n consul_host:\n type: string\n default: consul-server.onap\n consul_port:\n type: string\n default: \"8500\"\n cbs_host:\n type: string\n default: \"config-binding-servicel\"\n cbs_port:\n type: string\n default: \"10000\"\n policy_id:\n type: string\n default: \"onap.restart.tca\"\n external_port:\n type: string\n description: Kubernetes node port on which CDAPgui is exposed\n default: \"32012\"\n policy_model_id:\n type: string\n default: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\nnode_templates:\n tca_k8s:\n type: dcae.nodes.ContainerizedServiceComponent\n relationships:\n - target: tca_policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: \'dcaegen2-analytics-tca\'\n application_config: {}\n docker_config: {}\n image:\n get_input: tag_version\n log_info:\n log_directory: \"/opt/app/TCAnalytics/logs\"\n application_config:\n app_config:\n appDescription: DCAE Analytics Threshold Crossing Alert Application\n appName: dcae-tca\n tcaAlertsAbatementTableName: TCAAlertsAbatementTable\n tcaAlertsAbatementTableTTLSeconds: \'1728000\'\n tcaSubscriberOutputStreamName: TCASubscriberOutputStream\n tcaVESAlertsTableName: TCAVESAlertsTable\n tcaVESAlertsTableTTLSeconds: \'1728000\'\n tcaVESMessageStatusTableName: TCAVESMessageStatusTable\n tcaVESMessageStatusTableTTLSeconds: \'86400\'\n thresholdCalculatorFlowletInstances: \'2\'\n app_preferences:\n aaiEnrichmentHost:\n get_input: aaiEnrichmentHost\n aaiEnrichmentIgnoreSSLCertificateErrors: \'true\'\n aaiEnrichmentPortNumber: \'8443\'\n aaiEnrichmentProtocol: https\n aaiEnrichmentUserName: dcae@dcae.onap.org\n aaiEnrichmentUserPassword: demo123456!\n aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query\n aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf\n enableAAIEnrichment:\n get_input: enableAAIEnrichment\n enableRedisCaching:\n get_input: enableRedisCaching\n redisHosts:\n get_input: redisHosts\n enableAlertCEFFormat: \'false\'\n publisherContentType: application/json\n publisherHostName:\n get_input: dmaap_host\n publisherHostPort:\n get_input: dmaap_port\n publisherMaxBatchSize: \'1\'\n publisherMaxRecoveryQueueSize: \'100000\'\n publisherPollingInterval: \'20000\'\n publisherProtocol: http\n publisherTopicName: unauthenticated.DCAE_CL_OUTPUT\n subscriberConsumerGroup: OpenDCAE-clamp\n subscriberConsumerId: c12\n subscriberContentType: application/json\n subscriberHostName:\n get_input: dmaap_host\n subscriberHostPort:\n get_input: dmaap_port\n subscriberMessageLimit: \'-1\'\n subscriberPollingInterval: \'30000\'\n subscriberProtocol: http\n subscriberTimeoutMS: \'-1\'\n subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT\n# tca_policy: \'{\"domain\":\"measurementsForVfScaling\",\"metricsPerEventName\":[{\"eventName\":\"vFirewallBroadcastPackets\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"LESS_OR_EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ONSET\"},{\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":700,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"vLoadBalancer\",\"controlLoopSchemaType\":\"VM\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":300,\"direction\":\"GREATER_OR_EQUAL\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]},{\"eventName\":\"Measurement_vGMUX\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"policyName\":\"DCAE.Config_tca-hi-lo\",\"policyVersion\":\"v0.0.1\",\"thresholds\":[{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"EQUAL\",\"severity\":\"MAJOR\",\"closedLoopEventStatus\":\"ABATED\"},{\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":0,\"direction\":\"GREATER\",\"severity\":\"CRITICAL\",\"closedLoopEventStatus\":\"ONSET\"}]}]}\'\n service_component_type: dcaegen2-analytics_tca\n interfaces:\n cloudify.interfaces.lifecycle:\n start:\n inputs:\n envs:\n DMAAPHOST:\n { get_input: dmaap_host }\n DMAAPPORT:\n { get_input: dmaap_port }\n DMAAPPUBTOPIC: \"unauthenticated.DCAE_CL_OUTPUT\"\n DMAAPSUBTOPIC: \"unauthenticated.VES_MEASUREMENT_OUTPUT\"\n AAIHOST:\n { get_input: aaiEnrichmentHost }\n AAIPORT:\n { get_input: aaiEnrichmentPort }\n CONSUL_HOST:\n { get_input: consul_host }\n CONSUL_PORT:\n { get_input: consul_port }\n CBS_HOST:\n { get_input: cbs_host }\n CBS_PORT:\n { get_input: cbs_port }\n CONFIG_BINDING_SERVICE: \"config_binding_service\"\n ports:\n - concat: [\"11011:\", { get_input: external_port }]\n tca_policy:\n type: clamp.nodes.policy\n properties:\n policy_id:\n get_input: policy_id\n policy_model_id: \"onap.policies.monitoring.cdap.tca.hi.lo.app\"\n','typeId-6c349c12-eabd-44a2-9b2d-e9115fb27655',0,1,'63cac700-ab9a-4115-a74f-7eac85e3fce0'); /*!40000 ALTER TABLE `loop_templates` ENABLE KEYS */; UNLOCK TABLES; @@ -126,8 +126,8 @@ 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.0'); -INSERT INTO `loopelementmodels_to_policymodels` VALUES ('onap.policies.monitoring.tcagen2','onap.policies.monitoring.tcagen2','1.0.0'); +INSERT INTO `loopelementmodels_to_policymodels` (`loop_element_name`, `policy_model_type`, `policy_model_version`) VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','onap.policies.monitoring.cdap.tca.hi.lo.app','1.0.0'); +INSERT INTO `loopelementmodels_to_policymodels` (`loop_element_name`, `policy_model_type`, `policy_model_version`) VALUES ('onap.policies.monitoring.tcagen2','onap.policies.monitoring.tcagen2','1.0.0'); /*!40000 ALTER TABLE `loopelementmodels_to_policymodels` ENABLE KEYS */; UNLOCK TABLES; @@ -155,10 +155,10 @@ 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_rwh4R_v1_0_ResourceInstanceName1_tca',0); -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_rwh4R_v1_0_ResourceInstanceName1_tca_3',0); -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_rwh4R_v1_0_ResourceInstanceName2_tca_2',0); -INSERT INTO `looptemplates_to_loopelementmodels` VALUES ('onap.policies.monitoring.tcagen2','LOOP_TEMPLATE_rwh4R_v1_0_ResourceInstanceName1_tca-guilin',0); +INSERT INTO `looptemplates_to_loopelementmodels` (`loop_element_model_name`, `loop_template_name`, `flow_order`) VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName1_tca',0); +INSERT INTO `looptemplates_to_loopelementmodels` (`loop_element_model_name`, `loop_template_name`, `flow_order`) VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName1_tca_3',0); +INSERT INTO `looptemplates_to_loopelementmodels` (`loop_element_model_name`, `loop_template_name`, `flow_order`) VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName2_tca_2',0); +INSERT INTO `looptemplates_to_loopelementmodels` (`loop_element_model_name`, `loop_template_name`, `flow_order`) VALUES ('onap.policies.monitoring.tcagen2','LOOP_TEMPLATE_RzsRR_v1_0_ResourceInstanceName1_tca-guilin',0); /*!40000 ALTER TABLE `looptemplates_to_loopelementmodels` ENABLE KEYS */; UNLOCK TABLES; @@ -186,13 +186,14 @@ UNLOCK TABLES; LOCK TABLES `policy_models` WRITE; /*!40000 ALTER TABLE `policy_models` DISABLE KEYS */; -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.Blacklist','1.0.0','Not found','2021-01-23 23:56:32.963597','Not found','2021-01-23 23:56:33.101248','Blacklist','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing\n the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.Blacklist:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports blacklist of entity id\'s from performing control loop\n actions on.\n properties:\n blacklist:\n type: list\n description: List of entity id\'s\n required: true\n entry_schema:\n type: string\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"xacml\"\n ]\n }\n ]\n}'); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.FrequencyLimiter','1.0.0','Not found','2021-01-23 23:56:32.937919','Not found','2021-01-23 23:56:33.101810','FrequencyLimiter','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing\n the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.FrequencyLimiter:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports limiting the frequency of actions being taken by a Actor.\n properties:\n timeWindow:\n type: integer\n description: The time window to count the actions against.\n required: true\n timeUnits:\n type: string\n description: The units of time the window is counting.\n constraints:\n - valid_values:\n - second\n - minute\n - hour\n - day\n - week\n - month\n - year\n limit:\n type: integer\n description: The limit\n required: true\n constraints:\n - greater_than: 0\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"xacml\"\n ]\n }\n ]\n}'); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.guard.common.MinMax','2.0.0','Not found','2021-01-23 23:56:32.986131','Not found','2021-01-23 23:56:32.986131','MinMax','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing\n the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.MinMax:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports Min/Max number of entity for scaling operations\n properties:\n min:\n type: integer\n required: true\n description: The minimum instances of this entity\n max:\n type: integer\n required: false\n description: The maximum instances of this entity\n',NULL); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.common.Apex','1.0.0','Not found','2021-01-23 23:56:32.914471','Not found','2021-01-23 23:56:33.102152','Apex','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.Common:\n properties:\n abatement:\n name: abatement\n type: boolean\n typeVersion: 0.0.0\n description: Whether an abatement event message will be expected for\n the control loop from DCAE.\n default: \'false\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n operations:\n name: operations\n type: list\n typeVersion: 0.0.0\n description: List of operations to be performed when Control Loop\n is triggered.\n required: true\n constraints: [\n ]\n entry_schema:\n type: onap.datatype.controlloop.Operation\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata: {\n }\n trigger:\n name: trigger\n type: string\n typeVersion: 0.0.0\n description: Initial operation to execute upon receiving an Onset\n event message for the Control Loop.\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: The unique control loop id.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.Common\n version: 1.0.0\n derived_from: tosca.policies.Root\n metadata: {\n }\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n onap.policies.controlloop.operational.common.Apex:\n properties:\n engineServiceParameters:\n name: engineServiceParameters\n type: string\n typeVersion: 0.0.0\n description: The engine parameters like name, instanceCount, policy\n implementation, parameters etc.\n required: true\n constraints: [\n ]\n metadata: {\n }\n eventOutputParameters:\n name: eventOutputParameters\n type: string\n typeVersion: 0.0.0\n description: The event output parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n javaProperties:\n name: javaProperties\n type: string\n typeVersion: 0.0.0\n description: Name/value pairs of properties to be set for APEX if\n needed.\n required: false\n constraints: [\n ]\n metadata: {\n }\n eventInputParameters:\n name: eventInputParameters\n type: string\n typeVersion: 0.0.0\n description: The event input parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.common.Apex\n version: 1.0.0\n derived_from: onap.policies.controlloop.operational.Common\n metadata: {\n }\n description: Operational policies for Apex PDP\ndata_types:\n onap.datatype.controlloop.Actor:\n constraints: [\n ]\n properties:\n payload:\n name: payload\n type: map\n typeVersion: 0.0.0\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n target:\n name: target\n type: onap.datatype.controlloop.Target\n typeVersion: 0.0.0\n description: The resource the operation should be performed on.\n required: true\n constraints: [\n ]\n metadata: {\n }\n actor:\n name: actor\n type: string\n typeVersion: 0.0.0\n description: The actor performing the operation.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n name: operation\n type: string\n typeVersion: 0.0.0\n description: The operation the actor is performing.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operation\n name: onap.datatype.controlloop.Actor\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An actor/operation/target definition\n onap.datatype.controlloop.Operation:\n constraints: [\n ]\n properties:\n failure_retries:\n name: failure_retries\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n has exceeded its max retries.\n default: final_failure_retries\n required: false\n constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: Unique identifier for the operation\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_timeout:\n name: failure_timeout\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the time out for\n the operation occurs.\n default: final_failure_timeout\n required: false\n constraints: [\n ]\n metadata: {\n }\n failure:\n name: failure\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on Actor operation\n failure.\n default: final_failure\n required: false\n constraints: [\n ]\n metadata: {\n }\n operation:\n name: operation\n type: onap.datatype.controlloop.Actor\n typeVersion: 0.0.0\n description: The definition of the operation to be performed.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_guard:\n name: failure_guard\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n is blocked due to guard policy enforcement.\n default: final_failure_guard\n required: false\n constraints: [\n ]\n metadata: {\n }\n retries:\n name: retries\n type: integer\n typeVersion: 0.0.0\n description: The number of retries the actor should attempt to perform\n the operation.\n default: \'0\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\n description: The amount of time for the actor to perform the operation.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_exception:\n name: failure_exception\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n causes an exception.\n default: final_failure_exception\n required: false\n constraints: [\n ]\n metadata: {\n }\n description:\n name: description\n type: string\n typeVersion: 0.0.0\n description: A user-friendly description of the intent for the operation\n required: false\n constraints: [\n ]\n metadata: {\n }\n success:\n name: success\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on success. A value\n of \"final_success\" indicates and end to the operation.\n default: final_success\n required: false\n constraints: [\n ]\n metadata: {\n }\n name: onap.datatype.controlloop.Operation\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An operation supported by an actor\n onap.datatype.controlloop.Target:\n constraints: [\n ]\n properties:\n entityIds:\n name: entityIds\n type: map\n typeVersion: 0.0.0\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n targetType:\n name: targetType\n type: string\n typeVersion: 0.0.0\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n metadata: {\n }\n name: onap.datatype.controlloop.Target\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: Definition for a entity in A&AI to perform a control loop operation\n on\nname: ToscaServiceTemplateSimple\nversion: 1.0.0\nmetadata: {\n }\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"drools\"\n ]\n }\n ]\n}'); -INSERT INTO `policy_models` VALUES ('onap.policies.controlloop.operational.common.Drools','1.0.0','Not found','2021-01-23 23:56:32.877171','Not found','2021-01-23 23:56:33.102699','Drools','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.common.Drools:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Operational policies for Drools PDP\n properties:\n controllerName:\n type: string\n description: Drools controller properties\n required: false\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for\n the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset\n event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop\n is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\ndata_types:\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation\n on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operations\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform\n the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value\n of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation\n failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for\n the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation\n has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation\n causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation\n is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"drools\"\n ]\n }\n ]\n}'); -INSERT INTO `policy_models` VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','1.0.0','Not found','2021-01-23 23:56:25.365554','Not found','2021-01-23 23:56:33.103172','app','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: a base policy type for all policies that govern monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: onap.datatypes.monitoring.tca_policy\n description: TCA Policy JSON\n required: true\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name\n e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to\n be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be\n analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); -INSERT INTO `policy_models` VALUES ('onap.policies.monitoring.tcagen2','1.0.0','Not found','2021-01-23 23:56:25.531567','Not found','2021-01-23 23:56:33.104041','tcagen2','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n version: 1.0.0\n name: onap.policies.Monitoring\n description: a base policy type for all policies that govern monitoring provisioning\n onap.policies.monitoring.tcagen2:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n name: onap.policies.monitoring.tcagen2\n properties:\n tca.policy:\n type: onap.datatypes.monitoring.tca_policy\n description: TCA Policy JSON\n required: true\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name\n e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to\n be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be\n analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.controlloop.guard.common.Blacklist','1.0.0','Not found','2021-03-05 17:10:27.333221','Not found','2021-03-05 17:10:27.473020','Blacklist','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing\n the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.Blacklist:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports blacklist of entity id\'s from performing control loop\n actions on.\n properties:\n blacklist:\n type: list\n description: List of entity id\'s\n required: true\n entry_schema:\n type: string\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.controlloop.guard.common.FrequencyLimiter','1.0.0','Not found','2021-03-05 17:10:27.311329','Not found','2021-03-05 17:10:27.473520','FrequencyLimiter','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing\n the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.FrequencyLimiter:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports limiting the frequency of actions being taken by a Actor.\n properties:\n timeWindow:\n type: integer\n description: The time window to count the actions against.\n required: true\n timeUnits:\n type: string\n description: The units of time the window is counting.\n constraints:\n - valid_values:\n - second\n - minute\n - hour\n - day\n - week\n - month\n - year\n limit:\n type: integer\n description: The limit\n required: true\n constraints:\n - greater_than: 0\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.controlloop.guard.common.MinMax','2.0.0','Not found','2021-03-05 17:10:27.377510','Not found','2021-03-05 17:10:27.377510','MinMax','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.guard.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n This is the base Policy Type for Guard policies that guard the execution of Operational\n Policies.\n properties:\n actor:\n type: string\n description: Specifies the Actor the guard applies to.\n required: true\n operation:\n type: string\n description: Specified the operation that the actor is performing\n the guard applies to.\n required: true\n timeRange:\n type: tosca.datatypes.TimeInterval\n description: |\n An optional range of time during the day the guard policy is valid for.\n required: false\n id:\n type: string\n description: The Control Loop id this applies to.\n required: false\n onap.policies.controlloop.guard.common.MinMax:\n derived_from: onap.policies.controlloop.guard.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Supports Min/Max number of entity for scaling operations\n properties:\n min:\n type: integer\n required: true\n description: The minimum instances of this entity\n max:\n type: integer\n required: false\n description: The maximum instances of this entity\n',NULL); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.controlloop.operational.common.Apex','1.0.0','Not found','2021-03-05 17:10:27.289621','Not found','2021-03-05 17:10:27.473869','Apex','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.Common:\n properties:\n abatement:\n name: abatement\n type: boolean\n typeVersion: 0.0.0\n description: Whether an abatement event message will be expected for\n the control loop from DCAE.\n default: \'false\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n operations:\n name: operations\n type: list\n typeVersion: 0.0.0\n description: List of operations to be performed when Control Loop\n is triggered.\n required: true\n constraints: [\n ]\n entry_schema:\n type: onap.datatype.controlloop.Operation\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata: {\n }\n trigger:\n name: trigger\n type: string\n typeVersion: 0.0.0\n description: Initial operation to execute upon receiving an Onset\n event message for the Control Loop.\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: The unique control loop id.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.Common\n version: 1.0.0\n derived_from: tosca.policies.Root\n metadata: {\n }\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n onap.policies.controlloop.operational.common.Apex:\n properties:\n engineServiceParameters:\n name: engineServiceParameters\n type: string\n typeVersion: 0.0.0\n description: The engine parameters like name, instanceCount, policy\n implementation, parameters etc.\n required: true\n constraints: [\n ]\n metadata: {\n }\n eventOutputParameters:\n name: eventOutputParameters\n type: string\n typeVersion: 0.0.0\n description: The event output parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n javaProperties:\n name: javaProperties\n type: string\n typeVersion: 0.0.0\n description: Name/value pairs of properties to be set for APEX if\n needed.\n required: false\n constraints: [\n ]\n metadata: {\n }\n eventInputParameters:\n name: eventInputParameters\n type: string\n typeVersion: 0.0.0\n description: The event input parameters.\n required: true\n constraints: [\n ]\n metadata: {\n }\n name: onap.policies.controlloop.operational.common.Apex\n version: 1.0.0\n derived_from: onap.policies.controlloop.operational.Common\n metadata: {\n }\n description: Operational policies for Apex PDP\ndata_types:\n onap.datatype.controlloop.Actor:\n constraints: [\n ]\n properties:\n payload:\n name: payload\n type: map\n typeVersion: 0.0.0\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n target:\n name: target\n type: onap.datatype.controlloop.Target\n typeVersion: 0.0.0\n description: The resource the operation should be performed on.\n required: true\n constraints: [\n ]\n metadata: {\n }\n actor:\n name: actor\n type: string\n typeVersion: 0.0.0\n description: The actor performing the operation.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n name: operation\n type: string\n typeVersion: 0.0.0\n description: The operation the actor is performing.\n required: true\n constraints: [\n ]\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operation\n name: onap.datatype.controlloop.Actor\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An actor/operation/target definition\n onap.datatype.controlloop.Operation:\n constraints: [\n ]\n properties:\n failure_retries:\n name: failure_retries\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n has exceeded its max retries.\n default: final_failure_retries\n required: false\n constraints: [\n ]\n metadata: {\n }\n id:\n name: id\n type: string\n typeVersion: 0.0.0\n description: Unique identifier for the operation\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_timeout:\n name: failure_timeout\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the time out for\n the operation occurs.\n default: final_failure_timeout\n required: false\n constraints: [\n ]\n metadata: {\n }\n failure:\n name: failure\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on Actor operation\n failure.\n default: final_failure\n required: false\n constraints: [\n ]\n metadata: {\n }\n operation:\n name: operation\n type: onap.datatype.controlloop.Actor\n typeVersion: 0.0.0\n description: The definition of the operation to be performed.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_guard:\n name: failure_guard\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n is blocked due to guard policy enforcement.\n default: final_failure_guard\n required: false\n constraints: [\n ]\n metadata: {\n }\n retries:\n name: retries\n type: integer\n typeVersion: 0.0.0\n description: The number of retries the actor should attempt to perform\n the operation.\n default: \'0\'\n required: true\n constraints: [\n ]\n metadata: {\n }\n timeout:\n name: timeout\n type: integer\n typeVersion: 0.0.0\n description: The amount of time for the actor to perform the operation.\n required: true\n constraints: [\n ]\n metadata: {\n }\n failure_exception:\n name: failure_exception\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke when the current operation\n causes an exception.\n default: final_failure_exception\n required: false\n constraints: [\n ]\n metadata: {\n }\n description:\n name: description\n type: string\n typeVersion: 0.0.0\n description: A user-friendly description of the intent for the operation\n required: false\n constraints: [\n ]\n metadata: {\n }\n success:\n name: success\n type: string\n typeVersion: 0.0.0\n description: Points to the operation to invoke on success. A value\n of \"final_success\" indicates and end to the operation.\n default: final_success\n required: false\n constraints: [\n ]\n metadata: {\n }\n name: onap.datatype.controlloop.Operation\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: An operation supported by an actor\n onap.datatype.controlloop.Target:\n constraints: [\n ]\n properties:\n entityIds:\n name: entityIds\n type: map\n typeVersion: 0.0.0\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n constraints: [\n ]\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: [\n ]\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n targetType:\n name: targetType\n type: string\n typeVersion: 0.0.0\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n metadata: {\n }\n name: onap.datatype.controlloop.Target\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {\n }\n description: Definition for a entity in A&AI to perform a control loop operation\n on\nname: ToscaServiceTemplateSimple\nversion: 1.0.0\nmetadata: {\n }\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"apex\",\n \"drools\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.controlloop.operational.common.Drools','1.0.0','Not found','2021-03-05 17:10:27.263600','Not found','2021-03-05 17:10:27.476583','Drools','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.controlloop.operational.common.Drools:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n description: Operational policies for Drools PDP\n properties:\n controllerName:\n type: string\n description: Drools controller properties\n required: false\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for\n the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset\n event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop\n is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\ndata_types:\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation\n on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations, ClampExecution:CDS/operations\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy\n to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform\n the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value\n of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation\n failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for\n the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation\n has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation\n causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation\n is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard\n','{\n \"supportedPdpGroups\": [\n {\n \"controlloop\": [\n \"apex\",\n \"drools\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.monitoring.cdap.tca.hi.lo.app','1.0.0','Not found','2021-03-05 17:10:19.671978','Not found','2021-03-05 17:10:27.477076','app','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n version: 1.0.0\n description: a base policy type for all policies that govern monitoring provisioning\n onap.policies.monitoring.cdap.tca.hi.lo.app:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n properties:\n tca_policy:\n type: onap.datatypes.monitoring.tca_policy\n description: TCA Policy JSON\n required: true\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name\n e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to\n be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be\n analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.monitoring.tcagen2','1.0.0','Not found','2021-03-05 17:10:19.809945','Not found','2021-03-05 17:10:27.477416','tcagen2','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n version: 1.0.0\n name: onap.policies.Monitoring\n description: a base policy type for all policies that govern monitoring provisioning\n onap.policies.monitoring.tcagen2:\n derived_from: onap.policies.Monitoring\n version: 1.0.0\n name: onap.policies.monitoring.tcagen2\n properties:\n tca.policy:\n type: onap.datatypes.monitoring.tca_policy\n description: TCA Policy JSON\n required: true\ndata_types:\n onap.datatypes.monitoring.metricsPerEventName:\n derived_from: tosca.datatypes.Root\n properties:\n controlLoopSchemaType:\n type: string\n required: true\n description: Specifies Control Loop Schema Type for the event Name\n e.g. VNF, VM\n constraints:\n - valid_values:\n - VM\n - VNF\n eventName:\n type: string\n required: true\n description: Event name to which thresholds need to be applied\n policyName:\n type: string\n required: true\n description: TCA Policy Scope Name\n policyScope:\n type: string\n required: true\n description: TCA Policy Scope\n policyVersion:\n type: string\n required: true\n description: TCA Policy Scope Version\n thresholds:\n type: list\n required: true\n description: Thresholds associated with eventName\n entry_schema:\n type: onap.datatypes.monitoring.thresholds\n onap.datatypes.monitoring.tca_policy:\n derived_from: tosca.datatypes.Root\n properties:\n domain:\n type: string\n required: true\n description: Domain name to which TCA needs to be applied\n default: measurementsForVfScaling\n constraints:\n - equal: measurementsForVfScaling\n metricsPerEventName:\n type: list\n required: true\n description: Contains eventName and threshold details that need to\n be applied to given eventName\n entry_schema:\n type: onap.datatypes.monitoring.metricsPerEventName\n onap.datatypes.monitoring.thresholds:\n derived_from: tosca.datatypes.Root\n properties:\n closedLoopControlName:\n type: string\n required: true\n description: Closed Loop Control Name associated with the threshold\n closedLoopEventStatus:\n type: string\n required: true\n description: Closed Loop Event Status of the threshold\n constraints:\n - valid_values:\n - ONSET\n - ABATED\n direction:\n type: string\n required: true\n description: Direction of the threshold\n constraints:\n - valid_values:\n - LESS\n - LESS_OR_EQUAL\n - GREATER\n - GREATER_OR_EQUAL\n - EQUAL\n fieldPath:\n type: string\n required: true\n description: Json field Path as per CEF message which needs to be\n analyzed for TCA\n constraints:\n - valid_values:\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated\n - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait\n - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage\n - $.event.measurementsForVfScalingFields.meanRequestLatency\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree\n - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed\n - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\n severity:\n type: string\n required: true\n description: Threshold Event Severity\n constraints:\n - valid_values:\n - CRITICAL\n - MAJOR\n - MINOR\n - WARNING\n - NORMAL\n thresholdValue:\n type: integer\n required: true\n description: Threshold value for the field Path inside CEF message\n version:\n type: string\n required: true\n description: Version number associated with the threshold\n','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); +INSERT INTO `policy_models` (`policy_model_type`, `version`, `created_by`, `created_timestamp`, `updated_by`, `updated_timestamp`, `policy_acronym`, `policy_tosca`, `policy_pdp_group`) VALUES ('onap.policies.Naming','1.0.0','Not found','2021-03-05 17:10:27.355402','Not found','2021-03-05 17:10:27.477691','Naming','tosca_definitions_version: tosca_simple_yaml_1_1_0\npolicy_types:\n onap.policies.Naming:\n derived_from: tosca.policies.Root\n version: 1.0.0\n name: onap.policies.Naming\n description: Virtual policy node for naming\n properties:\n policy-instance-name:\n type: string\n naming-models:\n type: list\n entry_schema:\n type: policy.data.naming-model-entity\ndata_types:\n policy.data.naming-model-entity:\n derived_from: tosca.datatypes.Root\n properties:\n nfRole:\n type: string\n required: false\n metadata:\n matchable: true\n naming-type:\n type: string\n required: true\n metadata:\n matchable: true\n naming-recipe:\n type: string\n required: true\n name-operation:\n type: string\n required: false\n naming-properties:\n type: list\n required: true\n entry_schema:\n type: policy.data.naming-property\n policy.data.naming-property:\n derived_from: tosca.datatypes.Root\n properties:\n property-name:\n type: string\n required: true\n metadata:\n matchable: true\n property-value:\n type: string\n required: false\n property-operation:\n type: string\n required: false\n source-system:\n type: string\n required: false\n source-endpoint:\n type: string\n required: false\n increment-sequence:\n type: policy.data.increment-sequence\n required: false\n policy.data.increment-sequence:\n derived_from: tosca.datatypes.Root\n properties:\n scope:\n type: list\n required: true\n entry_schema:\n type: string\n constraints:\n - valid_values:\n - CLOUD_REGION_ID\n - LOCATION_CLLI\n - VNF\n - VM\n - VFMODULE\n - PRECEEDING\n - TRAILING\n - ENTIRETY\n sequence-type:\n type: string\n require: true\n entry_schema:\n type: string\n constraints:\n - valid_values:\n - numeric\n - alpha-numeric\n start-value:\n type: string\n required: true\n max:\n type: string\n required: false\n increment:\n type: string\n required: true\n length:\n type: string\n required: true\n','{\n \"supportedPdpGroups\": [\n {\n \"monitoring\": [\n \"xacml\"\n ]\n }\n ]\n}'); /*!40000 ALTER TABLE `policy_models` ENABLE KEYS */; UNLOCK TABLES; @@ -202,7 +203,7 @@ UNLOCK TABLES; LOCK TABLES `services` WRITE; /*!40000 ALTER TABLE `services` DISABLE KEYS */; -INSERT INTO `services` VALUES ('63cac700-ab9a-4115-a74f-7eac85e3fce0','vLoadBalancerMS','{\n \"CP\": {},\n \"VL\": {},\n \"VF\": {\n \"vLoadBalancerMS 0\": {\n \"resourceVendor\": \"Test\",\n \"name\": \"vLoadBalancerMS\",\n \"resourceVendorModelNumber\": \"\",\n \"description\": \"vLBMS\",\n \"invariantUUID\": \"1a31b9f2-e50d-43b7-89b3-a040250cf506\",\n \"UUID\": \"b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6\",\n \"type\": \"VF\",\n \"category\": \"Application L4+\",\n \"subcategory\": \"Load Balancer\",\n \"version\": \"1.0\",\n \"customizationUUID\": \"465246dc-7748-45f4-a013-308d92922552\",\n \"resourceVendorRelease\": \"1.0\",\n \"controllerProperties\": {\n \"sdnc_model_name\": \"baseconfiguration\",\n \"sdnc_model_version\": \"1.0.0\",\n \"workflows\": {\n \"resource-assignment\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"activate-restconf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"activate-cli\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"assign-activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"imperative-test-wf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"CR\": {},\n \"VFC\": {},\n \"PNF\": {},\n \"Service\": {},\n \"CVFC\": {},\n \"Service Proxy\": {},\n \"Configuration\": {},\n \"AllottedResource\": {},\n \"VFModule\": {\n \"Vloadbalancerms..vpkg..module-1\": {\n \"vfModuleModelInvariantUUID\": \"ca052563-eb92-4b5b-ad41-9111768ce043\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vpkg..module-1\",\n \"vfModuleModelUUID\": \"1e725ccc-b823-4f67-82b9-4f4367070dbc\",\n \"vfModuleModelCustomizationUUID\": \"1bffdc31-a37d-4dee-b65c-dde623a76e52\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vpkg\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vdns..module-3\": {\n \"vfModuleModelInvariantUUID\": \"4c10ba9b-f88f-415e-9de3-5d33336047fa\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vdns..module-3\",\n \"vfModuleModelUUID\": \"4fa73b49-8a6c-493e-816b-eb401567b720\",\n \"vfModuleModelCustomizationUUID\": \"bafcdab0-801d-4d81-9ead-f464640a38b1\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vdns\",\n \"max_vf_module_instances\": 50,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..base_template..module-0\": {\n \"vfModuleModelInvariantUUID\": \"921f7c96-ebdd-42e6-81b9-1cfc0c9796f3\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..base_template..module-0\",\n \"vfModuleModelUUID\": \"63734409-f745-4e4d-a38b-131638a0edce\",\n \"vfModuleModelCustomizationUUID\": \"86baddea-c730-4fb8-9410-cd2e17fd7f27\",\n \"min_vf_module_instances\": 1,\n \"vf_module_label\": \"base_template\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Base\",\n \"isBase\": true,\n \"initial_count\": 1,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vlb..module-2\": {\n \"vfModuleModelInvariantUUID\": \"a772a1f4-0064-412c-833d-4749b15828dd\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vlb..module-2\",\n \"vfModuleModelUUID\": \"0f5c3f6a-650a-4303-abb6-fff3e573a07a\",\n \"vfModuleModelCustomizationUUID\": \"96a78aad-4ffb-4ef0-9c4f-deb03bf1d806\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vlb\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n }\n }\n}','{\n \"serviceType\": \"\",\n \"serviceRole\": \"\",\n \"description\": \"vLBMS\",\n \"type\": \"Service\",\n \"instantiationType\": \"A-la-carte\",\n \"namingPolicy\": \"\",\n \"serviceEcompNaming\": \"true\",\n \"environmentContext\": \"General_Revenue-Bearing\",\n \"name\": \"vLoadBalancerMS\",\n \"invariantUUID\": \"30ec5b59-4799-48d8-ac5f-1058a6b0e48f\",\n \"ecompGeneratedNaming\": \"true\",\n \"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fce0\",\n \"category\": \"Network L4+\"\n}','1.0'); +INSERT INTO `services` (`service_uuid`, `name`, `resource_details`, `service_details`, `version`) VALUES ('63cac700-ab9a-4115-a74f-7eac85e3fce0','vLoadBalancerMS','{\n \"CP\": {},\n \"VL\": {},\n \"VF\": {\n \"vLoadBalancerMS 0\": {\n \"resourceVendor\": \"Test\",\n \"name\": \"vLoadBalancerMS\",\n \"resourceVendorModelNumber\": \"\",\n \"description\": \"vLBMS\",\n \"invariantUUID\": \"1a31b9f2-e50d-43b7-89b3-a040250cf506\",\n \"UUID\": \"b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6\",\n \"type\": \"VF\",\n \"category\": \"Application L4+\",\n \"subcategory\": \"Load Balancer\",\n \"version\": \"1.0\",\n \"customizationUUID\": \"465246dc-7748-45f4-a013-308d92922552\",\n \"resourceVendorRelease\": \"1.0\",\n \"controllerProperties\": {\n \"sdnc_model_name\": \"baseconfiguration\",\n \"sdnc_model_version\": \"1.0.0\",\n \"workflows\": {\n \"resource-assignment\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"activate-restconf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"activate-cli\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"assign-activate\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n },\n \"imperative-test-wf\": {\n \"inputs\": {\n \"resource-assignment-properties\": {\n \"type\": \"object\",\n \"properties\": {\n \"request-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"service-instance-id\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"hostname\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"request-info\": {\n \"type\": \"object\",\n \"properties\": {\n \"prop1\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n },\n \"prop2\": {\n \"required\": true,\n \"type\": \"string\",\n \"input-param\": true\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"CR\": {},\n \"VFC\": {},\n \"PNF\": {},\n \"Service\": {},\n \"CVFC\": {},\n \"Service Proxy\": {},\n \"Configuration\": {},\n \"AllottedResource\": {},\n \"VFModule\": {\n \"Vloadbalancerms..vpkg..module-1\": {\n \"vfModuleModelInvariantUUID\": \"ca052563-eb92-4b5b-ad41-9111768ce043\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vpkg..module-1\",\n \"vfModuleModelUUID\": \"1e725ccc-b823-4f67-82b9-4f4367070dbc\",\n \"vfModuleModelCustomizationUUID\": \"1bffdc31-a37d-4dee-b65c-dde623a76e52\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vpkg\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vdns..module-3\": {\n \"vfModuleModelInvariantUUID\": \"4c10ba9b-f88f-415e-9de3-5d33336047fa\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vdns..module-3\",\n \"vfModuleModelUUID\": \"4fa73b49-8a6c-493e-816b-eb401567b720\",\n \"vfModuleModelCustomizationUUID\": \"bafcdab0-801d-4d81-9ead-f464640a38b1\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vdns\",\n \"max_vf_module_instances\": 50,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n },\n \"Vloadbalancerms..base_template..module-0\": {\n \"vfModuleModelInvariantUUID\": \"921f7c96-ebdd-42e6-81b9-1cfc0c9796f3\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..base_template..module-0\",\n \"vfModuleModelUUID\": \"63734409-f745-4e4d-a38b-131638a0edce\",\n \"vfModuleModelCustomizationUUID\": \"86baddea-c730-4fb8-9410-cd2e17fd7f27\",\n \"min_vf_module_instances\": 1,\n \"vf_module_label\": \"base_template\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Base\",\n \"isBase\": true,\n \"initial_count\": 1,\n \"volume_group\": false\n },\n \"Vloadbalancerms..vlb..module-2\": {\n \"vfModuleModelInvariantUUID\": \"a772a1f4-0064-412c-833d-4749b15828dd\",\n \"vfModuleModelVersion\": \"1\",\n \"vfModuleModelName\": \"Vloadbalancerms..vlb..module-2\",\n \"vfModuleModelUUID\": \"0f5c3f6a-650a-4303-abb6-fff3e573a07a\",\n \"vfModuleModelCustomizationUUID\": \"96a78aad-4ffb-4ef0-9c4f-deb03bf1d806\",\n \"min_vf_module_instances\": 0,\n \"vf_module_label\": \"vlb\",\n \"max_vf_module_instances\": 1,\n \"vf_module_type\": \"Expansion\",\n \"isBase\": false,\n \"initial_count\": 0,\n \"volume_group\": false\n }\n }\n}','{\n \"serviceType\": \"\",\n \"serviceRole\": \"\",\n \"description\": \"vLBMS\",\n \"type\": \"Service\",\n \"instantiationType\": \"A-la-carte\",\n \"namingPolicy\": \"\",\n \"serviceEcompNaming\": \"true\",\n \"environmentContext\": \"General_Revenue-Bearing\",\n \"name\": \"vLoadBalancerMS\",\n \"invariantUUID\": \"30ec5b59-4799-48d8-ac5f-1058a6b0e48f\",\n \"ecompGeneratedNaming\": \"true\",\n \"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fce0\",\n \"category\": \"Network L4+\"\n}','1.0'); /*!40000 ALTER TABLE `services` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -214,4 +215,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-01-23 22:57:34 +-- Dump completed on 2021-03-05 16:11:22 diff --git a/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java b/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java index d57ce2095..fd5079c47 100644 --- a/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java +++ b/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java @@ -40,10 +40,10 @@ public class JsonUtils { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(JsonUtils.class); - public static final Gson GSON = new GsonBuilder() + public static final Gson GSON = new GsonBuilder().setPrettyPrinting() .registerTypeAdapter(SecureServicePermission.class, new SecureServicePermissionDeserializer()).create(); - public static final Gson GSON_JPA_MODEL = new GsonBuilder() + public static final Gson GSON_JPA_MODEL = new GsonBuilder().setPrettyPrinting() .registerTypeAdapter(Instant.class, new InstantSerializer()) .registerTypeAdapter(Instant.class, new InstantDeserializer()).setPrettyPrinting() .excludeFieldsWithoutExposeAnnotation().create(); diff --git a/src/main/java/org/onap/policy/clamp/policy/Policy.java b/src/main/java/org/onap/policy/clamp/policy/Policy.java index 801183cab..f8bdab6c2 100644 --- a/src/main/java/org/onap/policy/clamp/policy/Policy.java +++ b/src/main/java/org/onap/policy/clamp/policy/Policy.java @@ -1,10 +1,12 @@ /*- * ============LICENSE_START======================================================= - * ONAP CLAMP + * ONAP POLICY-CLAMP * ================================================================================ * Copyright (C) 2019 Nokia Intellectual Property. All rights * reserved. * ================================================================================ + * Modifications Copyright (C) 2021 AT&T + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -91,13 +93,6 @@ public abstract class Policy extends AuditEntity { @JoinColumn(name = "policy_model_version", referencedColumnName = "version")}) private PolicyModel policyModel; - private JsonObject createJsonFromPolicyTosca() { - Map<String, Object> map = - new Yaml().load(this.getPolicyModel() != null ? this.getPolicyModel().getPolicyModelTosca() : ""); - JSONObject jsonObject = new JSONObject(map); - return new Gson().fromJson(jsonObject.toString(), JsonObject.class); - } - /** * This method create the policy payload that must be sent to PEF. * @@ -105,39 +100,12 @@ public abstract class Policy extends AuditEntity { * @throws UnsupportedEncodingException In case of failure */ public String createPolicyPayload() throws UnsupportedEncodingException { - JsonObject toscaJson = createJsonFromPolicyTosca(); - - JsonObject policyPayloadResult = new JsonObject(); - - policyPayloadResult.add("tosca_definitions_version", toscaJson.get("tosca_definitions_version")); - - JsonObject topologyTemplateNode = new JsonObject(); - policyPayloadResult.add("topology_template", topologyTemplateNode); - - JsonArray policiesArray = new JsonArray(); - topologyTemplateNode.add("policies", policiesArray); - - JsonObject thisPolicy = new JsonObject(); - policiesArray.add(thisPolicy); - - JsonObject policyDetails = new JsonObject(); - thisPolicy.add(this.getName(), policyDetails); - policyDetails.addProperty("type", this.getPolicyModel().getPolicyModelType()); - policyDetails.addProperty("type_version", this.getPolicyModel().getVersion()); - policyDetails.addProperty("version", this.getPolicyModel().getVersion()); - - JsonObject policyMetadata = new JsonObject(); - policyDetails.add("metadata", policyMetadata); - policyMetadata.addProperty("policy-id", this.getName()); - - policyDetails.add("properties", this.getConfigurationsJson()); - - String policyPayload = new GsonBuilder().setPrettyPrinting().create().toJson(policyPayloadResult); - logger.info("Policy payload: " + policyPayload); - return policyPayload; + return PolicyPayload + .createPolicyPayload(this.getPolicyModel().getPolicyModelType(), this.getPolicyModel().getVersion(), + this.getName(), this.getPolicyModel().getVersion(), this.getConfigurationsJson(), + this.getPolicyModel() != null ? this.getPolicyModel().getPolicyModelTosca() : ""); } - /** * Name getter. * @@ -172,7 +140,7 @@ public abstract class Policy extends AuditEntity { * Regenerate the Policy Json Representation. * * @param toscaConverter The tosca converter required to regenerate the json schema - * @param serviceModel The service model associated + * @param serviceModel The service model associated */ public abstract void updateJsonRepresentation(ToscaConverterWithDictionarySupport toscaConverter, Service serviceModel); diff --git a/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java b/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java index 196642589..bdd77cb41 100644 --- a/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java +++ b/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java @@ -165,7 +165,7 @@ public class PolicyEngineServices { options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); Yaml yamlParser = new Yaml(options); String responseBody = callCamelRoute( - ExchangeBuilder.anExchange(camelContext).withProperty("policyModelName", policyType) + ExchangeBuilder.anExchange(camelContext).withProperty("policyModelType", policyType) .withProperty("policyModelVersion", policyVersion).build(), "direct:get-policy-tosca-model", "Get one policy"); diff --git a/src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java b/src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java new file mode 100644 index 000000000..d2c860150 --- /dev/null +++ b/src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP POLICY-CLAMP + * ================================================================================ + * Copyright (C) 2021 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.policy.clamp.policy; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.io.UnsupportedEncodingException; +import java.util.Map; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.yaml.snakeyaml.Yaml; + +/** + * This class is a utility class to create the policy payload. + */ +public class PolicyPayload { + + private static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyPayload.class); + + private static JsonObject createJsonFromPolicyTosca(String toscaContent) { + Map<String, Object> map = + new Yaml().load(!StringUtils.isEmpty(toscaContent) ? toscaContent : ""); + return JsonUtils.GSON.fromJson(new JSONObject(map).toString(), JsonObject.class); + } + + /** + * This method create the policy payload that must be sent to PEF. + * + * @return A String containing the payload + * @throws UnsupportedEncodingException In case of failure + */ + public static String createPolicyPayload(String policyModelType, String policyModelVersion, String policyName, + String policyVersion, JsonObject policyProperties, String toscaContent) + throws UnsupportedEncodingException { + JsonObject policyPayloadResult = new JsonObject(); + + policyPayloadResult.add("tosca_definitions_version", + createJsonFromPolicyTosca(toscaContent).get("tosca_definitions_version")); + + JsonObject topologyTemplateNode = new JsonObject(); + policyPayloadResult.add("topology_template", topologyTemplateNode); + + JsonArray policiesArray = new JsonArray(); + topologyTemplateNode.add("policies", policiesArray); + + JsonObject thisPolicy = new JsonObject(); + policiesArray.add(thisPolicy); + + JsonObject policyDetails = new JsonObject(); + thisPolicy.add(policyName, policyDetails); + policyDetails.addProperty("type", policyModelType); + policyDetails.addProperty("type_version", policyModelVersion); + policyDetails.addProperty("version", policyVersion); + policyDetails.addProperty("name", policyName); + + JsonObject policyMetadata = new JsonObject(); + policyDetails.add("metadata", policyMetadata); + policyMetadata.addProperty("policy-id", policyName); + policyMetadata.addProperty("policy-version", policyVersion); + + policyDetails.add("properties", policyProperties); + + String policyPayload = JsonUtils.GSON.toJson(policyPayloadResult); + logger.info("Policy payload: " + policyPayload); + return policyPayload; + } +}
\ No newline at end of file diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml index 01ad8a8a3..7de2de1c9 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -500,7 +500,7 @@ <simple resultType="java.lang.Boolean">false</simple> </setProperty> <to uri="direct:delete-policy-from-loop-object"/> - <to uri="direct:create-policy"/> + <to uri="direct:create-policy-from-loop-object"/> </split> <log loggingLevel="INFO" message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}"/> @@ -517,7 +517,7 @@ </setProperty> <to uri="direct:delete-policy-from-loop-object"/> - <to uri="direct:create-policy"/> + <to uri="direct:create-policy-from-loop-object"/> </split> <delay> @@ -1363,32 +1363,35 @@ </get> <!-- Create a new policy --> - <post uri="/v2/policies/{policyModelName}/{policyModelVersion}" + <post uri="/v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}" type="com.google.gson.JsonElement" consumes="application/json" outType="com.google.gson.JsonObject" produces="application/json"> <route> <removeHeaders pattern="*" - excludePattern="policyModelName|policyModelVersion"/> + excludePattern="policyModelType|policyModelVersion|policyName|policyVersion"/> <doTry> <to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'CREATE a new Policy ')"/> <to uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'policies','','update')"/> - <setProperty propertyName="policyModelName"> - <simple>${header.policyModelName}</simple> + <setProperty propertyName="policyModelType"> + <simple>${header.policyModelType}</simple> </setProperty> <setProperty propertyName="policyModelVersion"> <simple>${header.policyModelVersion}</simple> </setProperty> + <setProperty propertyName="policyProperties"> + <simple>${body}</simple> + </setProperty> + <to + uri="bean:org.onap.policy.clamp.loop.template.PolicyModelsService?method=getPolicyModelTosca(${header.policyModelType},${header.policyModelVersion})"/> <setBody> - <method ref="org.onap.policy.clamp.policy.pdpgroup.PoliciesPdpMerger" - method="removePdpStatesOnePolicy(${body})"/> + <method ref="org.onap.policy.clamp.policy.PolicyPayload" + method="createPolicyPayload(${header.policyModelType}, ${header.policyModelVersion}, + ${header.policyName}, ${header.policyVersion}, ${exchangeProperty[policyProperties]}, ${body})"/> </setBody> - <setBody> - <simple>${body.toString()}</simple> - </setBody> <to uri="direct:create-policy"/> <to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=endLog()"/> diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index f9f2b1d72..c92617856 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -183,7 +183,7 @@ <simple>${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}</simple> </setProperty> <setProperty propertyName="policyModelVersion"> - <simple>${exchangeProperty[policy].getPolicyModel().getVersion()</simple> + <simple>${exchangeProperty[policy].getPolicyModel().getVersion()}</simple> </setProperty> <setProperty propertyName="policyName"> <simple>${exchangeProperty[policy].getName()}</simple> @@ -386,7 +386,7 @@ <from uri="direct:get-policy-tosca-model"/> <doTry> <log loggingLevel="INFO" - message="Getting the policy tosca model: ${exchangeProperty[policyModelName]}/${exchangeProperty[policyModelVersion]}"/> + message="Getting the policy tosca model: ${exchangeProperty[policyModelType]}/${exchangeProperty[policyModelVersion]}"/> <to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy model')"/> <setHeader headerName="CamelHttpMethod"> @@ -405,9 +405,9 @@ </simple> </setHeader> <log loggingLevel="INFO" - message="Endpoint to get policy model: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}"></log> + message="Endpoint to get policy model: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelType]}/versions/${exchangeProperty[policyModelVersion]}"></log> <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelType]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> <convertBodyTo type="java.lang.String"/> <doFinally> <to uri="direct:reset-raise-http-exception-flag"/> diff --git a/ui-react-lib/libIndex.js b/ui-react-lib/libIndex.js index eef1ca215..a8c3d1cfc 100755 --- a/ui-react-lib/libIndex.js +++ b/ui-react-lib/libIndex.js @@ -42,6 +42,8 @@ export { default as OnapUtils } from './src/utils/OnapUtils'; export { default as OpenLoopModal } from './src/components/dialogs/Loop/OpenLoopModal'; export { default as PerformActions } from './src/components/dialogs/PerformActions'; export { default as PolicyModal } from './src/components/dialogs/Policy/PolicyModal'; +export { default as ToscaViewer } from './src/components/dialogs/Policy/ToscaViewer'; +export { default as PolicyEditor } from './src/components/dialogs/Policy/PolicyEditor'; export { default as PolicyToscaService } from './src/api/PolicyToscaService'; export { default as RefreshStatus } from './src/components/dialogs/RefreshStatus'; export { default as SvgGenerator } from './src/components/loop_viewer/svg/SvgGenerator'; diff --git a/ui-react/package.json b/ui-react/package.json index 232096926..83c9c77a6 100644 --- a/ui-react/package.json +++ b/ui-react/package.json @@ -36,7 +36,8 @@ "@material-ui/core": "4.9.11", "@material-ui/icons": "4.9.1", "material-table": "1.57.2", - "react-select": "3.0.8" + "react-select": "3.0.8", + "react-uuid": "1.0.2" }, "devDependencies": { "jest": "24.8.0", diff --git a/ui-react/src/__snapshots__/OnapClamp.test.js.snap b/ui-react/src/__snapshots__/OnapClamp.test.js.snap index fd1b0d57d..c7c7ecbaa 100644 --- a/ui-react/src/__snapshots__/OnapClamp.test.js.snap +++ b/ui-react/src/__snapshots__/OnapClamp.test.js.snap @@ -23,7 +23,9 @@ exports[`Verify OnapClamp Test the render method 1`] = ` "menuFontColor": "black", "menuHighlightedBackgroundColor": "#337ab7", "menuHighlightedFontColor": "white", - "toscaTextareaBackgroundColor": "#E8E8E8", + "policyEditorBackgroundColor": "white", + "policyEditorFontSize": "13px", + "toscaTextareaBackgroundColor": "white", "toscaTextareaFontSize": "13px", } } diff --git a/ui-react/src/api/PolicyService.js b/ui-react/src/api/PolicyService.js index a77a8bdb0..a9f44b2a4 100644 --- a/ui-react/src/api/PolicyService.js +++ b/ui-react/src/api/PolicyService.js @@ -43,8 +43,9 @@ export default class PolicyService { return ""; }) } - static createNewPolicy(policyModelType, policyModelVersion, policyJson) { - return fetch(window.location.pathname + 'restservices/clds/v2/policies/' + policyModelType + '/' + policyModelVersion, { + static createNewPolicy(policyModelType, policyModelVersion, policyName, policyVersion, policyJson) { + return fetch(window.location.pathname + 'restservices/clds/v2/policies/' + policyModelType + '/' + + policyModelVersion + '/' + policyName + '/' + policyVersion, { method: 'POST', credentials: 'same-origin', headers: { diff --git a/ui-react/src/api/PolicyToscaService.js b/ui-react/src/api/PolicyToscaService.js index 351126328..c54e768a9 100644 --- a/ui-react/src/api/PolicyToscaService.js +++ b/ui-react/src/api/PolicyToscaService.js @@ -39,43 +39,43 @@ export default class PolicyToscaService { } static getToscaPolicyModelYaml(policyModelType, policyModelVersion) { - return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/yaml/' + policyModelType + "/" + policyModelVersion, { - method: 'GET', - credentials: 'same-origin' - }) - .then(function (response) { - console.debug("getToscaPolicyModelYaml response received: ", response.status); - if (response.ok) { - return response.json(); - } else { - console.error("getToscaPolicyModelYaml query failed"); - return ""; - } - }) - .catch(function (error) { - console.error("getToscaPolicyModelYaml error received", error); - return ""; - }); + return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/yaml/' + policyModelType + "/" + policyModelVersion, { + method: 'GET', + credentials: 'same-origin' + }) + .then(function (response) { + console.debug("getToscaPolicyModelYaml response received: ", response.status); + if (response.ok) { + return response.json(); + } else { + console.error("getToscaPolicyModelYaml query failed"); + return ""; + } + }) + .catch(function (error) { + console.error("getToscaPolicyModelYaml error received", error); + return ""; + }); } static getToscaPolicyModel(policyModelType, policyModelVersion) { - return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/' + policyModelType + "/" + policyModelVersion, { - method: 'GET', - credentials: 'same-origin' - }) - .then(function (response) { - console.debug("getToscaPolicyModel response received: ", response.status); - if (response.ok) { - return response.json(); - } else { - console.error("getToscaPolicyModel query failed"); - return {}; - } - }) - .catch(function (error) { - console.error("getToscaPolicyModel error received", error); - return {}; - }); + return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/' + policyModelType + "/" + policyModelVersion, { + method: 'GET', + credentials: 'same-origin' + }) + .then(function (response) { + console.debug("getToscaPolicyModel response received: ", response.status); + if (response.ok) { + return response.json(); + } else { + console.error("getToscaPolicyModel query failed"); + return {}; + } + }) + .catch(function (error) { + console.error("getToscaPolicyModel error received", error); + return {}; + }); } static createPolicyModelFromToscaModel(jsonData) { diff --git a/ui-react/src/components/dialogs/Policy/PolicyEditor.js b/ui-react/src/components/dialogs/Policy/PolicyEditor.js new file mode 100644 index 000000000..e329e0c32 --- /dev/null +++ b/ui-react/src/components/dialogs/Policy/PolicyEditor.js @@ -0,0 +1,210 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP POLICY-CLAMP + * ================================================================================ + * Copyright (C) 2021 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +import React from 'react' +import PolicyToscaService from '../../../api/PolicyToscaService'; +import JSONEditor from '@json-editor/json-editor'; +import styled from 'styled-components'; +import Button from 'react-bootstrap/Button'; +import TextField from '@material-ui/core/TextField'; +import Alert from 'react-bootstrap/Alert'; +import PolicyService from '../../../api/PolicyService'; +import OnapUtils from '../../../utils/OnapUtils'; +import uuid from 'react-uuid'; + +const DivWhiteSpaceStyled = styled.div` + white-space: pre; +` + +const JsonEditorDiv = styled.div` + margin-top: 20px; + background-color: ${props => props.theme.loopViewerBackgroundColor}; + text-align: justify; + font-size: ${props => props.theme.policyEditorFontSize}; +` +const PanelDiv = styled.div` + margin-top: 20px; + text-align: justify; + font-size: ${props => props.theme.policyEditorFontSize}; + background-color: ${props => props.theme.loopViewerBackgroundColor}; +` + +export default class PolicyEditor extends React.Component { + + state = { + policyModelType: this.props.policyModelType, + policyModelTypeVersion: this.props.policyModelTypeVersion, + policyName: (typeof this.props.policyName !== "undefined") ? this.props.policyName : "org.onap.policy.new", + policyVersion: (typeof this.props.policyVersion !== "undefined") ? this.props.policyVersion : "0.0.1", + policyProperties: this.props.policyProperties, + showSuccessAlert: false, + showFailAlert: false, + jsonEditor: null, + jsonEditorDivId: uuid(), + } + + constructor(props, context) { + super(props, context); + this.createJsonEditor = this.createJsonEditor.bind(this); + this.getToscaModelForPolicy = this.getToscaModelForPolicy.bind(this); + this.disableAlert = this.disableAlert.bind(this); + this.handleCreateNewVersion = this.handleCreateNewVersion.bind(this); + this.handleChangePolicyName = this.handleChangePolicyName.bind(this); + this.handleChangePolicyVersion = this.handleChangePolicyVersion.bind(this); + } + + disableAlert() { + this.setState ({ showSuccessAlert: false, showFailAlert: false }); + } + + customValidation(editorData) { + // method for sub-classes to override with customized validation + return []; + } + + handleCreateNewVersion() { + var editorData = this.state.jsonEditor.getValue(); + var errors = this.state.jsonEditor.validate(); + errors = errors.concat(this.customValidation(editorData)); + + if (errors.length !== 0) { + console.error("Errors detected during policy data validation ", errors); + this.setState({ + showFailAlert: true, + showMessage: 'Errors detected during policy data validation:\n' + OnapUtils.jsonEditorErrorFormatter(errors) + }); + return; + } else { + console.info("NO validation errors found in policy data"); + PolicyService.createNewPolicy(this.state.policyModelType, this.state.policyModelTypeVersion, + this.state.policyName, this.state.policyVersion, editorData).then(respPolicyCreation => { + if (respPolicyCreation === "") { + //it indicates a failure + this.setState({ + showFailAlert: true, + showMessage: 'Policy Creation Failure' + }); + } else { + this.setState({ + showSuccessAlert: true, + showMessage: 'Policy '+ this.state.policyName + '/' + this.state.policyVersion + ' created successfully' + }); + } + }) + } + } + + bumpVersion(versionToBump) { + let semVer = versionToBump.split("."); + return parseInt(semVer[0])+1 + "." + semVer[1] + "." + semVer[2]; + } + + getToscaModelForPolicy() { + PolicyToscaService.getToscaPolicyModel(this.state.policyModelType, this.state.policyModelTypeVersion).then(respJsonPolicyTosca => { + if (respJsonPolicyTosca !== {}) { + this.setState({ + jsonSchemaPolicyTosca: respJsonPolicyTosca, + jsonEditor: this.createJsonEditor(respJsonPolicyTosca, this.state.policyProperties), + }) + } + }); + } + + componentDidMount() { + this.getToscaModelForPolicy(); + } + + createJsonEditor(toscaModel, editorData) { + JSONEditor.defaults.themes.myBootstrap4 = JSONEditor.defaults.themes.bootstrap4.extend({ + getTab: function(text,tabId) { + var liel = document.createElement('li'); + liel.classList.add('nav-item'); + var ael = document.createElement("a"); + ael.classList.add("nav-link"); + ael.setAttribute("style",'padding:10px;max-width:160px;'); + ael.setAttribute("href", "#" + tabId); + ael.setAttribute('data-toggle', 'tab'); + text.setAttribute("style",'word-wrap:break-word;'); + ael.appendChild(text); + liel.appendChild(ael); + return liel; + } + }); + return new JSONEditor(document.getElementById(this.state.jsonEditorDivId), + { + schema: toscaModel, + startval: editorData, + theme: 'myBootstrap4', + object_layout: 'grid', + disable_properties: false, + disable_edit_json: false, + disable_array_reorder: true, + disable_array_delete_last_row: true, + disable_array_delete_all_rows: false, + array_controls_top: true, + keep_oneof_values: false, + collapsed:true, + show_errors: 'always', + display_required_only: false, + show_opt_in: false, + prompt_before_delete: true, + required_by_default: false + }) + } + + handleChangePolicyName(event) { + this.setState({ + policyName: event.target.value, + }); + } + + handleChangePolicyVersion(event) { + this.setState({ + policyVersion: event.target.value, + }); + } + + render() { + return ( + <PanelDiv> + <Alert variant="success" show={this.state.showSuccessAlert} onClose={this.disableAlert} dismissible> + <DivWhiteSpaceStyled> + {this.state.showMessage} + </DivWhiteSpaceStyled> + </Alert> + <Alert variant="danger" show={this.state.showFailAlert} onClose={this.disableAlert} dismissible> + <DivWhiteSpaceStyled> + {this.state.showMessage} + </DivWhiteSpaceStyled> + </Alert> + <TextField required id="policyName" label="Required" defaultValue={this.state.policyName} + onChange={this.handleChangePolicyName} variant="outlined" size="small"/> + <TextField required id="policyVersion" label="Required" defaultValue={this.state.policyVersion} + onChange={this.handleChangePolicyVersion} size="small" variant="outlined"/> + <Button variant="secondary" title="Create a new policy version from the defined parameters" + onClick={this.handleCreateNewVersion}>Create New Version</Button> + <JsonEditorDiv id={this.state.jsonEditorDivId} title="Policy Properties"/> + </PanelDiv> + ); + } +}
\ No newline at end of file diff --git a/ui-react/src/components/dialogs/Policy/ToscaViewer.js b/ui-react/src/components/dialogs/Policy/ToscaViewer.js new file mode 100644 index 000000000..06e83164d --- /dev/null +++ b/ui-react/src/components/dialogs/Policy/ToscaViewer.js @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP POLICY-CLAMP + * ================================================================================ + * Copyright (C) 2021 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +import React from 'react' +import PolicyToscaService from '../../../api/PolicyToscaService'; +import styled from 'styled-components'; +import Button from 'react-bootstrap/Button'; + +const JsonEditorDiv = styled.div` + margin-top: 20px; + background-color: ${props => props.theme.toscaTextareaBackgroundColor}; + text-align: justify; + font-size: ${props => props.theme.toscaTextareaFontSize}; + width: 100%; + height: 30%; +` + +export default class ToscaViewer extends React.Component { + + state = { + toscaData: this.props.toscaData, + yamlPolicyTosca: this.getToscaModelYamlFor(this.props.toscaData), + } + + constructor(props, context) { + super(props, context); + this.getToscaModelYamlFor = this.getToscaModelYamlFor.bind(this); + } + + getToscaModelYamlFor(toscaData) { + PolicyToscaService.getToscaPolicyModelYaml(toscaData["policyModelType"], toscaData["version"]).then(respYamlPolicyTosca => { + this.setState({ + yamlPolicyTosca: respYamlPolicyTosca, + }) + }); + } + + render() { + return ( + <JsonEditorDiv> + <pre>{this.state.yamlPolicyTosca}</pre> + <Button variant="secondary" title="Create a new policy version from the defined parameters" + onClick={this.handleCreateNewVersion}>Create New Version</Button> + </JsonEditorDiv> + ); + } +}
\ No newline at end of file diff --git a/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js b/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js index b159584dd..1e71bb853 100644 --- a/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js +++ b/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js @@ -31,7 +31,7 @@ import Check from '@material-ui/icons/Check'; import ChevronLeft from '@material-ui/icons/ChevronLeft'; import ChevronRight from '@material-ui/icons/ChevronRight'; import Clear from '@material-ui/icons/Clear'; -import DeleteOutline from '@material-ui/icons/DeleteOutline'; +import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded'; import Edit from '@material-ui/icons/Edit'; import FilterList from '@material-ui/icons/FilterList'; import FirstPage from '@material-ui/icons/FirstPage'; @@ -40,42 +40,44 @@ import Remove from '@material-ui/icons/Remove'; import SaveAlt from '@material-ui/icons/SaveAlt'; import Search from '@material-ui/icons/Search'; import ViewColumn from '@material-ui/icons/ViewColumn'; +import DescriptionIcon from '@material-ui/icons/Description'; +import SettingsEthernetIcon from '@material-ui/icons/SettingsEthernet'; +import NoteAddIcon from '@material-ui/icons/NoteAdd'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Switch from '@material-ui/core/Switch'; import MaterialTable from "material-table"; import PolicyService from '../../../api/PolicyService'; import PolicyToscaService from '../../../api/PolicyToscaService'; import Select from 'react-select'; -import JSONEditor from '@json-editor/json-editor'; -import OnapUtils from '../../../utils/OnapUtils'; import Alert from 'react-bootstrap/Alert'; import Tabs from 'react-bootstrap/Tabs'; import Tab from 'react-bootstrap/Tab'; +import PolicyEditor from './PolicyEditor'; +import ToscaViewer from './ToscaViewer'; const DivWhiteSpaceStyled = styled.div` white-space: pre; ` const ModalStyled = styled(Modal)` - @media (min-width: 1200px) { + @media (min-width: 1000px) { .modal-xl { max-width: 96%; } } background-color: transparent; ` -const JsonEditorDiv = styled.div` - margin-top: 20px; - background-color: ${props => props.theme.toscaTextareaBackgroundColor}; - text-align: justify; - font-size: ${props => props.theme.toscaTextareaFontSize}; - width: 100%; - height: 30%; - border: 1px solid black; +const DetailedRow = styled.div` + margin: 0 auto; + background-color: ${props => props.theme.policyEditorBackgroundColor}; + font-size: ${props => props.theme.policyEditorFontSize}; + width: 97%; + margin-left: auto; + margin-right: 0; ` -const standardCellStyle = { border: '1px solid black' }; +const standardCellStyle = { backgroundColor: '#039be5', color: '#FFF', border: '1px solid black' }; const cellPdpGroupStyle = { backgroundColor: '#039be5', color: '#FFF', border: '1px solid black'}; const headerStyle = { backgroundColor: '#ddd', border: '2px solid black' }; const rowHeaderStyle = {backgroundColor:'#ddd', fontSize: '15pt', text: 'bold', border: '1px solid black'}; @@ -86,6 +88,8 @@ export default class ViewAllPolicies extends React.Component { content: 'Please select a policy to display it', selectedRowId: -1, policiesListData: [], + toscaModelsListData: [], + jsonEditorForPolicy: new Map(), prefixGrouping: false, showSuccessAlert: false, showFailAlert: false, @@ -128,11 +132,38 @@ export default class ViewAllPolicies extends React.Component { headerStyle: headerStyle } ], + toscaColumnsDefinition: [ + { + title: "Policy Model Type", field: "policyModelType", + cellStyle: standardCellStyle, + headerStyle: headerStyle + }, + { + title: "Policy Acronym", field: "policyAcronym", + cellStyle: standardCellStyle, + headerStyle: headerStyle + }, + { + title: "Version", field: "version", + cellStyle: standardCellStyle, + headerStyle: headerStyle + }, + { + title: "Uploaded By", field: "updatedBy", + cellStyle: standardCellStyle, + headerStyle: headerStyle + }, + { + title: "Uploaded Date", field: "updatedDate", editable: 'never', + cellStyle: standardCellStyle, + headerStyle: headerStyle + } + ], tableIcons: { Add: forwardRef((props, ref) => <AddBox {...props} ref={ref} />), Check: forwardRef((props, ref) => <Check {...props} ref={ref} />), Clear: forwardRef((props, ref) => <Clear {...props} ref={ref} />), - Delete: forwardRef((props, ref) => <DeleteOutline {...props} ref={ref} />), + Delete: forwardRef((props, ref) => <DeleteRoundedIcon {...props} ref={ref} />), DetailPanel: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />), Edit: forwardRef((props, ref) => <Edit {...props} ref={ref} />), Export: forwardRef((props, ref) => <SaveAlt {...props} ref={ref} />), @@ -154,14 +185,17 @@ export default class ViewAllPolicies extends React.Component { this.handleClose = this.handleClose.bind(this); this.renderPdpGroupDropBox = this.renderPdpGroupDropBox.bind(this); this.handlePdpGroupChange = this.handlePdpGroupChange.bind(this); - this.createJsonEditor = this.createJsonEditor.bind(this); this.handlePrefixGrouping = this.handlePrefixGrouping.bind(this); this.handleDeletePolicy = this.handleDeletePolicy.bind(this); - this.handleUpdatePolicy = this.handleUpdatePolicy.bind(this); - this.handleCreateNewVersion = this.handleCreateNewVersion.bind(this); this.disableAlert = this.disableAlert.bind(this); this.getAllPolicies(); + this.getAllToscaModels(); + } + getAllToscaModels() { + PolicyToscaService.getToscaPolicyModels().then(toscaModelsList => { + this.setState({ toscaModelsListData: toscaModelsList }); + }); } handlePdpGroupChange(e) { @@ -177,45 +211,6 @@ export default class ViewAllPolicies extends React.Component { } } - createJsonEditor(toscaModel, editorData) { - document.getElementById("policy-editor").innerHTML = ""; - JSONEditor.defaults.themes.myBootstrap4 = JSONEditor.defaults.themes.bootstrap4.extend({ - getTab: function(text,tabId) { - var liel = document.createElement('li'); - liel.classList.add('nav-item'); - var ael = document.createElement("a"); - ael.classList.add("nav-link"); - ael.setAttribute("style",'padding:10px;max-width:160px;'); - ael.setAttribute("href", "#" + tabId); - ael.setAttribute('data-toggle', 'tab'); - text.setAttribute("style",'word-wrap:break-word;'); - ael.appendChild(text); - liel.appendChild(ael); - return liel; - } - }); - return new JSONEditor(document.getElementById("policy-editor"), - { - schema: toscaModel, - startval: editorData, - theme: 'myBootstrap4', - object_layout: 'grid', - disable_properties: false, - disable_edit_json: false, - disable_array_reorder: true, - disable_array_delete_last_row: true, - disable_array_delete_all_rows: false, - array_controls_top: true, - keep_oneof_values: false, - collapsed:true, - show_errors: 'always', - display_required_only: false, - show_opt_in: false, - prompt_before_delete: true, - required_by_default: false - }) - } - renderPdpGroupDropBox(dataRow) { let optionItems = [{label: "NOT DEPLOYED", value: "NOT DEPLOYED"}]; let selectedItem = {label: "NOT DEPLOYED", value: "NOT DEPLOYED"}; @@ -245,17 +240,6 @@ export default class ViewAllPolicies extends React.Component { this.props.history.push('/') } - handleOnRowClick(rowData) { - PolicyToscaService.getToscaPolicyModel(rowData["type"], rowData["type_version"]).then(respJsonPolicyTosca => { - this.setState({ - selectedRowId: rowData.tableData.id, - selectedRowIdJsonSchema: respJsonPolicyTosca, - selectedRowIdPolicyProperties: rowData["properties"], - jsonEditorForPolicy: this.createJsonEditor(respJsonPolicyTosca, rowData["properties"]) - }); - }); - } - handlePrefixGrouping(event) { this.setState({prefixGrouping: event.target.checked}); } @@ -279,92 +263,60 @@ export default class ViewAllPolicies extends React.Component { ) } - customValidation(editorData) { - // method for sub-classes to override with customized validation - return []; - } - - handleCreateNewVersion() { - var editorData = this.state.jsonEditorForPolicy.getValue(); - var errors = this.state.jsonEditorForPolicy.validate(); - errors = errors.concat(this.customValidation(editorData)); - - if (errors.length !== 0) { - console.error("Errors detected during policy data validation ", errors); - this.setState({ - showFailAlert: true, - showMessage: 'Errors detected during policy data validation:\n' + OnapUtils.jsonEditorErrorFormatter(errors) - }); - return; - } else { - console.info("NO validation errors found in policy data"); - let newPolicy = JSON.parse(JSON.stringify(this.state.policiesListData[this.state.selectedRowId])); - newPolicy["properties"] = editorData; - let newVersion = this.bumpVersion(newPolicy["version"]); - newPolicy["version"] = newVersion; - newPolicy["metadata"]["policy-version"] = newVersion; - // Remove stuff added by UI - delete newPolicy["tableData"]; - PolicyService.createNewPolicy(newPolicy["type"], newPolicy["type_version"], newPolicy).then(respPolicyCreation => { - if (respPolicyCreation === "") { - //it indicates a failure - this.setState({ - showFailAlert: true, - showMessage: 'Policy Creation Failure' - }); - } else { - this.setState({ - showSuccessAlert: true, - showMessage: 'Policy in version ' + newVersion + ' created successfully' - }); - } - }) - } - } - - bumpVersion(versionToBump) { - let semVer = versionToBump.split("."); - return parseInt(semVer[0])+1 + "." + semVer[1] + "." + semVer[2]; - } - - handleUpdatePolicy() { - this.setState({ show: false }); - this.props.history.push('/') - } - disableAlert() { this.setState ({ showSuccessAlert: false, showFailAlert: false }); } - render() { - return ( - <ModalStyled size="xl" show={this.state.show} onHide={this.handleClose} backdrop="static" keyboard={false}> - <Modal.Header closeButton> - </Modal.Header> - <Tabs id="controlled-tab-example" activeKey={this.state.key} onSelect={key => this.setState({ key, selectedRowData: {} })}> - <Tab eventKey="policies" title="Policies in Policy Framework"> + renderPoliciesTab() { + return ( + <Tab eventKey="policies" title="Policies in Policy Framework"> <Modal.Body> <FormControlLabel control={<Switch checked={this.state.prefixGrouping} onChange={this.handlePrefixGrouping} />} label="Group by prefix" /> <MaterialTable - title={"View All Policies in Policy Engine"} + title={"Policies"} data={this.state.policiesListData} columns={this.state.policyColumnsDefinition} icons={this.state.tableIcons} - onRowClick={(event, rowData) => {this.handleOnRowClick(rowData)}} + onRowClick={(event, rowData, togglePanel) => togglePanel()} options={{ grouping: true, exportButton: true, headerStyle:rowHeaderStyle, rowStyle: rowData => ({ backgroundColor: (this.state.selectedRowId !== -1 && this.state.selectedRowId === rowData.tableData.id) ? '#EEE' : '#FFF' - }) + }), + actionsColumnIndex: -1 }} + detailPanel={[ + { + icon: SettingsEthernetIcon, + tooltip: 'Show Configuration', + render: rowData => { + return ( + <DetailedRow> + <PolicyEditor policyModelType={rowData["type"]} policyModelTypeVersion={rowData["type_version"]} policyName={rowData["name"]} policyVersion={rowData["version"]} policyProperties={rowData["properties"]} /> + </DetailedRow> + ) + }, + }, + { + icon: DescriptionIcon, + tooltip: 'Show Raw Data', + render: rowData => { + return ( + <DetailedRow> + <pre>{JSON.stringify(rowData, null, 2)}</pre> + </DetailedRow> + ) + }, + }, + ]} actions={[ { - icon: forwardRef((props, ref) => <DeleteOutline {...props} ref={ref} />), + icon: forwardRef((props, ref) => <DeleteRoundedIcon {...props} ref={ref} />), tooltip: 'Delete Policy', onClick: (event, rowData) => this.handleDeletePolicy(event, rowData) } @@ -372,13 +324,89 @@ export default class ViewAllPolicies extends React.Component { /> </Modal.Body> </Tab> + ); + } + + renderToscaTab() { + return ( + <Tab eventKey="tosca models" title="Tosca Models in Policy Framework"> + <Modal.Body> + <FormControlLabel + control={<Switch checked={this.state.prefixGrouping} onChange={this.handlePrefixGrouping} />} + label="Group by prefix" + /> + <MaterialTable + title={"Tosca Models"} + data={this.state.toscaModelsListData} + columns={this.state.toscaColumnsDefinition} + icons={this.state.tableIcons} + onRowClick={(event, rowData, togglePanel) => togglePanel()} + options={{ + grouping: true, + exportButton: true, + headerStyle:rowHeaderStyle, + rowStyle: rowData => ({ + backgroundColor: (this.state.selectedRowId !== -1 && this.state.selectedRowId === rowData.tableData.id) ? '#EEE' : '#FFF' + }), + actionsColumnIndex: -1 + }} + detailPanel={[ + { + icon: SettingsEthernetIcon, + tooltip: 'Show Tosca', + render: rowData => { + return ( + <DetailedRow> + <ToscaViewer toscaData={rowData} /> + </DetailedRow> + ) + }, + }, + { + icon: DescriptionIcon, + tooltip: 'Show Raw Data', + render: rowData => { + return ( + <DetailedRow> + <pre>{JSON.stringify(rowData, null, 2)}</pre> + </DetailedRow> + ) + }, + }, + { + icon: NoteAddIcon, + tooltip: 'Create a policy from this model', + render: rowData => { + return ( + <DetailedRow> + <PolicyEditor policyModelType={rowData["policyModelType"]} policyModelTypeVersion={rowData["version"]} policyProperties={{}} /> + </DetailedRow> + ) + }, + }, + ]} + actions={[ + { + icon: forwardRef((props, ref) => <DeleteRoundedIcon {...props} ref={ref} />), + tooltip: 'Delete Tosca Model', + onClick: (event, rowData) => this.handleDeletePolicy(event, rowData) + } + ]} + /> + </Modal.Body> + </Tab> + ); + } + + render() { + return ( + <ModalStyled size="xl" show={this.state.show} onHide={this.handleClose} backdrop="static" keyboard={false}> + <Modal.Header closeButton> + </Modal.Header> + <Tabs id="controlled-tab-example" activeKey={this.state.key} onSelect={key => this.setState({ key, selectedRowData: {} })}> + {this.renderPoliciesTab()} + {this.renderToscaTab()} </Tabs> - <JsonEditorDiv> - <h5>Policy Properties Editor</h5> - <div id="policy-editor" title="Policy Properties"/> - <Button variant="secondary" title="Create a new policy version from the defined parameters" - onClick={this.handleCreateNewVersion}>Create New Version</Button> - </JsonEditorDiv> <Alert variant="success" show={this.state.showSuccessAlert} onClose={this.disableAlert} dismissible> <DivWhiteSpaceStyled> {this.state.showMessage} diff --git a/ui-react/src/theme/globalStyle.js b/ui-react/src/theme/globalStyle.js index 43aa30f00..1e316d20b 100644 --- a/ui-react/src/theme/globalStyle.js +++ b/ui-react/src/theme/globalStyle.js @@ -90,6 +90,9 @@ export const DefaultClampTheme = { menuHighlightedBackgroundColor: '#337ab7', menuHighlightedFontColor: 'white', - toscaTextareaBackgroundColor: '#E8E8E8', - toscaTextareaFontSize: '13px' + toscaTextareaBackgroundColor: 'white', + toscaTextareaFontSize: '13px', + + policyEditorBackgroundColor: 'white', + policyEditorFontSize: '13px' }; |