aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java110
-rw-r--r--src/main/java/org/onap/clamp/clds/config/ClampProperties.java65
-rw-r--r--src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java133
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/sdc/controller/BlueprintParserException.java54
-rw-r--r--src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintMicroService.java (renamed from src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java)44
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java161
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/ChainGenerator.java24
-rwxr-xr-xsrc/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java8
-rwxr-xr-xsrc/main/java/org/onap/clamp/clds/util/drawing/Painter.java10
-rw-r--r--src/main/java/org/onap/clamp/clds/util/drawing/SvgFacade.java4
-rw-r--r--src/main/java/org/onap/clamp/loop/CsarInstaller.java69
-rw-r--r--src/main/java/org/onap/clamp/loop/template/LoopElementModel.java2
-rw-r--r--src/main/java/org/onap/clamp/loop/template/PolicyModel.java10
-rw-r--r--src/main/java/org/onap/clamp/policy/downloader/PolicyDownloader.java61
-rw-r--r--src/main/resources/application-noaaf.properties22
-rw-r--r--src/main/resources/application.properties30
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml1075
-rw-r--r--src/test/java/org/onap/clamp/clds/it/PolicyConfigurationItCase.java71
-rw-r--r--src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java33
-rw-r--r--src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java94
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java39
-rw-r--r--src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java16
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java22
-rw-r--r--src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java17
-rw-r--r--src/test/resources/application.properties29
-rw-r--r--src/test/resources/clds/OperationalPolicyRepresentationBuilderTest.java52
-rw-r--r--src/test/resources/clds/blueprint-parser-mapping.json18
-rw-r--r--src/test/resources/clds/blueprint-with-microservice-chain.yaml238
-rw-r--r--src/test/resources/clds/camel/rest/clamp-api-v2.xml42
-rw-r--r--src/test/resources/clds/camel/routes/policy-flows.xml1075
-rw-r--r--src/test/resources/clds/holmes-old-style-ms.yaml117
-rw-r--r--src/test/resources/clds/single-microservice-fragment-invalid.yaml (renamed from src/test/resources/clds/single-microservice-fragment-valid.yaml)0
-rw-r--r--src/test/resources/clds/single-microservice-fragment-valid-with-version.yaml21
-rw-r--r--src/test/resources/clds/tca-old-style-ms.yaml169
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/holmes.yaml174
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/not-recognized.yaml130
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json48
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json48
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca.json36
-rw-r--r--src/test/resources/logback.xml91
-rw-r--r--src/test/resources/tosca/dcea_blueprint.yml170
46 files changed, 2012 insertions, 2635 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java
new file mode 100644
index 000000000..d99e9b569
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.clamp.clds.client;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.ExchangeBuilder;
+import org.onap.clamp.clds.config.ClampProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * The class implements the communication with the Policy Engine to retrieve
+ * policy models (tosca). It mainly delegates the physical calls to Camel
+ * engine.
+ *
+ */
+@Component
+public class PolicyEngineServices {
+ private final CamelContext camelContext;
+
+ private final ClampProperties refProp;
+
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyEngineServices.class);
+ protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ public static final String POLICY_RETRY_INTERVAL = "policy.retry.interval";
+ public static final String POLICY_RETRY_LIMIT = "policy.retry.limit";
+
+ @Autowired
+ public PolicyEngineServices(CamelContext camelContext, ClampProperties refProp) {
+ this.refProp = refProp;
+ this.camelContext = camelContext;
+ }
+
+ private void downloadAllPolicies() {
+ /*
+ * Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext)
+ * .withProperty("blueprintResourceId",
+ * resourceUuid).withProperty("blueprintServiceId", serviceUuid)
+ * .withProperty("blueprintName", artifactName).build();
+ * metricsLogger.info("Attempt n°" + i + " to contact DCAE inventory");
+ *
+ * Exchange exchangeResponse =
+ * camelContext.createProducerTemplate().send("direct:get-all-policy-models",
+ * myCamelExchange);
+ */
+ }
+
+ /**
+ * This method can be used to download a policy tosca model on the engine.
+ *
+ * @param policyType The policy type (id)
+ * @param policyVersion The policy version
+ * @return A string with the whole policy tosca model
+ * @throws InterruptedException in case of issue when sleeping during the retry
+ */
+ public String downloadOnePolicy(String policyType, String policyVersion) throws InterruptedException {
+ int retryInterval = 0;
+ int retryLimit = 1;
+ if (refProp.getStringValue(POLICY_RETRY_LIMIT) != null) {
+ retryLimit = Integer.valueOf(refProp.getStringValue(POLICY_RETRY_LIMIT));
+ }
+ if (refProp.getStringValue(POLICY_RETRY_INTERVAL) != null) {
+ retryInterval = Integer.valueOf(refProp.getStringValue(POLICY_RETRY_INTERVAL));
+ }
+ for (int i = 0; i < retryLimit; i++) {
+ Exchange paramExchange = ExchangeBuilder.anExchange(camelContext)
+ .withProperty("policyModelName", policyType).withProperty("policyModelVersion", policyVersion)
+ .build();
+
+ Exchange exchangeResponse = camelContext.createProducerTemplate().send("direct:get-policy-model",
+ paramExchange);
+
+ if (Integer.valueOf(200).equals(exchangeResponse.getIn().getHeader("CamelHttpResponseCode"))) {
+ return (String) exchangeResponse.getIn().getBody();
+ } else {
+ logger.info("Policy " + retryInterval + "ms before retrying ...");
+ // wait for a while and try to connect to DCAE again
+ Thread.sleep(retryInterval);
+ }
+ }
+ return "";
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
index 9905585d3..8eae9066d 100644
--- a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
+++ b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java
@@ -23,13 +23,11 @@
package org.onap.clamp.clds.config;
-import com.google.common.base.Splitter;
-
import com.google.gson.JsonElement;
+
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
-import java.util.List;
import org.apache.commons.io.IOUtils;
import org.onap.clamp.clds.util.JsonUtils;
@@ -53,8 +51,7 @@ public class ClampProperties {
/**
* get property value.
*
- * @param key
- * The first key
+ * @param key The first key
* @return The string with the value
*/
public String getStringValue(String key) {
@@ -65,10 +62,8 @@ public class ClampProperties {
* get property value for a combo key (key1 + "." + key2). If not found just use
* key1.
*
- * @param key1
- * The first key
- * @param key2
- * The second key after a dot
+ * @param key1 The first key
+ * @param key2 The second key after a dot
* @return The string with the value
*/
public String getStringValue(String key1, String key2) {
@@ -83,17 +78,15 @@ public class ClampProperties {
* Return json as objects that can be updated. The value obtained from the
* clds-reference file will be used as a filename.
*
- * @param key
- * The key that will be used to access the clds-reference file
+ * @param key The key that will be used to access the clds-reference file
* @return A jsonNode
- * @throws IOException
- * In case of issues with the JSON parser
+ * @throws IOException In case of issues with the JSON parser
*/
public JsonElement getJsonTemplate(String key) throws IOException {
String fileReference = getStringValue(key);
return (fileReference != null)
- ? JsonUtils.GSON.fromJson(getFileContentFromPath(fileReference), JsonElement.class)
- : null;
+ ? JsonUtils.GSON.fromJson(getFileContentFromPath(fileReference), JsonElement.class)
+ : null;
}
/**
@@ -101,30 +94,25 @@ public class ClampProperties {
* "." + key2), otherwise default to just key1. The value obtained from the
* clds-reference file will be used as a filename.
*
- * @param key1
- * The first key
- * @param key2
- * The second key after a dot
+ * @param key1 The first key
+ * @param key2 The second key after a dot
* @return A JsonNode
- * @throws IOException
- * In case of issues with the JSON parser
+ * @throws IOException In case of issues with the JSON parser
*/
public JsonElement getJsonTemplate(String key1, String key2) throws IOException {
String fileReference = getStringValue(key1, key2);
return (fileReference != null)
- ? JsonUtils.GSON.fromJson(getFileContentFromPath(fileReference), JsonElement.class)
- : null;
+ ? JsonUtils.GSON.fromJson(getFileContentFromPath(fileReference), JsonElement.class)
+ : null;
}
/**
* Return the file content. The value obtained from the clds-reference file will
* be used as a filename.
*
- * @param key
- * The key that will be used to access the clds-reference file
+ * @param key The key that will be used to access the clds-reference file
* @return File content in String
- * @throws IOException
- * In case of issues with the JSON parser
+ * @throws IOException In case of issues with the JSON parser
*/
public String getFileContent(String key) throws IOException {
String fileReference = getStringValue(key);
@@ -136,13 +124,10 @@ public class ClampProperties {
* otherwise default to just key1. The value obtained from the clds-reference
* file will be used as a filename.
*
- * @param key1
- * The first key
- * @param key2
- * The second key after a dot
+ * @param key1 The first key
+ * @param key2 The second key after a dot
* @return File content in String
- * @throws IOException
- * In case of issues with the JSON parser
+ * @throws IOException In case of issues with the JSON parser
*/
public String getFileContent(String key1, String key2) throws IOException {
String fileReference = getStringValue(key1, key2);
@@ -153,18 +138,4 @@ public class ClampProperties {
URL url = appContext.getResource(filepath).getURL();
return IOUtils.toString(url, StandardCharsets.UTF_8);
}
-
- /**
- * Returns the list of strings split with separator.
- *
- * @param key
- * property key
- * @param separator
- * property value separator
- * @return List of Strings split with a separator
- */
- public List<String> getStringList(String key, String separator) {
- return Splitter.on(separator).trimResults().omitEmptyStrings()
- .splitToList(env.getProperty(CONFIG_PREFIX + key));
- }
}
diff --git a/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java b/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java
deleted file mode 100644
index a4f37e8bb..000000000
--- a/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2018 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.clamp.clds.config;
-
-import java.util.Properties;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-@Component
-@ConfigurationProperties(prefix = "clamp.config.policy")
-public class PolicyConfiguration {
-
- public static final String PDP_URL1 = "PDP_URL1";
- public static final String PDP_URL2 = "PDP_URL2";
- public static final String PAP_URL = "PAP_URL";
- public static final String NOTIFICATION_TYPE = "NOTIFICATION_TYPE";
- public static final String NOTIFICATION_UEB_SERVERS = "NOTIFICATION_UEB_SERVERS";
- public static final String CLIENT_ID = "CLIENT_ID";
- public static final String CLIENT_KEY = "CLIENT_KEY";
- public static final String ENVIRONMENT = "ENVIRONMENT";
- private String pdpUrl1;
- private String pdpUrl2;
- private String papUrl;
- private String notificationType;
- private String notificationUebServers;
- private String clientId;
- private String clientKey;
- private String policyEnvironment;
-
- public String getPdpUrl1() {
- return pdpUrl1;
- }
-
- public void setPdpUrl1(String pdpUrl1) {
- this.pdpUrl1 = pdpUrl1;
- }
-
- public String getPdpUrl2() {
- return pdpUrl2;
- }
-
- public void setPdpUrl2(String pdpUrl2) {
- this.pdpUrl2 = pdpUrl2;
- }
-
- public String getPapUrl() {
- return papUrl;
- }
-
- public void setPapUrl(String papUrl) {
- this.papUrl = papUrl;
- }
-
- public String getNotificationType() {
- return notificationType;
- }
-
- public void setNotificationType(String notificationType) {
- this.notificationType = notificationType;
- }
-
- public String getNotificationUebServers() {
- return notificationUebServers;
- }
-
- public void setNotificationUebServers(String notificationUebServers) {
- this.notificationUebServers = notificationUebServers;
- }
-
- public String getClientId() {
- return clientId;
- }
-
- public void setClientId(String clientId) {
- this.clientId = clientId;
- }
-
- public String getClientKey() {
- return clientKey;
- }
-
- public void setClientKey(String clientKey) {
- this.clientKey = clientKey;
- }
-
- public String getPolicyEnvironment() {
- return policyEnvironment;
- }
-
- public void setPolicyEnvironment(String environment) {
- this.policyEnvironment = environment;
- }
-
- /**
- * Returns policy configuration properties.
- *
- * @return policy configuration properties
- */
- public Properties getProperties() {
- Properties prop = new Properties();
- prop.put(PDP_URL1, pdpUrl1);
- prop.put(PDP_URL2, pdpUrl2);
- prop.put(PAP_URL, papUrl);
- prop.put(NOTIFICATION_TYPE, notificationType);
- prop.put(NOTIFICATION_UEB_SERVERS, notificationUebServers);
- prop.put(CLIENT_ID, clientId);
- prop.put(CLIENT_KEY, clientKey);
- prop.put(ENVIRONMENT, policyEnvironment);
- return prop;
- }
-}
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
index 5a3e22a35..eca45d66f 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
@@ -41,14 +41,12 @@ import org.onap.clamp.loop.CsarInstaller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
@Configuration
-@ComponentScan(basePackages = { "org.onap.clamp.loop", "org.onap.clamp.clds.config" })
-@Profile("clamp-sdc-controller-new")
+@Profile("clamp-sdc-controller")
public class SdcControllerConfiguration {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcControllerConfiguration.class);
diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/BlueprintParserException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/BlueprintParserException.java
new file mode 100644
index 000000000..7257fd8a0
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/BlueprintParserException.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.clamp.clds.exception.sdc.controller;
+
+/**
+ * Exception during blueprint parsing.
+ */
+public class BlueprintParserException extends Exception {
+
+ /**
+ * Serial ID.
+ */
+ private static final long serialVersionUID = -3044162346353623199L;
+
+ /**
+ * This constructor can be used to create a new SdcDownloadException.
+ *
+ * @param message The message to dump
+ */
+ public BlueprintParserException(final String message) {
+ super(message);
+ }
+
+ /**
+ * This constructor can be used to create a new SdcDownloadException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
+ */
+ public BlueprintParserException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java
index 19bc23d5e..fc2ca5caa 100644
--- a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java
+++ b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java
@@ -46,7 +46,7 @@ public class DcaeInventoryCache {
public void addDcaeInventoryResponse(DcaeInventoryResponse inventoryResponse) {
Set<DcaeInventoryResponse> responsesSet = blueprintsMap.get(inventoryResponse.getAsdcServiceId());
if (responsesSet == null) {
- responsesSet = new TreeSet<DcaeInventoryResponse>();
+ responsesSet = new TreeSet<>();
blueprintsMap.put(inventoryResponse.getAsdcServiceId(), responsesSet);
}
responsesSet.add(inventoryResponse);
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
index bd18baea6..fbb37d525 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
@@ -33,6 +33,7 @@ import java.util.concurrent.ThreadLocalRandom;
import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.config.sdc.SdcSingleControllerConfiguration;
+import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcControllerException;
@@ -290,6 +291,10 @@ public class SdcSingleController {
sendAllNotificationForCsarHandler(notificationData, csar, NotificationType.DEPLOY,
DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
Thread.currentThread().interrupt();
+ } catch (BlueprintParserException e) {
+ logger.error("BlueprintParser exception caught during the notification processing", e);
+ sendAllNotificationForCsarHandler(notificationData, csar, NotificationType.DEPLOY,
+ DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
} catch (RuntimeException e) {
logger.error("Unexpected exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(notificationData, csar, NotificationType.DEPLOY,
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintMicroService.java
index 68ac842cf..e00ce9430 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintMicroService.java
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
- * Modifications copyright (c) 2019 AT&T
+ * Modifications copyright (c) 2019-2020 AT&T
* ===================================================================
*
*/
@@ -26,25 +26,24 @@ package org.onap.clamp.clds.sdc.controller.installer;
import java.util.Objects;
-public class MicroService {
+public class BlueprintMicroService {
private final String name;
private final String modelType;
private final String inputFrom;
- private String mappedNameJpa;
+ private final String modelVersion;
/**
* The Micro service constructor.
*
- * @param name The name in String
- * @param modelType The model type
- * @param inputFrom Comes from (single chained)
- * @param mappedNameJpa Name in database
+ * @param name The name in String
+ * @param modelType The model type
+ * @param inputFrom Comes from (single chained)
*/
- public MicroService(String name, String modelType, String inputFrom, String mappedNameJpa) {
+ public BlueprintMicroService(String name, String modelType, String inputFrom, String modelVersion) {
this.name = name;
this.inputFrom = inputFrom;
- this.mappedNameJpa = mappedNameJpa;
this.modelType = modelType;
+ this.modelVersion = modelVersion;
}
public String getName() {
@@ -59,18 +58,19 @@ public class MicroService {
return inputFrom;
}
- @Override
- public String toString() {
- return "MicroService{" + "name='" + name + '\'' + ", modelType='" + modelType + '\'' + ", inputFrom='"
- + inputFrom + '\'' + ", mappedNameJpa='" + mappedNameJpa + '\'' + '}';
- }
-
- public String getMappedNameJpa() {
- return mappedNameJpa;
+ /**
+ * modelVerrsion getter.
+ *
+ * @return the modelVersion
+ */
+ public String getModelVersion() {
+ return modelVersion;
}
- public void setMappedNameJpa(String mappedNameJpa) {
- this.mappedNameJpa = mappedNameJpa;
+ @Override
+ public String toString() {
+ return "MicroService {" + "name='" + name + '\'' + ", modelType='" + modelType + '\'' + ", inputFrom='"
+ + inputFrom + '\'' + ", modelVersion='" + modelVersion + '\'' + '}';
}
@Override
@@ -81,13 +81,13 @@ public class MicroService {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
- MicroService that = (MicroService) obj;
+ BlueprintMicroService that = (BlueprintMicroService) obj;
return name.equals(that.name) && modelType.equals(that.modelType) && inputFrom.equals(that.inputFrom)
- && mappedNameJpa.equals(that.mappedNameJpa);
+ && modelVersion.equals(that.modelVersion);
}
@Override
public int hashCode() {
- return Objects.hash(name, modelType, inputFrom, mappedNameJpa);
+ return Objects.hash(name, modelType, inputFrom, modelVersion);
}
}
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java
index 0dd231f03..981a20416 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java
@@ -24,6 +24,8 @@
package org.onap.clamp.clds.sdc.controller.installer;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@@ -38,76 +40,74 @@ import java.util.Map.Entry;
import java.util.Set;
import org.json.JSONObject;
-import org.springframework.stereotype.Component;
+import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
import org.yaml.snakeyaml.Yaml;
-@Component
public class BlueprintParser {
static final String TCA = "TCA";
- static final String HOLMES = "Holmes";
- private static final String TCA_POLICY = "tca_policy";
- private static final String HOLMES_PREFIX = "holmes";
private static final String NODE_TEMPLATES = "node_templates";
private static final String DCAE_NODES = "dcae.nodes.";
+ private static final String DCAE_NODES_POLICY = "dcae.nodes.policy";
private static final String TYPE = "type";
private static final String PROPERTIES = "properties";
private static final String NAME = "name";
private static final String INPUT = "inputs";
private static final String GET_INPUT = "get_input";
- private static final String POLICY_MODELID = "policy_model_id";
+ private static final String POLICY_MODEL_ID = "policy_model_id";
+ private static final String POLICY_MODEL_VERSION = "policy_model_version";
private static final String RELATIONSHIPS = "relationships";
private static final String CLAMP_NODE_RELATIONSHIPS_GETS_INPUT_FROM = "clamp_node.relationships.gets_input_from";
private static final String TARGET = "target";
+ public static final String DEFAULT_VERSION = "1.0.0";
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(BlueprintParser.class);
+
+ private BlueprintParser() {
+
+ }
/**
* Get all micro services from blueprint.
*
* @param blueprintString the blueprint in a String
* @return A set of MircoService
+ * @throws BlueprintParserException In case of issues with the parsing
*/
- public Set<MicroService> getMicroServices(String blueprintString) {
- Set<MicroService> microServices = new HashSet<>();
+ public static Set<BlueprintMicroService> getMicroServices(String blueprintString) throws BlueprintParserException {
+ Set<BlueprintMicroService> microServices = new HashSet<>();
JsonObject blueprintJson = BlueprintParser.convertToJson(blueprintString);
JsonObject nodeTemplateList = blueprintJson.get(NODE_TEMPLATES).getAsJsonObject();
JsonObject inputList = blueprintJson.get(INPUT).getAsJsonObject();
for (Entry<String, JsonElement> entry : nodeTemplateList.entrySet()) {
JsonObject nodeTemplate = entry.getValue().getAsJsonObject();
- if (nodeTemplate.get(TYPE).getAsString().contains(DCAE_NODES)) {
- MicroService microService = getNodeRepresentation(entry, nodeTemplateList, inputList);
- microServices.add(microService);
+ if (!nodeTemplate.get(TYPE).getAsString().contains(DCAE_NODES_POLICY)
+ && nodeTemplate.get(TYPE).getAsString().contains(DCAE_NODES)) {
+ BlueprintMicroService microService = getNodeRepresentation(entry, nodeTemplateList, inputList);
+ if (!microService.getModelType().isBlank()) {
+ microServices.add(microService);
+ } else {
+ logger.warn("Microservice " + microService.getName()
+ + " will NOT be used by CLAMP as the model type is not defined or has not been found");
+ }
}
}
- microServices.removeIf(ms -> TCA_POLICY.equals(ms.getName()));
+ logger.debug("Those microservices have been found in the blueprint:" + microServices);
return microServices;
}
/**
- * Does a fallback to TCA or Holmes.
+ * Does a fallback to TCA.
*
- * @param blueprintString the blueprint in a String
* @return The list of microservices
*/
- public List<MicroService> fallbackToOneMicroService(String blueprintString) {
- JsonObject jsonObject = BlueprintParser.convertToJson(blueprintString);
- JsonObject results = jsonObject.get(NODE_TEMPLATES).getAsJsonObject();
- String theBiggestMicroServiceContent = "";
- String theBiggestMicroServiceKey = "";
- for (Entry<String, JsonElement> entry : results.entrySet()) {
- String msAsString = entry.getValue().toString();
- int len = msAsString.length();
- if (len > theBiggestMicroServiceContent.length()) {
- theBiggestMicroServiceContent = msAsString;
- theBiggestMicroServiceKey = entry.getKey();
- }
- }
- String msName = theBiggestMicroServiceKey.toLowerCase().contains(HOLMES_PREFIX) ? HOLMES : TCA;
- return Collections
- .singletonList(new MicroService(msName, "onap.policies.monitoring.cdap.tca.hi.lo.app", "", ""));
+ public static List<BlueprintMicroService> fallbackToOneMicroService() {
+ return Collections.singletonList(
+ new BlueprintMicroService(TCA, "onap.policies.monitoring.cdap.tca.hi.lo.app", "", DEFAULT_VERSION));
}
- String getName(Entry<String, JsonElement> entry) {
+ static String getName(Entry<String, JsonElement> entry) {
String microServiceYamlName = entry.getKey();
JsonObject ob = entry.getValue().getAsJsonObject();
if (ob.has(PROPERTIES)) {
@@ -119,7 +119,7 @@ public class BlueprintParser {
return microServiceYamlName;
}
- String getInput(Entry<String, JsonElement> entry) {
+ static String getInput(Entry<String, JsonElement> entry) {
JsonObject ob = entry.getValue().getAsJsonObject();
if (ob.has(RELATIONSHIPS)) {
JsonArray relationships = ob.getAsJsonArray(RELATIONSHIPS);
@@ -133,51 +133,81 @@ public class BlueprintParser {
return "";
}
- String findModelTypeInTargetArray(JsonArray jsonArray, JsonObject nodeTemplateList, JsonObject inputList) {
- for (JsonElement elem : jsonArray) {
- String modelType = getModelType(
- new AbstractMap.SimpleEntry<String, JsonElement>(elem.getAsJsonObject().get(TARGET).getAsString(),
- nodeTemplateList.get(elem.getAsJsonObject().get(TARGET).getAsString()).getAsJsonObject()),
- nodeTemplateList, inputList);
- if (!modelType.isEmpty()) {
- return modelType;
+ static String findPropertyInRelationshipsArray(String propertyName, JsonArray relationshipsArray,
+ JsonObject blueprintNodeTemplateList, JsonObject blueprintInputList) throws BlueprintParserException {
+ for (JsonElement elem : relationshipsArray) {
+ if (blueprintNodeTemplateList.get(elem.getAsJsonObject().get(TARGET).getAsString()) == null) {
+ throw new BlueprintParserException(
+ "The Target mentioned in the blueprint is not a known entry in the blueprint: "
+ + elem.getAsJsonObject().get(TARGET).getAsString());
+ } else {
+ String property = getPropertyValue(propertyName,
+ new AbstractMap.SimpleEntry<String, JsonElement>(
+ elem.getAsJsonObject().get(TARGET).getAsString(), blueprintNodeTemplateList
+ .get(elem.getAsJsonObject().get(TARGET).getAsString()).getAsJsonObject()),
+ blueprintNodeTemplateList, blueprintInputList);
+ if (!property.isEmpty()) {
+ return property;
+ }
}
}
return "";
}
- String getModelType(Entry<String, JsonElement> entry, JsonObject nodeTemplateList, JsonObject inputList) {
- JsonObject ob = entry.getValue().getAsJsonObject();
+ static String getDirectOrInputPropertyValue(String propertyName, JsonObject blueprintInputList,
+ JsonObject nodeTemplateContent) {
+ JsonObject properties = nodeTemplateContent.get(PROPERTIES).getAsJsonObject();
+ if (properties.has(propertyName)) {
+ if (properties.get(propertyName).isJsonObject()) {
+ // it's a blueprint parameter
+ return blueprintInputList
+ .get(properties.get(propertyName).getAsJsonObject().get(GET_INPUT).getAsString())
+ .getAsJsonObject().get("default").getAsString();
+ } else {
+ // It's a direct value
+ return properties.get(propertyName).getAsString();
+ }
+ }
+ return "";
+ }
+
+ static String getPropertyValue(String propertyName, Entry<String, JsonElement> nodeTemplateEntry,
+ JsonObject blueprintNodeTemplateList, JsonObject blueprintIputList) throws BlueprintParserException {
+ JsonObject nodeTemplateContent = nodeTemplateEntry.getValue().getAsJsonObject();
// Search first in this node template
- if (ob.has(PROPERTIES)) {
- JsonObject properties = ob.get(PROPERTIES).getAsJsonObject();
- if (properties.has(POLICY_MODELID)) {
- if (properties.get(POLICY_MODELID).isJsonObject()) {
- // it's a blueprint parameter
- return inputList.get(properties.get(POLICY_MODELID).getAsJsonObject().get(GET_INPUT).getAsString())
- .getAsJsonObject().get("default").getAsString();
- } else {
- // It's a direct value
- return properties.get(POLICY_MODELID).getAsString();
- }
+ if (nodeTemplateContent.has(PROPERTIES)) {
+ String propValue = getDirectOrInputPropertyValue(propertyName, blueprintIputList, nodeTemplateContent);
+ if (!propValue.isBlank()) {
+ return propValue;
}
}
// Or it's may be defined in a relationship
- if (ob.has(RELATIONSHIPS)) {
- return findModelTypeInTargetArray(ob.get(RELATIONSHIPS).getAsJsonArray(), nodeTemplateList, inputList);
+ if (nodeTemplateContent.has(RELATIONSHIPS)) {
+ return findPropertyInRelationshipsArray(propertyName,
+ nodeTemplateContent.get(RELATIONSHIPS).getAsJsonArray(), blueprintNodeTemplateList,
+ blueprintIputList);
}
return "";
}
- MicroService getNodeRepresentation(Entry<String, JsonElement> entry, JsonObject nodeTemplateList,
- JsonObject inputList) {
- String name = getName(entry);
- String getInputFrom = getInput(entry);
- String modelType = getModelType(entry, nodeTemplateList, inputList);
- return new MicroService(name, modelType, getInputFrom, "");
+ static BlueprintMicroService getNodeRepresentation(Entry<String, JsonElement> nodeTemplateEntry,
+ JsonObject blueprintNodeTemplateList, JsonObject blueprintInputList) throws BlueprintParserException {
+ String modelIdFound = getPropertyValue(POLICY_MODEL_ID, nodeTemplateEntry, blueprintNodeTemplateList,
+ blueprintInputList);
+ String versionFound = getPropertyValue(POLICY_MODEL_VERSION, nodeTemplateEntry, blueprintNodeTemplateList,
+ blueprintInputList);
+ if (modelIdFound.isBlank()) {
+ logger.warn("policy_model_id is not defined for the node template:" + nodeTemplateEntry.getKey());
+ }
+ if (versionFound.isBlank()) {
+ logger.warn("policy_model_version is not defined (setting it to a default value) for the node template:"
+ + nodeTemplateEntry.getKey());
+ }
+ return new BlueprintMicroService(getName(nodeTemplateEntry), modelIdFound, getInput(nodeTemplateEntry),
+ !versionFound.isBlank() ? versionFound : DEFAULT_VERSION);
}
- private String getTarget(JsonObject elementObject) {
+ private static String getTarget(JsonObject elementObject) {
if (elementObject.has(TYPE) && elementObject.has(TARGET)
&& elementObject.get(TYPE).getAsString().equals(CLAMP_NODE_RELATIONSHIPS_GETS_INPUT_FROM)) {
return elementObject.get(TARGET).getAsString();
@@ -186,10 +216,7 @@ public class BlueprintParser {
}
private static JsonObject convertToJson(String yamlString) {
- Yaml yaml = new Yaml();
- Map<String, Object> map = yaml.load(yamlString);
-
- JSONObject jsonObject = new JSONObject(map);
- return new Gson().fromJson(jsonObject.toString(), JsonObject.class);
+ Map<String, Object> map = new Yaml().load(yamlString);
+ return new Gson().fromJson(new JSONObject(map).toString(), JsonObject.class);
}
}
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/ChainGenerator.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/ChainGenerator.java
index 9e76cc938..2bd259c2b 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/ChainGenerator.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/ChainGenerator.java
@@ -42,11 +42,11 @@ public class ChainGenerator {
* @param input A set of microservices
* @return The list of microservice chained
*/
- public List<MicroService> getChainOfMicroServices(Set<MicroService> input) {
- LinkedList<MicroService> returnList = new LinkedList<>();
+ public List<BlueprintMicroService> getChainOfMicroServices(Set<BlueprintMicroService> input) {
+ LinkedList<BlueprintMicroService> returnList = new LinkedList<>();
if (preValidate(input)) {
- LinkedList<MicroService> theList = new LinkedList<>();
- for (MicroService ms : input) {
+ LinkedList<BlueprintMicroService> theList = new LinkedList<>();
+ for (BlueprintMicroService ms : input) {
insertNodeTemplateIntoChain(ms, theList);
}
if (postValidate(theList)) {
@@ -56,16 +56,16 @@ public class ChainGenerator {
return returnList;
}
- private boolean preValidate(Set<MicroService> input) {
- List<MicroService> noInputs = input.stream().filter(ms -> "".equals(ms.getInputFrom()))
+ private boolean preValidate(Set<BlueprintMicroService> input) {
+ List<BlueprintMicroService> noInputs = input.stream().filter(ms -> "".equals(ms.getInputFrom()))
.collect(Collectors.toList());
return noInputs.size() == 1;
}
- private boolean postValidate(LinkedList<MicroService> microServices) {
+ private boolean postValidate(LinkedList<BlueprintMicroService> microServices) {
for (int i = 1; i < microServices.size() - 1; i++) {
- MicroService prev = microServices.get(i - 1);
- MicroService current = microServices.get(i);
+ BlueprintMicroService prev = microServices.get(i - 1);
+ BlueprintMicroService current = microServices.get(i);
if (!current.getInputFrom().equals(prev.getName())) {
return false;
}
@@ -73,11 +73,11 @@ public class ChainGenerator {
return true;
}
- private void insertNodeTemplateIntoChain(MicroService microServicetoInsert,
- LinkedList<MicroService> chainOfMicroServices) {
+ private void insertNodeTemplateIntoChain(BlueprintMicroService microServicetoInsert,
+ LinkedList<BlueprintMicroService> chainOfMicroServices) {
int insertIndex = 0;
for (int i = 0; i < chainOfMicroServices.size(); i++) {
- MicroService current = chainOfMicroServices.get(i);
+ BlueprintMicroService current = chainOfMicroServices.get(i);
if (microServicetoInsert.getName().equals(current.getInputFrom())) {
insertIndex = i;
break;
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java
index 8ded0cb87..6ce89873b 100755
--- a/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java
+++ b/src/main/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilder.java
@@ -28,12 +28,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import org.onap.clamp.clds.sdc.controller.installer.MicroService;
+import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService;
public class ClampGraphBuilder {
private String policy;
private String collector;
- private List<MicroService> microServices = new ArrayList<>();
+ private List<BlueprintMicroService> microServices = new ArrayList<>();
private final Painter painter;
public ClampGraphBuilder(Painter painter) {
@@ -50,12 +50,12 @@ public class ClampGraphBuilder {
return this;
}
- public ClampGraphBuilder addMicroService(MicroService ms) {
+ public ClampGraphBuilder addMicroService(BlueprintMicroService ms) {
microServices.add(ms);
return this;
}
- public ClampGraphBuilder addAllMicroServices(List<MicroService> msList) {
+ public ClampGraphBuilder addAllMicroServices(List<BlueprintMicroService> msList) {
microServices.addAll(msList);
return this;
}
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java b/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java
index af6caf932..d96c9e537 100755
--- a/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java
+++ b/src/main/java/org/onap/clamp/clds/util/drawing/Painter.java
@@ -31,7 +31,7 @@ import java.awt.RenderingHints;
import java.util.List;
import org.apache.batik.svggen.SVGGraphics2D;
-import org.onap.clamp.clds.sdc.controller.installer.MicroService;
+import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService;
public class Painter {
private final int canvasSize;
@@ -57,7 +57,7 @@ public class Painter {
this.canvasSize = DEFALUT_CANVAS_SIZE;
}
- DocumentBuilder doPaint(String collector, List<MicroService> microServices, String policy) {
+ DocumentBuilder doPaint(String collector, List<BlueprintMicroService> microServices, String policy) {
int numOfRectangles = 2 + microServices.size();
int numOfArrows = numOfRectangles + 1;
int baseLength = (canvasSize - 2 * CIRCLE_RADIUS) / (numOfArrows + numOfRectangles);
@@ -76,12 +76,12 @@ public class Painter {
return ib.getDocumentBuilder();
}
- private void doTheActualDrawing(String collector, List<MicroService> microServices, String policy,
+ private void doTheActualDrawing(String collector, List<BlueprintMicroService> microServices, String policy,
ImageBuilder ib) {
ib.circle("start-circle", SLIM_LINE).arrow().rectangle(collector, RectTypes.COLECTOR, collector);
- for (MicroService ms : microServices) {
- ib.arrow().rectangle(ms.getMappedNameJpa(), RectTypes.MICROSERVICE, ms.getName());
+ for (BlueprintMicroService ms : microServices) {
+ ib.arrow().rectangle(ms.getModelType(), RectTypes.MICROSERVICE, ms.getName());
}
ib.arrow().rectangle(policy, RectTypes.POLICY, policy).arrow().circle("stop-circle", THICK_LINE);
diff --git a/src/main/java/org/onap/clamp/clds/util/drawing/SvgFacade.java b/src/main/java/org/onap/clamp/clds/util/drawing/SvgFacade.java
index ae0c1729c..251f48864 100644
--- a/src/main/java/org/onap/clamp/clds/util/drawing/SvgFacade.java
+++ b/src/main/java/org/onap/clamp/clds/util/drawing/SvgFacade.java
@@ -27,7 +27,7 @@ package org.onap.clamp.clds.util.drawing;
import java.util.List;
import org.apache.batik.svggen.SVGGraphics2D;
-import org.onap.clamp.clds.sdc.controller.installer.MicroService;
+import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService;
import org.onap.clamp.clds.util.XmlTools;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
@@ -40,7 +40,7 @@ public class SvgFacade {
* @param microServicesChain THe chain of microservices
* @return A String containing the SVG
*/
- public String getSvgImage(List<MicroService> microServicesChain) {
+ public String getSvgImage(List<BlueprintMicroService> microServicesChain) {
SVGGraphics2D svgGraphics2D = new SVGGraphics2D(XmlTools.createEmptySvgDocument());
Document document = XmlTools.createEmptySvgDocument();
DocumentBuilder dp = new DocumentBuilder(document, svgGraphics2D.getDOMFactory());
diff --git a/src/main/java/org/onap/clamp/loop/CsarInstaller.java b/src/main/java/org/onap/clamp/loop/CsarInstaller.java
index 013d3419d..022b0e28a 100644
--- a/src/main/java/org/onap/clamp/loop/CsarInstaller.java
+++ b/src/main/java/org/onap/clamp/loop/CsarInstaller.java
@@ -33,13 +33,15 @@ import java.util.Map.Entry;
import org.json.simple.parser.ParseException;
import org.onap.clamp.clds.client.DcaeInventoryServices;
+import org.onap.clamp.clds.client.PolicyEngineServices;
+import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
import org.onap.clamp.clds.model.dcae.DcaeInventoryResponse;
import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
+import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService;
import org.onap.clamp.clds.sdc.controller.installer.BlueprintParser;
import org.onap.clamp.clds.sdc.controller.installer.ChainGenerator;
import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
-import org.onap.clamp.clds.sdc.controller.installer.MicroService;
import org.onap.clamp.clds.util.drawing.SvgFacade;
import org.onap.clamp.loop.service.CsarServiceInstaller;
import org.onap.clamp.loop.service.Service;
@@ -47,6 +49,8 @@ import org.onap.clamp.loop.template.LoopElementModel;
import org.onap.clamp.loop.template.LoopTemplate;
import org.onap.clamp.loop.template.LoopTemplatesRepository;
import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.clamp.loop.template.PolicyModelId;
+import org.onap.clamp.loop.template.PolicyModelsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@@ -61,31 +65,27 @@ import org.springframework.stereotype.Component;
public class CsarInstaller {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarInstaller.class);
- public static final String CONTROL_NAME_PREFIX = "ClosedLoop-";
- public static final String GET_INPUT_BLUEPRINT_PARAM = "get_input";
- // This will be used later as the policy scope
- public static final String MODEL_NAME_PREFIX = "Loop_";
@Autowired
- LoopsRepository loopRepository;
+ private PolicyModelsRepository policyModelsRepository;
@Autowired
- LoopTemplatesRepository loopTemplatesRepository;
+ private LoopTemplatesRepository loopTemplatesRepository;
@Autowired
- BlueprintParser blueprintParser;
+ private ChainGenerator chainGenerator;
@Autowired
- ChainGenerator chainGenerator;
+ private DcaeInventoryServices dcaeInventoryService;
@Autowired
- DcaeInventoryServices dcaeInventoryService;
+ private SvgFacade svgFacade;
@Autowired
- private SvgFacade svgFacade;
+ private CsarServiceInstaller csarServiceInstaller;
@Autowired
- CsarServiceInstaller csarServiceInstaller;
+ private PolicyEngineServices policyEngineServices;
/**
* Verify whether Csar is deployed.
@@ -113,8 +113,11 @@ public class CsarInstaller {
* @param csar The Csar Handler
* @throws SdcArtifactInstallerException The SdcArtifactInstallerException
* @throws InterruptedException The InterruptedException
+ * @throws BlueprintParserException In case of issues with the blueprint
+ * parsing
*/
- public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException, InterruptedException {
+ public void installTheCsar(CsarHandler csar)
+ throws SdcArtifactInstallerException, InterruptedException, BlueprintParserException {
logger.info("Installing the CSAR " + csar.getFilePath());
installTheLoopTemplates(csar, csarServiceInstaller.installTheService(csar));
logger.info("Successfully installed the CSAR " + csar.getFilePath());
@@ -127,9 +130,11 @@ public class CsarInstaller {
* @param service The service object that is related to the loop
* @throws SdcArtifactInstallerException The SdcArtifactInstallerException
* @throws InterruptedException The InterruptedException
+ * @throws BlueprintParserException In case of issues with the blueprint
+ * parsing
*/
public void installTheLoopTemplates(CsarHandler csar, Service service)
- throws SdcArtifactInstallerException, InterruptedException {
+ throws SdcArtifactInstallerException, InterruptedException, BlueprintParserException {
try {
logger.info("Installing the Loops");
for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) {
@@ -145,20 +150,20 @@ public class CsarInstaller {
}
private LoopTemplate createLoopTemplateFromBlueprint(CsarHandler csar, BlueprintArtifact blueprintArtifact,
- Service service) throws IOException, ParseException, InterruptedException {
+ Service service) throws IOException, ParseException, InterruptedException, BlueprintParserException {
LoopTemplate newLoopTemplate = new LoopTemplate();
newLoopTemplate.setBlueprint(blueprintArtifact.getDcaeBlueprint());
newLoopTemplate.setName(LoopTemplate.generateLoopTemplateName(csar.getSdcNotification().getServiceName(),
csar.getSdcNotification().getServiceVersion(),
blueprintArtifact.getResourceAttached().getResourceInstanceName(),
blueprintArtifact.getBlueprintArtifactName()));
- List<MicroService> microServicesChain = chainGenerator
- .getChainOfMicroServices(blueprintParser.getMicroServices(blueprintArtifact.getDcaeBlueprint()));
+ List<BlueprintMicroService> microServicesChain = chainGenerator
+ .getChainOfMicroServices(BlueprintParser.getMicroServices(blueprintArtifact.getDcaeBlueprint()));
if (microServicesChain.isEmpty()) {
- microServicesChain = blueprintParser.fallbackToOneMicroService(blueprintArtifact.getDcaeBlueprint());
+ microServicesChain = BlueprintParser.fallbackToOneMicroService();
}
newLoopTemplate.setModelService(service);
- newLoopTemplate.addLoopElementModels(createMicroServiceModels(microServicesChain, csar, blueprintArtifact));
+ newLoopTemplate.addLoopElementModels(createMicroServiceModels(microServicesChain));
newLoopTemplate.setMaximumInstancesAllowed(0);
newLoopTemplate.setSvgRepresentation(svgFacade.getSvgImage(microServicesChain));
DcaeInventoryResponse dcaeResponse = queryDcaeToGetServiceTypeId(blueprintArtifact);
@@ -166,14 +171,14 @@ public class CsarInstaller {
return newLoopTemplate;
}
- private HashSet<LoopElementModel> createMicroServiceModels(List<MicroService> microServicesChain, CsarHandler csar,
- BlueprintArtifact blueprintArtifact) throws IOException {
+ private HashSet<LoopElementModel> createMicroServiceModels(List<BlueprintMicroService> microServicesChain)
+ throws InterruptedException {
HashSet<LoopElementModel> newSet = new HashSet<>();
- for (MicroService microService : microServicesChain) {
+ for (BlueprintMicroService microService : microServicesChain) {
LoopElementModel loopElementModel = new LoopElementModel(microService.getModelType(), "CONFIG_POLICY",
- blueprintArtifact.getDcaeBlueprint());
+ null);
newSet.add(loopElementModel);
- loopElementModel.addPolicyModel(createPolicyModel(microService, csar));
+ loopElementModel.addPolicyModel(getPolicyModel(microService));
}
return newSet;
}
@@ -183,14 +188,20 @@ public class CsarInstaller {
return policyNameArray[policyNameArray.length - 1];
}
- private PolicyModel createPolicyModel(MicroService microService, CsarHandler csar) throws IOException {
- return new PolicyModel(microService.getModelType(), csar.getPolicyModelYaml().orElse(""), "1.0",
- createPolicyAcronym(microService.getModelType()));
+ private PolicyModel createPolicyModel(BlueprintMicroService microService) throws InterruptedException {
+ return new PolicyModel(microService.getModelType(),
+ policyEngineServices.downloadOnePolicy(microService.getModelType(), microService.getModelVersion()),
+ microService.getModelVersion(), createPolicyAcronym(microService.getModelType()));
+ }
+
+ private PolicyModel getPolicyModel(BlueprintMicroService microService) throws InterruptedException {
+ return policyModelsRepository
+ .findById(new PolicyModelId(microService.getModelType(), microService.getModelVersion()))
+ .orElse(createPolicyModel(microService));
}
/**
- * ll get the latest version of the artifact (version can be specified to DCAE
- * call).
+ * Get the service blueprint Id in the Dcae inventory using the SDC UUID.
*
* @return The DcaeInventoryResponse object containing the dcae values
*/
diff --git a/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java b/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java
index e3f05a01d..0a0831bb7 100644
--- a/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java
+++ b/src/main/java/org/onap/clamp/loop/template/LoopElementModel.java
@@ -70,7 +70,7 @@ public class LoopElementModel extends AuditEntity implements Serializable {
/**
* Here we store the blueprint coming from DCAE.
*/
- @Column(columnDefinition = "MEDIUMTEXT", nullable = false, name = "blueprint_yaml")
+ @Column(columnDefinition = "MEDIUMTEXT", name = "blueprint_yaml")
private String blueprint;
/**
diff --git a/src/main/java/org/onap/clamp/loop/template/PolicyModel.java b/src/main/java/org/onap/clamp/loop/template/PolicyModel.java
index 886e8c806..53539fccb 100644
--- a/src/main/java/org/onap/clamp/loop/template/PolicyModel.java
+++ b/src/main/java/org/onap/clamp/loop/template/PolicyModel.java
@@ -224,7 +224,13 @@ public class PolicyModel extends AuditEntity implements Serializable, Comparable
@Override
public int compareTo(PolicyModel arg0) {
- // Reverse it, so that by default we have the latest
- return SemanticVersioning.compare(arg0.getVersion(), this.version);
+
+ if (this.getPolicyModelType().equals(arg0.getPolicyModelType())) {
+ // Reverse it, so that by default we have the latest in they are same model type
+ return SemanticVersioning.compare(arg0.getVersion(), this.version);
+ } else {
+ return this.getPolicyModelType().compareTo(arg0.getPolicyModelType());
+ }
+
}
}
diff --git a/src/main/java/org/onap/clamp/policy/downloader/PolicyDownloader.java b/src/main/java/org/onap/clamp/policy/downloader/PolicyDownloader.java
new file mode 100644
index 000000000..b712dc3f6
--- /dev/null
+++ b/src/main/java/org/onap/clamp/policy/downloader/PolicyDownloader.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.clamp.policy.downloader;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import org.apache.camel.CamelContext;
+import org.onap.clamp.clds.client.DcaeInventoryServices;
+import org.onap.clamp.clds.config.ClampProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+
+/**
+ * This class implements a periodic job that is done in the background to
+ * synchronize policy models available on the policy engine and the clamp
+ * database table PolicyModel.
+ */
+@Configuration
+@Profile("clamp-policy-controller")
+public class PolicyDownloader {
+
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class);
+ protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ public static final String POLICY_RETRY_INTERVAL = "policy.retry.interval";
+ public static final String POLICY_RETRY_LIMIT = "policy.retry.limit";
+
+ private final CamelContext camelContext;
+
+ private final ClampProperties refProp;
+
+ @Autowired
+ public PolicyDownloader(CamelContext camelContext, ClampProperties refProp) {
+ this.refProp = refProp;
+ this.camelContext = camelContext;
+ }
+
+}
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties
index d389b211c..b9af1b470 100644
--- a/src/main/resources/application-noaaf.properties
+++ b/src/main/resources/application-noaaf.properties
@@ -73,7 +73,7 @@ clamp.config.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile
server.servlet.context-path=/
#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-default-user,clamp-sdc-controller-new,clamp-ssl-config
+spring.profiles.active=clamp-default,clamp-default-user,clamp-sdc-controller,clamp-ssl-config
spring.http.converters.preferred-json-mapper=gson
#The max number of active threads in this pool
@@ -160,26 +160,6 @@ clamp.config.policy.pap.url=http4://localhost:8085
clamp.config.policy.pap.userName=healthcheck
clamp.config.policy.pap.password=zb!XztG34
-
-clamp.config.policy.clientKey=dGVzdA==
-#DEVL for development
-#TEST for Test environments
-#PROD for prod environments
-clamp.config.policy.policyEnvironment=TEST
-# General Policy request properties
-#
-clamp.config.policy.onap.name=DCAE
-clamp.config.policy.pdp.group=default
-clamp.config.policy.ms.type=MicroService
-clamp.config.policy.ms.policyNamePrefix=Config_MS_
-clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_
-clamp.config.policy.base.policyNamePrefix=Config_
-clamp.config.policy.op.type=BRMS_Param
-
-clamp.config.import.tosca.model=true
-clamp.config.tosca.policyTypes=tca
-clamp.config.tosca.filePath=/tmp/tosca-models
-
# TCA MicroService Policy request build properties
#
clamp.config.tca.policyid.prefix=DCAE.Config_
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index b97d64364..e4568995d 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -78,7 +78,7 @@ server.ssl.trust-store-password=enc:iDnPBBLq_EMidXlMa1FEuBR8TZzYxrCg66vq_XfLHdJ
server.servlet.context-path=/
#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller-new,clamp-ssl-config
+spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller,clamp-ssl-config
spring.http.converters.preferred-json-mapper=gson
#The max number of active threads in this pool
@@ -163,34 +163,6 @@ clamp.config.policy.pap.url=http4://policy.api.simpledemo.onap.org:6969
clamp.config.policy.pap.userName=healthcheck
clamp.config.policy.pap.password=zb!XztG34
-clamp.config.policy.pdpUrl1=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
-clamp.config.policy.pdpUrl2=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
-clamp.config.policy.papUrl=http://policy.api.simpledemo.onap.org:8081/pap/ , testpap, alpha123
-clamp.config.policy.notificationType=websocket
-clamp.config.policy.notificationUebServers=localhost
-clamp.config.policy.notificationTopic=PDPD-CONFIGURATION
-clamp.config.policy.clientId=python
-# base64 encoding
-
-clamp.config.policy.clientKey=dGVzdA==
-#DEVL for development
-#TEST for Test environments
-#PROD for prod environments
-clamp.config.policy.policyEnvironment=TEST
-# General Policy request properties
-#
-clamp.config.policy.onap.name=DCAE
-clamp.config.policy.pdp.group=default
-clamp.config.policy.ms.type=MicroService
-clamp.config.policy.ms.policyNamePrefix=Config_MS_
-clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_
-clamp.config.policy.base.policyNamePrefix=Config_
-clamp.config.policy.op.type=BRMS_Param
-
-clamp.config.import.tosca.model=true
-clamp.config.tosca.policyTypes=tca
-clamp.config.tosca.filePath=/tmp/tosca-models
-
# TCA MicroService Policy request build properties
#
clamp.config.tca.policyid.prefix=DCAE.Config_
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml
index 97416a6cc..ce24b27ce 100644
--- a/src/main/resources/clds/camel/routes/policy-flows.xml
+++ b/src/main/resources/clds/camel/routes/policy-flows.xml
@@ -1,520 +1,587 @@
<routes xmlns="http://camel.apache.org/schema/spring">
- <route id="verify-one-policy">
- <from uri="direct:verify-one-policy" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-policy" />
- <when>
- <simple> ${header.CamelHttpResponseCode} != 200 </simple>
- <setProperty propertyName="policyFound">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <log loggingLevel="WARN"
- message="At least one policy has not been found on policy engine: ${exchangeProperty[policyName]}" />
- </when>
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-deployment-policy" />
- <when>
- <simple> ${header.CamelHttpResponseCode} != 200 </simple>
- <setProperty propertyName="policyDeployed">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <log loggingLevel="WARN"
- message="At least one policy has not been deployed on policy engine: ${exchangeProperty[policyName]}" />
- </when>
- <setProperty propertyName="newPolicyState">
- <simple>${exchangeProperty[policyComponent].computeState(*)}</simple>
- </setProperty>
- </route>
-
- <route id="get-policy">
- <from uri="direct:get-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Getting Policy: ${exchangeProperty[policyName]}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Get Policy')" />
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} GET
- Policy status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="get-deployment-policy">
- <from uri="direct:get-deployment-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Getting the policy deployment in PDP: ${exchangeProperty[policyName]}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy deployment in PDP')" />
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get policy deployment status: {{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} GET Policy deployment
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
+ <route id="verify-one-policy">
+ <from uri="direct:verify-one-policy"/>
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
</setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
- <route id="create-micro-service-policy">
- <from uri="direct:create-micro-service-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')" />
- <setBody>
- <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} creation
- status
- </simple>
+ <to uri="direct:get-policy"/>
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="policyFound">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <log loggingLevel="WARN"
+ message="At least one policy has not been found on policy engine: ${exchangeProperty[policyName]}"/>
+ </when>
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
</setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
+ <to uri="direct:get-deployment-policy"/>
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="policyDeployed">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <log loggingLevel="WARN"
+ message="At least one policy has not been deployed on policy engine: ${exchangeProperty[policyName]}"/>
+ </when>
+ <setProperty propertyName="newPolicyState">
+ <simple>${exchangeProperty[policyComponent].computeState(*)}</simple>
</setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ </route>
- <route id="delete-micro-service-policy">
- <from uri="direct:delete-micro-service-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
+ <route id="get-policy">
+ <from uri="direct:get-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting Policy: ${exchangeProperty[policyName]}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Get Policy')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} GET
+ Policy status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="get-deployment-policy">
+ <from uri="direct:get-deployment-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting the policy deployment in PDP: ${exchangeProperty[policyName]}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy deployment in PDP')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policy deployment status: {{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} GET Policy deployment
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-all-policy-models">
+ <from uri="direct:get-all-policy-models"/>
+ <doTry>
+ <log loggingLevel="INFO" message="Getting all the policy models"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting all the policy models')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get all policy models: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/api/v1/policytypes?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <convertBodyTo type="java.lang.String"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-policy-model">
+ <from uri="direct:get-policy-model"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting the policy model: ${exchangeProperty[policyModelName]}/${exchangeProperty[policyModelVersion]}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy model')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policy model: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <convertBodyTo type="java.lang.String"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="create-micro-service-policy">
+ <from uri="direct:create-micro-service-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')"/>
+ <setBody>
+ <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[microServicePolicy].getName()} creation
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="create-operational-policy">
- <from uri="direct:create-operational-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')" />
- <setBody>
- <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} creation
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="delete-micro-service-policy">
+ <from uri="direct:delete-micro-service-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')"/>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <route id="delete-operational-policy">
- <from uri="direct:delete-operational-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[microServicePolicy].getName()} removal
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="create-guard-policy">
- <from uri="direct:create-guard-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')" />
- <setBody>
- <simple>${exchangeProperty[guardPolicy].getValue()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} creation status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="create-operational-policy">
+ <from uri="direct:create-operational-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')"/>
+ <setBody>
+ <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[operationalPolicy].getName()} creation
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="delete-guard-policy">
- <from uri="direct:delete-guard-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
+ <route id="delete-operational-policy">
+ <from uri="direct:delete-operational-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')"/>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[operationalPolicy].getName()} removal
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} removal status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="create-guard-policy">
+ <from uri="direct:create-guard-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating Guard Policy: ${exchangeProperty[guardPolicy].getKey()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')"/>
+ <setBody>
+ <simple>${exchangeProperty[guardPolicy].getValue()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[guardPolicy].getKey()} creation status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="add-all-to-active-pdp-group">
- <from uri="direct:add-all-to-active-pdp-group" />
- <doTry>
- <log loggingLevel="INFO"
- message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')" />
- <setBody>
- <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
+ <route id="delete-guard-policy">
+ <from uri="direct:delete-guard-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Deleting Guard Policy: ${exchangeProperty[guardPolicy].getKey()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')"/>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>PDP Group push ALL status</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[guardPolicy].getKey()} removal status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="remove-all-policy-from-active-pdp-group">
- <from uri="direct:remove-all-policy-from-active-pdp-group" />
- <doTry>
- <log loggingLevel="INFO"
- message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')" />
- <split>
- <simple>${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])}
- </simple>
- <setProperty propertyName="policyName">
- <simple>${body}</simple>
- </setProperty>
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} PDP Group removal status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </split>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <setProperty propertyName="logMessage">
- <simple>PDP Group removal, Error reported: ${exception}</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doCatch>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doFinally>
- </doTry>
- </route>
+ <route id="add-all-to-active-pdp-group">
+ <from uri="direct:add-all-to-active-pdp-group"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')"/>
+ <setBody>
+ <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>PDP Group push ALL status</simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="remove-all-policy-from-active-pdp-group">
+ <from uri="direct:remove-all-policy-from-active-pdp-group"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')"/>
+ <split>
+ <simple>${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])}
+ </simple>
+ <setProperty propertyName="policyName">
+ <simple>${body}</simple>
+ </setProperty>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} PDP Group removal status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </split>
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <setProperty propertyName="logMessage">
+ <simple>PDP Group removal, Error reported: ${exception}</simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doCatch>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
</routes> \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyConfigurationItCase.java b/src/test/java/org/onap/clamp/clds/it/PolicyConfigurationItCase.java
deleted file mode 100644
index fd20e360a..000000000
--- a/src/test/java/org/onap/clamp/clds/it/PolicyConfigurationItCase.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-2018 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.clamp.clds.it;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.clamp.clds.config.PolicyConfiguration;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-/**
- * Test Config Policy read from application.properties.
- */
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class PolicyConfigurationItCase {
-
- @Autowired
- private PolicyConfiguration policyConfiguration;
-
- @Test
- public void testPolicyConfiguration() {
- assertNotNull(policyConfiguration.getPdpUrl1());
- assertNotNull(policyConfiguration.getPdpUrl2());
- assertNotNull(policyConfiguration.getPapUrl());
- assertNotNull(policyConfiguration.getPolicyEnvironment());
- assertNotNull(policyConfiguration.getClientId());
- assertNotNull(policyConfiguration.getClientKey());
- assertNotNull(policyConfiguration.getNotificationType());
- assertNotNull(policyConfiguration.getNotificationUebServers());
- assertEquals(8, policyConfiguration.getProperties().size());
- assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL1))
- .contains("/pdp/ , testpdp, alpha123"));
- assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL2))
- .contains("/pdp/ , testpdp, alpha123"));
- assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PAP_URL))
- .contains("/pap/ , testpap, alpha123"));
- assertEquals("websocket", policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_TYPE));
- assertEquals("localhost",
- policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_UEB_SERVERS));
- assertEquals("python", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_ID));
- assertEquals("dGVzdA==", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_KEY));
- assertEquals("DEVL", policyConfiguration.getProperties().get(PolicyConfiguration.ENVIRONMENT));
- }
-}
diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
index d34042038..c25415ecc 100644
--- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
@@ -28,10 +28,9 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-
import com.google.gson.JsonElement;
+
import java.io.IOException;
-import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -55,19 +54,15 @@ public class CldsReferencePropertiesItCase {
*/
@Test
public void testGetStringValue() {
- assertEquals("DCAE", refProp.getStringValue("policy.onap.name"));
- assertEquals("Config_MS_", refProp.getStringValue("policy.ms.policyNamePrefix", ""));
- assertEquals("Config_MS_", refProp.getStringValue("policy.ms.policyNamePrefix", "testos"));
- assertEquals("Config_MS_", refProp.getStringValue("policy.ms", "policyNamePrefix"));
- assertNull(refProp.getStringValue("does.not.exist"));
+ assertEquals("healthcheck", refProp.getStringValue("policy.api.userName"));
}
@Test
public void shouldReturnJsonFromTemplate() throws IOException {
- //when
+ // when
JsonElement root = refProp.getJsonTemplate("ui.location.default");
- //then
+ // then
assertNotNull(root);
assertTrue(root.isJsonObject());
assertEquals("Data Center 1", root.getAsJsonObject().get("DC1").getAsString());
@@ -75,10 +70,10 @@ public class CldsReferencePropertiesItCase {
@Test
public void shouldReturnJsonFromTemplate_2() throws IOException {
- //when
+ // when
JsonElement root = refProp.getJsonTemplate("ui.location", "default");
- //then
+ // then
assertNotNull(root);
assertTrue(root.isJsonObject());
assertEquals("Data Center 1", root.getAsJsonObject().get("DC1").getAsString());
@@ -86,18 +81,17 @@ public class CldsReferencePropertiesItCase {
@Test
public void shouldReturnNullIfPropertyNotFound() throws IOException {
- //when
+ // when
JsonElement root = refProp.getJsonTemplate("ui.location", "");
- //then
+ // then
assertNull(root);
}
/**
* Test getting prop value as a JSON Node / template.
*
- * @throws IOException
- * when JSON parsing fails
+ * @throws IOException when JSON parsing fails
*/
@Test
public void testGetFileContent() throws IOException {
@@ -109,13 +103,4 @@ public class CldsReferencePropertiesItCase {
content = refProp.getFileContent("ui.location", "default");
assertEquals(location, content);
}
-
- @Test
- public void testGetStringList() {
- List<String> profileList = refProp.getStringList("policy.pdpUrl1", ",");
- assertEquals(3, profileList.size());
- assertTrue(profileList.get(0).trim().startsWith("http://localhost:"));
- assertEquals("testpdp", profileList.get(1).trim());
- assertEquals("alpha123", profileList.get(2).trim());
- }
}
diff --git a/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java b/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java
index 7c520a252..7ef734533 100644
--- a/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java
@@ -45,7 +45,7 @@ import org.springframework.test.util.ReflectionTestUtils;
*/
@RunWith(SpringRunner.class)
@SpringBootTest
-@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller-new")
+@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller")
public class SdcControllersConfigurationItCase {
@Autowired
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
index e48bfc44a..9efb68983 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
@@ -44,6 +44,7 @@ import org.json.JSONObject;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
import org.onap.clamp.clds.util.ResourceFileUtil;
import org.yaml.snakeyaml.Yaml;
@@ -53,17 +54,16 @@ public class BlueprintParserTest {
private static final String SECOND_APPP = "second_app";
private static final String THIRD_APPP = "third_app";
private static final String MODEL_TYPE1 = "type1";
- private static final String MODEL_TYPE2 = "type2";
- private static final String MODEL_TYPE3 = "type3";
+ private static final String MODEL_TYPE_TCA = "onap.policies.monitoring.cdap.tca.hi.lo.app";
+ private static final String VERSION = "1.0.0";
private static String microServiceTheWholeBlueprintValid;
- private static String microServiceBlueprintOldStyleTCA;
- private static String microServiceBlueprintOldStyleHolmes;
private static String newMicroServiceBlueprint;
- private static JsonObject jsonObjectBlueprintValid;
+ private static JsonObject jsonObjectBlueprintInvalid;
private static JsonObject jsonObjectBlueprintWithoutName;
private static JsonObject jsonObjectBlueprintWithoutProperties;
private static JsonObject jsonObjectBlueprintWithoutRelationships;
+ private static JsonObject jsonObjectBlueprintValidWithVersion;
/**
* Method to load Blueprints before all test.
@@ -74,20 +74,21 @@ public class BlueprintParserTest {
public static void loadBlueprints() throws IOException {
microServiceTheWholeBlueprintValid = ResourceFileUtil
.getResourceAsString("clds/blueprint-with-microservice-chain.yaml");
- microServiceBlueprintOldStyleTCA = ResourceFileUtil.getResourceAsString("clds/tca-old-style-ms.yaml");
+
newMicroServiceBlueprint = ResourceFileUtil.getResourceAsString("clds/new-microservice.yaml");
- microServiceBlueprintOldStyleHolmes = ResourceFileUtil.getResourceAsString("clds/holmes-old-style-ms.yaml");
- String microServiceBlueprintValid = ResourceFileUtil
- .getResourceAsString("clds/single-microservice-fragment-valid.yaml");
+ String microServiceBlueprintInvalid = ResourceFileUtil
+ .getResourceAsString("clds/single-microservice-fragment-invalid.yaml");
+ jsonObjectBlueprintInvalid = yamlToJson(microServiceBlueprintInvalid);
String microServiceBlueprintWithoutName = ResourceFileUtil
.getResourceAsString("clds/single-microservice-fragment-without-name.yaml");
+ jsonObjectBlueprintWithoutName = yamlToJson(microServiceBlueprintWithoutName);
String microServiceBlueprintWithoutProperties = ResourceFileUtil
.getResourceAsString("clds/single-microservice-fragment-without-properties.yaml");
-
- jsonObjectBlueprintValid = yamlToJson(microServiceBlueprintValid);
- jsonObjectBlueprintWithoutName = yamlToJson(microServiceBlueprintWithoutName);
jsonObjectBlueprintWithoutProperties = yamlToJson(microServiceBlueprintWithoutProperties);
+ String microServiceBlueprintValidWithVersion = ResourceFileUtil
+ .getResourceAsString("clds/single-microservice-fragment-valid-with-version.yaml");
+ jsonObjectBlueprintValidWithVersion = yamlToJson(microServiceBlueprintValidWithVersion);
String microServiceBlueprintWithoutRelationships = ResourceFileUtil
.getResourceAsString("clds/single-microservice-fragment-without-relationships.yaml");
@@ -97,11 +98,11 @@ public class BlueprintParserTest {
@Test
public void getNameShouldReturnDefinedName() {
- final JsonObject jsonObject = jsonObjectBlueprintValid;
+ final JsonObject jsonObject = jsonObjectBlueprintInvalid;
String expectedName = jsonObject.get(jsonObject.keySet().iterator().next()).getAsJsonObject().get("properties")
.getAsJsonObject().get("name").getAsString();
Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
- String actualName = new BlueprintParser().getName(entry);
+ String actualName = BlueprintParser.getName(entry);
Assert.assertEquals(expectedName, actualName);
}
@@ -112,7 +113,7 @@ public class BlueprintParserTest {
String expectedName = jsonObject.keySet().iterator().next();
Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
- String actualName = new BlueprintParser().getName(entry);
+ String actualName = BlueprintParser.getName(entry);
Assert.assertEquals(expectedName, actualName);
}
@@ -123,18 +124,18 @@ public class BlueprintParserTest {
String expectedName = jsonObject.keySet().iterator().next();
Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
- String actualName = new BlueprintParser().getName(entry);
+ String actualName = BlueprintParser.getName(entry);
Assert.assertEquals(expectedName, actualName);
}
@Test
public void getInputShouldReturnInputWhenPresent() {
- final JsonObject jsonObject = jsonObjectBlueprintValid;
+ final JsonObject jsonObject = jsonObjectBlueprintInvalid;
String expected = FIRST_APPP;
Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
- String actual = new BlueprintParser().getInput(entry);
+ String actual = BlueprintParser.getInput(entry);
Assert.assertEquals(expected, actual);
}
@@ -145,63 +146,56 @@ public class BlueprintParserTest {
String expected = "";
Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
- String actual = new BlueprintParser().getInput(entry);
+ String actual = BlueprintParser.getInput(entry);
Assert.assertEquals(expected, actual);
}
- @Test
- public void getNodeRepresentationFromCompleteYaml() {
- final JsonObject jsonObject = jsonObjectBlueprintValid;
-
- MicroService expected = new MicroService(SECOND_APPP, MODEL_TYPE1, FIRST_APPP, "");
- Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
- MicroService actual = new BlueprintParser().getNodeRepresentation(entry, jsonObject, null);
-
- Assert.assertEquals(expected, actual);
+ @Test(expected = BlueprintParserException.class)
+ public void getNodeRepresentationFromIncompleteYaml() throws BlueprintParserException {
+ BlueprintParser.getNodeRepresentation(jsonObjectBlueprintInvalid.entrySet().iterator().next(),
+ jsonObjectBlueprintInvalid, null);
}
@Test
- public void getMicroServicesFromBlueprintTest() {
- MicroService thirdApp = new MicroService(THIRD_APPP, MODEL_TYPE3, "", "");
- MicroService firstApp = new MicroService(FIRST_APPP, MODEL_TYPE1, THIRD_APPP, "");
- MicroService secondApp = new MicroService(SECOND_APPP, MODEL_TYPE2, FIRST_APPP, "");
+ public void getNodeRepresentationFromCompleteYamlWithModelVersion() throws BlueprintParserException {
+ final JsonObject jsonObject = jsonObjectBlueprintValidWithVersion;
- Set<MicroService> expected = new HashSet<>(Arrays.asList(firstApp, secondApp, thirdApp));
- Set<MicroService> actual = new BlueprintParser().getMicroServices(microServiceTheWholeBlueprintValid);
+ BlueprintMicroService expected = new BlueprintMicroService(SECOND_APPP, MODEL_TYPE1, "", "10.0.0");
+ Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
+ BlueprintMicroService actual = BlueprintParser.getNodeRepresentation(entry, jsonObject, null);
Assert.assertEquals(expected, actual);
}
@Test
+ public void getMicroServicesFromBlueprintTest() throws BlueprintParserException {
+ BlueprintMicroService thirdApp = new BlueprintMicroService(THIRD_APPP, MODEL_TYPE_TCA, SECOND_APPP, VERSION);
+ BlueprintMicroService firstApp = new BlueprintMicroService(FIRST_APPP, MODEL_TYPE_TCA, "", VERSION);
+ BlueprintMicroService secondApp = new BlueprintMicroService(SECOND_APPP, MODEL_TYPE_TCA, FIRST_APPP, VERSION);
- public void fallBackToOneMicroServiceTcaTest() {
- MicroService tcaMs = new MicroService(BlueprintParser.TCA, "onap.policies.monitoring.cdap.tca.hi.lo.app", "",
- "");
- List<MicroService> expected = Collections.singletonList(tcaMs);
- List<MicroService> actual = new BlueprintParser().fallbackToOneMicroService(microServiceBlueprintOldStyleTCA);
+ Set<BlueprintMicroService> expected = new HashSet<>(Arrays.asList(firstApp, secondApp, thirdApp));
+ Set<BlueprintMicroService> actual = BlueprintParser.getMicroServices(microServiceTheWholeBlueprintValid);
Assert.assertEquals(expected, actual);
}
@Test
- public void fallBackToOneMicroServiceHolmesTest() {
- MicroService holmesMs = new MicroService(BlueprintParser.HOLMES, "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "", "");
-
- List<MicroService> expected = Collections.singletonList(holmesMs);
- List<MicroService> actual = new BlueprintParser()
- .fallbackToOneMicroService(microServiceBlueprintOldStyleHolmes);
+ public void fallBackToOneMicroServiceTcaTest() {
+ BlueprintMicroService tcaMs = new BlueprintMicroService(BlueprintParser.TCA,
+ "onap.policies.monitoring.cdap.tca.hi.lo.app", "", VERSION);
+ List<BlueprintMicroService> expected = Collections.singletonList(tcaMs);
+ List<BlueprintMicroService> actual = BlueprintParser.fallbackToOneMicroService();
Assert.assertEquals(expected, actual);
}
@Test
- public void newMicroServiceTest() {
- List<MicroService> microServicesChain = new ChainGenerator()
- .getChainOfMicroServices(new BlueprintParser().getMicroServices(newMicroServiceBlueprint));
+ public void newMicroServiceTest() throws BlueprintParserException {
+ List<BlueprintMicroService> microServicesChain = new ChainGenerator()
+ .getChainOfMicroServices(BlueprintParser.getMicroServices(newMicroServiceBlueprint));
if (microServicesChain.isEmpty()) {
- microServicesChain = new BlueprintParser().fallbackToOneMicroService(newMicroServiceBlueprint);
+ microServicesChain = BlueprintParser.fallbackToOneMicroService();
}
assertThat(microServicesChain.size()).isEqualTo(1);
assertThat(microServicesChain.get(0).getName()).isEqualTo("pmsh");
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
index 4b4563cd4..83b3dda01 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
@@ -36,42 +36,43 @@ public class ChainGeneratorTest {
private static final String SECOND_APPP = "second_app";
private static final String THIRD_APPP = "third_app";
private static final String FOURTH_APPP = "fourth_app";
+ private static final String DEFAULT_VERSION = "1.0.0";
@Test
public void getChainOfMicroServicesTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "");
- MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "");
- MicroService ms4 = new MicroService(FOURTH_APPP, "", THIRD_APPP, "");
+ BlueprintMicroService ms1 = new BlueprintMicroService(FIRST_APPP, "", "", DEFAULT_VERSION);
+ BlueprintMicroService ms2 = new BlueprintMicroService(SECOND_APPP, "", FIRST_APPP, DEFAULT_VERSION);
+ BlueprintMicroService ms3 = new BlueprintMicroService(THIRD_APPP, "", SECOND_APPP, DEFAULT_VERSION);
+ BlueprintMicroService ms4 = new BlueprintMicroService(FOURTH_APPP, "", THIRD_APPP, DEFAULT_VERSION);
- List<MicroService> expectedList = Arrays.asList(ms1, ms2, ms3, ms4);
- Set<MicroService> inputSet = new HashSet<>(expectedList);
+ List<BlueprintMicroService> expectedList = Arrays.asList(ms1, ms2, ms3, ms4);
+ Set<BlueprintMicroService> inputSet = new HashSet<>(expectedList);
- List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
+ List<BlueprintMicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
Assert.assertEquals(expectedList, actualList);
}
@Test
public void getChainOfMicroServicesTwiceNoInputTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, "", "", "");
- MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "");
- MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "");
+ BlueprintMicroService ms1 = new BlueprintMicroService(FIRST_APPP, "", "", DEFAULT_VERSION);
+ BlueprintMicroService ms2 = new BlueprintMicroService(SECOND_APPP, "", "", DEFAULT_VERSION);
+ BlueprintMicroService ms3 = new BlueprintMicroService(THIRD_APPP, "", SECOND_APPP, DEFAULT_VERSION);
+ BlueprintMicroService ms4 = new BlueprintMicroService(FOURTH_APPP, "", FIRST_APPP, DEFAULT_VERSION);
- Set<MicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
- List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
+ Set<BlueprintMicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
+ List<BlueprintMicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
Assert.assertTrue(actualList.isEmpty());
}
@Test
public void getChainOfMicroServicesBranchingTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "");
- MicroService ms3 = new MicroService(THIRD_APPP, "", FIRST_APPP, "");
- MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "");
+ BlueprintMicroService ms1 = new BlueprintMicroService(FIRST_APPP, "", "", DEFAULT_VERSION);
+ BlueprintMicroService ms2 = new BlueprintMicroService(SECOND_APPP, "", FIRST_APPP, DEFAULT_VERSION);
+ BlueprintMicroService ms3 = new BlueprintMicroService(THIRD_APPP, "", FIRST_APPP, DEFAULT_VERSION);
+ BlueprintMicroService ms4 = new BlueprintMicroService(FOURTH_APPP, "", FIRST_APPP, DEFAULT_VERSION);
- Set<MicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
- List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
+ Set<BlueprintMicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
+ List<BlueprintMicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
Assert.assertTrue(actualList.isEmpty());
}
}
diff --git a/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java b/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java
index 1453d0baa..f6054d538 100644
--- a/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java
@@ -45,7 +45,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
-@PowerMockIgnore({ "javax.crypto.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*" })
+@PowerMockIgnore({ "javax.crypto.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*" })
public class CryptoUtilsTest {
private final String data = "This is a test string";
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
index 269ad42e1..65eb2696f 100644
--- a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
@@ -39,7 +39,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.clamp.clds.sdc.controller.installer.MicroService;
+import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService;
@RunWith(MockitoJUnitRunner.class)
public class ClampGraphBuilderTest {
@@ -50,7 +50,7 @@ public class ClampGraphBuilderTest {
private ArgumentCaptor<String> collectorCaptor;
@Captor
- private ArgumentCaptor<List<MicroService>> microServicesCaptor;
+ private ArgumentCaptor<List<BlueprintMicroService>> microServicesCaptor;
@Captor
private ArgumentCaptor<String> policyCaptor;
@@ -58,17 +58,17 @@ public class ClampGraphBuilderTest {
@Test
public void clampGraphBuilderCompleteChainTest() {
String collector = "VES";
- MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id");
- MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id");
+ BlueprintMicroService ms1 = new BlueprintMicroService("ms1", "", "", "1.0.0");
+ BlueprintMicroService ms2 = new BlueprintMicroService("ms2", "", "", "1.0.0");
String policy = "OperationalPolicy";
- final List<MicroService> microServices = Arrays.asList(ms1, ms2);
+ final List<BlueprintMicroService> microServices = Arrays.asList(ms1, ms2);
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).policy(policy).build();
verify(mockPainter, times(1)).doPaint(collectorCaptor.capture(), microServicesCaptor.capture(),
- policyCaptor.capture());
+ policyCaptor.capture());
Assert.assertEquals(collector, collectorCaptor.getValue());
Assert.assertEquals(microServices, microServicesCaptor.getValue());
@@ -78,8 +78,8 @@ public class ClampGraphBuilderTest {
@Test(expected = InvalidStateException.class)
public void clampGraphBuilderNoPolicyGivenTest() {
String collector = "VES";
- MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id");
- MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id");
+ BlueprintMicroService ms1 = new BlueprintMicroService("ms1", "", "", "1.0.0");
+ BlueprintMicroService ms2 = new BlueprintMicroService("ms2", "", "", "1.0.0");
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).build();
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index 70adf3eef..636684cdb 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -44,6 +44,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.onap.clamp.clds.Application;
+import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
@@ -73,7 +74,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller-new")
+@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller")
public class CsarInstallerItCase {
private static final String CSAR_ARTIFACT_NAME = "example/sdc/service_Vloadbalancerms_csar.csar";
@@ -180,7 +181,7 @@ public class CsarInstallerItCase {
@Test
@Transactional
public void testIsCsarAlreadyDeployedTca() throws SdcArtifactInstallerException, SdcToscaParserException,
- CsarHandlerException, IOException, InterruptedException {
+ CsarHandlerException, IOException, InterruptedException, BlueprintParserException {
String generatedName = RandomStringUtils.randomAlphanumeric(5);
CsarHandler csarHandler = buildFakeCsarHandler(generatedName);
assertThat(csarInstaller.isCsarAlreadyDeployed(csarHandler)).isFalse();
@@ -192,7 +193,7 @@ public class CsarInstallerItCase {
@Transactional
@Commit
public void testInstallTheCsarTca() throws SdcArtifactInstallerException, SdcToscaParserException,
- CsarHandlerException, IOException, JSONException, InterruptedException {
+ CsarHandlerException, IOException, JSONException, InterruptedException, BlueprintParserException {
String generatedName = RandomStringUtils.randomAlphanumeric(5);
CsarHandler csar = buildFakeCsarHandler(generatedName);
csarInstaller.installTheCsar(csar);
@@ -233,16 +234,9 @@ public class CsarInstallerItCase {
assertThat(policyModelsRepository.findAll().size()).isEqualByComparingTo(1);
assertThat(policyModelsRepository
- .existsById(new PolicyModelId("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0"))).isTrue();
- }
-
- @Test(expected = SdcArtifactInstallerException.class)
- @Transactional
- public void shouldThrowSdcArtifactInstallerException()
- throws SdcArtifactInstallerException, SdcToscaParserException, IOException, InterruptedException {
- String generatedName = RandomStringUtils.randomAlphanumeric(5);
- CsarHandler csarHandler = buildFakeCsarHandler(generatedName);
- Mockito.when(csarHandler.getPolicyModelYaml()).thenThrow(IOException.class);
- csarInstaller.installTheCsar(csarHandler);
+ .existsById(new PolicyModelId("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0"))).isTrue();
+ assertThat(policyModelsRepository
+ .getOne((new PolicyModelId("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0")))
+ .getPolicyModelTosca()).isNotBlank();
}
}
diff --git a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
index f8c1d8662..ce1181d33 100644
--- a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
+++ b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
@@ -28,6 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
+import java.util.stream.Collectors;
import javax.transaction.Transactional;
@@ -52,11 +53,13 @@ public class PolicyModelServiceItCase {
@Autowired
PolicyModelsRepository policyModelsRepository;
- private static final String POLICY_MODEL_TYPE_1 = "org.onap.test";
+ private static final String POLICY_MODEL_TYPE_1 = "org.onap.testos";
private static final String POLICY_MODEL_TYPE_1_VERSION_1 = "1.0.0";
- private static final String POLICY_MODEL_TYPE_2 = "org.onap.test2";
+ private static final String POLICY_MODEL_TYPE_2 = "org.onap.testos2";
+ private static final String POLICY_MODEL_TYPE_3 = "org.onap.testos3";
private static final String POLICY_MODEL_TYPE_2_VERSION_1 = "1.0.0";
+ private static final String POLICY_MODEL_TYPE_3_VERSION_1 = "1.0.0";
private static final String POLICY_MODEL_TYPE_2_VERSION_2 = "2.0.0";
private PolicyModel getPolicyModel(String policyType, String policyModelTosca, String version, String policyAcronym,
@@ -150,9 +153,17 @@ public class PolicyModelServiceItCase {
PolicyModel policyModel2 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml", POLICY_MODEL_TYPE_2_VERSION_2, "TEST",
"VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel2);
+ PolicyModel policyModel3 = getPolicyModel(POLICY_MODEL_TYPE_3, "yaml", POLICY_MODEL_TYPE_3_VERSION_1, "TEST",
+ "VARIANT", "user");
+ policyModelsService.saveOrUpdatePolicyModel(policyModel3);
SortedSet<PolicyModel> sortedSet = new TreeSet<>();
policyModelsService.getAllPolicyModels().forEach(sortedSet::add);
- assertThat(sortedSet).contains(policyModel2, policyModel1);
+ List<PolicyModel> listToCheck = sortedSet.stream().filter(
+ policy -> policy.equals(policyModel3) || policy.equals(policyModel2) || policy.equals(policyModel1))
+ .collect(Collectors.toList());
+ assertThat(listToCheck.get(0)).isEqualByComparingTo(policyModel2);
+ assertThat(listToCheck.get(1)).isEqualByComparingTo(policyModel1);
+ assertThat(listToCheck.get(2)).isEqualByComparingTo(policyModel3);
}
}
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index bbade742c..17c42f560 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -116,7 +116,7 @@ spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.use-new-id-generator-mappings=true
# Whether to enable logging of SQL statements.
-spring.jpa.show-sql=true
+#spring.jpa.show-sql=true
#Async Executor default Parameters
async.core.pool.size=10
@@ -148,33 +148,6 @@ clamp.config.policy.pap.url=http4://localhost:${docker.http-cache.port.host}
clamp.config.policy.pap.userName=healthcheck
clamp.config.policy.pap.password=zb!XztG34
-clamp.config.policy.pdpUrl1=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123
-clamp.config.policy.pdpUrl2=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123
-clamp.config.policy.papUrl=http://localhost:${docker.http-cache.port.host}/pap/ , testpap, alpha123
-clamp.config.policy.notificationType=websocket
-clamp.config.policy.notificationUebServers=localhost
-clamp.config.policy.notificationTopic=
-clamp.config.policy.clientId=python
-# base64 encoding
-clamp.config.policy.clientKey=dGVzdA==
-#DEVL for development
-#TEST for Test environments
-#PROD for prod environments
-clamp.config.policy.policyEnvironment=DEVL
-# General Policy request properties
-#
-clamp.config.policy.onap.name=DCAE
-clamp.config.policy.pdp.group=default
-clamp.config.policy.ms.type=MicroService
-clamp.config.policy.ms.policyNamePrefix=Config_MS_
-clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_
-clamp.config.policy.base.policyNamePrefix=Config_
-clamp.config.policy.op.type=BRMS_Param
-
-clamp.config.import.tosca.model=false
-clamp.config.tosca.policyTypes=tca
-clamp.config.tosca.filePath=/tmp/tosca-models
-
# TCA MicroService Policy request build properties
#
clamp.config.tca.policyid.prefix=DCAE.Config_
diff --git a/src/test/resources/clds/OperationalPolicyRepresentationBuilderTest.java b/src/test/resources/clds/OperationalPolicyRepresentationBuilderTest.java
deleted file mode 100644
index 904525bea..000000000
--- a/src/test/resources/clds/OperationalPolicyRepresentationBuilderTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 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.clamp.policy.operational;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onap.clamp.clds.util.ResourceFileUtil;
-import org.skyscreamer.jsonassert.JSONAssert;
-
-public class OperationalPolicyRepresentationBuilderTest {
-
- @Test
- public void testOperationalPolicyPayloadConstruction() throws IOException {
- JsonObject jsonModel = new GsonBuilder().create()
- .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), JsonObject.class);
-
- JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(jsonModel);
-
- assertThat(jsonSchema).isNotNull();
-
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/operational-policy-json-schema.json"),
- new GsonBuilder().create().toJson(jsonSchema), false);
- }
-
-}
diff --git a/src/test/resources/clds/blueprint-parser-mapping.json b/src/test/resources/clds/blueprint-parser-mapping.json
deleted file mode 100644
index a22e9fcf1..000000000
--- a/src/test/resources/clds/blueprint-parser-mapping.json
+++ /dev/null
@@ -1,18 +0,0 @@
-[
- {
- "blueprintKey": "tca_",
- "dcaeDeployable":"true",
- "files": {
- "bpmnXmlFilePath": "classpath:/clds/templates/bpmn/tca-template.xml",
- "svgXmlFilePath": "classpath:/clds/templates/bpmn/tca-img.xml"
- }
- },
- {
- "blueprintKey": "holmes_",
- "dcaeDeployable":"false",
- "files": {
- "bpmnXmlFilePath": "classpath:/clds/templates/bpmn/holmes-template.xml",
- "svgXmlFilePath": "classpath:/clds/templates/bpmn/holmes-img.xml"
- }
- }
-]
diff --git a/src/test/resources/clds/blueprint-with-microservice-chain.yaml b/src/test/resources/clds/blueprint-with-microservice-chain.yaml
index fa2d72052..0e9e4bc8c 100644
--- a/src/test/resources/clds/blueprint-with-microservice-chain.yaml
+++ b/src/test/resources/clds/blueprint-with-microservice-chain.yaml
@@ -1,98 +1,202 @@
tosca_definitions_version: cloudify_dsl_1_3
+description: >
+ This blueprint deploys/manages the TCA module as a Docker container
+
imports:
- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.4/k8splugin_types.yaml
+ - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml
- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml
inputs:
- first_app_docker_image:
+ aaiEnrichmentHost:
+ type: string
+ default: "aai.onap.svc.cluster.local"
+ aaiEnrichmentPort:
+ type: string
+ default: "8443"
+ enableAAIEnrichment:
+ type: string
+ default: true
+ dmaap_host:
+ type: string
+ default: message-router.onap.svc.cluster.local
+ dmaap_port:
type: string
- default: "image1"
- second_app_docker_image:
+ default: "3904"
+ enableRedisCaching:
type: string
- default: "image2"
- third_app_docker_image:
+ default: false
+ redisHosts:
type: string
- default: "image3"
- dmaap_ip:
+ default: dcae-redis.onap.svc.cluster.local:6379
+ tag_version:
type: string
- default: "message-router:3904"
- dmaap_topic:
+ default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest"
+ consul_host:
type: string
- default: "/events/unauthenticated.DCAE_CL_OUTPUT"
+ default: consul-server.onap.svc.cluster.local
+ consul_port:
+ type: string
+ default: "8500"
+ cbs_host:
+ type: string
+ default: "config-binding-service.dcae.svc.cluster.local"
+ cbs_port:
+ type: string
+ default: "10000"
policy_id:
type: string
- default: "policy_id"
+ default: "none"
+ external_port:
+ type: string
+ description: Kubernetes node port on which CDAPgui is exposed
+ default: "32012"
+ policy_model_id:
+ type: string
+ default: "onap.policies.monitoring.cdap.tca.hi.lo.app"
+
node_templates:
- second_app:
- type: dcae.nodes.ContainerizedServiceComponentUsingDmaap
+ first_app:
+ type: dcae.nodes.ContainerizedServiceComponent
properties:
- service_component_type: dcaegen2-analytics-tca
- service_component_name_override: second_app
- image: { get_input: second_app_docker_image }
- policy_id:
- policy_model_id: "type2"
- interfaces:
- cloudify.interfaces.lifecycle:
- start:
- inputs:
- envs:
- grpc_server.host: "first_app.onap"
- dmaap_ip: {get_input: dmaap_ip}
- dmapp_topic: {get_input: dmaap_topic}
- policy_id: {get_input: policy_id}
- ports:
- - 8080:8080
+ service_component_type: 'dcaegen2-analytics-tca'
+ application_config: {}
+ docker_config: {}
+ image:
+ get_input: tag_version
+ log_info:
+ log_directory: "/opt/app/TCAnalytics/logs"
relationships:
- - type: cloudify.relationships.connected_to
- target: first_app
+ - target: tca_policy_1
+ type: cloudify.relationships.depends_on
+ second_app:
+ type: dcae.nodes.ContainerizedServiceComponent
+ relationships:
+ - target: tca_policy_2
+ type: cloudify.relationships.depends_on
- type: clamp_node.relationships.gets_input_from
target: first_app
- first_app:
- type: dcae.nodes.ContainerizedPlatformComponent
properties:
- name: first_app
- dns_name: "first_app"
- image: { get_input: first_app_docker_image }
- container_port: 6565
- policy_id:
- policy_model_id: "type1"
+ service_component_type: 'dcaegen2-analytics-tca'
+ application_config: {}
+ docker_config: {}
+ image:
+ get_input: tag_version
+ log_info:
+ log_directory: "/opt/app/TCAnalytics/logs"
+ application_config:
+ app_config:
+ appDescription: DCAE Analytics Threshold Crossing Alert Application
+ appName: dcae-tca
+ tcaAlertsAbatementTableName: TCAAlertsAbatementTable
+ tcaAlertsAbatementTableTTLSeconds: '1728000'
+ tcaSubscriberOutputStreamName: TCASubscriberOutputStream
+ tcaVESAlertsTableName: TCAVESAlertsTable
+ tcaVESAlertsTableTTLSeconds: '1728000'
+ tcaVESMessageStatusTableName: TCAVESMessageStatusTable
+ tcaVESMessageStatusTableTTLSeconds: '86400'
+ thresholdCalculatorFlowletInstances: '2'
+ app_preferences:
+ aaiEnrichmentHost:
+ get_input: aaiEnrichmentHost
+ aaiEnrichmentIgnoreSSLCertificateErrors: 'true'
+ aaiEnrichmentPortNumber: '8443'
+ aaiEnrichmentProtocol: https
+ aaiEnrichmentUserName: dcae@dcae.onap.org
+ aaiEnrichmentUserPassword: demo123456!
+ aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query
+ aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf
+ enableAAIEnrichment:
+ get_input: enableAAIEnrichment
+ enableRedisCaching:
+ get_input: enableRedisCaching
+ redisHosts:
+ get_input: redisHosts
+ enableAlertCEFFormat: 'false'
+ publisherContentType: application/json
+ publisherHostName:
+ get_input: dmaap_host
+ publisherHostPort:
+ get_input: dmaap_port
+ publisherMaxBatchSize: '1'
+ publisherMaxRecoveryQueueSize: '100000'
+ publisherPollingInterval: '20000'
+ publisherProtocol: http
+ publisherTopicName: unauthenticated.DCAE_CL_OUTPUT
+ subscriberConsumerGroup: OpenDCAE-c12
+ subscriberConsumerId: c12
+ subscriberContentType: application/json
+ subscriberHostName:
+ get_input: dmaap_host
+ subscriberHostPort:
+ get_input: dmaap_port
+ subscriberMessageLimit: '-1'
+ subscriberPollingInterval: '30000'
+ subscriberProtocol: http
+ subscriberTimeoutMS: '-1'
+ subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT
+ tca_policy: ''
+ service_component_type: dcaegen2-analytics_tca
interfaces:
cloudify.interfaces.lifecycle:
start:
inputs:
envs:
- dmaap_ip: {get_input: dmaap_ip}
- dmapp_topic: {get_input: dmaap_topic}
- policy_id: {get_input: policy_id}
+ DMAAPHOST:
+ { get_input: dmaap_host }
+ DMAAPPORT:
+ { get_input: dmaap_port }
+ DMAAPPUBTOPIC: "unauthenticated.DCAE_CL_OUTPUT"
+ DMAAPSUBTOPIC: "unauthenticated.VES_MEASUREMENT_OUTPUT"
+ AAIHOST:
+ { get_input: aaiEnrichmentHost }
+ AAIPORT:
+ { get_input: aaiEnrichmentPort }
+ CONSUL_HOST:
+ { get_input: consul_host }
+ CONSUL_PORT:
+ { get_input: consul_port }
+ CBS_HOST:
+ { get_input: cbs_host }
+ CBS_PORT:
+ { get_input: cbs_port }
+ CONFIG_BINDING_SERVICE: "config_binding_service"
ports:
- - 8081:8081
+ - concat: ["11011:", { get_input: external_port }]
+ third_app:
+ type: dcae.nodes.ContainerizedServiceComponent
+ properties:
+ service_component_type: 'dcaegen2-analytics-tca'
+ application_config: {}
+ docker_config: {}
+ image:
+ get_input: tag_version
+ log_info:
+ log_directory: "/opt/app/TCAnalytics/logs"
relationships:
- - type: cloudify.relationships.connected_to
- target: third_app
+ - target: tca_policy_3
+ type: cloudify.relationships.depends_on
- type: clamp_node.relationships.gets_input_from
- target: third_app
-
- third_app:
- type: dcae.nodes.ContainerizedPlatformComponent
+ target: second_app
+ tca_policy_1:
+ type: dcae.nodes.policy
properties:
- name: third_app
- dns_name: "third_app"
- image: { get_input: third_app_docker_image }
- container_port: 443
policy_id:
- policy_model_id: "type3"
- interfaces:
- cloudify.interfaces.lifecycle:
- start:
- inputs:
- envs:
- dmaap_ip: {get_input: dmaap_ip}
- dmapp_topic: {get_input: dmaap_topic}
- policy_id: {get_input: policy_id}
- ports:
- - 8082:8082
- tca_policy:
+ get_input: policy_id
+ policy_model_id:
+ get_input: policy_model_id
+ tca_policy_2:
type: dcae.nodes.policy
properties:
- policy_id: { get_input: policy_id } \ No newline at end of file
+ policy_id:
+ get_input: policy_id
+ policy_model_id:
+ get_input: policy_model_id
+
+ tca_policy_3:
+ type: dcae.nodes.policy
+ properties:
+ policy_id:
+ get_input: policy_id
+ policy_model_id:
+ get_input: policy_model_id
diff --git a/src/test/resources/clds/camel/rest/clamp-api-v2.xml b/src/test/resources/clds/camel/rest/clamp-api-v2.xml
index cf99625ee..a0a3eb104 100644
--- a/src/test/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/test/resources/clds/camel/rest/clamp-api-v2.xml
@@ -238,6 +238,48 @@
</route>
</put>
<put
+ uri="/v2/loop/refreshOpPolicyJsonSchema/{loopName}"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Refresh Operational Policy UI for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'REFRESH OP Policy UI request')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=refreshOpPolicyJsonRepresentation(${header.loopName})" />
+ <log
+ loggingLevel="INFO"
+ message="REFRESH request successfully executed for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH request successfully executed','INFO',${exchangeProperty[loopObject]})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ message="REFRESH request failed for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
+ </doCatch>
+ </doTry>
+ </route>
+ </put>
+ <put
uri="/v2/loop/undeploy/{loopName}"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
diff --git a/src/test/resources/clds/camel/routes/policy-flows.xml b/src/test/resources/clds/camel/routes/policy-flows.xml
index 75ac66c6c..ce24b27ce 100644
--- a/src/test/resources/clds/camel/routes/policy-flows.xml
+++ b/src/test/resources/clds/camel/routes/policy-flows.xml
@@ -1,520 +1,587 @@
<routes xmlns="http://camel.apache.org/schema/spring">
- <route id="verify-one-policy">
- <from uri="direct:verify-one-policy" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-policy" />
- <when>
- <simple> ${header.CamelHttpResponseCode} != 200 </simple>
- <setProperty propertyName="policyFound">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <log loggingLevel="WARN"
- message="At least one policy has not been found on policy engine: ${exchangeProperty[policyName]}" />
- </when>
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-deployment-policy" />
- <when>
- <simple> ${header.CamelHttpResponseCode} != 200 </simple>
- <setProperty propertyName="policyDeployed">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <log loggingLevel="WARN"
- message="At least one policy has not been deployed on policy engine: ${exchangeProperty[policyName]}" />
- </when>
- <setProperty propertyName="newPolicyState">
- <simple>${exchangeProperty[policyComponent].computeState(*)}</simple>
- </setProperty>
- </route>
-
- <route id="get-policy">
- <from uri="direct:get-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Getting Policy: ${exchangeProperty[policyName]}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Get Policy')" />
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} GET
- Policy status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
-
- <route id="get-deployment-policy">
- <from uri="direct:get-deployment-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Getting the policy deployment in PDP: ${exchangeProperty[policyName]}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy deployment in PDP')" />
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get policy deployment status: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/deployed"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/deployed?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} GET Policy deployment
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
+ <route id="verify-one-policy">
+ <from uri="direct:verify-one-policy"/>
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
</setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
- <route id="create-micro-service-policy">
- <from uri="direct:create-micro-service-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')" />
- <setBody>
- <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} creation
- status
- </simple>
+ <to uri="direct:get-policy"/>
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="policyFound">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <log loggingLevel="WARN"
+ message="At least one policy has not been found on policy engine: ${exchangeProperty[policyName]}"/>
+ </when>
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
</setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
+ <to uri="direct:get-deployment-policy"/>
+ <when>
+ <simple> ${header.CamelHttpResponseCode} != 200 </simple>
+ <setProperty propertyName="policyDeployed">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <log loggingLevel="WARN"
+ message="At least one policy has not been deployed on policy engine: ${exchangeProperty[policyName]}"/>
+ </when>
+ <setProperty propertyName="newPolicyState">
+ <simple>${exchangeProperty[policyComponent].computeState(*)}</simple>
</setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ </route>
- <route id="delete-micro-service-policy">
- <from uri="direct:delete-micro-service-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
+ <route id="get-policy">
+ <from uri="direct:get-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting Policy: ${exchangeProperty[policyName]}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Get Policy')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} GET
+ Policy status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="get-deployment-policy">
+ <from uri="direct:get-deployment-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting the policy deployment in PDP: ${exchangeProperty[policyName]}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy deployment in PDP')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policy deployment status: {{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} GET Policy deployment
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-all-policy-models">
+ <from uri="direct:get-all-policy-models"/>
+ <doTry>
+ <log loggingLevel="INFO" message="Getting all the policy models"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting all the policy models')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get all policy models: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/api/v1/policytypes?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <convertBodyTo type="java.lang.String"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-policy-model">
+ <from uri="direct:get-policy-model"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting the policy model: ${exchangeProperty[policyModelName]}/${exchangeProperty[policyModelVersion]}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy model')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policy model: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <convertBodyTo type="java.lang.String"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="create-micro-service-policy">
+ <from uri="direct:create-micro-service-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')"/>
+ <setBody>
+ <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[microServicePolicy].getName()} creation
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="create-operational-policy">
- <from uri="direct:create-operational-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')" />
- <setBody>
- <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} creation
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="delete-micro-service-policy">
+ <from uri="direct:delete-micro-service-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')"/>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <route id="delete-operational-policy">
- <from uri="direct:delete-operational-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[microServicePolicy].getName()} removal
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="create-guard-policy">
- <from uri="direct:create-guard-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')" />
- <setBody>
- <simple>${exchangeProperty[guardPolicy].getValue()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} creation status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="create-operational-policy">
+ <from uri="direct:create-operational-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')"/>
+ <setBody>
+ <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[operationalPolicy].getName()} creation
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="delete-guard-policy">
- <from uri="direct:delete-guard-policy" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')" />
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
+ <route id="delete-operational-policy">
+ <from uri="direct:delete-operational-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')"/>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[operationalPolicy].getName()} removal
+ status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} removal status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <route id="create-guard-policy">
+ <from uri="direct:create-guard-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating Guard Policy: ${exchangeProperty[guardPolicy].getKey()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')"/>
+ <setBody>
+ <simple>${exchangeProperty[guardPolicy].getValue()}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[guardPolicy].getKey()} creation status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="add-all-to-active-pdp-group">
- <from uri="direct:add-all-to-active-pdp-group" />
- <doTry>
- <log loggingLevel="INFO"
- message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')" />
- <setBody>
- <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
+ <route id="delete-guard-policy">
+ <from uri="direct:delete-guard-policy"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Deleting Guard Policy: ${exchangeProperty[guardPolicy].getKey()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')"/>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>PDP Group push ALL status</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[guardPolicy].getKey()} removal status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
- <route id="remove-all-policy-from-active-pdp-group">
- <from uri="direct:remove-all-policy-from-active-pdp-group" />
- <doTry>
- <log loggingLevel="INFO"
- message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')" />
- <split>
- <simple>${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])}
- </simple>
- <setProperty propertyName="policyName">
- <simple>${body}</simple>
- </setProperty>
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} PDP Group removal status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </split>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <setProperty propertyName="logMessage">
- <simple>PDP Group removal, Error reported: ${exception}</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doCatch>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doFinally>
- </doTry>
- </route>
+ <route id="add-all-to-active-pdp-group">
+ <from uri="direct:add-all-to-active-pdp-group"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')"/>
+ <setBody>
+ <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ <setProperty propertyName="logMessage">
+ <simple>PDP Group push ALL status</simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doFinally>
+ </doTry>
+ </route>
+
+ <route id="remove-all-policy-from-active-pdp-group">
+ <from uri="direct:remove-all-policy-from-active-pdp-group"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')"/>
+ <split>
+ <simple>${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])}
+ </simple>
+ <setProperty propertyName="policyName">
+ <simple>${body}</simple>
+ </setProperty>
+ <setBody>
+ <constant>null</constant>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} PDP Group removal status
+ </simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </split>
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <setProperty propertyName="logMessage">
+ <simple>PDP Group removal, Error reported: ${exception}</simple>
+ </setProperty>
+ <setProperty propertyName="logComponent">
+ <simple>POLICY</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response"/>
+ </doCatch>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
</routes> \ No newline at end of file
diff --git a/src/test/resources/clds/holmes-old-style-ms.yaml b/src/test/resources/clds/holmes-old-style-ms.yaml
deleted file mode 100644
index 3f0c9a604..000000000
--- a/src/test/resources/clds/holmes-old-style-ms.yaml
+++ /dev/null
@@ -1,117 +0,0 @@
-tosca_definitions_version: cloudify_dsl_1_3
-imports:
- - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
- - https://nexus01.research.att.com:8443/repository/solutioning01-mte2-raw/type_files/docker/2.3.0+t.0.4/node-type.yaml
- - https://nexus01.research.att.com:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml
- - http://nexus01.research.att.com:8081/repository/solutioning01-mte2-raw/type_files/dmaap/1.2.0/dmaap.yaml
-inputs:
- dcae_service_location:
- type: string
- docker_host_override:
- type: string
- topic0_aaf_password:
- type: string
- topic0_aaf_username:
- type: string
- topic0_client_role:
- type: string
- topic1_aaf_password:
- type: string
- topic1_aaf_username:
- type: string
- topic1_client_role:
- type: string
- location_id:
- type: string
- service_id:
- type: string
- policy_id:
- type: string
- default: "CLAMPPolicyTriggerNoaapp_v1_0_29b0578b_dcee_472c_8cdd0.ClosedLoop_860ee9f2_ba64_11e8_a16b_02bd571477fe_TCA_1d13unw"
-node_templates:
- policy_0:
- type: dcae.nodes.policy
- properties:
- policy_model: policy.nodes.holmes
- policy_filter: "DCAE.Config_Holmes.*"
- policy_id:
- get_input: policy_id
- docker_host_host:
- type: dcae.nodes.SelectedDockerHost
- properties:
- docker_host_override:
- get_input: docker_host_override
- location_id:
- get_input: dcae_service_location
- holmes_rule_homes-rule:
- type: dcae.nodes.DockerContainerForComponentsUsingDmaap
- properties:
- application_config:
- services_calls:
- - msb_config:
- concat:
- - '{{'
- - get_property:
- - SELF
- - msb_config
- - node_name
- - '}}'
- streams_publishes: []
- streams_subscribes:
- - sec_measurement_unsecure:
- aaf_password:
- get_input: topic0_aaf_password
- aaf_username:
- get_input: topic0_aaf_username
- dmaap_info: <<topic0>>
- type: message_router
- - sec_measurement:
- aaf_password:
- get_input: topic1_aaf_password
- aaf_username:
- get_input: topic1_aaf_username
- dmaap_info: <<topic1>>
- type: message_router
- docker_config:
- healthcheck:
- endpoint: api/holmes-rule-mgmt/v1/healthcheck
- interval: 15s
- timeout: 1s
- type: http
- ports:
- - 9101:9101
- image: nexus3.onap.org:10001/onap/holmes/rule-manamgement:latest
- location_id:
- get_input: dcae_service_location
- service_component_type: dcae-analytics-holmes-rule-manamgement
- streams_publishes: []
- streams_subscribes:
- - client_role:
- get_input: topic0_client_role
- location:
- get_input: dcae_service_location
- name: topic0
- type: message_router
- - client_role:
- get_input: topic1_client_role
- location:
- get_input: dcae_service_location
- name: topic1
- type: message_router
- relationships:
- - target: docker_host_host
- type: dcae.relationships.component_contained_in
- - target: topic0
- type: dcae.relationships.subscribe_to_events
- - target: topic1
- type: dcae.relationships.subscribe_to_events
- - target: policy_0
- type: dcae.relationships.depends_on
- topic0:
- type: dcae.nodes.Topic
- properties:
- topic_name: ''
- topic1:
- type: dcae.nodes.Topic
- properties:
- topic_name: ''
diff --git a/src/test/resources/clds/single-microservice-fragment-valid.yaml b/src/test/resources/clds/single-microservice-fragment-invalid.yaml
index 2c1680717..2c1680717 100644
--- a/src/test/resources/clds/single-microservice-fragment-valid.yaml
+++ b/src/test/resources/clds/single-microservice-fragment-invalid.yaml
diff --git a/src/test/resources/clds/single-microservice-fragment-valid-with-version.yaml b/src/test/resources/clds/single-microservice-fragment-valid-with-version.yaml
new file mode 100644
index 000000000..ae31fb16a
--- /dev/null
+++ b/src/test/resources/clds/single-microservice-fragment-valid-with-version.yaml
@@ -0,0 +1,21 @@
+second_app:
+ type: dcae.nodes.ContainerizedServiceComponentUsingDmaap
+ properties:
+ service_component_type: dcaegen2-analytics-tca
+ service_component_name_override: second_app
+ image: { get_input: second_app_docker_image }
+ name: second_app
+ policy_id:
+ policy_model_id: "type1"
+ policy_model_version: "10.0.0"
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ envs:
+ grpc_server.host: "first_app.onap"
+ dmaap_ip: {get_input: dmaap_ip}
+ dmapp_topic: {get_input: dmaap_topic}
+ policy_id: {get_input: policy_id}
+ ports:
+ - 8080:8080
diff --git a/src/test/resources/clds/tca-old-style-ms.yaml b/src/test/resources/clds/tca-old-style-ms.yaml
deleted file mode 100644
index b976190a1..000000000
--- a/src/test/resources/clds/tca-old-style-ms.yaml
+++ /dev/null
@@ -1,169 +0,0 @@
-tosca_definitions_version: cloudify_dsl_1_3
-imports:
- - "http://www.getcloudify.org/spec/cloudify/3.4/types.yaml"
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/dockerplugin/3.2.0/dockerplugin_types.yaml
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/relationshipplugin/1.0.0/relationshipplugin_types.yaml
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml
-
-inputs:
- dh_override:
- type: string
- default: "component_dockerhost"
- dh_location_id:
- type: string
- default: "zone1"
- aaiEnrichmentHost:
- type: string
- default: "none"
- aaiEnrichmentPort:
- type: string
- default: 8443
- enableAAIEnrichment:
- type: string
- default: false
- dmaap_host:
- type: string
- default: dmaap.onap-message-router
- dmaap_port:
- type: string
- default: 3904
- enableRedisCaching:
- type: string
- default: false
- redisHosts:
- type: string
- tag_version:
- type: string
- default: "nexus3.onap.org:10001/onap//onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.0.0"
- consul_host:
- type: string
- default: consul-server.onap-consul
- consul_port:
- type: string
- default: "8500"
- cbs_host:
- type: string
- default: "config-binding-service.dcae"
- cbs_port:
- type: string
- default: "10000"
- policy_id:
- type: string
- default: "none"
- external_port:
- type: string
- description: "Port for CDAPgui to be exposed"
- default: "32010"
-
-node_templates:
- docker_service_host:
- properties:
- docker_host_override:
- get_input: dh_override
- location_id:
- get_input: dh_location_id
- type: dcae.nodes.SelectedDockerHost
- tca_docker:
- relationships:
- - type: dcae.relationships.component_contained_in
- target: docker_service_host
- - target: tca_policy
- type: cloudify.relationships.depends_on
- type: dcae.nodes.DockerContainerForComponentsUsingDmaap
- properties:
- application_config:
- app_config:
- appDescription: DCAE Analytics Threshold Crossing Alert Application
- appName: dcae-tca
- tcaAlertsAbatementTableName: TCAAlertsAbatementTable
- tcaAlertsAbatementTableTTLSeconds: '1728000'
- tcaSubscriberOutputStreamName: TCASubscriberOutputStream
- tcaVESAlertsTableName: TCAVESAlertsTable
- tcaVESAlertsTableTTLSeconds: '1728000'
- tcaVESMessageStatusTableName: TCAVESMessageStatusTable
- tcaVESMessageStatusTableTTLSeconds: '86400'
- thresholdCalculatorFlowletInstances: '2'
- app_preferences:
- aaiEnrichmentHost:
- get_input: aaiEnrichmentHost
- aaiEnrichmentIgnoreSSLCertificateErrors: 'true'
- aaiEnrichmentPortNumber: '8443'
- aaiEnrichmentProtocol: https
- aaiEnrichmentUserName: DCAE
- aaiEnrichmentUserPassword: DCAE
- aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query
- aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf
- enableAAIEnrichment:
- get_input: enableAAIEnrichment
- enableRedisCaching:
- get_input: enableRedisCaching
- redisHosts:
- get_input: redisHosts
- enableAlertCEFFormat: 'false'
- publisherContentType: application/json
- publisherHostName:
- get_input: dmaap_host
- publisherHostPort:
- get_input: dmaap_port
- publisherMaxBatchSize: '1'
- publisherMaxRecoveryQueueSize: '100000'
- publisherPollingInterval: '20000'
- publisherProtocol: http
- publisherTopicName: unauthenticated.DCAE_CL_OUTPUT
- subscriberConsumerGroup: OpenDCAE-c12
- subscriberConsumerId: c12
- subscriberContentType: application/json
- subscriberHostName:
- get_input: dmaap_host
- subscriberHostPort:
- get_input: dmaap_port
- subscriberMessageLimit: '-1'
- subscriberPollingInterval: '30000'
- subscriberProtocol: http
- subscriberTimeoutMS: '-1'
- subscriberTopicName: unauthenticated.SEC_MEASUREMENT_OUTPUT
- tca_policy_default: '{"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.vNicUsageArray[*].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.vNicUsageArray[*].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.vNicUsageArray[*].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"}]}]}'
- service_component_type: dcaegen2-analytics_tca
- docker_config:
- healthcheck:
- endpoint: /healthcheck
- interval: 15s
- timeout: 1s
- type: http
- image:
- get_input: tag_version
- interfaces:
- cloudify.interfaces.lifecycle:
- start:
- inputs:
- envs:
- DMAAPHOST:
- { get_input: dmaap_host }
- DMAAPPORT:
- { get_input: dmaap_port }
- DMAAPPUBTOPIC: "unauthenticated.DCAE_CL_OUTPUT"
- DMAAPSUBTOPIC: "unauthenticated.SEC_MEASUREMENT_OUTPUT"
- AAIHOST:
- { get_input: aaiEnrichmentHost }
- AAIPORT:
- { get_input: aaiEnrichmentPort }
- CONSUL_HOST:
- { get_input: consul_host }
- CONSUL_PORT:
- { get_input: consul_port }
- CBS_HOST:
- { get_input: cbs_host }
- CBS_PORT:
- { get_input: cbs_port }
- CONFIG_BINDING_SERVICE: "config_binding_service"
- ports:
- - concat: ["11011:", { get_input: external_port }]
- stop:
- inputs:
- cleanup_image: true
- tca_policy:
- type: dcae.nodes.policy
- properties:
- policy_id:
- get_input: policy_id
-
diff --git a/src/test/resources/example/sdc/blueprint-dcae/holmes.yaml b/src/test/resources/example/sdc/blueprint-dcae/holmes.yaml
deleted file mode 100644
index f180a7df6..000000000
--- a/src/test/resources/example/sdc/blueprint-dcae/holmes.yaml
+++ /dev/null
@@ -1,174 +0,0 @@
-tosca_definitions_version: cloudify_dsl_1_3
-imports:
-- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
-- https://nexus01.research.att.com:8443/repository/solutioning01-mte2-raw/type_files/docker/2.3.0+t.0.4/node-type.yaml
-- https://nexus01.research.att.com:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml
-- http://nexus01.research.att.com:8081/repository/solutioning01-mte2-raw/type_files/dmaap/1.2.0/dmaap.yaml
-inputs:
- dcae_service_location:
- type: string
- docker_host_override:
- type: string
- topic0_aaf_password:
- type: string
- topic0_aaf_username:
- type: string
- topic0_client_role:
- type: string
- topic1_aaf_password:
- type: string
- topic1_aaf_username:
- type: string
- topic1_client_role:
- type: string
-node_templates:
- policy_0:
- type: dcae.nodes.policy
- properties:
- policy_model: policy.nodes.holmes
- policy_filter: "DCAE.Config_Holmes.*"
- docker_host_host:
- type: dcae.nodes.SelectedDockerHost
- properties:
- docker_host_override:
- get_input: docker_host_override
- location_id:
- get_input: dcae_service_location
- holmes-rule_homes-rule:
- type: dcae.nodes.DockerContainerForComponentsUsingDmaap
- properties:
- application_config:
- holmes.default.rule.volte.scenario1: 'package dcae.ves.test
-
- import org.onap.some.related.packages;
-
- rule"SameVNF_Relation_Rule"
-
- salience 120
-
- no-loop true
-
- when
-
- $root : VesAlarm(
-
- $sourceId: sourceId, sourceId != null && !sourceId.equals(""),
-
- specificProblem in ( "LSS_cpiPCSCFFailReg(121297)", "LSS_cpiSIPRetransmitInvite(120267)" ),
-
- $eventId: eventId)
-
- $child : VesAlarm( eventId != $eventId,
-
- CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, $sourceId),
-
- specificProblem in ("LSS_externalLinkDown(4271)","LSS_failedAttachReqsRateExceeded(4272)"),
-
- this after [-60s, 60s] $root)
-
- then
-
- DmaapService.publishResult(...);
-
- end'
- holmes.default.rule.volte.scenario2: 'package dcae.ves.test
-
- import org.onap.some.related.packages;
-
- rule"SameVNF_Relation_Rule_1"
-
- salience 120
-
- no-loop true
-
- when
-
- $root : VesAlarm(
-
- $sourceId: sourceId, sourceId != null && !sourceId.equals(""),
-
- specificProblem in ( "LSS_cpiPCSCFFailReg(121297)", "LSS_cpiSIPRetransmitInvite(120267)" ),
-
- $eventId: eventId)
-
- $child : VesAlarm( eventId != $eventId,
-
- CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, $sourceId),
-
- specificProblem in ("LSS_externalLinkDown(4271)","LSS_failedAttachReqsRateExceeded(4272)"),
-
- this after [-60s, 60s] $root)
-
- then
-
- DmaapService.publishResult(...);
-
- end'
- services_calls:
- - msb_config:
- concat:
- - '{{'
- - get_property:
- - SELF
- - msb_config
- - node_name
- - '}}'
- streams_publishes: []
- streams_subscribes:
- - sec_measurement_unsecure:
- aaf_password:
- get_input: topic0_aaf_password
- aaf_username:
- get_input: topic0_aaf_username
- dmaap_info: <<topic0>>
- type: message_router
- - sec_measurement:
- aaf_password:
- get_input: topic1_aaf_password
- aaf_username:
- get_input: topic1_aaf_username
- dmaap_info: <<topic1>>
- type: message_router
- docker_config:
- healthcheck:
- endpoint: api/holmes-rule-mgmt/v1/healthcheck
- interval: 15s
- timeout: 1s
- type: http
- ports:
- - 9101:9101
- image: nexus3.onap.org:10001/onap/holmes/rule-manamgement:latest
- location_id:
- get_input: dcae_service_location
- service_component_type: dcae-analytics-holmes-rule-manamgement
- streams_publishes: []
- streams_subscribes:
- - client_role:
- get_input: topic0_client_role
- location:
- get_input: dcae_service_location
- name: topic0
- type: message_router
- - client_role:
- get_input: topic1_client_role
- location:
- get_input: dcae_service_location
- name: topic1
- type: message_router
- relationships:
- - target: docker_host_host
- type: dcae.relationships.component_contained_in
- - target: topic0
- type: dcae.relationships.subscribe_to_events
- - target: topic1
- type: dcae.relationships.subscribe_to_events
- - target: policy_0
- type: dcae.relationships.depends_on
- topic0:
- type: dcae.nodes.Topic
- properties:
- topic_name: ''
- topic1:
- type: dcae.nodes.Topic
- properties:
- topic_name: ''
diff --git a/src/test/resources/example/sdc/blueprint-dcae/not-recognized.yaml b/src/test/resources/example/sdc/blueprint-dcae/not-recognized.yaml
deleted file mode 100644
index 6522885ff..000000000
--- a/src/test/resources/example/sdc/blueprint-dcae/not-recognized.yaml
+++ /dev/null
@@ -1,130 +0,0 @@
-tosca_definitions_version: cloudify_dsl_1_3
-imports:
-- http://dockercentral.it.att.com:8093/nexus/repository/rawcentral/com.att.dcae.controller/type_files/dockerplugin/2.4.0+t.0.8/node-type.yaml
-- http://dockercentral.it.att.com:8093/nexus/repository/rawcentral/com.att.dcae.controller/type_files/dmaap/1.2.0+t.0.9/dmaap.yaml
-- http://dockercentral.it.att.com:8093/nexus/repository/rawcentral/com.att.dcae.controller/type_files/relationship/1.0.0+t.0.1/relationship-types.yaml
-inputs:
- commonEventHeader.domain:
- type: string
- commonEventHeader.version:
- type: string
- dcae_service_location:
- type: string
- docker_host_override:
- type: string
- default: ''
- elementType:
- type: string
- feed_id:
- type: string
- mappingType:
- type: string
- measurementsForVfScalingFields.measurementsForVfScalingVersion:
- type: string
- phases.docker_map.phaseName:
- type: string
- topic1_aaf_password:
- type: string
- topic1_aaf_username:
- type: string
- topic1_client_role:
- type: string
-node_templates:
- DockerMap_n.1519416493392.3_DockerMap:
- type: dcae.nodes.DockerContainerForComponentsUsingDmaap
- properties:
- application_config:
- commonEventHeader.domain:
- get_input: commonEventHeader.domain
- commonEventHeader.version:
- get_input: commonEventHeader.version
- csvToVesJson: '{"processing":[{"phase":"pmossFoiPhase","filter":{"class":"Contains","string":"${file}","value":"NOKvMRF"},"processors":[{"class":"LogEvent","title":"PM-FOIEvent-Received","logName":"com.att.gfp.dcae.eventProcessor.input","logLevel":"DEBUG"},{"class":"RunPhase","phase":"vFoiNokRunPhase"}]},{"phase":"vFoiNokRunPhase","comments":"generic parsing","processors":[{"replace":",","field":"data","class":"ReplaceText","find":";"},{"replace":",","field":"file","class":"ReplaceText","find":"_"}]},{"phase":"vFoiNokRunPhase","filter":{"class":"Contains","string":"${data[1]}","value":"Begin date"},"processors":[{"class":"ExtractText","field":"event.commonEventHeader.startEpochMicrosec","value":"${data[1]}","regex":".*Begin date,([^,]*),.*"},{"class":"DateFormatter","value":"${event.commonEventHeader.startEpochMicrosec}","fromFormat":"MM/dd/yy HH:mm:ss a","fromTz":"GMT","toField":"event.commonEventHeader.startEpochMicrosec","toFormat":"#ms","toTz":"#ms"}]},{"phase":"vFoiNokRunPhase","filter":{"class":"Contains","string":"${data[2]}","value":"End date"},"processors":[{"class":"ExtractText","field":"event.commonEventHeader.lastEpochMicrosec","value":"${data[2]}","regex":".*End date,([^,]*),.*"},{"class":"DateFormatter","value":"${event.commonEventHeader.lastEpochMicrosec}","fromFormat":"MM/dd/yy HH:mm:ss a","fromTz":"GMT","toField":"event.commonEventHeader.lastEpochMicrosec","toFormat":"#ms","toTz":"#ms"},{"class":"DateFormatter","value":"${event.commonEventHeader.lastEpochMicrosec}","fromFormat":"#ms","fromTz":"#ms","toField":"event.commonEventHeader.internalHeaderFields.DATETIMEUTC","toFormat":"yyyyMMddHHmmss","toTz":"GMT"}]},{"phase":"vFoiNokRunPhase","processors":[{"class":"ExtractText","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[0].value","value":"${data[7]}","regex":".*CpuSys,+(\\d+,){3}.*"},{"class":"ReplaceText","replace":"","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[0].value","find":","},{"class":"ExtractText","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[1].value","value":"${data[5]}","regex":".*CpuUsage,+(\\d+,){3}.*"},{"class":"ReplaceText","replace":"","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[1].value","find":","},{"class":"ExtractText","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[2].value","value":"${data[7]}","regex":".*CpuSys,+(\\d+,){2}.*"},{"class":"ReplaceText","replace":"","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[2].value","find":","},{"class":"ExtractText","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[3].value","value":"${data[5]}","regex":".*CpuUsage,+(\\d+,){2}.*"},{"class":"ReplaceText","replace":"","field":"event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[3].value","find":","}]},{"phase":"vFoiNokRunPhase","processors":[{"class":"ExtractText","field":"event.commonEventHeader.eventName","value":"${file}","regex":"([^,]*),.*"},{"class":"ExtractText","field":"event.commonEventHeader.reportingEntityName","value":"${file}","regex":".*,([^,]*)\\..*"}]},{"phase":"vFoiNokRunPhase","comments":"generic parsing","processors":[{"class":"Set","updates":{"event.commonEventHeader.lastEpochMicrosec":"${event.commonEventHeader.lastEpochMicrosec}000","event.commonEventHeader.startEpochMicrosec":"${event.commonEventHeader.startEpochMicrosec}000","event.commonEventHeader.domain":"measurementsForVfScaling","event.commonEventHeader.eventName":"Mfvs_${event.commonEventHeader.eventName}","event.commonEventHeader.eventType":"csv2ves","event.commonEventHeader.priority":"Normal","event.commonEventHeader.sequence":0,"event.commonEventHeader.sourceName":"${event.commonEventHeader.reportingEntityName}","event.commonEventHeader.version":3.0,"event.commonEventHeader.eventId":"%{now.ms}","event.commonEventHeader.internalHeaderFields.dbTableSuffix":"","event.measurementsForVfScalingFields.measurementInterval":900,"event.measurementsForVfScalingFields.measurementsForVfScalingVersion":2.0,"event.measurementsForVfScalingFields.additionalMeasurements.name":"csv2ves","event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[0].name":"CpuSysMax","event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[1].name":"CpuUsageMax","event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[2].name":"CpuSysAverage","event.measurementsForVfScalingFields.additionalMeasurements.arrayOfFields[3].name":"CpuUsageAverage"}},{"class":"DateFormatter","value":"${event.commonEventHeader.eventId}","fromFormat":"#ms","fromTz":"#ms","toField":"event.commonEventHeader.eventId","toFormat":"yyyyMMddHHmmssSSS","toTz":"GMT"}]},{"phase":"vFoiNokRunPhase","processors":[{"class":"Clear","fields":["data","file"]},{"class":"LogText","logLevel":"INFO","logText":"Finished-PM-FOIEvent-parsing"},{"class":"LogEvent","title":"PM-FOIEvent-Received-Output"},{"class":"RunPhase","phase":"foiEventToDmaapPhase"}]}]}'
- elementType:
- get_input: elementType
- isSelfServeComponent: 'True'
- mappingType:
- get_input: mappingType
- measurementsForVfScalingFields.measurementsForVfScalingVersion:
- get_input: measurementsForVfScalingFields.measurementsForVfScalingVersion
- phases.docker_map.phaseName:
- get_input: phases.docker_map.phaseName
- services_calls: {}
- streams_publishes:
- DCAE-VES-PM-EVENT:
- aaf_password:
- get_input: topic1_aaf_password
- aaf_username:
- get_input: topic1_aaf_username
- dmaap_info: <<topic1_n.1519416493404.5>>
- type: message_router
- streams_subscribes:
- DCAE_PM_DATA_C_M:
- dmaap_info: <<feed_n.1519416394214.2>>
- type: data_router
- useDtiConfig: 'False'
- docker_config:
- healthcheck:
- interval: 300s
- script: /opt/app/vec/bin/common/HealthCheck_DockerMap.sh
- timeout: 15s
- type: docker
- volumes:
- - container:
- bind: /opt/app/dcae-certificate
- host:
- path: /opt/app/dcae-certificate
- - container:
- bind: /opt/app/dmd/log/AGENT
- host:
- path: /opt/logs/DCAE/dockermap/dmd/AGENT
- - container:
- bind: /opt/app/dmd/log/WATCHER
- host:
- path: /opt/logs/DCAE/dockermap/dmd/WATCHER
- - container:
- bind: /opt/app/vec/logs/DCAE
- host:
- path: /opt/logs/DCAE/dockermap/dockermap-logs
- - container:
- bind: /opt/app/vec/archive/data
- host:
- path: /opt/data/DCAE/dockermap/dockermap-archive
- image: dockercentral.it.att.com:5100/com.att.dcae.controller/dcae-controller-dockermap:18.02-004
- location_id:
- get_input: dcae_service_location
- service_component_type: dcae.collectors.docker.map.pm
- streams_publishes:
- - client_role:
- get_input: topic1_client_role
- location:
- get_input: dcae_service_location
- name: topic1_n.1519416493404.5
- type: message_router
- streams_subscribes:
- - location:
- get_input: dcae_service_location
- name: feed_n.1519416394214.2
- type: data_router
- relationships:
- - target: docker_host_host
- type: dcae.relationships.component_contained_in
- - target: feed_n.1519416394214.2
- type: dcae.relationships.subscribe_to_files
- - target: topic1_n.1519416493404.5
- type: dcae.relationships.publish_events
- docker_host_host:
- type: dcae.nodes.SelectedDockerHost
- properties:
- docker_host_override:
- get_input: docker_host_override
- location_id:
- get_input: dcae_service_location
- feed_n.1519416394214.2:
- type: dcae.nodes.ExistingFeed
- properties:
- feed_id:
- get_input: feed_id
- topic1_n.1519416493404.5:
- type: dcae.nodes.Topic
- properties:
- topic_name: DCAE-VES-PM-EVENT-v1
diff --git a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json b/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json
deleted file mode 100644
index d7a54162f..000000000
--- a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "global": [
- {
- "name": "service",
- "value": [
- "4cc5b45a-1f63-4194-8100-cd8e14248c92"
- ]
- },
- {
- "name": "vf",
- "value": [
- "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad"
- ]
- },
- {
- "name": "actionSet",
- "value": [
- "vnfRecipe"
- ]
- },
- {
- "name": "location",
- "value": [
- "DC1"
- ]
- },
- {
- "name": "deployParameters",
- "value": {
- "aaiEnrichmentHost": "aai.onap.svc.cluster.local",
- "aaiEnrichmentPort": "8443",
- "enableAAIEnrichment": true,
- "dmaap_host": "message-router.onap",
- "dmaap_port": "3904",
- "enableRedisCaching": false,
- "redisHosts": "dcae-redis.onap.svc.cluster.local:6379",
- "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1",
- "consul_host": "consul-server.onap",
- "consul_port": "8500",
- "cbs_host": "config-binding-servicel",
- "cbs_port": "10000",
- "external_port": "32012",
- "policy_model_id": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "policy_id": "AUTO_GENERATED_POLICY_ID_AT_SUBMIT"
- }
- }
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json b/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json
deleted file mode 100644
index 012c46e9c..000000000
--- a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "global": [
- {
- "name": "service",
- "value": [
- "4cc5b45a-1f63-4194-8100-cd8e14248c92"
- ]
- },
- {
- "name": "vf",
- "value": [
- "07e266fc-49ab-4cd7-8378-ca4676f1b9ec"
- ]
- },
- {
- "name": "actionSet",
- "value": [
- "vnfRecipe"
- ]
- },
- {
- "name": "location",
- "value": [
- "DC1"
- ]
- },
- {
- "name": "deployParameters",
- "value": {
- "aaiEnrichmentHost": "aai.onap.svc.cluster.local",
- "aaiEnrichmentPort": "8443",
- "enableAAIEnrichment": true,
- "dmaap_host": "message-router.onap.svc.cluster.local",
- "dmaap_port": "3904",
- "enableRedisCaching": false,
- "redisHosts": "dcae-redis.onap.svc.cluster.local:6379",
- "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest",
- "consul_host": "consul-server.onap.svc.cluster.local",
- "consul_port": "8500",
- "cbs_host": "config-binding-service.dcae.svc.cluster.local",
- "cbs_port": "10000",
- "external_port": "32012",
- "policy_id": "AUTO_GENERATED_POLICY_ID_AT_SUBMIT",
- "policy_model_id": "onap.policies.monitoring.cdap.tca.hi.lo.app"
- }
- }
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca.json b/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca.json
deleted file mode 100644
index ce3158d93..000000000
--- a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "global": [
- {
- "name": "service",
- "value": [
- "4cc5b45a-1f63-4194-8100-cd8e14248c92"
- ]
- },
- {
- "name": "vf",
- "value": [
- "07e266fc-49ab-4cd7-8378-ca4676f1b9ec"
- ]
- },
- {
- "name": "actionSet",
- "value": [
- "vnfRecipe"
- ]
- },
- {
- "name": "location",
- "value": [
- "DC1"
- ]
- },
- {
- "name": "deployParameters",
- "value": {
- "location_id": "",
- "service_id": "",
- "policy_id": "AUTO_GENERATED_POLICY_ID_AT_SUBMIT"
- }
- }
- ]
-}
diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml
index 07e587855..c71bcba8f 100644
--- a/src/test/resources/logback.xml
+++ b/src/test/resources/logback.xml
@@ -1,2 +1,91 @@
<!-- Empty Configuration to prevent creating log files by Units Tests (e.g LoggingUtilsTest) ! -->
-<configuration />
+<configuration>
+ <jmxConfigurator />
+ <!-- Example evaluator filter applied against console appender -->
+ <property
+ name="p_tim"
+ value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}" />
+ <property
+ name="p_lvl"
+ value="%level" />
+ <property
+ name="p_log"
+ value="%logger" />
+ <property
+ name="p_mdc"
+ value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}" />
+ <property
+ name="p_msg"
+ value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}" />
+ <property
+ name="p_exc"
+ value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}" />
+ <property
+ name="p_mak"
+ value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}" />
+ <property
+ name="p_thr"
+ value="%thread" />
+ <property
+ name="defaultPattern"
+ value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n" />
+ <property
+ name="debugPattern"
+ value="%nopexception${p_tim}|${p_lvl}|${p_mdc}|${p_exc}|%msg%n" />
+
+ <!-- Example evaluator filter applied against console appender -->
+ <appender
+ name="STDOUT"
+ class="ch.qos.logback.core.ConsoleAppender">
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+ <encoder>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+ </pattern>
+ </encoder>
+ </appender>
+ <logger
+ name="org.onap.aaf"
+ level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <logger
+ name="org.apache"
+ level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <!-- Spring related loggers -->
+ <logger
+ name="org.springframework"
+ level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <!-- CLDS related loggers -->
+ <logger
+ name="org.onap.clamp"
+ level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <!-- CLDS related loggers -->
+ <logger
+ name="com.att.eelf.error"
+ level="OFF">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger
+ name="ch.qos.logback.classic"
+ level="INFO" />
+ <logger
+ name="ch.qos.logback.core"
+ level="INFO" />
+
+ <!-- logback jms appenders & loggers definition ends here -->
+
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
diff --git a/src/test/resources/tosca/dcea_blueprint.yml b/src/test/resources/tosca/dcea_blueprint.yml
deleted file mode 100644
index 0d3ea0462..000000000
--- a/src/test/resources/tosca/dcea_blueprint.yml
+++ /dev/null
@@ -1,170 +0,0 @@
-#
-# ============LICENSE_START====================================================
-# =============================================================================
-# Copyright (c) 2018 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======================================================
-
-tosca_definitions_version: cloudify_dsl_1_3
-
-description: >
- This blueprint deploys/manages the TCA module as a Docker container
-
-imports:
- - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.4/k8splugin_types.yaml
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml
-inputs:
- aaiEnrichmentHost:
- type: string
- default: "aai.onap.svc.cluster.local"
- aaiEnrichmentPort:
- type: string
- default: "8443"
- enableAAIEnrichment:
- type: string
- default: true
- dmaap_host:
- type: string
- default: message-router
- dmaap_port:
- type: string
- default: "3904"
- enableRedisCaching:
- type: string
- default: false
- redisHosts:
- type: string
- default: dcae-redis:6379
- tag_version:
- type: string
- default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0"
- consul_host:
- type: string
- default: consul-server
- consul_port:
- type: string
- default: "8500"
- cbs_host:
- type: string
- default:
- test:
- test: test
- cbs_port:
- type: string
- default: "10000"
- policy_id:
- type: string
- default: "none"
- external_port:
- type: string
- description: Kubernetes node port on which CDAPgui is exposed
- default: "32010"
-
-node_templates:
- tca_k8s:
- type: dcae.nodes.ContainerizedServiceComponent
- relationships:
- - target: tca_policy
- type: cloudify.relationships.depends_on
- properties:
- service_component_type: 'dcaegen2-analytics-tca'
- docker_config: {}
- image:
- get_input: tag_version
- log_info:
- log_directory: "/opt/app/TCAnalytics/logs"
- application_config:
- app_config:
- appDescription: DCAE Analytics Threshold Crossing Alert Application
- appName: dcae-tca-ak-serv
- tcaAlertsAbatementTableName: TCAAlertsAbatementTable
- tcaAlertsAbatementTableTTLSeconds: '1728000'
- tcaSubscriberOutputStreamName: TCASubscriberOutputStream
- tcaVESAlertsTableName: TCAVESAlertsTable
- tcaVESAlertsTableTTLSeconds: '1728000'
- tcaVESMessageStatusTableName: TCAVESMessageStatusTable
- tcaVESMessageStatusTableTTLSeconds: '86400'
- thresholdCalculatorFlowletInstances: '2'
- app_preferences:
- aaiEnrichmentHost:
- get_input: aaiEnrichmentHost
- aaiEnrichmentIgnoreSSLCertificateErrors: 'true'
- aaiEnrichmentPortNumber: '8443'
- aaiEnrichmentProtocol: https
- aaiEnrichmentUserName: DCAE
- aaiEnrichmentUserPassword: DCAE
- aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query
- aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf
- enableAAIEnrichment:
- get_input: enableAAIEnrichment
- enableRedisCaching:
- get_input: enableRedisCaching
- redisHosts:
- get_input: redisHosts
- enableAlertCEFFormat: 'false'
- publisherContentType: application/json
- publisherHostName:
- get_input: dmaap_host
- publisherHostPort:
- get_input: dmaap_port
- publisherMaxBatchSize: '1'
- publisherMaxRecoveryQueueSize: '100000'
- publisherPollingInterval: '20000'
- publisherProtocol: http
- publisherTopicName: unauthenticated.DCAE_CL_OUTPUT
- subscriberConsumerGroup: OpenDCAE-c12
- subscriberConsumerId: c12
- subscriberContentType: application/json
- subscriberHostName:
- get_input: dmaap_host
- subscriberHostPort:
- get_input: dmaap_port
- subscriberMessageLimit: '-1'
- subscriberPollingInterval: '30000'
- subscriberProtocol: http
- subscriberTimeoutMS: '-1'
- subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT
- 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"}]}]}'
- interfaces:
- cloudify.interfaces.lifecycle:
- start:
- inputs:
- envs:
- DMAAPHOST:
- { get_input: dmaap_host }
- DMAAPPORT:
- { get_input: dmaap_port }
- DMAAPPUBTOPIC: "unauthenticated.DCAE_CL_OUTPUT"
- DMAAPSUBTOPIC: "unauthenticated.VES_MEASUREMENT_OUTPUT"
- AAIHOST:
- { get_input: aaiEnrichmentHost }
- AAIPORT:
- { get_input: aaiEnrichmentPort }
- CONSUL_HOST:
- { get_input: consul_host }
- CONSUL_PORT:
- { get_input: consul_port }
- CBS_HOST:
- { get_input: cbs_host }
- CBS_PORT:
- { get_input: cbs_port }
- CONFIG_BINDING_SERVICE: "config_binding_service"
- ports:
- - concat: ["11011:", { get_input: external_port }]
- tca_policy:
- type: dcae.nodes.policy
- properties:
- policy_id:
- get_input: policy_id